File tree 4 files changed +1273
-1866
lines changed
4 files changed +1273
-1866
lines changed Original file line number Diff line number Diff line change 41
41
"ts-jest" : " ^25.2.1" ,
42
42
"ts-node" : " ^8" ,
43
43
"typescript" : " ^3.9.7" ,
44
- "vtex" : " ^2.128 .0"
44
+ "vtex" : " 4.1 .0"
45
45
},
46
46
"engines" : {
47
47
"node" : " >=8.0.0"
Original file line number Diff line number Diff line change 1
- import { AppGraphQLClient , InstanceOptions , IOContext } from '@vtex/api'
1
+ import type { InstanceOptions , IOContext } from '@vtex/api'
2
+ import { AppGraphQLClient } from '@vtex/api'
2
3
import { IOClientFactory } from 'vtex'
3
4
4
5
export interface RedirectInput {
@@ -40,32 +41,30 @@ export class Rewriter extends AppGraphQLClient {
40
41
}
41
42
42
43
public exportRedirects = ( next ?: string ) : Promise < ExportResponse > =>
43
- this . graphql
44
- . query < { redirect : { listRedirects : ExportResponse } } , { next ?: string } > (
44
+ this . http
45
+ . post < { data : { redirect : { listRedirects : ExportResponse } } } > (
46
+ '' ,
45
47
{
46
- query : `
47
- query ListRedirects($next: String) {
48
- redirect {
49
- listRedirects(next: $next) {
50
- next
51
- routes {
52
- binding
53
- from
54
- to
55
- type
56
- endDate
57
- }
58
- }
59
- }
60
- }
61
- ` ,
48
+ query : `query ListRedirects($next: String) {
49
+ redirect {
50
+ listRedirects(next: $next) {
51
+ next
52
+ routes {
53
+ from
54
+ to
55
+ type
56
+ endDate
57
+ }
58
+ }
59
+ }
60
+ }` ,
62
61
variables : { next } ,
63
62
} ,
64
63
{
65
64
metric : 'rewriter-get-redirects' ,
66
65
}
67
66
)
68
- . then ( ( res ) => res . data ? .redirect ?. listRedirects ) as Promise < ExportResponse >
67
+ . then ( ( res ) => res . data . redirect ?. listRedirects ) as Promise < ExportResponse >
69
68
70
69
public importRedirects = ( routes : RedirectInput [ ] ) : Promise < boolean > =>
71
70
this . graphql
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import { readJson, writeFile } from 'fs-extra'
3
3
import { Parser } from 'json2csv'
4
4
import ora from 'ora'
5
5
import { createInterface } from 'readline'
6
- import { Redirect , Rewriter } from '../../clients/apps/Rewriter'
6
+ import type { Redirect } from '../../clients/apps/Rewriter'
7
+ import { Rewriter } from '../../clients/apps/Rewriter'
7
8
import { SessionManager , logger , isVerbose } from 'vtex'
8
9
import {
9
10
deleteMetainfo ,
You can’t perform that action at this time.
0 commit comments