@uecsio/pages-api 2.1.0 → 2.3.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 +27 -271
- package/dist/consts/index.d.ts +2 -0
- package/dist/consts/index.d.ts.map +1 -0
- package/dist/consts/index.js +5 -0
- package/dist/consts/index.js.map +1 -0
- package/dist/dto/create-page.dto.d.ts +2 -2
- package/dist/dto/create-page.dto.d.ts.map +1 -1
- package/dist/dto/create-page.dto.js +6 -13
- package/dist/dto/create-page.dto.js.map +1 -1
- package/dist/dto/update-page.dto.d.ts +5 -10
- package/dist/dto/update-page.dto.d.ts.map +1 -1
- package/dist/dto/update-page.dto.js +7 -90
- package/dist/dto/update-page.dto.js.map +1 -1
- package/dist/entities/page.entity.js +2 -2
- package/dist/entities/page.entity.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/migrations/1704067200000-CreatePagesTable.js +19 -19
- package/dist/migrations/1704067200000-CreatePagesTable.js.map +1 -1
- package/dist/migrations/migration.config.d.ts +1 -2
- package/dist/migrations/migration.config.d.ts.map +1 -1
- package/dist/migrations/migration.config.js +2 -4
- package/dist/migrations/migration.config.js.map +1 -1
- package/dist/pages.module.d.ts.map +1 -1
- package/dist/pages.module.js +2 -8
- package/dist/pages.module.js.map +1 -1
- package/package.json +9 -12
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.d.ts +0 -6
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.d.ts.map +0 -1
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.js +0 -18
- package/dist/migrations/1735689600000-AddUniqueConstraintToUrl.js.map +0 -1
- package/dist/services/page-url.service.d.ts +0 -10
- package/dist/services/page-url.service.d.ts.map +0 -1
- package/dist/services/page-url.service.js +0 -38
- package/dist/services/page-url.service.js.map +0 -1
- package/dist/services/pages.service.d.ts +0 -7
- package/dist/services/pages.service.d.ts.map +0 -1
- package/dist/services/pages.service.js +0 -32
- package/dist/services/pages.service.js.map +0 -1
- package/dist/subscribers/page-url.subscriber.d.ts +0 -12
- package/dist/subscribers/page-url.subscriber.d.ts.map +0 -1
- package/dist/subscribers/page-url.subscriber.js +0 -44
- package/dist/subscribers/page-url.subscriber.js.map +0 -1
- package/dist/tests/pages.test.config.d.ts +0 -29
- package/dist/tests/pages.test.config.d.ts.map +0 -1
- package/dist/tests/pages.test.config.js +0 -83
- package/dist/tests/pages.test.config.js.map +0 -1
- package/dist/validators/is-unique-url.constraint.d.ts +0 -10
- package/dist/validators/is-unique-url.constraint.d.ts.map +0 -1
- package/dist/validators/is-unique-url.constraint.js +0 -51
- package/dist/validators/is-unique-url.constraint.js.map +0 -1
- package/dist/validators/is-unique-url.validator.d.ts +0 -3
- package/dist/validators/is-unique-url.validator.d.ts.map +0 -1
- package/dist/validators/is-unique-url.validator.js +0 -18
- package/dist/validators/is-unique-url.validator.js.map +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
|
|
2
|
-
import { Repository } from 'typeorm';
|
|
3
|
-
import { Page } from '../entities/page.entity';
|
|
4
|
-
export declare class IsUniqueUrlConstraint implements ValidatorConstraintInterface {
|
|
5
|
-
private readonly pageRepository;
|
|
6
|
-
constructor(pageRepository: Repository<Page>);
|
|
7
|
-
validate(url: string, args: ValidationArguments): Promise<boolean>;
|
|
8
|
-
defaultMessage(args: ValidationArguments): string;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=is-unique-url.constraint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-unique-url.constraint.d.ts","sourceRoot":"","sources":["../../src/validators/is-unique-url.constraint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,4BAA4B,EAC5B,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,qBAEa,qBAAsB,YAAW,4BAA4B;IAGtE,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC;IAG7C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BxE,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM;CAGlD"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.IsUniqueUrlConstraint = void 0;
|
|
16
|
-
const class_validator_1 = require("class-validator");
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
-
const typeorm_2 = require("typeorm");
|
|
20
|
-
const page_entity_1 = require("../entities/page.entity");
|
|
21
|
-
let IsUniqueUrlConstraint = class IsUniqueUrlConstraint {
|
|
22
|
-
constructor(pageRepository) {
|
|
23
|
-
this.pageRepository = pageRepository;
|
|
24
|
-
}
|
|
25
|
-
async validate(url, args) {
|
|
26
|
-
if (!url || typeof url !== 'string') {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
const object = args.object;
|
|
30
|
-
const excludeId = object.id || object['id'];
|
|
31
|
-
const queryBuilder = this.pageRepository
|
|
32
|
-
.createQueryBuilder('page')
|
|
33
|
-
.where('page.url = :url', { url });
|
|
34
|
-
if (excludeId) {
|
|
35
|
-
queryBuilder.andWhere('page.id != :id', { id: excludeId });
|
|
36
|
-
}
|
|
37
|
-
const existingPage = await queryBuilder.getOne();
|
|
38
|
-
return !existingPage;
|
|
39
|
-
}
|
|
40
|
-
defaultMessage(args) {
|
|
41
|
-
return 'A page with this URL already exists';
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
exports.IsUniqueUrlConstraint = IsUniqueUrlConstraint;
|
|
45
|
-
exports.IsUniqueUrlConstraint = IsUniqueUrlConstraint = __decorate([
|
|
46
|
-
(0, class_validator_1.ValidatorConstraint)({ name: 'isUniqueUrl', async: true }),
|
|
47
|
-
(0, common_1.Injectable)(),
|
|
48
|
-
__param(0, (0, typeorm_1.InjectRepository)(page_entity_1.Page)),
|
|
49
|
-
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
50
|
-
], IsUniqueUrlConstraint);
|
|
51
|
-
//# sourceMappingURL=is-unique-url.constraint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-unique-url.constraint.js","sourceRoot":"","sources":["../../src/validators/is-unique-url.constraint.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAIyB;AACzB,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,yDAA+C;AAIxC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAEmB,cA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EAAE,iBAAiB,IAC9C,QAAQ,MAAM,EAAE,cAAc,MAAM,UAUtD"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsUniqueUrl = IsUniqueUrl;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
const is_unique_url_constraint_1 = require("./is-unique-url.constraint");
|
|
6
|
-
function IsUniqueUrl(validationOptions) {
|
|
7
|
-
return function (object, propertyName) {
|
|
8
|
-
(0, class_validator_1.registerDecorator)({
|
|
9
|
-
name: 'isUniqueUrl',
|
|
10
|
-
target: object.constructor,
|
|
11
|
-
propertyName: propertyName,
|
|
12
|
-
options: validationOptions,
|
|
13
|
-
constraints: [],
|
|
14
|
-
validator: is_unique_url_constraint_1.IsUniqueUrlConstraint,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=is-unique-url.validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-unique-url.validator.js","sourceRoot":"","sources":["../../src/validators/is-unique-url.validator.ts"],"names":[],"mappings":";;AA4BA,kCAWC;AAvCD,qDAIyB;AACzB,yEAAmE;AAuBnE,SAAgB,WAAW,CAAC,iBAAqC;IAC/D,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,IAAA,mCAAiB,EAAC;YAChB,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,gDAAqB;SACjC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|