@maioradv/cms-basic-lib 1.0.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 +6 -0
- package/dist/apitokens/graphql.d.ts +4 -0
- package/dist/apitokens/graphql.js +45 -0
- package/dist/apitokens/index.d.ts +14 -0
- package/dist/apitokens/index.js +31 -0
- package/dist/apitokens/types.d.ts +22 -0
- package/dist/apitokens/types.js +2 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.js +15 -0
- package/dist/auth/types.d.ts +60 -0
- package/dist/auth/types.js +38 -0
- package/dist/client.d.ts +41 -0
- package/dist/client.js +60 -0
- package/dist/collections/graphql.d.ts +16 -0
- package/dist/collections/graphql.js +97 -0
- package/dist/collections/index.d.ts +26 -0
- package/dist/collections/index.js +62 -0
- package/dist/collections/types.d.ts +57 -0
- package/dist/collections/types.js +2 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +20 -0
- package/dist/configs/graphql.d.ts +4 -0
- package/dist/configs/graphql.js +86 -0
- package/dist/configs/index.d.ts +17 -0
- package/dist/configs/index.js +37 -0
- package/dist/configs/model.d.ts +5 -0
- package/dist/configs/model.js +2 -0
- package/dist/configs/services/ti-delizio.config.d.ts +18 -0
- package/dist/configs/services/ti-delizio.config.js +9 -0
- package/dist/configs/types.d.ts +23 -0
- package/dist/configs/types.js +2 -0
- package/dist/core/dto/clauses/index.d.ts +17 -0
- package/dist/core/dto/clauses/index.js +10 -0
- package/dist/core/dto/pagination/index.d.ts +37 -0
- package/dist/core/dto/pagination/index.js +6 -0
- package/dist/core/dto/sorting/index.d.ts +9 -0
- package/dist/core/dto/sorting/index.js +10 -0
- package/dist/core/model/remove-gql.response.d.ts +3 -0
- package/dist/core/model/remove-gql.response.js +2 -0
- package/dist/core/types/resolver.d.ts +12 -0
- package/dist/core/types/resolver.js +2 -0
- package/dist/core/utils/queryParams.d.ts +9 -0
- package/dist/core/utils/queryParams.js +14 -0
- package/dist/customers/types.d.ts +9 -0
- package/dist/customers/types.js +2 -0
- package/dist/error.d.ts +14 -0
- package/dist/error.js +39 -0
- package/dist/images/graphql.d.ts +4 -0
- package/dist/images/graphql.js +38 -0
- package/dist/images/index.d.ts +11 -0
- package/dist/images/index.js +27 -0
- package/dist/images/types.d.ts +29 -0
- package/dist/images/types.js +2 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +31 -0
- package/dist/io/index.d.ts +5 -0
- package/dist/io/index.js +13 -0
- package/dist/io/types.d.ts +4 -0
- package/dist/io/types.js +2 -0
- package/dist/languages/graphql.d.ts +4 -0
- package/dist/languages/graphql.js +51 -0
- package/dist/languages/index.d.ts +14 -0
- package/dist/languages/index.js +31 -0
- package/dist/languages/types.d.ts +29 -0
- package/dist/languages/types.js +2 -0
- package/dist/model.d.ts +25 -0
- package/dist/model.js +43 -0
- package/dist/popups/graphql.d.ts +4 -0
- package/dist/popups/graphql.js +54 -0
- package/dist/popups/index.d.ts +22 -0
- package/dist/popups/index.js +53 -0
- package/dist/popups/triggers.d.ts +6 -0
- package/dist/popups/triggers.js +12 -0
- package/dist/popups/types.d.ts +67 -0
- package/dist/popups/types.js +21 -0
- package/dist/productAttributes/graphql.d.ts +6 -0
- package/dist/productAttributes/graphql.js +103 -0
- package/dist/productAttributes/index.d.ts +16 -0
- package/dist/productAttributes/index.js +37 -0
- package/dist/productAttributes/types.d.ts +37 -0
- package/dist/productAttributes/types.js +2 -0
- package/dist/productAttributes/values.d.ts +11 -0
- package/dist/productAttributes/values.js +21 -0
- package/dist/products/graphql.d.ts +4 -0
- package/dist/products/graphql.js +56 -0
- package/dist/products/index.d.ts +26 -0
- package/dist/products/index.js +65 -0
- package/dist/products/types.d.ts +82 -0
- package/dist/products/types.js +2 -0
- package/dist/products/variants.d.ts +6 -0
- package/dist/products/variants.js +12 -0
- package/dist/roles/graphql.d.ts +4 -0
- package/dist/roles/graphql.js +50 -0
- package/dist/roles/index.d.ts +14 -0
- package/dist/roles/index.js +31 -0
- package/dist/roles/types.d.ts +25 -0
- package/dist/roles/types.js +2 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.js +19 -0
- package/package.json +30 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LanguagesResolvers = void 0;
|
|
4
|
+
exports.LanguagesResolvers = {
|
|
5
|
+
query: {
|
|
6
|
+
languages: {
|
|
7
|
+
name: 'languages',
|
|
8
|
+
query: `query LanguageList($limit: Int, $after: Int, $before: Int){
|
|
9
|
+
languages(limit: $limit, after: $after, before: $before){
|
|
10
|
+
edges {
|
|
11
|
+
node {
|
|
12
|
+
id
|
|
13
|
+
}
|
|
14
|
+
cursor
|
|
15
|
+
}
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
active
|
|
20
|
+
iso
|
|
21
|
+
locale
|
|
22
|
+
published
|
|
23
|
+
translations {
|
|
24
|
+
key
|
|
25
|
+
locale
|
|
26
|
+
value
|
|
27
|
+
}
|
|
28
|
+
createdAt
|
|
29
|
+
updatedAt
|
|
30
|
+
}
|
|
31
|
+
meta {
|
|
32
|
+
startCursor
|
|
33
|
+
endCursor
|
|
34
|
+
hasNextPage
|
|
35
|
+
hasPreviousPage
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}`,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
mutation: {
|
|
42
|
+
removeLanguages: {
|
|
43
|
+
name: 'removeLanguages',
|
|
44
|
+
query: `mutation LanguageDelete($id: [Int!]!){
|
|
45
|
+
removeLanguages(id: $id) {
|
|
46
|
+
count
|
|
47
|
+
}
|
|
48
|
+
}`,
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { QueryLanguageGQLDto } from "./graphql";
|
|
5
|
+
import { CreateLanguageDto, Language, QueryLanguageDto, UpdateLanguageDto } from "./types";
|
|
6
|
+
export default class Languages extends ApiModule implements RestApiModuleI, GraphApiModuleI {
|
|
7
|
+
create(args: CreateLanguageDto): Promise<Language>;
|
|
8
|
+
findAll(args?: QueryLanguageDto): Promise<PaginatedDto<Language>>;
|
|
9
|
+
findOne(id: number): Promise<Language>;
|
|
10
|
+
update(id: number, data: UpdateLanguageDto): Promise<Language>;
|
|
11
|
+
remove(id: number): Promise<Language>;
|
|
12
|
+
list(args?: QueryLanguageGQLDto): Promise<PaginatedGQL<Language>>;
|
|
13
|
+
removeMany(id: number | number[]): Promise<RemoveGQL>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 Languages extends model_1.ApiModule {
|
|
7
|
+
create(args) {
|
|
8
|
+
return this._call('post', '/languages', args);
|
|
9
|
+
}
|
|
10
|
+
findAll(args = {}) {
|
|
11
|
+
return this._call('get', '/languages', (0, queryParams_1.queryParams)(args));
|
|
12
|
+
}
|
|
13
|
+
findOne(id) {
|
|
14
|
+
return this._call('get', `/languages/${id}`);
|
|
15
|
+
}
|
|
16
|
+
update(id, data) {
|
|
17
|
+
return this._call('patch', `/languages/${id}`, data);
|
|
18
|
+
}
|
|
19
|
+
remove(id) {
|
|
20
|
+
return this._call('delete', `/languages/${id}`);
|
|
21
|
+
}
|
|
22
|
+
list(args = {}) {
|
|
23
|
+
return this._graphql(graphql_1.LanguagesResolvers.query.languages, args);
|
|
24
|
+
}
|
|
25
|
+
removeMany(id) {
|
|
26
|
+
return this._graphql(graphql_1.LanguagesResolvers.mutation.removeLanguages, {
|
|
27
|
+
id
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = Languages;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BooleanClause, StringClause, WhereClausesDto } from "../core/dto/clauses";
|
|
2
|
+
import { Sorting, SortingParamsDto } from "../core/dto/sorting";
|
|
3
|
+
import { QueryParamsDto } from "../core/utils/queryParams";
|
|
4
|
+
import { OmitRequire, Translation } from "../types";
|
|
5
|
+
export type Language = {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
active: boolean;
|
|
9
|
+
iso: string;
|
|
10
|
+
locale: string;
|
|
11
|
+
published: boolean;
|
|
12
|
+
translations: Translation[];
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
};
|
|
16
|
+
export type CreateLanguageDto = OmitRequire<Language, 'id' | 'createdAt' | 'updatedAt', 'name' | 'iso' | 'locale'>;
|
|
17
|
+
export type UpdateLanguageDto = Partial<CreateLanguageDto>;
|
|
18
|
+
export type SortingLanguageDto = SortingParamsDto<{
|
|
19
|
+
name?: Sorting;
|
|
20
|
+
active?: Sorting;
|
|
21
|
+
published?: Sorting;
|
|
22
|
+
}>;
|
|
23
|
+
export type ClausesLanguageDto = WhereClausesDto<{
|
|
24
|
+
name?: StringClause;
|
|
25
|
+
locale?: StringClause;
|
|
26
|
+
active?: BooleanClause;
|
|
27
|
+
published?: BooleanClause;
|
|
28
|
+
}>;
|
|
29
|
+
export type QueryLanguageDto = QueryParamsDto<SortingLanguageDto, ClausesLanguageDto>;
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Axios, AxiosRequestConfig } from "axios";
|
|
2
|
+
import { ResolverDef } from "./core/types/resolver";
|
|
3
|
+
import { AccessTokenDto } from "./auth/types";
|
|
4
|
+
export declare class ApiModule {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: Axios);
|
|
7
|
+
protected _call<Res, Req = Record<string, any>>(method: CallMethod, path: string, data?: Req, opts?: AxiosRequestConfig): Promise<Res>;
|
|
8
|
+
protected _graphql<Res, Req = Record<string, any>>(resolver: ResolverDef<string>, variables?: Req): Promise<Res>;
|
|
9
|
+
}
|
|
10
|
+
export interface ClientApiI {
|
|
11
|
+
auth: () => Promise<AccessTokenDto>;
|
|
12
|
+
}
|
|
13
|
+
export interface RestApiModuleI {
|
|
14
|
+
create: (args: unknown) => Promise<unknown>;
|
|
15
|
+
findAll: (args?: unknown) => Promise<unknown>;
|
|
16
|
+
findOne: (id: number, args?: unknown) => Promise<unknown>;
|
|
17
|
+
update: (id: number, args: unknown) => Promise<unknown>;
|
|
18
|
+
remove: (id: number) => Promise<unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface GraphApiModuleI {
|
|
21
|
+
list: (args: unknown) => Promise<unknown>;
|
|
22
|
+
removeMany: (id: number | number[]) => Promise<unknown>;
|
|
23
|
+
}
|
|
24
|
+
type CallMethod = 'get' | 'post' | 'patch' | 'delete';
|
|
25
|
+
export {};
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiModule = void 0;
|
|
4
|
+
const error_1 = require("./error");
|
|
5
|
+
class ApiModule {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async _call(method, path, data, opts) {
|
|
10
|
+
try {
|
|
11
|
+
const response = await this.client.request({
|
|
12
|
+
method: method,
|
|
13
|
+
url: path,
|
|
14
|
+
data: method !== 'get' ? data !== null && data !== void 0 ? data : undefined : undefined,
|
|
15
|
+
params: method === 'get' ? data !== null && data !== void 0 ? data : undefined : undefined,
|
|
16
|
+
...opts
|
|
17
|
+
});
|
|
18
|
+
return response.data;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
throw new error_1.RestApiError(error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async _graphql(resolver, variables) {
|
|
25
|
+
try {
|
|
26
|
+
const response = await this.client.request({
|
|
27
|
+
method: 'post',
|
|
28
|
+
url: '/graphql',
|
|
29
|
+
data: {
|
|
30
|
+
query: resolver.query,
|
|
31
|
+
variables
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
if (response.data.errors)
|
|
35
|
+
throw new Error(response.data.errors.map(e => e.message).join(', '));
|
|
36
|
+
return response.data.data[resolver.name];
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new error_1.GraphApiError(error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ApiModule = ApiModule;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PopupsResolvers = void 0;
|
|
4
|
+
exports.PopupsResolvers = {
|
|
5
|
+
query: {
|
|
6
|
+
popups: {
|
|
7
|
+
name: 'popups',
|
|
8
|
+
query: `query PopupList($limit: Int, $after: Int, $before: Int){
|
|
9
|
+
popups(limit: $limit, after: $after, before: $before){
|
|
10
|
+
edges {
|
|
11
|
+
node {
|
|
12
|
+
id
|
|
13
|
+
}
|
|
14
|
+
cursor
|
|
15
|
+
}
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
modal
|
|
20
|
+
target
|
|
21
|
+
published
|
|
22
|
+
translations {
|
|
23
|
+
key
|
|
24
|
+
locale
|
|
25
|
+
value
|
|
26
|
+
}
|
|
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
|
+
removePopups: {
|
|
46
|
+
name: 'removePopups',
|
|
47
|
+
query: `mutation PopupDelete($id: [Int!]!){
|
|
48
|
+
removePopups(id: $id) {
|
|
49
|
+
count
|
|
50
|
+
}
|
|
51
|
+
}`,
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PaginatedDto, PaginatedGQL } from "../core/dto/pagination";
|
|
2
|
+
import { RemoveGQL } from "../core/model/remove-gql.response";
|
|
3
|
+
import { Image } from "../images/types";
|
|
4
|
+
import { RestApiModuleI, ApiModule, GraphApiModuleI } from "../model";
|
|
5
|
+
import { WithRelation } from "../types";
|
|
6
|
+
import { QueryPopupGQLDto } from "./graphql";
|
|
7
|
+
import { CreatePopupDto, CreatePopupImageDto, CreatePopupTriggerDto, FindOnePopupDto, Popup, PopupImage, PopupTrigger, QueryPopupDto, UpdatePopupDto, UpdatePopupImageDto } from "./types";
|
|
8
|
+
export default class Popups extends ApiModule implements RestApiModuleI, GraphApiModuleI {
|
|
9
|
+
create(args: CreatePopupDto): Promise<Popup>;
|
|
10
|
+
findAll(args?: QueryPopupDto): Promise<PaginatedDto<Popup>>;
|
|
11
|
+
findOne(id: number): Promise<FindOnePopupDto>;
|
|
12
|
+
update(id: number, data: UpdatePopupDto): Promise<Popup>;
|
|
13
|
+
remove(id: number): Promise<Popup>;
|
|
14
|
+
list(args?: QueryPopupGQLDto): Promise<PaginatedGQL<Popup>>;
|
|
15
|
+
removeMany(id: number | number[]): Promise<RemoveGQL>;
|
|
16
|
+
createImage(popupId: number, args: CreatePopupImageDto): Promise<PopupImage>;
|
|
17
|
+
findAllImages(popupId: number): Promise<WithRelation<PopupImage, 'Image', Image>[]>;
|
|
18
|
+
updateImage(popupId: number, imageId: number, data: UpdatePopupImageDto): Promise<PopupImage>;
|
|
19
|
+
removeImage(popupId: number, imageId: number): Promise<PopupImage>;
|
|
20
|
+
createTrigger(popupId: number, args: CreatePopupTriggerDto): Promise<PopupTrigger>;
|
|
21
|
+
findAllTriggers(popupId: number): Promise<PopupTrigger[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 Popups extends model_1.ApiModule {
|
|
7
|
+
create(args) {
|
|
8
|
+
return this._call('post', '/popups', args);
|
|
9
|
+
}
|
|
10
|
+
findAll(args = {}) {
|
|
11
|
+
return this._call('get', '/popups', (0, queryParams_1.queryParams)(args));
|
|
12
|
+
}
|
|
13
|
+
findOne(id) {
|
|
14
|
+
return this._call('get', `/popups/${id}`);
|
|
15
|
+
}
|
|
16
|
+
update(id, data) {
|
|
17
|
+
return this._call('patch', `/popups/${id}`, data);
|
|
18
|
+
}
|
|
19
|
+
remove(id) {
|
|
20
|
+
return this._call('delete', `/popups/${id}`);
|
|
21
|
+
}
|
|
22
|
+
list(args = {}) {
|
|
23
|
+
return this._graphql(graphql_1.PopupsResolvers.query.popups, args);
|
|
24
|
+
}
|
|
25
|
+
removeMany(id) {
|
|
26
|
+
return this._graphql(graphql_1.PopupsResolvers.mutation.removePopups, {
|
|
27
|
+
id
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
createImage(popupId, args) {
|
|
31
|
+
return this._call('post', `/popups/${popupId}/images`, args, {
|
|
32
|
+
headers: {
|
|
33
|
+
'Content-Type': 'multipart/form-data'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
findAllImages(popupId) {
|
|
38
|
+
return this._call('get', `/popups/${popupId}/images`);
|
|
39
|
+
}
|
|
40
|
+
updateImage(popupId, imageId, data) {
|
|
41
|
+
return this._call('patch', `/popups/${popupId}/images/${imageId}`, data);
|
|
42
|
+
}
|
|
43
|
+
removeImage(popupId, imageId) {
|
|
44
|
+
return this._call('delete', `/popups/${popupId}/images/${imageId}`);
|
|
45
|
+
}
|
|
46
|
+
createTrigger(popupId, args) {
|
|
47
|
+
return this._call('post', `/popups/${popupId}/triggers`, args);
|
|
48
|
+
}
|
|
49
|
+
findAllTriggers(popupId) {
|
|
50
|
+
return this._call('get', `/popups/${popupId}/triggers`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.default = Popups;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiModule } from "../model";
|
|
2
|
+
import { PopupTrigger, UpdatePopupTriggerDto } from "./types";
|
|
3
|
+
export default class PopupTriggers extends ApiModule {
|
|
4
|
+
update(id: number, data: UpdatePopupTriggerDto): Promise<PopupTrigger>;
|
|
5
|
+
remove(id: number): Promise<PopupTrigger>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const model_1 = require("../model");
|
|
4
|
+
class PopupTriggers extends model_1.ApiModule {
|
|
5
|
+
update(id, data) {
|
|
6
|
+
return this._call('patch', `/popup-triggers/${id}`, data);
|
|
7
|
+
}
|
|
8
|
+
remove(id) {
|
|
9
|
+
return this._call('delete', `/popup-triggers/${id}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.default = PopupTriggers;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BooleanClause, StringClause, WhereClausesDto } from "../core/dto/clauses";
|
|
2
|
+
import { Sorting, SortingParamsDto } from "../core/dto/sorting";
|
|
3
|
+
import { QueryParamsDto } from "../core/utils/queryParams";
|
|
4
|
+
import { CreateImageDto, Image } from "../images/types";
|
|
5
|
+
import { Metafield, OmitRequire, Translation, WithRelation } from "../types";
|
|
6
|
+
export declare enum PopupTarget {
|
|
7
|
+
menu = "menu",
|
|
8
|
+
menuDetail = "menuDetail",
|
|
9
|
+
collectionDetail = "collectionDetail"
|
|
10
|
+
}
|
|
11
|
+
export declare enum PopupModal {
|
|
12
|
+
image = "image",
|
|
13
|
+
text = "text"
|
|
14
|
+
}
|
|
15
|
+
export declare enum PopupTriggerRule {
|
|
16
|
+
eventName = "eventName",
|
|
17
|
+
timeoutDelay = "timeoutDelay",
|
|
18
|
+
maxViewsNumber = "maxViewsNumber",
|
|
19
|
+
elementDetailId = "elementDetailId"
|
|
20
|
+
}
|
|
21
|
+
export type Popup = {
|
|
22
|
+
id: number;
|
|
23
|
+
name: string;
|
|
24
|
+
target: PopupTarget;
|
|
25
|
+
modal: PopupModal;
|
|
26
|
+
translations: Translation[];
|
|
27
|
+
metafields: Metafield[];
|
|
28
|
+
published: boolean;
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
updatedAt: Date;
|
|
31
|
+
};
|
|
32
|
+
export type PopupImage = {
|
|
33
|
+
popupId: number;
|
|
34
|
+
imageId: number;
|
|
35
|
+
locale: string | null;
|
|
36
|
+
position: number | null;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
updatedAt: Date;
|
|
39
|
+
};
|
|
40
|
+
export type PopupTrigger = {
|
|
41
|
+
id: number;
|
|
42
|
+
name: string;
|
|
43
|
+
rule: PopupTriggerRule;
|
|
44
|
+
value: string;
|
|
45
|
+
popupId: number;
|
|
46
|
+
published: boolean;
|
|
47
|
+
createdAt: Date;
|
|
48
|
+
updatedAt: Date;
|
|
49
|
+
};
|
|
50
|
+
export type CreatePopupDto = OmitRequire<Popup, 'id' | 'createdAt' | 'updatedAt', 'name' | 'target' | 'modal'> & {
|
|
51
|
+
triggers?: CreatePopupTriggerDto[];
|
|
52
|
+
};
|
|
53
|
+
export type UpdatePopupDto = Partial<Omit<CreatePopupDto, 'triggers'>>;
|
|
54
|
+
export type CreatePopupImageDto = OmitRequire<PopupImage, 'popupId' | 'createdAt' | 'updatedAt' | 'imageId'> & CreateImageDto;
|
|
55
|
+
export type UpdatePopupImageDto = Omit<CreatePopupImageDto, 'file'>;
|
|
56
|
+
export type CreatePopupTriggerDto = OmitRequire<PopupTrigger, 'id' | 'createdAt' | 'updatedAt' | 'popupId', 'name' | 'rule' | 'value'>;
|
|
57
|
+
export type UpdatePopupTriggerDto = Partial<CreatePopupTriggerDto>;
|
|
58
|
+
export type FindOnePopupDto = WithRelation<Popup, 'PopupTrigger', WithRelation<PopupTrigger, 'PopupImage', WithRelation<PopupImage, 'Image', Image>[]>[]>;
|
|
59
|
+
export type SortingPopupDto = SortingParamsDto<{
|
|
60
|
+
name?: Sorting;
|
|
61
|
+
published?: Sorting;
|
|
62
|
+
}>;
|
|
63
|
+
export type ClausesPopupDto = WhereClausesDto<{
|
|
64
|
+
name?: StringClause;
|
|
65
|
+
published?: BooleanClause;
|
|
66
|
+
}>;
|
|
67
|
+
export type QueryPopupDto = QueryParamsDto<SortingPopupDto, ClausesPopupDto>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PopupTriggerRule = exports.PopupModal = exports.PopupTarget = void 0;
|
|
4
|
+
var PopupTarget;
|
|
5
|
+
(function (PopupTarget) {
|
|
6
|
+
PopupTarget["menu"] = "menu";
|
|
7
|
+
PopupTarget["menuDetail"] = "menuDetail";
|
|
8
|
+
PopupTarget["collectionDetail"] = "collectionDetail";
|
|
9
|
+
})(PopupTarget || (exports.PopupTarget = PopupTarget = {}));
|
|
10
|
+
var PopupModal;
|
|
11
|
+
(function (PopupModal) {
|
|
12
|
+
PopupModal["image"] = "image";
|
|
13
|
+
PopupModal["text"] = "text";
|
|
14
|
+
})(PopupModal || (exports.PopupModal = PopupModal = {}));
|
|
15
|
+
var PopupTriggerRule;
|
|
16
|
+
(function (PopupTriggerRule) {
|
|
17
|
+
PopupTriggerRule["eventName"] = "eventName";
|
|
18
|
+
PopupTriggerRule["timeoutDelay"] = "timeoutDelay";
|
|
19
|
+
PopupTriggerRule["maxViewsNumber"] = "maxViewsNumber";
|
|
20
|
+
PopupTriggerRule["elementDetailId"] = "elementDetailId";
|
|
21
|
+
})(PopupTriggerRule || (exports.PopupTriggerRule = PopupTriggerRule = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PaginatedGQLQueryDto } from "../core/dto/pagination";
|
|
2
|
+
import { Resolvers } from "../core/types/resolver";
|
|
3
|
+
export declare const ProductAttributesResolvers: Resolvers<['productAttributes'], ['removeProductAttributes']>;
|
|
4
|
+
export type QueryProductAttributeGQLDto = PaginatedGQLQueryDto;
|
|
5
|
+
export declare const ProductAttributeValuesResolvers: Resolvers<['productAttributeValues'], ['removeProductAttributeValues']>;
|
|
6
|
+
export type QueryProductAttributeValueGQLDto = PaginatedGQLQueryDto;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductAttributeValuesResolvers = exports.ProductAttributesResolvers = void 0;
|
|
4
|
+
exports.ProductAttributesResolvers = {
|
|
5
|
+
query: {
|
|
6
|
+
productAttributes: {
|
|
7
|
+
name: 'productAttributes',
|
|
8
|
+
query: `query ProductAttributeList($limit: Int, $after: Int, $before: Int){
|
|
9
|
+
productAttributes(limit: $limit, after: $after, before: $before){
|
|
10
|
+
edges {
|
|
11
|
+
node {
|
|
12
|
+
id
|
|
13
|
+
}
|
|
14
|
+
cursor
|
|
15
|
+
}
|
|
16
|
+
nodes {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
slug
|
|
20
|
+
translations {
|
|
21
|
+
key
|
|
22
|
+
locale
|
|
23
|
+
value
|
|
24
|
+
}
|
|
25
|
+
metafields {
|
|
26
|
+
key
|
|
27
|
+
value
|
|
28
|
+
}
|
|
29
|
+
published
|
|
30
|
+
createdAt
|
|
31
|
+
updatedAt
|
|
32
|
+
}
|
|
33
|
+
meta {
|
|
34
|
+
startCursor
|
|
35
|
+
endCursor
|
|
36
|
+
hasNextPage
|
|
37
|
+
hasPreviousPage
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}`,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
mutation: {
|
|
44
|
+
removeProductAttributes: {
|
|
45
|
+
name: 'removeProductAttributes',
|
|
46
|
+
query: `mutation ProductAttributeDelete($id: [Int!]!){
|
|
47
|
+
removeProductAttributes(id: $id) {
|
|
48
|
+
count
|
|
49
|
+
}
|
|
50
|
+
}`,
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.ProductAttributeValuesResolvers = {
|
|
55
|
+
query: {
|
|
56
|
+
productAttributeValues: {
|
|
57
|
+
name: 'productAttributeValues',
|
|
58
|
+
query: `query ProductAttributeValueList($limit: Int, $after: Int, $before: Int){
|
|
59
|
+
productAttributeValues(limit: $limit, after: $after, before: $before){
|
|
60
|
+
edges {
|
|
61
|
+
node {
|
|
62
|
+
id
|
|
63
|
+
}
|
|
64
|
+
cursor
|
|
65
|
+
}
|
|
66
|
+
nodes {
|
|
67
|
+
id
|
|
68
|
+
name
|
|
69
|
+
productAttributeId
|
|
70
|
+
translations {
|
|
71
|
+
key
|
|
72
|
+
locale
|
|
73
|
+
value
|
|
74
|
+
}
|
|
75
|
+
metafields {
|
|
76
|
+
key
|
|
77
|
+
value
|
|
78
|
+
}
|
|
79
|
+
published
|
|
80
|
+
createdAt
|
|
81
|
+
updatedAt
|
|
82
|
+
}
|
|
83
|
+
meta {
|
|
84
|
+
startCursor
|
|
85
|
+
endCursor
|
|
86
|
+
hasNextPage
|
|
87
|
+
hasPreviousPage
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}`,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
mutation: {
|
|
94
|
+
removeProductAttributeValues: {
|
|
95
|
+
name: 'removeProductAttributeValues',
|
|
96
|
+
query: `mutation ProductAttributeValueDelete($id: [Int!]!){
|
|
97
|
+
removeProductAttributeValues(id: $id) {
|
|
98
|
+
count
|
|
99
|
+
}
|
|
100
|
+
}`,
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { QueryProductAttributeGQLDto } from "./graphql";
|
|
5
|
+
import { CreateProductAttributeDto, CreateProductAttributeValueDto, ProductAttribute, ProductAttributeValue, QueryProductAttributeDto, UpdateProductAttributeDto } from "./types";
|
|
6
|
+
export default class ProductAttributes extends ApiModule implements RestApiModuleI, GraphApiModuleI {
|
|
7
|
+
create(args: CreateProductAttributeDto): Promise<ProductAttribute>;
|
|
8
|
+
findAll(args?: QueryProductAttributeDto): Promise<PaginatedDto<ProductAttribute>>;
|
|
9
|
+
findOne(id: number): Promise<ProductAttribute>;
|
|
10
|
+
update(id: number, data: UpdateProductAttributeDto): Promise<ProductAttribute>;
|
|
11
|
+
remove(id: number): Promise<ProductAttribute>;
|
|
12
|
+
list(args?: QueryProductAttributeGQLDto): Promise<PaginatedGQL<ProductAttribute>>;
|
|
13
|
+
removeMany(id: number | number[]): Promise<RemoveGQL>;
|
|
14
|
+
createValue(attributeId: number, args: CreateProductAttributeValueDto): Promise<ProductAttributeValue>;
|
|
15
|
+
findAllValues(attributeId: number): Promise<ProductAttributeValue[]>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 ProductAttributes extends model_1.ApiModule {
|
|
7
|
+
create(args) {
|
|
8
|
+
return this._call('post', '/product-attributes', args);
|
|
9
|
+
}
|
|
10
|
+
findAll(args = {}) {
|
|
11
|
+
return this._call('get', '/product-attributes', (0, queryParams_1.queryParams)(args));
|
|
12
|
+
}
|
|
13
|
+
findOne(id) {
|
|
14
|
+
return this._call('get', `/product-attributes/${id}`);
|
|
15
|
+
}
|
|
16
|
+
update(id, data) {
|
|
17
|
+
return this._call('patch', `/product-attributes/${id}`, data);
|
|
18
|
+
}
|
|
19
|
+
remove(id) {
|
|
20
|
+
return this._call('delete', `/product-attributes/${id}`);
|
|
21
|
+
}
|
|
22
|
+
list(args = {}) {
|
|
23
|
+
return this._graphql(graphql_1.ProductAttributesResolvers.query.productAttributes, args);
|
|
24
|
+
}
|
|
25
|
+
removeMany(id) {
|
|
26
|
+
return this._graphql(graphql_1.ProductAttributesResolvers.mutation.removeProductAttributes, {
|
|
27
|
+
id
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
createValue(attributeId, args) {
|
|
31
|
+
return this._call('post', `/product-attributes/${attributeId}/attribute-values`, args);
|
|
32
|
+
}
|
|
33
|
+
findAllValues(attributeId) {
|
|
34
|
+
return this._call('get', `/product-attributes/${attributeId}/attribute-values`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = ProductAttributes;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BooleanClause, 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, Translation } from "../types";
|
|
5
|
+
export type ProductAttribute = {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
translations: Translation[];
|
|
10
|
+
metafields: Metafield[];
|
|
11
|
+
published: boolean;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
};
|
|
15
|
+
export type ProductAttributeValue = {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
productAttributeId: number;
|
|
19
|
+
translations: Translation[];
|
|
20
|
+
metafields: Metafield[];
|
|
21
|
+
published: boolean;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
};
|
|
25
|
+
export type CreateProductAttributeDto = OmitRequire<ProductAttribute, 'id' | 'createdAt' | 'updatedAt' | 'slug', 'name'>;
|
|
26
|
+
export type UpdateProductAttributeDto = Partial<CreateProductAttributeDto>;
|
|
27
|
+
export type CreateProductAttributeValueDto = OmitRequire<ProductAttributeValue, 'id' | 'createdAt' | 'updatedAt' | 'productAttributeId', 'name'>;
|
|
28
|
+
export type UpdateProductAttributeValueDto = Partial<CreateProductAttributeValueDto>;
|
|
29
|
+
export type SortingProductAttributeDto = SortingParamsDto<{
|
|
30
|
+
name?: Sorting;
|
|
31
|
+
published?: Sorting;
|
|
32
|
+
}>;
|
|
33
|
+
export type ClausesProductAttributeDto = WhereClausesDto<{
|
|
34
|
+
name?: StringClause;
|
|
35
|
+
published?: BooleanClause;
|
|
36
|
+
}>;
|
|
37
|
+
export type QueryProductAttributeDto = QueryParamsDto<SortingProductAttributeDto, ClausesProductAttributeDto>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PaginatedGQL } from "../core/dto/pagination";
|
|
2
|
+
import { RemoveGQL } from "../core/model/remove-gql.response";
|
|
3
|
+
import { ApiModule, GraphApiModuleI } from "../model";
|
|
4
|
+
import { QueryProductAttributeValueGQLDto } from "./graphql";
|
|
5
|
+
import { ProductAttributeValue, UpdateProductAttributeValueDto } from "./types";
|
|
6
|
+
export default class ProductAttributeValues extends ApiModule implements GraphApiModuleI {
|
|
7
|
+
update(id: number, data: UpdateProductAttributeValueDto): Promise<ProductAttributeValue>;
|
|
8
|
+
remove(id: number): Promise<ProductAttributeValue>;
|
|
9
|
+
list(args?: QueryProductAttributeValueGQLDto): Promise<PaginatedGQL<ProductAttributeValue>>;
|
|
10
|
+
removeMany(id: number | number[]): Promise<RemoveGQL>;
|
|
11
|
+
}
|