@fraym/crud 0.14.3 → 0.15.0
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/README.md +3 -35
- package/dist/cmd/crud.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ Use the `crud` cli command to automatically apply your crud schemas to the crud
|
|
|
22
22
|
Your type schemas have to match the glob you specify in the `CRUD_SCHEMA_GLOB` env variable (default: `./src/**/*.graphql`).
|
|
23
23
|
You can specify the address (and port) of the crud service instance you use in the `CRUD_SERVER_ADDRESS` env variable (default: `127.0.0.1:9000`).
|
|
24
24
|
|
|
25
|
+
You might have a seperate permissions directory or file. As soon as your permissions schema enum is not part of the projections glob you can specify a `PERMISSIONS_SCHEMA_GLOB` env variable. It is empty by default but as soon as you provide it it will add the files in that glob to your projections schema, too.
|
|
26
|
+
|
|
25
27
|
Use the `CRUD_NAMESPACE` env variable to restrict all migrations to your namespace. This is useful if multiple apps share the crud service. Note: You cannot name your crud type or namespace by a `Fraym` prefix. This is a reserved prefix for fraym apps.
|
|
26
28
|
|
|
27
29
|
You need to add a file that contains all built-in directives to your type schemas. The latest version of this file can be found [here](default.graphql).
|
|
@@ -33,6 +35,7 @@ Use a `.env` file or env variables to configure cte clients and the command:
|
|
|
33
35
|
```env
|
|
34
36
|
CRUD_SERVER_ADDRESS=127.0.0.1:9000
|
|
35
37
|
CRUD_SCHEMA_GLOB=./src/crud/*.graphql
|
|
38
|
+
PERMISSIONS_SCHEMA_GLOB=
|
|
36
39
|
CRUD_NAMESPACE=
|
|
37
40
|
```
|
|
38
41
|
|
|
@@ -239,38 +242,3 @@ You won't lose any data if you don't. Use it for your peace of mind.
|
|
|
239
242
|
```typescript
|
|
240
243
|
client.close();
|
|
241
244
|
```
|
|
242
|
-
|
|
243
|
-
## Development
|
|
244
|
-
|
|
245
|
-
You'll need the following apps for a smooth development experience:
|
|
246
|
-
|
|
247
|
-
- minikube
|
|
248
|
-
- lens
|
|
249
|
-
- okteto
|
|
250
|
-
- helm
|
|
251
|
-
|
|
252
|
-
### Running the dev environment
|
|
253
|
-
|
|
254
|
-
- Start minikube if not already done:
|
|
255
|
-
|
|
256
|
-
```shell
|
|
257
|
-
minikube start
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
- add mongodb and minio to your lokal kubernetes
|
|
261
|
-
- use Makefiles in `./.dev/*`
|
|
262
|
-
- copy `.env.build` to `.env.build.local`
|
|
263
|
-
- add your personal access token (needs read access for private fraym org repositories)
|
|
264
|
-
- deploy the app to your cluster
|
|
265
|
-
|
|
266
|
-
```
|
|
267
|
-
make init
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
- start okteto
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
make dev
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
- connect your IDE to that okteto instance
|
package/dist/cmd/crud.js
CHANGED
|
@@ -16,16 +16,21 @@ const run = async () => {
|
|
|
16
16
|
const argv = await (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
17
17
|
.config({
|
|
18
18
|
schemaGlob: "./src/**/*.graphql",
|
|
19
|
+
permissionsSchemaGlob: "",
|
|
19
20
|
serverAddress: "127.0.0.1:9000",
|
|
20
21
|
namespace: "",
|
|
21
22
|
})
|
|
22
23
|
.pkgConf("crud").argv;
|
|
23
24
|
let schemaGlob = argv.schemaGlob;
|
|
25
|
+
let permissionsSchemaGlob = argv.permissionsSchemaGlob;
|
|
24
26
|
let serverAddress = argv.serverAddress;
|
|
25
27
|
let namespace = argv.namespace;
|
|
26
28
|
if (process.env.CRUD_SCHEMA_GLOB) {
|
|
27
29
|
schemaGlob = process.env.CRUD_SCHEMA_GLOB;
|
|
28
30
|
}
|
|
31
|
+
if (process.env.PERMISSIONS_SCHEMA_GLOB) {
|
|
32
|
+
permissionsSchemaGlob = process.env.PERMISSIONS_SCHEMA_GLOB;
|
|
33
|
+
}
|
|
29
34
|
if (process.env.CRUD_SERVER_ADDRESS) {
|
|
30
35
|
serverAddress = process.env.CRUD_SERVER_ADDRESS;
|
|
31
36
|
}
|
|
@@ -35,7 +40,11 @@ const run = async () => {
|
|
|
35
40
|
if (namespace === "Fraym") {
|
|
36
41
|
throw new Error("Cannot use Fraym as namespace as it is reserved for fraym apps");
|
|
37
42
|
}
|
|
38
|
-
const
|
|
43
|
+
const schemaGlobs = [`${schemaGlob}`];
|
|
44
|
+
if (permissionsSchemaGlob) {
|
|
45
|
+
schemaGlobs.push(`${permissionsSchemaGlob}`);
|
|
46
|
+
}
|
|
47
|
+
const schema = await (0, load_1.loadSchema)(schemaGlobs, {
|
|
39
48
|
loaders: [new graphql_file_loader_1.GraphQLFileLoader()],
|
|
40
49
|
});
|
|
41
50
|
const definitions = getTypeDefinition(schema, namespace);
|