@longvansoftware/service-js-client 1.19.7 → 1.19.9

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.
@@ -1,19 +1,21 @@
1
- export declare const CHECK_DOMAIN_NAME_AVAILABLE: import("graphql").DocumentNode;
2
- export declare const CHECK_DOMAIN_NAME_AVAILAVLE_VNNIC: import("graphql").DocumentNode;
3
- export declare const GET_WHOIS_DOMAIN_INFO: import("graphql").DocumentNode;
4
- export declare const SERVICE_DETAIL: import("graphql").DocumentNode;
5
- export declare const GET_MAIL_RESOURCE: import("graphql").DocumentNode;
6
- export declare const GET_USER_MAIL_HOSTING: import("graphql").DocumentNode;
7
- export declare const SERVICE_TYPE: import("graphql").DocumentNode;
8
- export declare const SEARCH_SERVICE: import("graphql").DocumentNode;
9
- export declare const GET_PRODUCTS_OF_SERVICE: import("graphql").DocumentNode;
10
- export declare const GET_IPS_OF_SERVICE: import("graphql").DocumentNode;
11
- export declare const GET_SERVICES_BY_ORDER_ID: import("graphql").DocumentNode;
12
- export declare const GET_SERVICE_TYPE_LIST: import("graphql").DocumentNode;
13
- export declare const GET_DOMAIN_CONTACTS: import("graphql").DocumentNode;
14
- export declare const GET_OWNERS_BY_CUSTOMER_ID: import("graphql").DocumentNode;
15
- export declare const GET_CONTACTS_BY_OWNER_ID: import("graphql").DocumentNode;
16
- export declare const GET_DOMAIN_SUPPLIER: import("graphql").DocumentNode;
17
- export declare const CHECK_DOMAIN_EXIST: import("graphql").DocumentNode;
18
- export declare const SEARCH_ACTIONS: import("graphql").DocumentNode;
19
- export declare const GET_ELASTIC_CLOUD_RESOURCE: import("graphql").DocumentNode;
1
+ import { DocumentNode } from 'graphql';
2
+ export declare const CHECK_DOMAIN_NAME_AVAILABLE: DocumentNode;
3
+ export declare const CHECK_DOMAIN_NAME_AVAILAVLE_VNNIC: DocumentNode;
4
+ export declare const GET_WHOIS_DOMAIN_INFO: DocumentNode;
5
+ export declare const SERVICE_DETAIL: DocumentNode;
6
+ export declare const SERVICE_DETAIL_DYNAMIC: (fields?: string[]) => DocumentNode;
7
+ export declare const GET_MAIL_RESOURCE: DocumentNode;
8
+ export declare const GET_USER_MAIL_HOSTING: DocumentNode;
9
+ export declare const SERVICE_TYPE: DocumentNode;
10
+ export declare const SEARCH_SERVICE: DocumentNode;
11
+ export declare const GET_PRODUCTS_OF_SERVICE: DocumentNode;
12
+ export declare const GET_IPS_OF_SERVICE: DocumentNode;
13
+ export declare const GET_SERVICES_BY_ORDER_ID: DocumentNode;
14
+ export declare const GET_SERVICE_TYPE_LIST: DocumentNode;
15
+ export declare const GET_DOMAIN_CONTACTS: DocumentNode;
16
+ export declare const GET_OWNERS_BY_CUSTOMER_ID: DocumentNode;
17
+ export declare const GET_CONTACTS_BY_OWNER_ID: DocumentNode;
18
+ export declare const GET_DOMAIN_SUPPLIER: DocumentNode;
19
+ export declare const CHECK_DOMAIN_EXIST: DocumentNode;
20
+ export declare const SEARCH_ACTIONS: DocumentNode;
21
+ export declare const GET_ELASTIC_CLOUD_RESOURCE: DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_ELASTIC_CLOUD_RESOURCE = exports.SEARCH_ACTIONS = exports.CHECK_DOMAIN_EXIST = exports.GET_DOMAIN_SUPPLIER = exports.GET_CONTACTS_BY_OWNER_ID = exports.GET_OWNERS_BY_CUSTOMER_ID = exports.GET_DOMAIN_CONTACTS = exports.GET_SERVICE_TYPE_LIST = exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL = exports.GET_WHOIS_DOMAIN_INFO = exports.CHECK_DOMAIN_NAME_AVAILAVLE_VNNIC = exports.CHECK_DOMAIN_NAME_AVAILABLE = void 0;
3
+ exports.GET_ELASTIC_CLOUD_RESOURCE = exports.SEARCH_ACTIONS = exports.CHECK_DOMAIN_EXIST = exports.GET_DOMAIN_SUPPLIER = exports.GET_CONTACTS_BY_OWNER_ID = exports.GET_OWNERS_BY_CUSTOMER_ID = exports.GET_DOMAIN_CONTACTS = exports.GET_SERVICE_TYPE_LIST = exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL_DYNAMIC = exports.SERVICE_DETAIL = exports.GET_WHOIS_DOMAIN_INFO = exports.CHECK_DOMAIN_NAME_AVAILAVLE_VNNIC = exports.CHECK_DOMAIN_NAME_AVAILABLE = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CHECK_DOMAIN_NAME_AVAILABLE = (0, graphql_tag_1.gql) `
6
6
  query CheckDomainNameAvailable($domainName: String!) {
@@ -94,6 +94,18 @@ exports.SERVICE_DETAIL = (0, graphql_tag_1.gql) `
94
94
  }
