@maioradv/cms-basic-lib 1.0.3 → 1.0.5

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.
@@ -56,5 +56,7 @@ export declare enum Permission {
56
56
  read_configs = "read_configs",
57
57
  write_configs = "write_configs",
58
58
  write_io_operations = "write_io_operations",
59
- read_io_operations = "read_io_operations"
59
+ read_io_operations = "read_io_operations",
60
+ read_settings = "read_settings",
61
+ write_settings = "write_settings"
60
62
  }
@@ -35,4 +35,6 @@ var Permission;
35
35
  Permission["write_configs"] = "write_configs";
36
36
  Permission["write_io_operations"] = "write_io_operations";
37
37
  Permission["read_io_operations"] = "read_io_operations";
38
+ Permission["read_settings"] = "read_settings";
39
+ Permission["write_settings"] = "write_settings";
38
40
  })(Permission || (exports.Permission = Permission = {}));
package/dist/client.d.ts CHANGED
@@ -16,6 +16,7 @@ import ProductAttributes from "./productAttributes";
16
16
  import ProductAttributeValues from "./productAttributes/values";
17
17
  import Products from "./products";
18
18
  import ProductVariants from "./products/variants";
19
+ import Settings from "./settings";
19
20
  export declare class MaiorCmsApiClient implements ClientApiI {
20
21
  protected config: ApiConfigs;
21
22
  protected client: Axios;
@@ -34,8 +35,10 @@ export declare class MaiorCmsApiClient implements ClientApiI {
34
35
  products: Products;
35
36
  productVariants: ProductVariants;
36
37
  roles: Roles;
38
+ settings: Settings;
37
39
  constructor(config: ApiConfigs);
38
40
  protected _initClient(): Axios;
39
41
  protected _initModules(): void;
42
+ _setAccessToken(accessToken: string): void;
40
43
  auth(): Promise<AccessTokenDto>;
41
44
  }
package/dist/client.js CHANGED
@@ -19,6 +19,7 @@ const productAttributes_1 = require("./productAttributes");
19
19
  const values_1 = require("./productAttributes/values");
20
20
  const products_1 = require("./products");
21
21
  const variants_1 = require("./products/variants");
22
+ const settings_1 = require("./settings");
22
23
  class MaiorCmsApiClient {
23
24
  constructor(config) {
24
25
  this.config = config;
@@ -48,6 +49,10 @@ class MaiorCmsApiClient {
48
49
  this.products = new products_1.default(this.client);
49
50
  this.productVariants = new variants_1.default(this.client);
50
51
  this.roles = new roles_1.default(this.client);
52
+ this.settings = new settings_1.default(this.client);
53
+ }
54
+ _setAccessToken(accessToken) {
55
+ this.client.defaults.headers.common[types_1.ApiHeader.Authorization] = `Bearer ${accessToken}`;
51
56
  }
52
57
  async auth() {
53
58
  if (!this.configApi.credentials)
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from './popups/types';
15
15
  export * from './productAttributes/types';
16
16
  export * from './products/types';
17
17
  export * from './roles/types';
18
+ export * from './settings/types';
18
19
  export * from './core/dto/pagination';
19
- export { TiDelizioPlan } from './configs/services/ti-delizio.config';
20
+ export { TiDelizioPlan, TiDelizioConfig } from './configs/services/ti-delizio.config';
20
21
  export declare function maiorCmsApiClient(opt: MaiorCmsApiConfigs): MaiorCmsApiClient;
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ __exportStar(require("./popups/types"), exports);
31
31
  __exportStar(require("./productAttributes/types"), exports);
32
32
  __exportStar(require("./products/types"), exports);
33
33
  __exportStar(require("./roles/types"), exports);
34
+ __exportStar(require("./settings/types"), exports);
34
35
  __exportStar(require("./core/dto/pagination"), exports);
35
36
  var ti_delizio_config_1 = require("./configs/services/ti-delizio.config");
36
37
  Object.defineProperty(exports, "TiDelizioPlan", { enumerable: true, get: function () { return ti_delizio_config_1.TiDelizioPlan; } });
@@ -0,0 +1,4 @@
1
+ import { PaginatedGQLQueryDto } from "../core/dto/pagination";
2
+ import { Resolvers } from "../core/types/resolver";
3
+ export declare const SettingsResolvers: Resolvers<['settings'], ['removeSettings']>;
4
+ export type QuerySettingGQLDto = PaginatedGQLQueryDto;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsResolvers = void 0;
4
+ exports.SettingsResolvers = {
5
+ query: {
6
+ settings: {
7
+ name: 'settings',
8
+ query: `query SettingList($limit: Int, $after: Int, $before: Int){
9
+ settings(limit: $limit, after: $after, before: $before){
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
+ }`,
38
+ },
39
+ },
40
+ mutation: {
41
+ removeSettings: {
42
+ name: 'removeSettings',
43
+ query: `mutation SettingDelete($id: [Int!]!){
44
+ removeSettings(id: $id) {
45
+ count
46
+ }
47
+ }`,
48
+ },
49
+ }
50
+ };
@@ -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 { QuerySettingGQLDto } from "./graphql";
5
+ import { CreateSettingDto, QuerySettingDto, Setting, UpdateSettingDto } from "./types";
6
+ export default class Settings extends ApiModule implements RestApiModuleI, GraphApiModuleI {
7
+ create(args: CreateSettingDto): Promise<Setting>;
8
+ findAll(args?: QuerySettingDto): Promise<PaginatedDto<Setting>>;
9
+ findOne(id: number): Promise<Setting>;
10
+ update(id: number, data: UpdateSettingDto): Promise<Setting>;
11
+ remove(id: number): Promise<Setting>;
12
+ list(args?: QuerySettingGQLDto): Promise<PaginatedGQL<Setting>>;
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 Settings extends model_1.ApiModule {
7
+ create(args) {
8
+ return this._call('post', '/settings', args);
9
+ }
10
+ findAll(args = {}) {
11
+ return this._call('get', '/settings', (0, queryParams_1.queryParams)(args));
12
+ }
13
+ findOne(id) {
14
+ return this._call('get', `/settings/${id}`);
15
+ }
16
+ update(id, data) {
17
+ return this._call('patch', `/settings/${id}`, data);
18
+ }
19
+ remove(id) {
20
+ return this._call('delete', `/settings/${id}`);
21
+ }
22
+ list(args = {}) {
23
+ return this._graphql(graphql_1.SettingsResolvers.query.settings, args);
24
+ }
25
+ removeMany(id) {
26
+ return this._graphql(graphql_1.SettingsResolvers.mutation.removeSettings, {
27
+ id
28
+ });
29
+ }
30
+ }
31
+ exports.default = Settings;
@@ -0,0 +1,25 @@
1
+ import { 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 Setting = {
6
+ id: number;
7
+ namespace: string | null;
8
+ name: string;
9
+ value: string;
10
+ description: string | null;
11
+ translations: Translation[];
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ };
15
+ export type CreateSettingDto = OmitRequire<Setting, 'id' | 'createdAt' | 'updatedAt', 'name' | 'value'>;
16
+ export type UpdateSettingDto = Partial<CreateSettingDto>;
17
+ export type SortingSettingDto = SortingParamsDto<{
18
+ name?: Sorting;
19
+ }>;
20
+ export type ClausesSettingDto = WhereClausesDto<{
21
+ name?: StringClause;
22
+ description?: StringClause;
23
+ namespace?: StringClause;
24
+ }>;
25
+ export type QuerySettingDto = QueryParamsDto<SortingSettingDto, ClausesSettingDto>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maioradv/cms-basic-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "JS lib for Maior CMS Basic Api",
5
5
  "repository": "https://github.com/maioradv/cms-basic-lib.git",
6
6
  "author": "Maior ADV Srl",