feat: Create auth plugins types maps.

This commit is contained in:
Sam 2022-04-22 15:22:21 +02:00
parent b1dbf9e94a
commit 6df0010203
No known key found for this signature in database
GPG Key ID: D004126FCD1A6DF0
9 changed files with 167 additions and 11 deletions

106
.pnp.cjs generated
View File

@ -146,6 +146,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"name": "@lowdefy/plugin-aws",
"reference": "workspace:packages/plugins/plugins/plugin-aws"
},
{
"name": "@lowdefy/plugin-next-auth",
"reference": "workspace:packages/plugins/plugins/plugin-next-auth"
},
{
"name": "@lowdefy/server",
"reference": "workspace:packages/server"
@ -219,6 +223,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@lowdefy/operators-uuid", ["workspace:packages/plugins/operators/operators-uuid"]],
["@lowdefy/operators-yaml", ["workspace:packages/plugins/operators/operators-yaml"]],
["@lowdefy/plugin-aws", ["workspace:packages/plugins/plugins/plugin-aws"]],
["@lowdefy/plugin-next-auth", ["workspace:packages/plugins/plugins/plugin-next-auth"]],
["@lowdefy/server", ["workspace:packages/server"]],
["@lowdefy/server-dev", ["workspace:packages/server-dev"]],
["lowdefy", ["workspace:packages/cli"]]
@ -3078,6 +3083,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@lowdefy/operators-nunjucks", "workspace:packages/plugins/operators/operators-nunjucks"],
["@lowdefy/operators-uuid", "workspace:packages/plugins/operators/operators-uuid"],
["@lowdefy/operators-yaml", "workspace:packages/plugins/operators/operators-yaml"],
["@lowdefy/plugin-next-auth", "workspace:packages/plugins/plugins/plugin-next-auth"],
["@swc/cli", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.1.55"],
["@swc/core", "npm:1.2.135"],
["@swc/jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.2.17"],
@ -3519,6 +3525,21 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "SOFT",
}]
]],
["@lowdefy/plugin-next-auth", [
["workspace:packages/plugins/plugins/plugin-next-auth", {
"packageLocation": "./packages/plugins/plugins/plugin-next-auth/",
"packageDependencies": [
["@lowdefy/plugin-next-auth", "workspace:packages/plugins/plugins/plugin-next-auth"],
["@lowdefy/ajv", "workspace:packages/utils/ajv"],
["@swc/cli", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.1.55"],
["@swc/core", "npm:1.2.135"],
["@swc/jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.2.17"],
["jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:27.5.1"],
["next-auth", "virtual:3828db34ebd29f8d79b511e3dda5577d908743c95df6a5617131f10c5e8d5f4e186c617c1b33cc53cb90d5062cc3ecfe666338a3f54f9227de91ca5e440bfb5f#npm:4.3.3"]
],
"linkType": "SOFT",
}]
]],
["@lowdefy/server", [
["workspace:packages/server", {
"packageLocation": "./packages/server/",
@ -3536,7 +3557,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["less", "npm:4.1.2"],
["less-loader", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:10.2.0"],
["next", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:12.0.10"],
["next-auth", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.1.2"],
["next-auth", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.3.3"],
["next-with-less", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:2.0.4"],
["process", "npm:0.11.10"],
["react", "npm:17.0.2"],
@ -3580,7 +3601,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["less", "npm:4.1.2"],
["less-loader", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:10.2.0"],
["next", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:12.0.10"],
["next-auth", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.1.2"],
["next-auth", "virtual:b951ea20ab6cada5f665e8389a50d828047e6b6f10e6ebaddde1e74a94868ec6ec703ff140742f295ef663cf92da1bc80fe9bbeaab30196cba0e992f38cd19ea#npm:4.1.2"],
["next-with-less", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:2.0.4"],
["opener", "npm:1.5.2"],
["react", "npm:17.0.2"],
@ -13347,10 +13368,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
],
"linkType": "SOFT",
}],
["virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.1.2", {
"packageLocation": "./.yarn/__virtual__/next-auth-virtual-f193e3c511/0/cache/next-auth-npm-4.1.2-9c72914c15-70f63eb5bb.zip/node_modules/next-auth/",
["npm:4.3.3", {
"packageLocation": "./.yarn/cache/next-auth-npm-4.3.3-8e1e4b805d-7c90d34fd9.zip/node_modules/next-auth/",
"packageDependencies": [
["next-auth", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.1.2"],
["next-auth", "npm:4.3.3"]
],
"linkType": "SOFT",
}],
["virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.3.3", {
"packageLocation": "./.yarn/__virtual__/next-auth-virtual-d65a89d883/0/cache/next-auth-npm-4.3.3-8e1e4b805d-7c90d34fd9.zip/node_modules/next-auth/",
"packageDependencies": [
["next-auth", "virtual:003bebd8b7a948d12b44e2c11a621884feb1891eea3645171e827971487f79396db9f7422bc411ccf3f90877e94ec86f5c3da70b96efb5daddb2ee3b35eae5c6#npm:4.3.3"],
["@babel/runtime", "npm:7.16.7"],
["@panva/hkdf", "npm:1.0.1"],
["@types/nodemailer", null],
@ -13362,7 +13390,67 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["oauth", "npm:0.9.15"],
["openid-client", "npm:5.1.2"],
["preact", "npm:10.6.5"],
["preact-render-to-string", "virtual:f193e3c511e540ec0520130479044c6bfa311730f2473a274b50be6bbec06fd16e00f76501caf9772c0a03f460504e1a2aa841a4569401035986e59c957e070e#npm:5.1.19"],
["preact-render-to-string", "virtual:d08a9a71462078b2b791d53b1291b8e05100a8476aae24dd5b9d433a87a93a3fb9f8095d6c30b64a18b3f3a43f589a6302f433e862337d1959395ceb980a7f57#npm:5.1.19"],
["react", "npm:17.0.2"],
["react-dom", "virtual:573fe255dffc9c89f4f7aa60da718603753ee98acc55d6772bbd0ebdcf07f9183fb8e54b4f3f2246c538a14ead402db8d2e076039c667d1538702638a0cc87b8#npm:17.0.2"],
["uuid", "npm:8.3.2"]
],
"packagePeers": [
"@types/nodemailer",
"@types/react-dom",
"@types/react",
"nodemailer",
"react-dom",
"react"
],
"linkType": "HARD",
}],
["virtual:3828db34ebd29f8d79b511e3dda5577d908743c95df6a5617131f10c5e8d5f4e186c617c1b33cc53cb90d5062cc3ecfe666338a3f54f9227de91ca5e440bfb5f#npm:4.3.3", {
"packageLocation": "./.yarn/__virtual__/next-auth-virtual-d08a9a7146/0/cache/next-auth-npm-4.3.3-8e1e4b805d-7c90d34fd9.zip/node_modules/next-auth/",
"packageDependencies": [
["next-auth", "virtual:3828db34ebd29f8d79b511e3dda5577d908743c95df6a5617131f10c5e8d5f4e186c617c1b33cc53cb90d5062cc3ecfe666338a3f54f9227de91ca5e440bfb5f#npm:4.3.3"],
["@babel/runtime", "npm:7.16.7"],
["@panva/hkdf", "npm:1.0.1"],
["@types/nodemailer", null],
["@types/react", null],
["@types/react-dom", null],
["cookie", "npm:0.4.1"],
["jose", "npm:4.4.0"],
["nodemailer", null],
["oauth", "npm:0.9.15"],
["openid-client", "npm:5.1.2"],
["preact", "npm:10.6.5"],
["preact-render-to-string", "virtual:d08a9a71462078b2b791d53b1291b8e05100a8476aae24dd5b9d433a87a93a3fb9f8095d6c30b64a18b3f3a43f589a6302f433e862337d1959395ceb980a7f57#npm:5.1.19"],
["react", null],
["react-dom", null],
["uuid", "npm:8.3.2"]
],
"packagePeers": [
"@types/nodemailer",
"@types/react-dom",
"@types/react",
"nodemailer",
"react-dom",
"react"
],
"linkType": "HARD",
}],
["virtual:b951ea20ab6cada5f665e8389a50d828047e6b6f10e6ebaddde1e74a94868ec6ec703ff140742f295ef663cf92da1bc80fe9bbeaab30196cba0e992f38cd19ea#npm:4.1.2", {
"packageLocation": "./.yarn/__virtual__/next-auth-virtual-f63cfc51ff/0/cache/next-auth-npm-4.1.2-9c72914c15-70f63eb5bb.zip/node_modules/next-auth/",
"packageDependencies": [
["next-auth", "virtual:b951ea20ab6cada5f665e8389a50d828047e6b6f10e6ebaddde1e74a94868ec6ec703ff140742f295ef663cf92da1bc80fe9bbeaab30196cba0e992f38cd19ea#npm:4.1.2"],
["@babel/runtime", "npm:7.16.7"],
["@panva/hkdf", "npm:1.0.1"],
["@types/nodemailer", null],
["@types/react", null],
["@types/react-dom", null],
["cookie", "npm:0.4.1"],
["jose", "npm:4.4.0"],
["nodemailer", null],
["oauth", "npm:0.9.15"],
["openid-client", "npm:5.1.2"],
["preact", "npm:10.6.5"],
["preact-render-to-string", "virtual:d08a9a71462078b2b791d53b1291b8e05100a8476aae24dd5b9d433a87a93a3fb9f8095d6c30b64a18b3f3a43f589a6302f433e862337d1959395ceb980a7f57#npm:5.1.19"],
["react", "npm:17.0.2"],
["react-dom", "virtual:573fe255dffc9c89f4f7aa60da718603753ee98acc55d6772bbd0ebdcf07f9183fb8e54b4f3f2246c538a14ead402db8d2e076039c667d1538702638a0cc87b8#npm:17.0.2"],
["uuid", "npm:8.3.2"]
@ -14748,10 +14836,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
],
"linkType": "SOFT",
}],
["virtual:f193e3c511e540ec0520130479044c6bfa311730f2473a274b50be6bbec06fd16e00f76501caf9772c0a03f460504e1a2aa841a4569401035986e59c957e070e#npm:5.1.19", {
"packageLocation": "./.yarn/__virtual__/preact-render-to-string-virtual-904376bfc7/0/cache/preact-render-to-string-npm-5.1.19-12c6fd3420-b8b454d7b4.zip/node_modules/preact-render-to-string/",
["virtual:d08a9a71462078b2b791d53b1291b8e05100a8476aae24dd5b9d433a87a93a3fb9f8095d6c30b64a18b3f3a43f589a6302f433e862337d1959395ceb980a7f57#npm:5.1.19", {
"packageLocation": "./.yarn/__virtual__/preact-render-to-string-virtual-47606a3a91/0/cache/preact-render-to-string-npm-5.1.19-12c6fd3420-b8b454d7b4.zip/node_modules/preact-render-to-string/",
"packageDependencies": [
["preact-render-to-string", "virtual:f193e3c511e540ec0520130479044c6bfa311730f2473a274b50be6bbec06fd16e00f76501caf9772c0a03f460504e1a2aa841a4569401035986e59c957e070e#npm:5.1.19"],
["preact-render-to-string", "virtual:d08a9a71462078b2b791d53b1291b8e05100a8476aae24dd5b9d433a87a93a3fb9f8095d6c30b64a18b3f3a43f589a6302f433e862337d1959395ceb980a7f57#npm:5.1.19"],
["@types/preact", null],
["preact", "npm:10.6.5"],
["pretty-format", "npm:3.8.0"]

Binary file not shown.

View File

@ -84,6 +84,7 @@
"@lowdefy/operators-nunjucks": "4.0.0-alpha.8",
"@lowdefy/operators-uuid": "4.0.0-alpha.8",
"@lowdefy/operators-yaml": "4.0.0-alpha.8",
"@lowdefy/plugin-next-auth": "4.0.0-alpha.8",
"@swc/cli": "0.1.55",
"@swc/core": "1.2.135",
"@swc/jest": "0.2.17",

View File

@ -43,12 +43,17 @@ const defaultPackages = [
'@lowdefy/operators-nunjucks',
'@lowdefy/operators-uuid',
'@lowdefy/operators-yaml',
'@lowdefy/plugin-next-auth',
];
async function generateDefaultTypesMap() {
const packageFile = JSON.parse(await readFile(path.resolve(process.cwd(), './package.json')));
const defaultTypesMap = {
actions: {},
auth: {
providers: {},
callbacks: {},
},
blocks: {},
connections: {},
icons: {},

View File

@ -37,6 +37,22 @@ function createPluginTypesMap({ packageName, packageTypes, typePrefix = '', type
version,
});
createTypeDefinitions({
typeNames: type.isObject(packageTypes.auth) ? packageTypes.auth.callbacks : [],
store: typesMap.auth.callbacks,
packageName,
typePrefix,
version,
});
createTypeDefinitions({
typeNames: type.isObject(packageTypes.auth) ? packageTypes.auth.providers : [],
store: typesMap.auth.providers,
packageName,
typePrefix,
version,
});
createTypeDefinitions({
typeNames: packageTypes.blocks,
store: typesMap.blocks,

View File

@ -33,6 +33,10 @@ async function getPluginDefinitions({ directories }) {
async function createCustomPluginTypesMap({ directories }) {
const customTypesMap = {
actions: {},
auth: {
providers: {},
callbacks: {},
},
blocks: {},
connections: {},
icons: {},

View File

@ -33,6 +33,10 @@ async function getPluginDefinitions({ directories }) {
async function createCustomPluginTypesMap({ directories }) {
const customTypesMap = {
actions: {},
auth: {
providers: {},
callbacks: {},
},
blocks: {},
connections: {},
icons: {},

View File

@ -48,7 +48,7 @@
"@lowdefy/node-utils": "4.0.0-alpha.8",
"@lowdefy/operators-js": "4.0.0-alpha.8",
"next": "12.0.10",
"next-auth": "4.1.2",
"next-auth": "4.3.3",
"process": "0.11.10",
"react": "17.0.2",
"react-dom": "17.0.2",

View File

@ -2234,6 +2234,7 @@ __metadata:
"@lowdefy/operators-nunjucks": 4.0.0-alpha.8
"@lowdefy/operators-uuid": 4.0.0-alpha.8
"@lowdefy/operators-yaml": 4.0.0-alpha.8
"@lowdefy/plugin-next-auth": 4.0.0-alpha.8
"@swc/cli": 0.1.55
"@swc/core": 1.2.135
"@swc/jest": 0.2.17
@ -2626,6 +2627,19 @@ __metadata:
languageName: unknown
linkType: soft
"@lowdefy/plugin-next-auth@4.0.0-alpha.8, @lowdefy/plugin-next-auth@workspace:packages/plugins/plugins/plugin-next-auth":
version: 0.0.0-use.local
resolution: "@lowdefy/plugin-next-auth@workspace:packages/plugins/plugins/plugin-next-auth"
dependencies:
"@lowdefy/ajv": 4.0.0-alpha.8
"@swc/cli": 0.1.55
"@swc/core": 1.2.135
"@swc/jest": 0.2.17
jest: 27.5.1
next-auth: 4.3.3
languageName: unknown
linkType: soft
"@lowdefy/server-dev@workspace:packages/server-dev":
version: 0.0.0-use.local
resolution: "@lowdefy/server-dev@workspace:packages/server-dev"
@ -2685,7 +2699,7 @@ __metadata:
less: 4.1.2
less-loader: 10.2.0
next: 12.0.10
next-auth: 4.1.2
next-auth: 4.3.3
next-with-less: 2.0.4
process: 0.11.10
react: 17.0.2
@ -11047,6 +11061,30 @@ __metadata:
languageName: node
linkType: hard
"next-auth@npm:4.3.3":
version: 4.3.3
resolution: "next-auth@npm:4.3.3"
dependencies:
"@babel/runtime": ^7.16.3
"@panva/hkdf": ^1.0.1
cookie: ^0.4.1
jose: ^4.3.7
oauth: ^0.9.15
openid-client: ^5.1.0
preact: ^10.6.3
preact-render-to-string: ^5.1.19
uuid: ^8.3.2
peerDependencies:
nodemailer: ^6.6.5
react: ^17.0.2 || ^18.0.0-0
react-dom: ^17.0.2 || ^18.0.0-0
peerDependenciesMeta:
nodemailer:
optional: true
checksum: 7c90d34fd9af04a582f7dbf20612d39a9930b1a4df4ed0aa8086d0fe4617072c280e11856090d60e8ad1ffbf943ed1bb68ef9f937c6b869b829d7777c93f5f0d
languageName: node
linkType: hard
"next-with-less@npm:2.0.4":
version: 2.0.4
resolution: "next-with-less@npm:2.0.4"