@xano/cli 0.0.28 → 0.0.29
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.
|
@@ -9,9 +9,9 @@ export default class Pull extends BaseCommand {
|
|
|
9
9
|
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
};
|
|
16
16
|
run(): Promise<void>;
|
|
17
17
|
private loadCredentials;
|
|
@@ -44,6 +44,12 @@ Pulled 42 documents to ./my-workspace
|
|
|
44
44
|
description: 'Include records',
|
|
45
45
|
required: false,
|
|
46
46
|
}),
|
|
47
|
+
verbose: Flags.boolean({
|
|
48
|
+
char: 'v',
|
|
49
|
+
default: false,
|
|
50
|
+
description: 'Show request details',
|
|
51
|
+
required: false,
|
|
52
|
+
}),
|
|
47
53
|
workspace: Flags.string({
|
|
48
54
|
char: 'w',
|
|
49
55
|
description: 'Workspace ID (optional if set in profile)',
|
|
@@ -94,12 +100,21 @@ Pulled 42 documents to ./my-workspace
|
|
|
94
100
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/multidoc?${queryParams.toString()}`;
|
|
95
101
|
// Fetch multidoc from the API
|
|
96
102
|
let responseText;
|
|
103
|
+
const requestHeaders = {
|
|
104
|
+
'accept': 'application/json',
|
|
105
|
+
'Authorization': `Bearer ${profile.access_token}`,
|
|
106
|
+
};
|
|
107
|
+
if (flags.verbose) {
|
|
108
|
+
this.log('Request details:');
|
|
109
|
+
this.log(` Method: GET`);
|
|
110
|
+
this.log(` URL: ${apiUrl}`);
|
|
111
|
+
this.log(` Headers:`);
|
|
112
|
+
this.log(` accept: application/json`);
|
|
113
|
+
this.log(` Authorization: Bearer ${profile.access_token.slice(0, 8)}...${profile.access_token.slice(-4)}`);
|
|
114
|
+
}
|
|
97
115
|
try {
|
|
98
116
|
const response = await fetch(apiUrl, {
|
|
99
|
-
headers:
|
|
100
|
-
'accept': 'application/json',
|
|
101
|
-
'Authorization': `Bearer ${profile.access_token}`,
|
|
102
|
-
},
|
|
117
|
+
headers: requestHeaders,
|
|
103
118
|
method: 'GET',
|
|
104
119
|
});
|
|
105
120
|
if (!response.ok) {
|
|
@@ -7,9 +7,9 @@ export default class Push extends BaseCommand {
|
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
9
|
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
13
|
};
|
|
14
14
|
run(): Promise<void>;
|
|
15
15
|
/**
|
|
@@ -33,6 +33,12 @@ Pushed 42 documents from ./my-workspace
|
|
|
33
33
|
description: 'Branch name (optional if set in profile, defaults to live)',
|
|
34
34
|
required: false,
|
|
35
35
|
}),
|
|
36
|
+
verbose: Flags.boolean({
|
|
37
|
+
char: 'v',
|
|
38
|
+
default: false,
|
|
39
|
+
description: 'Show request details',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
36
42
|
workspace: Flags.string({
|
|
37
43
|
char: 'w',
|
|
38
44
|
description: 'Workspace ID (optional if set in profile)',
|
|
@@ -102,14 +108,25 @@ Pushed 42 documents from ./my-workspace
|
|
|
102
108
|
const queryParams = new URLSearchParams({ branch });
|
|
103
109
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/multidoc?${queryParams.toString()}`;
|
|
104
110
|
// POST the multidoc to the API
|
|
111
|
+
const requestHeaders = {
|
|
112
|
+
'accept': 'application/json',
|
|
113
|
+
'Authorization': `Bearer ${profile.access_token}`,
|
|
114
|
+
'Content-Type': 'text/x-xanoscript',
|
|
115
|
+
};
|
|
116
|
+
if (flags.verbose) {
|
|
117
|
+
this.log('Request details:');
|
|
118
|
+
this.log(` Method: POST`);
|
|
119
|
+
this.log(` URL: ${apiUrl}`);
|
|
120
|
+
this.log(` Headers:`);
|
|
121
|
+
this.log(` accept: application/json`);
|
|
122
|
+
this.log(` Authorization: Bearer ${profile.access_token.slice(0, 8)}...${profile.access_token.slice(-4)}`);
|
|
123
|
+
this.log(` Content-Type: text/x-xanoscript`);
|
|
124
|
+
this.log(` Body: ${multidoc.length} bytes (${documents.length} documents)`);
|
|
125
|
+
}
|
|
105
126
|
try {
|
|
106
127
|
const response = await fetch(apiUrl, {
|
|
107
128
|
body: multidoc,
|
|
108
|
-
headers:
|
|
109
|
-
'accept': 'application/json',
|
|
110
|
-
'Authorization': `Bearer ${profile.access_token}`,
|
|
111
|
-
'Content-Type': 'text/x-xanoscript',
|
|
112
|
-
},
|
|
129
|
+
headers: requestHeaders,
|
|
113
130
|
method: 'POST',
|
|
114
131
|
});
|
|
115
132
|
if (!response.ok) {
|