@apso/cli 0.33.1 → 0.34.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.
@@ -37,7 +37,7 @@ import {
37
37
  import { JSONResolver } from 'graphql-scalars';
38
38
  <% } %>
39
39
  import { Type } from 'class-transformer';
40
- import { CrudValidationGroups } from '@nestjsx/crud';
40
+ import { CrudValidationGroups } from '@apso/crud';
41
41
  <% if (it.importEnums) { %>
42
42
  import * as enums from '../enums';
43
43
  <% } %>
@@ -21,7 +21,7 @@ import { Type } from 'class-transformer';
21
21
 
22
22
  import { ObjectType, Field, Int, GraphQLISODateTime, ID } from '@nestjs/graphql';
23
23
  import { JSONResolver } from 'graphql-scalars';
24
- import { CrudValidationGroups } from '@nestjsx/crud';
24
+ import { CrudValidationGroups } from '@apso/crud';
25
25
  <% if (it.importEnums) { %>
26
26
  import * as enums from '../../enums';
27
27
  <% } %>
@@ -293,7 +293,7 @@ export class ScopeGuard implements CanActivate {
293
293
  if (scope.direct) {
294
294
  const scopeValue = this.getScopeValue(request, scope.contextKey);
295
295
  if (scopeValue) {
296
- // Add filter for @nestjsx/crud
296
+ // Add filter for @apso/crud
297
297
  request.query[`filter.${scope.field}`] = `$eq:${scopeValue}`;
298
298
  }
299
299
  }
@@ -4,7 +4,7 @@ import { Test, TestingModule } from '@nestjs/testing';
4
4
  import {<%= it.entityName %>, <%= it.entityName %>Create} from './dtos/<%= it.entityName%>.dto'
5
5
  import {<%= it.ctrlName %>} from "./<%= it.entityName %>.controller";
6
6
  import {<%= it.svcName %>} from "./<%= it.entityName %>.service";
7
- import { CrudRequest } from '@nestjsx/crud';
7
+ import { CrudRequest } from '@apso/crud';
8
8
 
9
9
  const baseRequest: CrudRequest = {
10
10
  parsed: {
@@ -1,7 +1,7 @@
1
1
  <%~ includeFile('./header.eta') %>
2
2
 
3
3
  import { Controller, Body } from "@nestjs/common";
4
- import { Crud, CrudController, Override, ParsedRequest, CrudRequest, ParsedBody, CreateManyDto } from '@nestjsx/crud';
4
+ import { Crud, CrudController, Override, ParsedRequest, CrudRequest, ParsedBody, CreateManyDto } from '@apso/crud';
5
5
  import { ApiTags, ApiResponse, ApiOperation, ApiBody } from '@nestjs/swagger';
6
6
  import {<%= it.entityName %>, <%= it.entityName %>Create, <%= it.entityName %>Update} from './dtos/<%= it.entityName%>.dto'
7
7
  import {<%= it.svcName %>} from './<%= it.entityName %>.service';
@@ -2,9 +2,9 @@
2
2
 
3
3
  import { Injectable, NotFoundException } from "@nestjs/common";
4
4
  import { InjectRepository } from "@nestjs/typeorm";
5
- import { TypeOrmCrudService } from "@nestjsx/crud-typeorm";
6
- import { QueryOptions, CrudRequest } from '@nestjsx/crud';
7
- import { ParsedRequestParams } from '@nestjsx/crud-request';
5
+ import { TypeOrmCrudService } from "@apso/crud-typeorm";
6
+ import { QueryOptions, CrudRequest } from '@apso/crud';
7
+ import { ParsedRequestParams } from '@apso/crud-request';
8
8
  import { Repository, DeepPartial } from 'typeorm';
9
9
 
10
10
  import {<%= it.entityName %>} from './<%= it.entityName%>.entity'
@@ -1,5 +1,13 @@
1
1
  import { TargetLanguage } from "../types";
2
2
  export declare const TEMPLATE_REPOS: Record<TargetLanguage, string>;
3
+ /**
4
+ * Git ref (tag or branch) to clone for each template. Pinning to a tag makes
5
+ * the CLI-version-to-template pairing explicit instead of a date cutoff on
6
+ * template main. v2.0.0 is the first TS template revision on published
7
+ * @apso/crud ^1.0.1 (dual-dialect: nestjsx + PostgREST); the Python and Go
8
+ * template repos are untagged and don't carry the dialect work.
9
+ */
10
+ export declare const TEMPLATE_REFS: Record<TargetLanguage, string>;
3
11
  export declare const PROJECT_NAME_PATTERN: RegExp;
4
12
  /**
5
13
  * Clone a template repository into the given project path.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initGitRepo = exports.ensureEnvFile = exports.cloneTemplate = exports.PROJECT_NAME_PATTERN = exports.TEMPLATE_REPOS = void 0;
3
+ exports.initGitRepo = exports.ensureEnvFile = exports.cloneTemplate = exports.PROJECT_NAME_PATTERN = exports.TEMPLATE_REFS = exports.TEMPLATE_REPOS = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs = tslib_1.__importStar(require("fs"));
6
6
  const path = tslib_1.__importStar(require("path"));
@@ -10,6 +10,18 @@ exports.TEMPLATE_REPOS = {
10
10
  python: "https://github.com/apsoai/service-template-python.git",
11
11
  go: "https://github.com/apsoai/service-template-go.git",
12
12
  };
13
+ /**
14
+ * Git ref (tag or branch) to clone for each template. Pinning to a tag makes
15
+ * the CLI-version-to-template pairing explicit instead of a date cutoff on
16
+ * template main. v2.0.0 is the first TS template revision on published
17
+ * @apso/crud ^1.0.1 (dual-dialect: nestjsx + PostgREST); the Python and Go
18
+ * template repos are untagged and don't carry the dialect work.
19
+ */
20
+ exports.TEMPLATE_REFS = {
21
+ typescript: "v2.0.0",
22
+ python: "main",
23
+ go: "main",
24
+ };
13
25
  exports.PROJECT_NAME_PATTERN = /^[A-Za-z][\w-]*$/;
14
26
  /**
15
27
  * Clone a template repository into the given project path.
@@ -17,7 +29,8 @@ exports.PROJECT_NAME_PATTERN = /^[A-Za-z][\w-]*$/;
17
29
  */
18
30
  function cloneTemplate(projectPath, language, log) {
19
31
  const repoUrl = exports.TEMPLATE_REPOS[language];
20
- log(`Cloning ${language} service template...`);
32
+ const templateRef = exports.TEMPLATE_REFS[language];
33
+ log(`Cloning ${language} service template (${templateRef})...`);
21
34
  if (fs.existsSync(projectPath)) {
22
35
  throw new Error(`Directory already exists: ${projectPath}`);
23
36
  }
@@ -27,12 +40,12 @@ function cloneTemplate(projectPath, language, log) {
27
40
  catch (error) {
28
41
  throw new Error(`Failed to create directory: ${error.message}`);
29
42
  }
30
- const cloneResult = shelljs_1.default.exec(`git clone --depth=1 --branch=main "${repoUrl}" "${projectPath}"`, { silent: true });
43
+ const cloneResult = shelljs_1.default.exec(`git clone --depth=1 --branch="${templateRef}" "${repoUrl}" "${projectPath}"`, { silent: true });
31
44
  if (cloneResult.code !== 0) {
32
45
  shelljs_1.default.rm("-rf", projectPath);
33
46
  throw new Error(`Failed to clone the template repository from GitHub.\n` +
34
47
  `Error Output:\n${cloneResult.stderr}\n\n` +
35
- `Please check your network connection and ensure the repository exists at ${repoUrl}`);
48
+ `Please check your network connection and ensure ref "${templateRef}" exists at ${repoUrl}`);
36
49
  }
37
50
  shelljs_1.default.rm("-rf", path.join(projectPath, ".git"));
38
51
  ensureEnvFile(projectPath, log);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.33.1",
3
+ "version": "0.34.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@apso/cli",
9
- "version": "0.33.1",
9
+ "version": "0.34.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@biomejs/biome": "^1.9.4",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.33.1",
2
+ "version": "0.34.0",
3
3
  "commands": {
4
4
  "config": {
5
5
  "id": "config",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.33.1",
3
+ "version": "0.34.0",
4
4
  "mcpName": "io.github.apsoai/apso",
5
5
  "description": "Apso CLI",
6
6
  "author": "Apso by Mavric - @mavric",