@azure-net/cli 1.3.7 → 1.3.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-net/cli",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "azure-net": "bin/azure-net.js"
@@ -53,7 +53,7 @@ export default async function generateCrud() {
53
53
  const baseArch = path.join(process.cwd(), 'src/app/contexts');
54
54
  const basePath = selectedModule ? path.join(baseArch, selectedModule) : path.join(baseArch, 'app-context');
55
55
 
56
- const domainPath = path.join(basePath, 'Domain', lower);
56
+ const domainPath = path.join(basePath, 'Domain', capital);
57
57
  const serviceDir = path.join(basePath, 'Application', 'Services');
58
58
  const repoPath = path.join(basePath, 'Infra', 'Repo');
59
59
 
@@ -65,8 +65,8 @@ export default async function generateCrud() {
65
65
  const aliasShared = '$shared-context';
66
66
 
67
67
  const templateData = {
68
- className: capital,
69
- domainName: lower,
68
+ camelCaseName: lower,
69
+ pascalCaseName: capital,
70
70
  endpoint,
71
71
  datasource,
72
72
  aliasDomain: `${aliasCurrent}/Domain`,
@@ -105,7 +105,6 @@ export default async function generateCrud() {
105
105
  path.join(domainPath, 'index.ts'),
106
106
  [`export * from './Abstracts';`, `export * from './Request';`].join('\n') + '\n'
107
107
  );
108
- await updateIndexTs(domainPath);
109
108
 
110
109
  // === 5) Repo
111
110
  const repoTpl = await fs.readFile(path.join(__dirname, '../templates/data/repo/ClassRepo.ejs'), 'utf-8');
@@ -1,29 +1,29 @@
1
1
  import { <%= datasource %> } from '<%= aliasShared %>/datasources';
2
2
  import type {
3
- I<%= className %>Collection,
4
- I<%= className %>Resource,
5
- I<%= className %>CreateRequest,
6
- I<%= className %>UpdateRequest
7
- } from '<%= aliasDomain %>/<%= domainName %>';
3
+ I<%= pascalCaseName %>Collection,
4
+ I<%= pascalCaseName %>Resource,
5
+ I<%= pascalCaseName %>CreateRequest,
6
+ I<%= pascalCaseName %>UpdateRequest
7
+ } from '<%= aliasDomain %>/<%= pascalCaseName %>';
8
8
 
9
- export class <%= className %>Repo {
9
+ export class <%= pascalCaseName %>Repo {
10
10
  private endpoint = '<%= endpoint %>';
11
11
  constructor(private source = new <%= datasource %>()) {}
12
12
 
13
13
  public async collection() {
14
- return await this.source.createRequest<I<%= className %>Collection>(({ http }) => http.get(this.endpoint));
14
+ return await this.source.createRequest<I<%= pascalCaseName %>Collection>(({ http }) => http.get(this.endpoint));
15
15
  }
16
16
 
17
17
  public async resource(id: number) {
18
- return await this.source.createRequest<I<%= className %>Resource>(({ http }) => http.get(`${this.endpoint}/${id}`));
18
+ return await this.source.createRequest<I<%= pascalCaseName %>Resource>(({ http }) => http.get(`${this.endpoint}/${id}`));
19
19
  }
20
20
 
21
- public async create(data: I<%= className %>CreateRequest) {
22
- return await this.source.createRequest<I<%= className %>Resource>(({ http }) => http.post(this.endpoint, { json: data }));
21
+ public async create(data: I<%= pascalCaseName %>CreateRequest) {
22
+ return await this.source.createRequest<I<%= pascalCaseName %>Resource>(({ http }) => http.post(this.endpoint, { json: data }));
23
23
  }
24
24
 
25
- public async update(id: number, data: I<%= className %>UpdateRequest) {
26
- return await this.source.createRequest<I<%= className %>Resource>(({ http }) => http.put(`${this.endpoint}/${id}`, { json: data }));
25
+ public async update(id: number, data: I<%= pascalCaseName %>UpdateRequest) {
26
+ return await this.source.createRequest<I<%= pascalCaseName %>Resource>(({ http }) => http.put(`${this.endpoint}/${id}`, { json: data }));
27
27
  }
28
28
 
29
29
  public async remove(id: number) {
@@ -1,6 +1,6 @@
1
- export interface I<%= className %>Resource {
1
+ export interface I<%= pascalCaseName %>Resource {
2
2
  // TODO: define fields
3
3
  [key: string]: unknown;
4
4
  }
5
5
 
6
- export type I<%= className %>Collection = I<%= className %>Resource[];
6
+ export type I<%= pascalCaseName %>Collection = I<%= pascalCaseName %>Resource[];
@@ -1,4 +1,4 @@
1
- export interface I<%= className %>CreateRequest {
1
+ export interface I<%= pascalCaseName %>CreateRequest {
2
2
  // TODO: define fields
3
3
  [key: string]: unknown;
4
4
  }
@@ -1,4 +1,4 @@
1
- export interface I<%= className %>UpdateRequest {
1
+ export interface I<%= pascalCaseName %>UpdateRequest {
2
2
  // TODO: define fields
3
3
  [key: string]: unknown;
4
4
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseRequest } from '@azure-net/kit';
2
- import type { I<%= className %>CreateRequest } from '../abstracts';
2
+ import type { I<%= pascalCaseName %>CreateRequest } from '../Abstracts';
3
3
 
4
- export class <%= className %>CreateRequest extends BaseRequest<I<%= className %>CreateRequest> {
4
+ export class <%= pascalCaseName %>CreateRequest extends BaseRequest<I<%= pascalCaseName %>CreateRequest> {
5
5
  override rules() {
6
6
  return {};
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseRequest } from '@azure-net/kit';
2
- import type { I<%= className %>UpdateRequest } from '../abstracts';
2
+ import type { I<%= pascalCaseName %>UpdateRequest } from '../Abstracts';
3
3
 
4
- export class <%= className %>UpdateRequest extends BaseRequest<I<%= className %>UpdateRequest> {
4
+ export class <%= pascalCaseName %>UpdateRequest extends BaseRequest<I<%= pascalCaseName %>UpdateRequest> {
5
5
  override rules() {
6
6
  return {};
7
7
  }
@@ -1,29 +1,29 @@
1
1
  import { BaseService } from '@azure-net/kit';
2
- import { <%= className %>Repo } from '<%= aliasRepo %>';
3
- import type { <%= className %>CreateRequest, <%= className %>UpdateRequest } from '<%= aliasDomain %>/<%= domainName %>';
2
+ import { <%= pascalCaseName %>Repo } from '<%= aliasRepo %>';
3
+ import type { <%= pascalCaseName %>CreateRequest, <%= pascalCaseName %>UpdateRequest } from '<%= aliasDomain %>/<%= pascalCaseName %>';
4
4
 
5
- export class <%= className %>Service extends BaseService {
6
- constructor(private <%= domainName %>Repo = new <%= className %>Repo()) {
5
+ export class <%= pascalCaseName %>Service extends BaseService {
6
+ constructor(private <%= camelCaseName %>Repo = new <%= pascalCaseName %>Repo()) {
7
7
  super();
8
8
  }
9
9
 
10
10
  async collection() {
11
- return await this.transformResponse(this.<%= domainName %>Repo.collection());
11
+ return await this.transformResponse(this.<%= camelCaseName %>Repo.collection());
12
12
  }
13
13
 
14
14
  async resource(id: number) {
15
- return await this.transformResponse(this.<%= domainName %>Repo.resource(id));
15
+ return await this.transformResponse(this.<%= camelCaseName %>Repo.resource(id));
16
16
  }
17
17
 
18
- async create(request: <%= className %>CreateRequest) {
19
- return await this.transformResponse(this.<%= domainName %>Repo.create(request.json()));
18
+ async create(request: <%= pascalCaseName %>CreateRequest) {
19
+ return await this.transformResponse(this.<%= camelCaseName %>Repo.create(request.json()));
20
20
  }
21
21
 
22
- async update(id: number, request: <%= className %>UpdateRequest) {
23
- return await this.transformResponse(this.<%= domainName %>Repo.update(id, request.json()));
22
+ async update(id: number, request: <%= pascalCaseName %>UpdateRequest) {
23
+ return await this.transformResponse(this.<%= camelCaseName %>Repo.update(id, request.json()));
24
24
  }
25
25
 
26
26
  async remove(id: number) {
27
- return await this.transformResponse(this.<%= domainName %>Repo.remove(id));
27
+ return await this.transformResponse(this.<%= camelCaseName %>Repo.remove(id));
28
28
  }
29
29
  }