@lenne.tech/cli 0.0.86 → 0.0.87

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.
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const crypto = require("crypto");
13
+ /**
14
+ * Open regex tools in browser
15
+ */
16
+ const NewCommand = {
17
+ name: 'createSecret',
18
+ alias: ['cs'],
19
+ description: 'Create a new secret string (for JWT config)',
20
+ hidden: false,
21
+ run: (toolbox) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const { print: { success }, } = toolbox;
23
+ success(crypto.randomBytes(512).toString('base64'));
24
+ // For tests
25
+ return `secret created`;
26
+ }),
27
+ };
28
+ exports.default = NewCommand;
29
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLXNlY3JldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21tYW5kcy9zZXJ2ZXIvY3JlYXRlLXNlY3JldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztBQUFBLGlDQUFpQztBQUlqQzs7R0FFRztBQUNILE1BQU0sVUFBVSxHQUFtQjtJQUNqQyxJQUFJLEVBQUUsY0FBYztJQUNwQixLQUFLLEVBQUUsQ0FBQyxJQUFJLENBQUM7SUFDYixXQUFXLEVBQUUsNkNBQTZDO0lBQzFELE1BQU0sRUFBRSxLQUFLO0lBQ2IsR0FBRyxFQUFFLENBQU8sT0FBK0IsRUFBRSxFQUFFO1FBQzdDLE1BQU0sRUFDSixLQUFLLEVBQUUsRUFBRSxPQUFPLEVBQUUsR0FDbkIsR0FBRyxPQUFPLENBQUM7UUFDWixPQUFPLENBQUMsTUFBTSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQztRQUVwRCxZQUFZO1FBQ1osT0FBTyxnQkFBZ0IsQ0FBQztJQUMxQixDQUFDLENBQUE7Q0FDRixDQUFDO0FBRUYsa0JBQWUsVUFBVSxDQUFDIn0=
@@ -1,9 +1,7 @@
1
- import { FilterArgs, GraphQLUser, RoleEnum, Roles } from '@lenne.tech/nest-server';
1
+ import { FilterArgs, GraphQLServiceOptions, RoleEnum, Roles, ServiceOptions } from '@lenne.tech/nest-server';
2
2
  import { Inject } from '@nestjs/common';
3
- import { Args, Info, Mutation, Query, Resolver, Subscription } from '@nestjs/graphql';
4
- import { GraphQLResolveInfo } from 'graphql';
3
+ import { Args, Mutation, Query, Resolver, Subscription } from '@nestjs/graphql';
5
4
  import { PubSub } from 'graphql-subscriptions';
6
- import { User } from '../user/user.model';
7
5
  import { <%= props.namePascal %>CreateInput } from './inputs/<%= props.nameKebab %>-create.input';
8
6
  import { <%= props.namePascal %>Input } from './inputs/<%= props.nameKebab %>.input';
9
7
  import { FindAndCount<%= props.namePascal %>sResult } from './outputs/find-and-count-<%= props.nameKebab %>s-result.output';
