@nomalism-com/types 0.35.10 → 0.35.11
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/dist/index.cjs
CHANGED
|
@@ -5840,7 +5840,6 @@ var ITagType = Object.keys(ITagTypeEnum);
|
|
|
5840
5840
|
var route_schema_exports111 = {};
|
|
5841
5841
|
__export(route_schema_exports111, {
|
|
5842
5842
|
createBody: () => createBody70,
|
|
5843
|
-
updateBody: () => updateBody61,
|
|
5844
5843
|
updateManyBody: () => updateManyBody3
|
|
5845
5844
|
});
|
|
5846
5845
|
import joi112 from "joi";
|
|
@@ -5848,18 +5847,13 @@ var createBodyKeys69 = {
|
|
|
5848
5847
|
document_header_id: joi112.string().uuid().required(),
|
|
5849
5848
|
index: joi112.number().allow(0).required(),
|
|
5850
5849
|
text: joi112.string().required(),
|
|
5851
|
-
type: joi112.string().valid(
|
|
5850
|
+
type: joi112.string().valid(...ITagType).required()
|
|
5852
5851
|
};
|
|
5853
5852
|
var createBody70 = joi112.object().keys(createBodyKeys69).messages(messages);
|
|
5854
|
-
var updateBodyKeys59 = {
|
|
5855
|
-
index: joi112.number().allow(0).optional(),
|
|
5856
|
-
type: joi112.string().valid("private", "public").optional()
|
|
5857
|
-
};
|
|
5858
|
-
var updateBody61 = joi112.object().keys(updateBodyKeys59).messages(messages);
|
|
5859
5853
|
var updateManyBodyKeys2 = {
|
|
5860
5854
|
id: joi112.string().uuid().required(),
|
|
5861
5855
|
index: joi112.number().allow(0).optional(),
|
|
5862
|
-
type: joi112.string().valid(
|
|
5856
|
+
type: joi112.string().valid(...ITagType).optional()
|
|
5863
5857
|
};
|
|
5864
5858
|
var updateManyBody3 = joi112.array().items(joi112.object().keys(updateManyBodyKeys2)).messages(messages);
|
|
5865
5859
|
|
package/dist/index.js
CHANGED
|
@@ -5840,7 +5840,6 @@ var ITagType = Object.keys(ITagTypeEnum);
|
|
|
5840
5840
|
var route_schema_exports111 = {};
|
|
5841
5841
|
__export(route_schema_exports111, {
|
|
5842
5842
|
createBody: () => createBody70,
|
|
5843
|
-
updateBody: () => updateBody61,
|
|
5844
5843
|
updateManyBody: () => updateManyBody3
|
|
5845
5844
|
});
|
|
5846
5845
|
import joi112 from "joi";
|
|
@@ -5848,18 +5847,13 @@ var createBodyKeys69 = {
|
|
|
5848
5847
|
document_header_id: joi112.string().uuid().required(),
|
|
5849
5848
|
index: joi112.number().allow(0).required(),
|
|
5850
5849
|
text: joi112.string().required(),
|
|
5851
|
-
type: joi112.string().valid(
|
|
5850
|
+
type: joi112.string().valid(...ITagType).required()
|
|
5852
5851
|
};
|
|
5853
5852
|
var createBody70 = joi112.object().keys(createBodyKeys69).messages(messages);
|
|
5854
|
-
var updateBodyKeys59 = {
|
|
5855
|
-
index: joi112.number().allow(0).optional(),
|
|
5856
|
-
type: joi112.string().valid("private", "public").optional()
|
|
5857
|
-
};
|
|
5858
|
-
var updateBody61 = joi112.object().keys(updateBodyKeys59).messages(messages);
|
|
5859
5853
|
var updateManyBodyKeys2 = {
|
|
5860
5854
|
id: joi112.string().uuid().required(),
|
|
5861
5855
|
index: joi112.number().allow(0).optional(),
|
|
5862
|
-
type: joi112.string().valid(
|
|
5856
|
+
type: joi112.string().valid(...ITagType).optional()
|
|
5863
5857
|
};
|
|
5864
5858
|
var updateManyBody3 = joi112.array().items(joi112.object().keys(updateManyBodyKeys2)).messages(messages);
|
|
5865
5859
|
|
|
@@ -11,14 +11,11 @@ export declare const ITagTypeEnum: {
|
|
|
11
11
|
export type ITagType = (typeof ITagTypeEnum)[keyof typeof ITagTypeEnum];
|
|
12
12
|
export declare const ITagType: string[];
|
|
13
13
|
export type ICreateRequest = Omit<Entity, 'id' | 'created_at' | 'updated_at' | 'created_by' | 'updated_by'>;
|
|
14
|
-
export type IUpdateRequest = Pick<Entity, 'index' | 'type'>;
|
|
15
14
|
export type IUpdateManyRequest = Pick<Entity, 'id' | 'index' | 'type'>;
|
|
16
15
|
export type IFindResponse = Omit<Entity, 'created_at' | 'updated_at'>;
|
|
17
16
|
export interface IRepository {
|
|
18
17
|
create(data: ICreateRequest): Promise<void>;
|
|
19
18
|
findByDocumentHeaderId(selector: IShared.IFindByIdRequest): Promise<IFindResponse[]>;
|
|
20
|
-
findById(selector: IShared.IFindByIdRequest): Promise<IFindResponse>;
|
|
21
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
|
|
22
19
|
updateMany(data: IUpdateManyRequest[]): Promise<void>;
|
|
23
20
|
delete(selector: IShared.IFindByIdRequest): Promise<void>;
|
|
24
21
|
}
|
package/package.json
CHANGED
|
@@ -23,15 +23,12 @@ export type ICreateRequest = Omit<
|
|
|
23
23
|
Entity,
|
|
24
24
|
'id' | 'created_at' | 'updated_at' | 'created_by' | 'updated_by'
|
|
25
25
|
>;
|
|
26
|
-
export type IUpdateRequest = Pick<Entity, 'index' | 'type'>;
|
|
27
26
|
export type IUpdateManyRequest = Pick<Entity, 'id' | 'index' | 'type'>;
|
|
28
27
|
export type IFindResponse = Omit<Entity, 'created_at' | 'updated_at'>;
|
|
29
28
|
|
|
30
29
|
export interface IRepository {
|
|
31
30
|
create(data: ICreateRequest): Promise<void>;
|
|
32
31
|
findByDocumentHeaderId(selector: IShared.IFindByIdRequest): Promise<IFindResponse[]>;
|
|
33
|
-
findById(selector: IShared.IFindByIdRequest): Promise<IFindResponse>;
|
|
34
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
|
|
35
32
|
updateMany(data: IUpdateManyRequest[]): Promise<void>;
|
|
36
33
|
delete(selector: IShared.IFindByIdRequest): Promise<void>;
|
|
37
34
|
}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import joi from 'joi';
|
|
2
2
|
import { messages } from '../../../shared/messages';
|
|
3
3
|
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { ICreateRequest,
|
|
4
|
+
import { ICreateRequest, IUpdateManyRequest, ITagType } from './interface';
|
|
5
5
|
|
|
6
6
|
// create body validation
|
|
7
7
|
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
8
|
document_header_id: joi.string().uuid().required(),
|
|
9
9
|
index: joi.number().allow(0).required(),
|
|
10
10
|
text: joi.string().required(),
|
|
11
|
-
type: joi
|
|
11
|
+
type: joi
|
|
12
|
+
.string()
|
|
13
|
+
.valid(...ITagType)
|
|
14
|
+
.required(),
|
|
12
15
|
};
|
|
13
16
|
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
14
17
|
|
|
15
|
-
// update body validation
|
|
16
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
17
|
-
index: joi.number().allow(0).optional(),
|
|
18
|
-
type: joi.string().valid('private', 'public').optional(),
|
|
19
|
-
};
|
|
20
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
21
|
-
|
|
22
18
|
// update body validation
|
|
23
19
|
const updateManyBodyKeys: IShared.IRouteRequest<IUpdateManyRequest> = {
|
|
24
20
|
id: joi.string().uuid().required(),
|
|
25
21
|
index: joi.number().allow(0).optional(),
|
|
26
|
-
type: joi
|
|
22
|
+
type: joi
|
|
23
|
+
.string()
|
|
24
|
+
.valid(...ITagType)
|
|
25
|
+
.optional(),
|
|
27
26
|
};
|
|
28
27
|
export const updateManyBody = joi
|
|
29
28
|
.array()
|