@maioradv/cms-basic-lib 1.6.9 → 1.7.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/dist/auth/types.d.ts +2 -4
- package/dist/auth/types.js +1 -3
- package/dist/cache/index.d.ts +4 -0
- package/dist/cache/index.js +9 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/reservations/graphql.d.ts +4 -0
- package/dist/reservations/graphql.js +87 -0
- package/dist/reservations/index.d.ts +15 -0
- package/dist/reservations/index.js +34 -0
- package/dist/reservations/types.d.ts +54 -0
- package/dist/reservations/types.js +18 -0
- package/package.json +1 -1
package/dist/auth/types.d.ts
CHANGED
|
@@ -38,9 +38,6 @@ export declare enum Permission {
|
|
|
38
38
|
write_productattributes = "write_productattributes",
|
|
39
39
|
read_productattributevalues = "read_productattributevalues",
|
|
40
40
|
write_productattributevalues = "write_productattributevalues",
|
|
41
|
-
read_bulkoperations = "read_bulkoperations",
|
|
42
|
-
write_bulkoperations = "write_bulkoperations",
|
|
43
|
-
run_bulkoperations = "run_bulkoperations",
|
|
44
41
|
read_discounts = "read_discounts",
|
|
45
42
|
write_discounts = "write_discounts",
|
|
46
43
|
read_languages = "read_languages",
|
|
@@ -64,5 +61,6 @@ export declare enum Permission {
|
|
|
64
61
|
read_linkcollections = "read_linkcollections",
|
|
65
62
|
write_linkcollections = "write_linkcollections",
|
|
66
63
|
read_reservations = "read_reservations",
|
|
67
|
-
write_reservations = "write_reservations"
|
|
64
|
+
write_reservations = "write_reservations",
|
|
65
|
+
push_reservations = "push_reservations"
|
|
68
66
|
}
|
package/dist/auth/types.js
CHANGED
|
@@ -16,9 +16,6 @@ var Permission;
|
|
|
16
16
|
Permission["write_productattributes"] = "write_productattributes";
|
|
17
17
|
Permission["read_productattributevalues"] = "read_productattributevalues";
|
|
18
18
|
Permission["write_productattributevalues"] = "write_productattributevalues";
|
|
19
|
-
Permission["read_bulkoperations"] = "read_bulkoperations";
|
|
20
|
-
Permission["write_bulkoperations"] = "write_bulkoperations";
|
|
21
|
-
Permission["run_bulkoperations"] = "run_bulkoperations";
|
|
22
19
|
Permission["read_discounts"] = "read_discounts";
|
|
23
20
|
Permission["write_discounts"] = "write_discounts";
|
|
24
21
|
Permission["read_languages"] = "read_languages";
|
|
@@ -43,4 +40,5 @@ var Permission;
|
|
|
43
40
|
Permission["write_linkcollections"] = "write_linkcollections";
|
|
44
41
|
Permission["read_reservations"] = "read_reservations";
|
|
45
42
|
Permission["write_reservations"] = "write_reservations";
|
|
43
|
+
Permission["push_reservations"] = "push_reservations";
|
|
46
44
|
})(Permission || (exports.Permission = Permission = {}));
|
package/dist/client.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ import Bundles from "./bundles";
|
|
|
21
21
|
import BundleVariants from "./bundles/variants";
|
|
22
22
|
import LinkCollections from "./linkCollections";
|
|
23
23
|
import Links from "./linkCollections/links";
|
|
24
|
+
import Cache from "./cache";
|
|
25
|
+
import Reservations from "./reservations";
|
|
24
26
|
export declare class MaiorCmsApiClient implements ClientApiI {
|
|
25
27
|
protected config: ApiConfigs;
|
|
26
28
|
protected client: Axios;
|
|
@@ -45,6 +47,8 @@ export declare class MaiorCmsApiClient implements ClientApiI {
|
|
|
45
47
|
bundleVariants: BundleVariants;
|
|
46
48
|
linkCollections: LinkCollections;
|
|
47
49
|
links: Links;
|
|
50
|
+
cache: Cache;
|
|
51
|
+
reservations: Reservations;
|
|
48
52
|
constructor(config: ApiConfigs);
|
|
49
53
|
protected _initClient(): Axios;
|
|
50
54
|
protected _initModules(): void;
|
package/dist/client.js
CHANGED
|
@@ -27,6 +27,8 @@ const bundles_1 = __importDefault(require("./bundles"));
|
|
|
27
27
|
const variants_2 = __importDefault(require("./bundles/variants"));
|
|
28
28
|
const linkCollections_1 = __importDefault(require("./linkCollections"));
|
|
29
29
|
const links_1 = __importDefault(require("./linkCollections/links"));
|
|
30
|
+
const cache_1 = __importDefault(require("./cache"));
|
|
31
|
+
const reservations_1 = __importDefault(require("./reservations"));
|
|
30
32
|
class MaiorCmsApiClient {
|
|
31
33
|
constructor(config) {
|
|
32
34
|
this.config = config;
|
|
@@ -62,6 +64,8 @@ class MaiorCmsApiClient {
|
|
|
62
64
|
this.bundleVariants = new variants_2.default(this.client);
|
|
63
65
|
this.linkCollections = new linkCollections_1.default(this.client);
|
|
64
66
|
this.links = new links_1.default(this.client);
|
|
67
|
+
this.cache = new cache_1.default(this.client);
|
|
68
|
+
this.reservations = new reservations_1.default(this.client);
|
|
65
69
|
}
|
|
66
70
|
_setAccessToken(accessToken) {
|
|
67
71
|
this.client.defaults.headers.common[types_1.ApiHeader.Authorization] = `Bearer ${accessToken}`;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './roles/types';
|
|
|
18
18
|
export * from './settings/types';
|
|
19
19
|
export * from './bundles/types';
|
|
20
20
|
export * from './linkCollections/types';
|
|
21
|
+
export * from './reservations/types';
|
|
21
22
|
export * from './gid';
|
|
22
23
|
export * from './core/dto/pagination';
|
|
23
24
|
export { TiDelizioPlan, TiDelizioConfig } from './configs/services/tidelizio.config';
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __exportStar(require("./roles/types"), exports);
|
|
|
34
34
|
__exportStar(require("./settings/types"), exports);
|
|
35
35
|
__exportStar(require("./bundles/types"), exports);
|
|
36
36
|
__exportStar(require("./linkCollections/types"), exports);
|
|
37
|
+
__exportStar(require("./reservations/types"), exports);
|
|
37
38
|
__exportStar(require("./gid"), exports);
|
|
38
39
|
__exportStar(require("./core/dto/pagination"), exports);
|
|
39
40
|
var tidelizio_config_1 = require("./configs/services/tidelizio.config");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PaginatedGQLQueryDto } from "../core/dto/pagination";
|
|
2
|
+
import { Resolvers } from "../core/types/resolver";
|
|
3
|
+
export declare const ReservationsResolvers: Resolvers<['reservations'], ['removeReservations', 'pushReservation']>;
|
|
4
|
+
export type QueryReservationGQLDto = PaginatedGQLQueryDto;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReservationsResolvers = void 0;
|
|
4
|
+
exports.ReservationsResolvers = {
|
|
5
|
+
query: {
|
|
6
|
+
reservations: {
|
|
7
|
+
name: 'reservations',
|
|
8
|
+
query: `query ReservationList($limit: Int, $after: Int, $before: Int, $sorting: String){
|
|
9
|
+
reservations(limit: $limit, after: $after, before: $before, sorting: $sorting){
|
|
10
|
+
edges {
|
|
11
|
+
node {
|
|
12
|
+
id
|
|
13
|
+
}
|
|
14
|
+
cursor
|
|
15
|
+
}
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
source
|
|
19
|
+
status
|
|
20
|
+
date
|
|
21
|
+
guestCount
|
|
22
|
+
name
|
|
23
|
+
lastName
|
|
24
|
+
phone
|
|
25
|
+
email
|
|
26
|
+
notes
|
|
27
|
+
metafields {
|
|
28
|
+
key
|
|
29
|
+
value
|
|
30
|
+
}
|
|
31
|
+
createdAt
|
|
32
|
+
updatedAt
|
|
33
|
+
}
|
|
34
|
+
meta {
|
|
35
|
+
startCursor
|
|
36
|
+
endCursor
|
|
37
|
+
hasNextPage
|
|
38
|
+
hasPreviousPage
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}`,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
mutation: {
|
|
45
|
+
removeReservations: {
|
|
46
|
+
name: 'removeReservations',
|
|
47
|
+
query: `mutation ReservationDelete($id: [Int!]!){
|
|
48
|
+
removeReservations(id: $id) {
|
|
49
|
+
count
|
|
50
|
+
}
|
|
51
|
+
}`,
|
|
52
|
+
},
|
|
53
|
+
pushReservation: {
|
|
54
|
+
name: 'pushReservation',
|
|
55
|
+
query: `mutation ReservationPush($source: ReservationSource, $date: DateTime!, $guestCount: Int!, $name: String!, $lastName: String, $phone: String!, $email: String, $notes: String, $metafields: [MetafieldEntry!]){
|
|
56
|
+
pushReservation(
|
|
57
|
+
source: $source,
|
|
58
|
+
date: $date,
|
|
59
|
+
guestCount: $guestCount,
|
|
60
|
+
name: $name,
|
|
61
|
+
lastName: $lastName,
|
|
62
|
+
phone: $phone,
|
|
63
|
+
email: $email,
|
|
64
|
+
notes: $notes,
|
|
65
|
+
metafields: $metafields
|
|
66
|
+
) {
|
|
67
|
+
id
|
|
68
|
+
source
|
|
69
|
+
status
|
|
70
|
+
date
|
|
71
|
+
guestCount
|
|
72
|
+
name
|
|
73
|
+
lastName
|
|
74
|
+
phone
|
|
75
|
+
email
|
|
76
|
+
notes
|
|
77
|
+
metafields {
|
|
78
|
+
key
|
|
79
|
+
value
|
|
80
|
+
}
|
|
81
|
+
createdAt
|
|
82
|
+
updatedAt
|
|
83
|
+
}
|
|
84
|
+
}`
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PaginatedDto, PaginatedGQL } from "../core/dto/pagination";
|
|
2
|
+
import { RemoveGQL } from "../core/model/remove-gql.response";
|
|
3
|
+
import { RestApiModuleI, ApiModule, GraphApiModuleI } from "../model";
|
|
4
|
+
import { QueryReservationGQLDto } from "./graphql";
|
|
5
|
+
import { CreateReservationDto, QueryReservationDto, Reservation, UpdateReservationDto, PushReservationDto } from "./types";
|
|
6
|
+
export default class Reservations extends ApiModule implements RestApiModuleI, GraphApiModuleI {
|
|
7
|
+
create(args: CreateReservationDto): Promise<Reservation>;
|
|
8
|
+
findAll(args?: QueryReservationDto): Promise<PaginatedDto<Reservation>>;
|
|
9
|
+
findOne(id: number): Promise<Reservation>;
|
|
10
|
+
update(id: number, data: UpdateReservationDto): Promise<Reservation>;
|
|
11
|
+
remove(id: number): Promise<Reservation>;
|
|
12
|
+
list(args?: QueryReservationGQLDto): Promise<PaginatedGQL<Reservation>>;
|
|
13
|
+
removeMany(id: number | number[]): Promise<RemoveGQL>;
|
|
14
|
+
push(args: PushReservationDto): Promise<Reservation>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const queryParams_1 = require("../core/utils/queryParams");
|
|
4
|
+
const model_1 = require("../model");
|
|
5
|
+
const graphql_1 = require("./graphql");
|
|
6
|
+
class Reservations extends model_1.ApiModule {
|
|
7
|
+
create(args) {
|
|
8
|
+
return this._call('post', '/reservations', args);
|
|
9
|
+
}
|
|
10
|
+
findAll(args = {}) {
|
|
11
|
+
return this._call('get', '/reservations', (0, queryParams_1.queryParams)(args));
|
|
12
|
+
}
|
|
13
|
+
findOne(id) {
|
|
14
|
+
return this._call('get', `/reservations/${id}`);
|
|
15
|
+
}
|
|
16
|
+
update(id, data) {
|
|
17
|
+
return this._call('patch', `/reservations/${id}`, data);
|
|
18
|
+
}
|
|
19
|
+
remove(id) {
|
|
20
|
+
return this._call('delete', `/reservations/${id}`);
|
|
21
|
+
}
|
|
22
|
+
list(args = {}) {
|
|
23
|
+
return this._graphql(graphql_1.ReservationsResolvers.query.reservations, args);
|
|
24
|
+
}
|
|
25
|
+
removeMany(id) {
|
|
26
|
+
return this._graphql(graphql_1.ReservationsResolvers.mutation.removeReservations, {
|
|
27
|
+
id
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
push(args) {
|
|
31
|
+
return this._graphql(graphql_1.ReservationsResolvers.mutation.pushReservation, args);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = Reservations;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DateClause, EnumClause, NumberClause, StringClause, WhereClausesDto } from "../core/dto/clauses";
|
|
2
|
+
import { Sorting, SortingParamsDto } from "../core/dto/sorting";
|
|
3
|
+
import { QueryParamsDto } from "../core/utils/queryParams";
|
|
4
|
+
import { Metafield, OmitRequire } from "../types";
|
|
5
|
+
export declare enum ReservationSource {
|
|
6
|
+
web = "web",
|
|
7
|
+
phone = "phone",
|
|
8
|
+
admin = "admin",
|
|
9
|
+
partner = "partner"
|
|
10
|
+
}
|
|
11
|
+
export declare enum ReservationStatus {
|
|
12
|
+
pending = "pending",
|
|
13
|
+
confirmed = "confirmed",
|
|
14
|
+
cancelled = "cancelled",
|
|
15
|
+
completed = "completed",
|
|
16
|
+
noShow = "noShow"
|
|
17
|
+
}
|
|
18
|
+
export type Reservation = {
|
|
19
|
+
id: number;
|
|
20
|
+
source: ReservationSource | null;
|
|
21
|
+
status: ReservationStatus;
|
|
22
|
+
date: Date;
|
|
23
|
+
guestCount: number;
|
|
24
|
+
name: string;
|
|
25
|
+
lastName: string | null;
|
|
26
|
+
phone: string;
|
|
27
|
+
email: string | null;
|
|
28
|
+
notes: string | null;
|
|
29
|
+
metafields: Metafield[];
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
};
|
|
33
|
+
export type CreateReservationDto = OmitRequire<Reservation, 'id' | 'createdAt' | 'updatedAt', 'date' | 'guestCount' | 'name' | 'phone'>;
|
|
34
|
+
export type UpdateReservationDto = Partial<CreateReservationDto>;
|
|
35
|
+
export type PushReservationDto = OmitRequire<Reservation, 'id' | 'createdAt' | 'updatedAt' | 'status', 'date' | 'guestCount' | 'name' | 'phone'>;
|
|
36
|
+
export type SortingReservationDto = SortingParamsDto<{
|
|
37
|
+
name?: Sorting;
|
|
38
|
+
date?: Sorting;
|
|
39
|
+
source?: Sorting;
|
|
40
|
+
email?: Sorting;
|
|
41
|
+
guestCount?: Sorting;
|
|
42
|
+
lastName?: Sorting;
|
|
43
|
+
status?: Sorting;
|
|
44
|
+
}>;
|
|
45
|
+
export type ClausesReservationDto = WhereClausesDto<{
|
|
46
|
+
search?: StringClause;
|
|
47
|
+
date?: DateClause;
|
|
48
|
+
minDate?: DateClause;
|
|
49
|
+
maxDate?: DateClause;
|
|
50
|
+
source?: EnumClause<ReservationSource>[];
|
|
51
|
+
status?: EnumClause<ReservationStatus>[];
|
|
52
|
+
guestCount?: NumberClause[];
|
|
53
|
+
}>;
|
|
54
|
+
export type QueryReservationDto = QueryParamsDto<SortingReservationDto, ClausesReservationDto>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReservationStatus = exports.ReservationSource = void 0;
|
|
4
|
+
var ReservationSource;
|
|
5
|
+
(function (ReservationSource) {
|
|
6
|
+
ReservationSource["web"] = "web";
|
|
7
|
+
ReservationSource["phone"] = "phone";
|
|
8
|
+
ReservationSource["admin"] = "admin";
|
|
9
|
+
ReservationSource["partner"] = "partner";
|
|
10
|
+
})(ReservationSource || (exports.ReservationSource = ReservationSource = {}));
|
|
11
|
+
var ReservationStatus;
|
|
12
|
+
(function (ReservationStatus) {
|
|
13
|
+
ReservationStatus["pending"] = "pending";
|
|
14
|
+
ReservationStatus["confirmed"] = "confirmed";
|
|
15
|
+
ReservationStatus["cancelled"] = "cancelled";
|
|
16
|
+
ReservationStatus["completed"] = "completed";
|
|
17
|
+
ReservationStatus["noShow"] = "noShow";
|
|
18
|
+
})(ReservationStatus || (exports.ReservationStatus = ReservationStatus = {}));
|