@flink-app/flink 0.3.7 → 0.3.11
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/bin/flink.js +2 -2
- package/dist/cli/build.js +3 -3
- package/dist/cli/clean.js +2 -2
- package/dist/cli/cli-utils.js +1 -1
- package/dist/cli/generate-schemas.js +20 -16
- package/dist/cli/run.js +2 -2
- package/dist/src/FlinkApp.d.ts +1 -1
- package/dist/src/FlinkApp.js +54 -50
- package/dist/src/FlinkErrors.d.ts +1 -1
- package/dist/src/FlinkErrors.js +5 -5
- package/dist/src/FlinkHttpHandler.d.ts +7 -7
- package/dist/src/FlinkLog.js +5 -5
- package/dist/src/FlinkRepo.js +1 -1
- package/dist/src/FlinkResponse.d.ts +2 -2
- package/dist/src/FsUtils.js +4 -4
- package/dist/src/TypeScriptCompiler.js +67 -63
- package/dist/src/TypeScriptUtils.js +1 -1
- package/dist/src/index.js +5 -1
- package/dist/src/mock-data-generator.js +1 -1
- package/dist/src/utils.js +9 -9
- package/package.json +2 -2
- package/readme.md +14 -10
- package/src/FlinkApp.ts +446 -510
package/readme.md
CHANGED
|
@@ -107,12 +107,12 @@ export default () => {};
|
|
|
107
107
|
|
|
108
108
|
The following building blocks exists in Flink:
|
|
109
109
|
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
110
|
+
- Handler - a handler is responsible for handling API requests and return a response. Normally a handler has some type of logic and invokes a _repo_ to CRUD data from database.
|
|
111
|
+
- Repo - a repository is used to abstract data access to database. A repo is used to access a mongo db and a repo is used per collection.
|
|
112
|
+
- App Context - the app context is the glue that ties parts of the app together. By defining and creating an app context you make sure that i.e. handlers can get access to repositories.
|
|
113
|
+
- Schemas - models that defines API requests and responses. These are typescript interfaces which will during compile time be converted into JSON schemas used to validate requests and responses and also used to generate API documentation.
|
|
114
|
+
- Flink app - is the entry
|
|
115
|
+
- Plugins - plugability is built into core of Flink. These can be external npm modules, or plugins inside your project. Plugins can for example extend the `request` object and add additional information such as auth user which can be used in handlers. Similar to how middleware works in express although a bit more constrained.
|
|
116
116
|
|
|
117
117
|
### Handlers
|
|
118
118
|
|
|
@@ -164,10 +164,10 @@ Then handler method must be of type `Handler` or `GetHandler`.
|
|
|
164
164
|
|
|
165
165
|
The handler function has generic type arguments which defines:
|
|
166
166
|
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
167
|
+
- Application context
|
|
168
|
+
- Request schema (optional)
|
|
169
|
+
- Response schema (optional)
|
|
170
|
+
- Params (optional)
|
|
171
171
|
|
|
172
172
|
> Note: `GetHandler<Ctx, ResSchema>` is just syntactic sugar since get handlers does not have request schemas so that type argument does not exist. Otherwise it is the same as `Handler<Ctx, ReqSchema, ResSchema>`
|
|
173
173
|
|
|
@@ -217,3 +217,7 @@ export const Props: RouteProps {
|
|
|
217
217
|
method: HttpMethod.get
|
|
218
218
|
}
|
|
219
219
|
```
|
|
220
|
+
|
|
221
|
+
## 🤕 Known issues
|
|
222
|
+
|
|
223
|
+
- Current TypeScript compiler is slow when project gets larger
|