95
95
  }
96
96
  `;
97
+ const SERVICE_DETAIL_DYNAMIC = (fields = []) => {
98
+ const fieldStr = fields.join('\n ');
99
+ const hasFields = fields.length > 0;
100
+ return (0, graphql_tag_1.gql) `
101
+ query ServiceDetail($serviceId: String) {
102
+ serviceDetail(serviceId: $serviceId) {
103
+ ${hasFields ? `${fieldStr}` : ''}
104
+ }
105
+ }
106
+ `;
107
+ };
108
+ exports.SERVICE_DETAIL_DYNAMIC = SERVICE_DETAIL_DYNAMIC;
97
109
  exports.GET_MAIL_RESOURCE = (0, graphql_tag_1.gql) `
98
110
  query GetMailResource($serviceId: String!) {
99
111
  getMailResource(serviceId: $serviceId) {
@@ -15,6 +15,9 @@ export declare const REMOVE_FILE: (fields?: string[]) => DocumentNode;
15
15
  export declare const UPDATE_ACL_PERMISSION_BUCKET: (fields?: string[]) => DocumentNode;
16
16
  export declare const UPDATE_BUCKET_VERSIONING: (fields?: string[]) => DocumentNode;
17
17
  export declare const RESTORE_FILE_TRASH: (fields?: string[]) => DocumentNode;
18
+ export declare const REMOVE_FILE_TRASH: (fields?: string[]) => DocumentNode;
19
+ export declare const RESTORE_FILE_OTHER_VERSION: (fields?: string[]) => DocumentNode;
20
+ export declare const REMOVE_FILE_OTHER_VERSION: (fields?: string[]) => DocumentNode;
18
21
  export declare const ADD_S3_DOMAIN: (fields?: string[]) => DocumentNode;
19
22
  export declare const REMOVE_S3_DOMAIN: (fields?: string[]) => DocumentNode;
20
23
  export declare const ADD_CORS_BUCKET: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REMOVE_CORS_BUCKET = exports.UPDATE_CORS_BUCKET = exports.ADD_CORS_BUCKET = exports.REMOVE_S3_DOMAIN = exports.ADD_S3_DOMAIN = exports.RESTORE_FILE_TRASH = exports.UPDATE_BUCKET_VERSIONING = exports.UPDATE_ACL_PERMISSION_BUCKET = exports.REMOVE_FILE = exports.MOVE_FILE = exports.COPY_FILE = exports.SHARE_LINK_FILE_BY_TIME = exports.SHARE_LINK_FILE_BY_TIME_DYNAMIC = exports.RENAME_FILE = exports.UPDATE_ACL_PERMISSION_FILE = exports.UPLOAD_FOLDER = exports.REMOVE_FOLDER = exports.CREATE_FOLDER = exports.DELETE_BUCKET = exports.RENAME_BUCKET = exports.CREATE_BUCKET = void 0;
3
+ exports.REMOVE_CORS_BUCKET = exports.UPDATE_CORS_BUCKET = exports.ADD_CORS_BUCKET = exports.REMOVE_S3_DOMAIN = exports.ADD_S3_DOMAIN = exports.REMOVE_FILE_OTHER_VERSION = exports.RESTORE_FILE_OTHER_VERSION = exports.REMOVE_FILE_TRASH = exports.RESTORE_FILE_TRASH = exports.UPDATE_BUCKET_VERSIONING = exports.UPDATE_ACL_PERMISSION_BUCKET = exports.REMOVE_FILE = exports.MOVE_FILE = exports.COPY_FILE = exports.SHARE_LINK_FILE_BY_TIME = exports.SHARE_LINK_FILE_BY_TIME_DYNAMIC = exports.RENAME_FILE = exports.UPDATE_ACL_PERMISSION_FILE = exports.UPLOAD_FOLDER = exports.REMOVE_FOLDER = exports.CREATE_FOLDER = exports.DELETE_BUCKET = exports.RENAME_BUCKET = exports.CREATE_BUCKET = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  const CREATE_BUCKET = (fields = []) => {
6
6
  const fieldStr = fields.join('\n ');
@@ -333,6 +333,70 @@ const RESTORE_FILE_TRASH = (fields = []) => {
333
333
  `;
334
334
  };
335
335
  exports.RESTORE_FILE_TRASH = RESTORE_FILE_TRASH;
336
+ const REMOVE_FILE_TRASH = (fields = []) => {
337
+ const fieldStr = fields.join('\n ');
338
+ const hasFields = fields.length > 0;
339
+ return (0, graphql_tag_1.gql) `
340
+ mutation RemoveFileTrash(
341
+ $s3UserId: String!,
342
+ $bucketId: String!,
343
+ $files: [FileTrashInput!]!
344
+ ) {
345
+ removeFileTrash(
346
+ s3UserId: $s3UserId,
347
+ bucketId: $bucketId,
348
+ files: $files
349
+ ) {
350
+ ${hasFields ? `${fieldStr}` : ''}
351
+ }
352
+ }
353
+ `;
354
+ };
355
+ exports.REMOVE_FILE_TRASH = REMOVE_FILE_TRASH;
356
+ const RESTORE_FILE_OTHER_VERSION = (fields = []) => {
357
+ const fieldStr = fields.join('\n ');
358
+ const hasFields = fields.length > 0;
359
+ return (0, graphql_tag_1.gql) `
360
+ mutation RestoreFileOtherVersion(
361
+ $s3UserId: String!,
362
+ $bucketId: String!,
363
+ $key: String!,
364
+ $versionId: String!
365
+ ) {
366
+ restoreFileOtherVersion(
367
+ s3UserId: $s3UserId,
368
+ bucketId: $bucketId,
369
+ key: $key,
370
+ versionId: $versionId
371
+ ) {
372
+ ${hasFields ? `${fieldStr}` : ''}
373
+ }
374
+ }
375
+ `;
376
+ };
377
+ exports.RESTORE_FILE_OTHER_VERSION = RESTORE_FILE_OTHER_VERSION;
378
+ const REMOVE_FILE_OTHER_VERSION = (fields = []) => {
379
+ const fieldStr = fields.join('\n ');
380
+ const hasFields = fields.length > 0;
381
+ return (0, graphql_tag_1.gql) `
382
+ mutation RemoveFileOtherVersion(
383
+ $s3UserId: String!,
384
+ $bucketId: String!,
385
+ $key: String!,
386
+ $versionId: String!
387
+ ) {
388
+ removeFileOtherVersion(
389
+ s3UserId: $s3UserId,
390
+ bucketId: $bucketId,
391
+ key: $key,
392
+ versionId: $versionId
393
+ ) {
394
+ ${hasFields ? `${fieldStr}` : ''}
395
+ }
396
+ }
397
+ `;
398
+ };
399
+ exports.REMOVE_FILE_OTHER_VERSION = REMOVE_FILE_OTHER_VERSION;
336
400
  const ADD_S3_DOMAIN = (fields = []) => {
337
401
  const fieldStr = fields.join('\n ');
338
402
  const hasFields = fields.length > 0;
@@ -5,4 +5,5 @@ export declare const GET_LIST_OBJECT: (fields?: string[]) => DocumentNode;
5
5
  export declare const GET_LIST_FILE_TRASH: (fields?: string[]) => DocumentNode;
6
6
  export declare const GET_LIST_S3_DOMAIN_BY_S3_USER_ID: (fields?: string[]) => DocumentNode;
7
7
  export declare const GET_LIST_CORS_BY_S3_USER_ID: (fields?: string[]) => DocumentNode;
8
+ export declare const GET_LIST_FILE_OTHER_VERSION: (fields?: string[]) => DocumentNode;
8
9
  export declare const CHART_IN_YEAR: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CHART_IN_YEAR = exports.GET_LIST_CORS_BY_S3_USER_ID = exports.GET_LIST_S3_DOMAIN_BY_S3_USER_ID = exports.GET_LIST_FILE_TRASH = exports.GET_LIST_OBJECT = exports.GET_LIST_BUCKET_BY_S3_USER_ID = exports.GET_LIST_S3_USER_BY_SERVICE_ID = void 0;
3
+ exports.CHART_IN_YEAR = exports.GET_LIST_FILE_OTHER_VERSION = exports.GET_LIST_CORS_BY_S3_USER_ID = exports.GET_LIST_S3_DOMAIN_BY_S3_USER_ID = exports.GET_LIST_FILE_TRASH = exports.GET_LIST_OBJECT = exports.GET_LIST_BUCKET_BY_S3_USER_ID = exports.GET_LIST_S3_USER_BY_SERVICE_ID = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  const GET_LIST_S3_USER_BY_SERVICE_ID = (fields = []) => {
6
6
  const fieldStr = fields.join('\n ');
@@ -74,6 +74,18 @@ const GET_LIST_CORS_BY_S3_USER_ID = (fields = []) => {
74
74
  `;
75
75
  };
76
76
  exports.GET_LIST_CORS_BY_S3_USER_ID = GET_LIST_CORS_BY_S3_USER_ID;
77
+ const GET_LIST_FILE_OTHER_VERSION = (fields = []) => {
78
+ const fieldStr = fields.join('\n ');
79
+ const hasFields = fields.length > 0;
80
+ return (0, graphql_tag_1.gql) `
81
+ query GetListFileOtherVersion($s3UserId: String!, $bucketId: String!, key: String) {
82
+ getListFileOtherVersion(s3UserId: $s3UserId, bucketId: $bucketId, key: $key) {
83
+ ${hasFields ? `${fieldStr}` : ''}
84
+ }
85
+ }
86
+ `;
87
+ };
88
+ exports.GET_LIST_FILE_OTHER_VERSION = GET_LIST_FILE_OTHER_VERSION;
77
89
  const CHART_IN_YEAR = (fields = []) => {
78
90
  const fieldStr = fields.join('\n ');
79
91
  const hasFields = fields.length > 0;
@@ -11,6 +11,7 @@ export declare class CloudService extends Service {
11
11
  setToken(token: string): void;
12
12
  setStoreId(storeId: string): void;
13
13
  serviceDetail(serviceId: string): Promise<any>;
14
+ serviceDetailDynamic(serviceId: string, fields: string[]): Promise<any>;
14
15
  updateServiceCompleted(serviceId: string, handleBy: string): Promise<any>;
15
16
  updateServiceNew(serviceId: string, handleBy: string): Promise<any>;
16
17
  updateServiceReadyDeploy(serviceId: string, handleBy: string): Promise<any>;
@@ -45,6 +45,22 @@ class CloudService extends serviceSDK_1.Service {
45
45
  }
46
46
  });
47
47
  }
48
+ serviceDetailDynamic(serviceId, fields) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const query = (0, queries_1.SERVICE_DETAIL_DYNAMIC)(fields);
51
+ const variables = {
52
+ serviceId,
53
+ };
54
+ try {
55
+ const response = yield this.graphqlQueryV2(query, variables);
56
+ return response.serviceDetail;
57
+ }
58
+ catch (error) {
59
+ console.log(`Error in serviceDetailDynamic: ${error}`);
60
+ throw error;
61
+ }
62
+ });
63
+ }
48
64
  updateServiceCompleted(serviceId, handleBy) {
49
65
  return __awaiter(this, void 0, void 0, function* () {
50
66
  const mutation = mutations_1.UPDATE_SERVICE_COMPLETED;
@@ -1,4 +1,4 @@
1
- import { FileInfoInput } from '../../types/storage_s3';
1
+ import { FileInfoInput, FileTrashInput } from '../../types/storage_s3';
2
2
  import { Service } from '../serviceSDK';
3
3
  export declare class StorageS3Service extends Service {
4
4
  constructor(endpoint: string, orgId: string, storeId: string);
@@ -21,6 +21,8 @@ export declare class StorageS3Service extends Service {
21
21
  updateAclPermissionBucket(s3UserId: string, bucketId: string, isPublic: boolean, updateBy: string, fields: string[]): Promise<any>;
22
22
  updateBucketVersioning(s3UserId: string, bucketId: string, isOn: boolean, updateBy: string, fields: string[]): Promise<any>;
23
23
  getListFileTrash(s3UserId: string, bucketId: string, fields: string[]): Promise<any>;
24
+ restoreFileTrash(s3UserId: string, bucketId: string, key: string, versionId: string, fields: string[]): Promise<any>;
25
+ removeFileTrash(s3UserId: string, bucketId: string, files: [FileTrashInput], fields: string[]): Promise<any>;
24
26
  getListS3DomainByS3UserId(s3UserId: string, fields: string[]): Promise<any>;
25
27
  addS3Domain(s3UserId: string, domain: string, byUser: string, fields: string[]): Promise<any>;
26
28
  removeS3Domain(s3UserId: string, domainId: string, byUser: string, fields: string[]): Promise<any>;
@@ -28,5 +30,8 @@ export declare class StorageS3Service extends Service {
28
30
  addCorsBucket(s3UserId: string, bucketId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, fields: string[]): Promise<any>;
29
31
  updateCorsBucket(s3UserId: string, bucketId: string, corsId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, fields: string[]): Promise<any>;
30
32
  removeCorsBucket(s3UserId: string, bucketId: string, corsId: string, updateBy: string, fields: string[]): Promise<any>;
33
+ getListFileOtherVersion(s3UserId: string, bucketId: string, key: string, fields: string[]): Promise<any>;
34
+ restoreFileOtherVersion(s3UserId: string, bucketId: string, key: string, versionId: string, fields: string[]): Promise<any>;
35
+ removeFileOtherVersion(s3UserId: string, bucketId: string, key: string, versionId: string, fields: string[]): Promise<any>;
31
36
  chartInYear(s3UserId: string, year: number, fields: string[]): Promise<any>;
32
37
  }
@@ -367,6 +367,43 @@ class StorageS3Service extends serviceSDK_1.Service {
367
367
  }
368
368
  });
369
369
  }
370
+ restoreFileTrash(s3UserId, bucketId, key, versionId, fields) {
371
+ return __awaiter(this, void 0, void 0, function* () {
372
+ const mutation = (0, mutations_1.RESTORE_FILE_TRASH)(fields);
373
+ const variables = {
374
+ s3UserId,
375
+ bucketId,
376
+ key,
377
+ versionId
378
+ };
379
+ try {
380
+ const response = yield this.graphqlMutationV2(mutation, variables);
381
+ return response.restoreFileTrash;
382
+ }
383
+ catch (error) {
384
+ console.log(`Error in restoreFileTrash: ${error}`);
385
+ throw error;
386
+ }
387
+ });
388
+ }
389
+ removeFileTrash(s3UserId, bucketId, files, fields) {
390
+ return __awaiter(this, void 0, void 0, function* () {
391
+ const mutation = (0, mutations_1.REMOVE_FILE_TRASH)(fields);
392
+ const variables = {
393
+ s3UserId,
394
+ bucketId,
395
+ files
396
+ };
397
+ try {
398
+ const response = yield this.graphqlMutationV2(mutation, variables);
399
+ return response.removeFileTrash;
400
+ }
401
+ catch (error) {
402
+ console.log(`Error in removeFileTrash: ${error}`);
403
+ throw error;
404
+ }
405
+ });
406
+ }
370
407
  getListS3DomainByS3UserId(s3UserId, fields) {
371
408
  return __awaiter(this, void 0, void 0, function* () {
372
409
  const query = (0, queries_1.GET_LIST_S3_DOMAIN_BY_S3_USER_ID)(fields);
@@ -502,6 +539,62 @@ class StorageS3Service extends serviceSDK_1.Service {
502
539
  }
503
540
  });
504
541
  }
542
+ getListFileOtherVersion(s3UserId, bucketId, key, fields) {
543
+ return __awaiter(this, void 0, void 0, function* () {
544
+ const query = (0, queries_1.GET_LIST_FILE_OTHER_VERSION)(fields);
545
+ const variables = {
546
+ s3UserId,
547
+ bucketId,
548
+ key,
549
+ };
550
+ try {
551
+ const response = yield this.graphqlQueryV2(query, variables);
552
+ return response.getListFileOtherVersion;
553
+ }
554
+ catch (error) {
555
+ console.log(`Error in getListFileOtherVersion: ${error}`);
556
+ throw error;
557
+ }
558
+ });
559
+ }
560
+ restoreFileOtherVersion(s3UserId, bucketId, key, versionId, fields) {
561
+ return __awaiter(this, void 0, void 0, function* () {
562
+ const mutation = (0, mutations_1.RESTORE_FILE_OTHER_VERSION)(fields);
563
+ const variables = {
564
+ s3UserId,
565
+ bucketId,
566
+ key,
567
+ versionId
568
+ };
569
+ try {
570
+ const response = yield this.graphqlMutationV2(mutation, variables);
571
+ return response.restoreFileOtherVersion;
572
+ }
573
+ catch (error) {
574
+ console.log(`Error in restoreFileOtherVersion: ${error}`);
575
+ throw error;
576
+ }
577
+ });
578
+ }
579
+ removeFileOtherVersion(s3UserId, bucketId, key, versionId, fields) {
580
+ return __awaiter(this, void 0, void 0, function* () {
581
+ const mutation = (0, mutations_1.REMOVE_FILE_OTHER_VERSION)(fields);
582
+ const variables = {
583
+ s3UserId,
584
+ bucketId,
585
+ key,
586
+ versionId
587
+ };
588
+ try {
589
+ const response = yield this.graphqlMutationV2(mutation, variables);
590
+ return response.removeFileOtherVersion;
591
+ }
592
+ catch (error) {
593
+ console.log(`Error in removeFileOtherVersion: ${error}`);
594
+ throw error;
595
+ }
596
+ });
597
+ }
505
598
  chartInYear(s3UserId, year, fields) {
506
599
  return __awaiter(this, void 0, void 0, function* () {
507
600
  const query = (0, queries_1.CHART_IN_YEAR)(fields);
@@ -4,3 +4,7 @@ export interface FileInfoInput {
4
4
  size: number;
5
5
  contentType: string;
6
6
  }
7
+ export interface FileTrashInput {
8
+ key: string;
9
+ versionId: string;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.19.7",
3
+ "version": "1.19.9",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [
@@ -1,14 +0,0 @@
1
- import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
2
- import { DocumentNode } from "graphql";
3
- export declare class Service {
4
- protected token: string | null;
5
- protected client: ApolloClient<NormalizedCacheObject>;
6
- protected orgId: string;
7
- protected storeId: string;
8
- protected endpoint: string;
9
- constructor(endpoint: string, orgId: string, storeId: string);
10
- setToken(token: string): void;
11
- protected graphqlQuery(query: DocumentNode, variables: any): Promise<any>;
12
- protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
13
- protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
14
- }
@@ -1,101 +0,0 @@
1
- "use strict";
2
- // src/service.ts
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Service = void 0;
17
- const client_1 = require("@apollo/client");
18
- const axios_1 = __importDefault(require("axios"));
19
- class Service {
20
- constructor(endpoint, orgId, storeId) {
21
- this.token = null;
22
- this.client = new client_1.ApolloClient({
23
- uri: endpoint,
24
- cache: new client_1.InMemoryCache(),
25
- defaultOptions: {
26
- query: {
27
- fetchPolicy: "network-only",
28
- },
29
- },
30
- });
31
- this.orgId = orgId;
32
- this.storeId = storeId;
33
- this.endpoint = endpoint;
34
- }
35
- setToken(token) {
36
- this.token = token;
37
- }
38
- // setOrgId(orgId: string) {
39
- // this.orgId = orgId;
40
- // }
41
- graphqlQuery(query, variables) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- try {
44
- const { data, errors } = yield this.client.query({
45
- query: (0, client_1.gql) `
46
- ${query}
47
- `,
48
- variables,
49
- });
50
- if (errors) {
51
- throw new Error(`GraphQL error! errors: ${errors}`);
52
- }
53
- return data;
54
- }
55
- catch (error) {
56
- console.log(`Error in graphqlQuery: ${error}`);
57
- throw error;
58
- }
59
- });
60
- }
61
- graphqlMutation(mutation, variables) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- try {
64
- const { data, errors } = yield this.client.mutate({
65
- mutation: (0, client_1.gql) `
66
- ${mutation}
67
- `,
68
- variables,
69
- });
70
- if (errors) {
71
- throw new Error(`GraphQL error! errors: ${errors}`);
72
- }
73
- return data;
74
- }
75
- catch (error) {
76
- console.log(`Error in graphqlMutation: ${error}`);
77
- throw error;
78
- }
79
- });
80
- }
81
- restApiCallWithToken(path, method, data, headers) {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- try {
84
- const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
85
- console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
86
- const response = yield (0, axios_1.default)({
87
- url: this.endpoint + path,
88
- method,
89
- data,
90
- headers: modifiedHeaders,
91
- });
92
- return response.data;
93
- }
94
- catch (error) {
95
- console.log(`Error in restApiCallWithToken: ${error}`);
96
- throw error;
97
- }
98
- });
99
- }
100
- }
101
- exports.Service = Service;
@@ -1 +0,0 @@
1
- export declare function buildFieldString(fields: (string | Record<string, any>)[], indent?: number): string;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildFieldString = void 0;
4
- function buildFieldString(fields, indent = 6) {
5
- const space = " ".repeat(indent);
6
- return fields
7
- .map((field) => {
8
- if (typeof field === "string")
9
- return `${space}${field}`;
10
- const [key, value] = Object.entries(field)[0];
11
- const nested = buildFieldString(value, indent + 2);
12
- return `${space}${key} {\n${nested}\n${space}}`;
13
- })
14
- .join("\n");
15
- }
16
- exports.buildFieldString = buildFieldString;