@maioradv/cms-basic-lib 1.6.9 → 1.7.1

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.
@@ -5,85 +5,85 @@ exports.ProductsResolvers = {
5
5
  query: {
6
6
  products: {
7
7
  name: 'products',
8
- query: `query ProductList($limit: Int, $after: Int, $before: Int, $collectionId: Int, $sorting: String){
9
- products(limit: $limit, after: $after, before: $before, collectionId: $collectionId, sorting: $sorting){
10
- edges {
11
- node {
12
- id
13
- }
14
- cursor
15
- }
16
- nodes {
17
- id
18
- slug
19
- title
20
- subtitle
21
- description
22
- tags
23
- externalId
24
- ProductVariant {
25
- id
26
- title
27
- subtitle
28
- description
29
- translations {
30
- key
31
- locale
32
- value
33
- }
34
- metafields {
35
- key
36
- value
37
- }
38
- price
39
- fullPrice
40
- productId
41
- published
42
- createdAt
43
- updatedAt
44
- }
45
- translations {
46
- key
47
- locale
48
- value
49
- }
50
- metafields {
51
- key
52
- value
53
- }
54
- published
55
- createdAt
56
- updatedAt
57
- }
58
- meta {
59
- startCursor
60
- endCursor
61
- hasNextPage
62
- hasPreviousPage
63
- }
64
- }
8
+ query: `query ProductList($limit: Int, $after: Int, $before: Int, $collectionId: Int, $sorting: String){
9
+ products(limit: $limit, after: $after, before: $before, collectionId: $collectionId, sorting: $sorting){
10
+ edges {
11
+ node {
12
+ id
13
+ }
14
+ cursor
15
+ }
16
+ nodes {
17
+ id
18
+ slug
19
+ title
20
+ subtitle
21
+ description
22
+ tags
23
+ externalId
24
+ ProductVariant {
25
+ id
26
+ title
27
+ subtitle
28
+ description
29
+ translations {
30
+ key
31
+ locale
32
+ value
33
+ }
34
+ metafields {
35
+ key
36
+ value
37
+ }
38
+ price
39
+ fullPrice
40
+ productId
41
+ published
42
+ createdAt
43
+ updatedAt
44
+ }
45
+ translations {
46
+ key
47
+ locale
48
+ value
49
+ }
50
+ metafields {
51
+ key
52
+ value
53
+ }
54
+ published
55
+ createdAt
56
+ updatedAt
57
+ }
58
+ meta {
59
+ startCursor
60
+ endCursor
61
+ hasNextPage
62
+ hasPreviousPage
63
+ }
64
+ }
65
65
  }`,
66
66
  },
67
67
  },
68
68
  mutation: {
69
69
  removeProducts: {
70
70
  name: 'removeProducts',
71
- query: `mutation ProductDelete($id: [Int!]!){
72
- removeProducts(id: $id) {
73
- count
74
- }
71
+ query: `mutation ProductDelete($id: [Int!]!){
72
+ removeProducts(id: $id) {
73
+ count
74
+ }
75
75
  }`,
76
76
  },
77
77
  updateManyProductAttributes: {
78
78
  name: 'updateManyProductAttributes',
79
- query: `mutation ProductAttributesUpdate($productId: Int!, $updateList:[UpdateManyProductAttributesListDto!]!) {
80
- updateManyProductAttributes(productId:$productId,updateList:$updateList){
81
- productAttributeValueId
82
- productId
83
- position
84
- createdAt
85
- updatedAt
86
- }
79
+ query: `mutation ProductAttributesUpdate($productId: Int!, $updateList:[UpdateManyProductAttributesListDto!]!) {
80
+ updateManyProductAttributes(productId:$productId,updateList:$updateList){
81
+ productAttributeValueId
82
+ productId
83
+ position
84
+ createdAt
85
+ updatedAt
86
+ }
87
87
  }`
88
88
  }
89
89
  }
@@ -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 = {}));
@@ -5,64 +5,64 @@ exports.RolesResolvers = {
5
5
  query: {
6
6
  roles: {
7
7
  name: 'roles',
8
- query: `query RoleList($limit: Int, $after: Int, $before: Int, $sorting: String){
9
- roles(limit: $limit, after: $after, before: $before, sorting: $sorting){
10
- edges {
11
- node {
12
- id
13
- }
14
- cursor
15
- }
16
- nodes {
17
- id
18
- name
19
- description
20
- permissions
21
- readonly
22
- translations {
23
- key
24
- locale
25
- value
26
- }
27
- createdAt
28
- updatedAt
29
- }
30
- meta {
31
- startCursor
32
- endCursor
33
- hasNextPage
34
- hasPreviousPage
35
- }
36
- }
8
+ query: `query RoleList($limit: Int, $after: Int, $before: Int, $sorting: String){
9
+ roles(limit: $limit, after: $after, before: $before, sorting: $sorting){
10
+ edges {
11
+ node {
12
+ id
13
+ }
14
+ cursor
15
+ }
16
+ nodes {
17
+ id
18
+ name
19
+ description
20
+ permissions
21
+ readonly
22
+ translations {
23
+ key
24
+ locale
25
+ value
26
+ }
27
+ createdAt
28
+ updatedAt
29
+ }
30
+ meta {
31
+ startCursor
32
+ endCursor
33
+ hasNextPage
34
+ hasPreviousPage
35
+ }
36
+ }
37
37
  }`,
38
38
  },
39
39
  },
40
40
  mutation: {
41
41
  removeRoles: {
42
42
  name: 'removeRoles',
43
- query: `mutation RoleDelete($id: [Int!]!){
44
- removeRoles(id: $id) {
45
- count
46
- }
43
+ query: `mutation RoleDelete($id: [Int!]!){
44
+ removeRoles(id: $id) {
45
+ count
46
+ }
47
47
  }`,
48
48
  },
49
49
  syncPermissionsRoles: {
50
50
  name: 'syncPermissionsRoles',
51
- query: `mutation RoleSyncPermissions {
52
- syncPermissionsRoles {
53
- id
54
- name
55
- description
56
- permissions
57
- readOnly
58
- translations {
59
- key
60
- locale
61
- value
62
- }
63
- createdAt
64
- updatedAt
65
- }
51
+ query: `mutation RoleSyncPermissions {
52
+ syncPermissionsRoles {
53
+ id
54
+ name
55
+ description
56
+ permissions
57
+ readOnly
58
+ translations {
59
+ key
60
+ locale
61
+ value
62
+ }
63
+ createdAt
64
+ updatedAt
65
+ }
66
66
  }`,
67
67
  },
68
68
  }
@@ -5,45 +5,45 @@ exports.SettingsResolvers = {
5
5
  query: {
6
6
  settings: {
7
7
  name: 'settings',
8
- query: `query SettingList($limit: Int, $after: Int, $before: Int, $sorting: String){
9
- settings(limit: $limit, after: $after, before: $before, sorting: $sorting){
10
- edges {
11
- node {
12
- id
13
- }
14
- cursor
15
- }
16
- nodes {
17
- id
18
- namespace
19
- name
20
- value
21
- description
22
- translations {
23
- key
24
- locale
25
- value
26
- }
27
- createdAt
28
- updatedAt
29
- }
30
- meta {
31
- startCursor
32
- endCursor
33
- hasNextPage
34
- hasPreviousPage
35
- }
36
- }
8
+ query: `query SettingList($limit: Int, $after: Int, $before: Int, $sorting: String){
9
+ settings(limit: $limit, after: $after, before: $before, sorting: $sorting){
10
+ edges {
11
+ node {
12
+ id
13
+ }
14
+ cursor
15
+ }
16
+ nodes {
17
+ id
18
+ namespace
19
+ name
20
+ value
21
+ description
22
+ translations {
23
+ key
24
+ locale
25
+ value
26
+ }
27
+ createdAt
28
+ updatedAt
29
+ }
30
+ meta {
31
+ startCursor
32
+ endCursor
33
+ hasNextPage
34
+ hasPreviousPage
35
+ }
36
+ }
37
37
  }`,
38
38
  },
39
39
  },
40
40
  mutation: {
41
41
  removeSettings: {
42
42
  name: 'removeSettings',
43
- query: `mutation SettingDelete($id: [Int!]!){
44
- removeSettings(id: $id) {
45
- count
46
- }
43
+ query: `mutation SettingDelete($id: [Int!]!){
44
+ removeSettings(id: $id) {
45
+ count
46
+ }
47
47
  }`,
48
48
  },
49
49
  }
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "@maioradv/cms-basic-lib",
3
- "version": "1.6.9",
4
- "description": "JS lib for Maior CMS Basic Api",
5
- "repository": "https://github.com/maioradv/cms-basic-lib.git",
6
- "author": "Maior ADV Srl",
7
- "license": "MIT",
8
- "private": false,
9
- "main": "dist/index.js",
10
- "types": "dist/index.d.ts",
11
- "files": [
12
- "/dist"
13
- ],
14
- "scripts": {
15
- "example": "ts-node example/test.ts",
16
- "build": "tsc"
17
- },
18
- "dependencies": {
19
- "axios": "^1.10.0"
20
- },
21
- "devDependencies": {
22
- "@types/node": "^20.14.9",
23
- "ts-node": "^10.9.2",
24
- "typescript": "^5.8.3"
25
- },
26
- "keywords": [
27
- "typescript",
28
- "maior"
29
- ]
30
- }
1
+ {
2
+ "name": "@maioradv/cms-basic-lib",
3
+ "version": "1.7.1",
4
+ "description": "JS lib for Maior CMS Basic Api",
5
+ "repository": "https://github.com/maioradv/cms-basic-lib.git",
6
+ "author": "Maior ADV Srl",
7
+ "license": "MIT",
8
+ "private": false,
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "files": [
12
+ "/dist"
13
+ ],
14
+ "scripts": {
15
+ "example": "ts-node example/test.ts",
16
+ "build": "tsc"
17
+ },
18
+ "dependencies": {
19
+ "axios": "^1.10.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^20.14.9",
23
+ "ts-node": "^10.9.2",
24
+ "typescript": "^5.8.3"
25
+ },
26
+ "keywords": [
27
+ "typescript",
28
+ "maior"
29
+ ]
30
+ }
@@ -1,25 +0,0 @@
1
- import { ServiceConfig } from "../model";
2
- export declare enum TiDelizioPlan {
3
- standard = "standard",
4
- plus = "plus",
5
- premium = "premium"
6
- }
7
- export interface TiDelizioConfig extends ServiceConfig {
8
- allowGoogleAnalytics?: boolean;
9
- allowMetaPixel?: boolean;
10
- allowGoogleTagManager?: boolean;
11
- allowAdvancedMenu?: boolean;
12
- allowDiscounts?: boolean;
13
- allowBundles?: boolean;
14
- allowCustomProductModal?: boolean;
15
- allowLocalization?: boolean;
16
- allowProductVideo?: boolean;
17
- allowPopup?: boolean;
18
- allowCustomTheme?: boolean;
19
- plan?: TiDelizioPlan;
20
- qrLinkRedirect?: string;
21
- maxMenuCollectionNumber?: number;
22
- maxProductsCollectionNumber?: number;
23
- maxProductImageNumber?: number;
24
- maxAdditionalLanguages?: number;
25
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TiDelizioPlan = void 0;
4
- var TiDelizioPlan;
5
- (function (TiDelizioPlan) {
6
- TiDelizioPlan["standard"] = "standard";
7
- TiDelizioPlan["plus"] = "plus";
8
- TiDelizioPlan["premium"] = "premium";
9
- })(TiDelizioPlan || (exports.TiDelizioPlan = TiDelizioPlan = {}));