From 99fab3f6214feb9606d8d24dc15d95532929f032 Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Fri, 5 Aug 2022 17:42:34 +0300 Subject: [PATCH 1/2] resolves #13504 promisfy rule functions --- npm/ng-packs/.gitignore | 2 ++ npm/ng-packs/package.json | 4 +++- .../packages/schematics/src/models/index.ts | 1 + .../packages/schematics/src/models/rule.ts | 3 +++ .../packages/schematics/src/utils/rule.ts | 8 +++++-- .../mock-schematic}/api-definition.json | 0 .../mock-schematic/mock-schematic-json.ts | 13 +++++++++++ .../scripts/mock-schematic/package.json | 22 +++++++++++++++++++ .../scripts/mock-schematic/tsconfig.json | 12 ++++++++++ 9 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 npm/ng-packs/packages/schematics/src/models/rule.ts rename npm/ng-packs/{packages/schematics/src/mocks => scripts/mock-schematic}/api-definition.json (100%) create mode 100644 npm/ng-packs/scripts/mock-schematic/mock-schematic-json.ts create mode 100644 npm/ng-packs/scripts/mock-schematic/package.json create mode 100644 npm/ng-packs/scripts/mock-schematic/tsconfig.json diff --git a/npm/ng-packs/.gitignore b/npm/ng-packs/.gitignore index 326e29324e..b542c2b12d 100644 --- a/npm/ng-packs/.gitignore +++ b/npm/ng-packs/.gitignore @@ -54,3 +54,5 @@ Thumbs.db !**/[Pp]ackages/* *.internal.* + +.angular diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 1798f45594..a669d3b970 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -34,7 +34,9 @@ "dev:schematics": "tsc -p packages/schematics/tsconfig.json -w", "ci": "yarn affected:lint && yarn affected:build && yarn affected:test", "lerna": "lerna", - "migrate-nx": "yarn nx migrate --run-migrations" + "migrate-nx": "yarn nx migrate --run-migrations", + "mock:schematics": "cd scripts/mock-schematic && yarn && yarn start", + "debug:schematics": "./node_modules/.bin/ng g ./packages/schematics/src/collection.json:proxy-add --module __default --apiName __default --source __default --target __default --url http://localhost:4300" }, "private": true, "devDependencies": { diff --git a/npm/ng-packs/packages/schematics/src/models/index.ts b/npm/ng-packs/packages/schematics/src/models/index.ts index 176c9c6617..c6d04f521e 100644 --- a/npm/ng-packs/packages/schematics/src/models/index.ts +++ b/npm/ng-packs/packages/schematics/src/models/index.ts @@ -5,6 +5,7 @@ export * from './method'; export * from './model'; export * from './project'; export * from './proxy-config'; +export * from './rule'; export * from './service'; export * from './tree'; export * from './util'; diff --git a/npm/ng-packs/packages/schematics/src/models/rule.ts b/npm/ng-packs/packages/schematics/src/models/rule.ts new file mode 100644 index 0000000000..9c4f9b43ea --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/models/rule.ts @@ -0,0 +1,3 @@ +import { Rule } from '@angular-devkit/schematics'; + +export type RuleReturn = ReturnType; diff --git a/npm/ng-packs/packages/schematics/src/utils/rule.ts b/npm/ng-packs/packages/schematics/src/utils/rule.ts index bd6acdd646..c68347531f 100644 --- a/npm/ng-packs/packages/schematics/src/utils/rule.ts +++ b/npm/ng-packs/packages/schematics/src/utils/rule.ts @@ -9,11 +9,15 @@ import { Source, Tree, } from '@angular-devkit/schematics'; +import { RuleReturn } from '../models/rule'; export function applyWithOverwrite(source: Source, rules: Rule[]): Rule { return (tree: Tree, _context: SchematicContext) => { - const rule = mergeWith(apply(source, [...rules, overwriteFileIfExists(tree)])); - + const mapped = rules.map(r => { + return ((_tree: Tree, _ctx: SchematicContext) => + new Promise(res => res(r(_tree, _ctx)))) as Rule; + }); + const rule = mergeWith(apply(source, [...mapped, overwriteFileIfExists(tree)])); return rule(tree, _context); }; } diff --git a/npm/ng-packs/packages/schematics/src/mocks/api-definition.json b/npm/ng-packs/scripts/mock-schematic/api-definition.json similarity index 100% rename from npm/ng-packs/packages/schematics/src/mocks/api-definition.json rename to npm/ng-packs/scripts/mock-schematic/api-definition.json diff --git a/npm/ng-packs/scripts/mock-schematic/mock-schematic-json.ts b/npm/ng-packs/scripts/mock-schematic/mock-schematic-json.ts new file mode 100644 index 0000000000..a4eb4f11d0 --- /dev/null +++ b/npm/ng-packs/scripts/mock-schematic/mock-schematic-json.ts @@ -0,0 +1,13 @@ +import express, { Request, Response } from 'express'; +import fs from 'fs'; + +const port = 4300; +const app = express(); + +app.get('/api/abp/api-definition', async (req: Request, res: Response) => { + const file = fs.readFileSync('./api-definition.json'); + res.contentType('application/json'); + res.send(file); +}); + +app.listen(port, () => console.log(`Server listening on http://localhost:${port}`)); diff --git a/npm/ng-packs/scripts/mock-schematic/package.json b/npm/ng-packs/scripts/mock-schematic/package.json new file mode 100644 index 0000000000..72bdd34635 --- /dev/null +++ b/npm/ng-packs/scripts/mock-schematic/package.json @@ -0,0 +1,22 @@ +{ + "name": "mocks-schematics", + "version": "0.0.1", + "description": "ABP Mock Proxy Generation App", + "scripts": { + "start": "nodemon mock-schematic-json.ts" + }, + "author": "", + "dependencies": { + "babel-preset-node6": "^11.0.0", + "express": "^4.18.1" + }, + "devDependencies": { + "@types/node": "^13.1.2", + "esm": "^3.2.25", + "ts-node": "^8.5.4", + "tsconfig-paths": "^3.9.0", + "typescript": "^3.7.4", + "nodemon": "^2.0.19", + "@types/express": "^4.17.13" + } +} diff --git a/npm/ng-packs/scripts/mock-schematic/tsconfig.json b/npm/ng-packs/scripts/mock-schematic/tsconfig.json new file mode 100644 index 0000000000..0e05b4f7ed --- /dev/null +++ b/npm/ng-packs/scripts/mock-schematic/tsconfig.json @@ -0,0 +1,12 @@ +{ +"compilerOptions": { + "target": "es5", + "module": "commonjs", + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + } +} From 09170382fdf906e4a7ba527a3ccf1ab69ec88119 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 11 Aug 2022 09:33:48 +0800 Subject: [PATCH 2/2] Update OpenIddict.md Resolve #13625 --- docs/en/Modules/OpenIddict.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/en/Modules/OpenIddict.md b/docs/en/Modules/OpenIddict.md index 9e603f76a8..85ece92ffc 100644 --- a/docs/en/Modules/OpenIddict.md +++ b/docs/en/Modules/OpenIddict.md @@ -4,6 +4,14 @@ This module implements the domain logic and database integrations, but not provides any UI. Management UI is useful if you need to add applications and scopes on the fly. In this case, you may build the management UI yourself or consider to purchase the [ABP Commercial](https://commercial.abp.io/) which provides the management UI for this module. +## How to Install + +This module comes as pre-installed (as NuGet/NPM packages) when you [create a new solution](https://abp.io/get-started) with the ABP Framework. You can continue to use it as package and get updates easily, or you can include its source code into your solution (see `get-source` [CLI](../CLI.md) command) to develop your custom module. + +### The Source Code + +The source code of this module can be accessed [here](https://github.com/abpframework/abp/tree/dev/modules/openiddict). The source code is licensed with [MIT](https://choosealicense.com/licenses/mit/), so you can freely use and customize it. + ## Relations to Other Modules This module is based on the [Identity Module](Identity.md) and have an [integration package](https://www.nuget.org/packages/Volo.Abp.Account.Web.OpenIddict) with the [Account Module](Account.md). @@ -206,6 +214,10 @@ If you need to customize OpenIddict, you need to replace/delete/add new handlers Please refer to: https://documentation.openiddict.com/guides/index.html#events-model +## Migrating Guide + +[Migrating from IdentityServer to OpenIddict Step by Step Guide ](Migration-Guides/OpenIddict-Step-by-Step.md) + ## Sponsor Please consider sponsoring this project: https://github.com/sponsors/kevinchalet