@@ -35,13 +33,11 @@ export class <%= props.namePascal %>Resolver {
35
33
  @Roles(RoleEnum.S_USER)
36
34
  @Query(() => FindAndCount<%= props.namePascal %>sResult, { description: 'Find <%= props.namePascal %>s (via filter)' })
37
35
  async findAndCount<%= props.namePascal %>s(
38
- @Info() info: GraphQLResolveInfo,
39
- @GraphQLUser() user: User,
36
+ @GraphQLServiceOptions() serviceOptions: ServiceOptions,
40
37
  @Args() args?: FilterArgs
41
38
  ) {
42
39
  return await this.<%= props.nameCamel %>Service.findAndCount(args, {
43
- currentUser: user,
44
- fieldSelection: { info, select: 'findAndCount<%= props.namePascal %>s.items' },
40
+ ...serviceOptions,
45
41
  inputType: FilterArgs,
46
42
  });
47
43
  }
@@ -52,13 +48,11 @@ export class <%= props.namePascal %>Resolver {
52
48
  @Roles(RoleEnum.S_USER)
53
49
  @Query(() => [<%= props.namePascal %>], { description: 'Find <%= props.namePascal %>s (via filter)' })
54
50
  async find<%= props.namePascal %>s(
55
- @Info() info: GraphQLResolveInfo,
56
- @GraphQLUser() user: User,
51
+ @GraphQLServiceOptions() serviceOptions: ServiceOptions,
57
52
  @Args() args?: FilterArgs
58
53
  ) {
59
54
  return await this.<%= props.nameCamel %>Service.find(args, {
60
- currentUser: user,
61
- fieldSelection: { info, select: 'find<%= props.namePascal %>s' },
55
+ ...serviceOptions,
62
56
  inputType: FilterArgs
63
57
  });
64
58
  }
@@ -69,14 +63,10 @@ export class <%= props.namePascal %>Resolver {
69
63
  @Roles(RoleEnum.S_USER)
70
64
  @Query(() => <%= props.namePascal %>, { description: 'Get <%= props.namePascal %> with specified ID' })
71
65
  async get<%= props.namePascal %>(
72
- @Info() info: GraphQLResolveInfo,
73
- @GraphQLUser() user: User,
66
+ @GraphQLServiceOptions() serviceOptions: ServiceOptions,
74
67
  @Args('id') id: string,
75
68
  ): Promise<<%= props.namePascal %>> {
76
- return await this.<%= props.nameCamel %>Service.get(id, {
77
- currentUser: user,
78
- fieldSelection: { info, select: 'get<%= props.namePascal %>' },
79
- });
69
+ return await this.<%= props.nameCamel %>Service.get(id, serviceOptions);
80
70
  }
81
71
 
82
72
  // ===========================================================================
@@ -89,13 +79,11 @@ export class <%= props.namePascal %>Resolver {
89
79
  @Roles(RoleEnum.S_USER)
90
80
  @Mutation(() => <%= props.namePascal %>, { description: 'Create a new <%= props.namePascal %>' })
91
81
  async create<%= props.namePascal %>(
92
- @Info() info: GraphQLResolveInfo,
93
- @GraphQLUser() user: User,
82
+ @GraphQLServiceOptions() serviceOptions: ServiceOptions,
94
83
  @Args('input') input: <%= props.namePascal %>CreateInput
95
84
  ): Promise<<%= props.namePascal %>> {
96
85
  return await this.<%= props.nameCamel %>Service.create(input, {
97
- currentUser: user,
98
- fieldSelection: { info, select: 'create<%= props.namePascal %>' },
86
+ ...serviceOptions,
99
87
  inputType: <%= props.namePascal %>CreateInput
100
88
  });
101
89
  }
@@ -106,13 +94,11 @@ export class <%= props.namePascal %>Resolver {
106
94
  @Roles(RoleEnum.S_USER)
107
95
  @Mutation(() => <%= props.namePascal %>, { description: 'Delete existing <%= props.namePascal %>' })
108
96
  async delete<%= props.namePascal %>(
109
- @Info() info: GraphQLResolveInfo,
110
- @GraphQLUser() user: User,
97
+ @GraphQLServiceOptions() serviceOptions: ServiceOptions,
111
98
  @Args('id') id: string
112
99
  ): Promise<<%= props.namePascal %>> {
113
100
  return await this.<%= props.nameCamel %>Service.delete(id, {
114
- currentUser: user,
115
- fieldSelection: { info, select: 'delete<%= props.namePascal %>' },
101
+ ...serviceOptions,
116
102
  roles: [RoleEnum.ADMIN, RoleEnum.S_CREATOR]
117
103
  });
118
104
  }
@@ -123,14 +109,12 @@ export class <%= props.namePascal %>Resolver {
123
109
  @Roles(RoleEnum.S_USER)
124
110
  @Mutation(() => <%= props.namePascal %>, { description: 'Update existing <%= props.namePascal %>' })
125
111
  async update<%= props.namePascal %>(
126
- @Info() info: GraphQLResolveInfo,
127
- @GraphQLUser() user: User,
112
+ @GraphQLServiceOptions() serviceOptions: ServiceOptions,
128
113
  @Args('id') id: string,
129
114
  @Args('input') input: <%= props.namePascal %>Input
130
115
  ): Promise<<%= props.namePascal %>> {
131
116
  return await this.<%= props.nameCamel %>Service.update(id, input, {
132
- currentUser: user,
133
- fieldSelection: { info, select: 'update<%= props.namePascal %>' },
117
+ serviceOptions,
134
118
  inputType: <%= props.namePascal %>Input,
135
119
  roles: [RoleEnum.ADMIN, RoleEnum.S_CREATOR]
136
120
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/cli",
3
- "version": "0.0.86",
3
+ "version": "0.0.87",
4
4
  "description": "lenne.Tech CLI: lt",
5
5
  "keywords": [
6
6
  "lenne.Tech",