@xano/cli 0.0.20 → 0.0.22

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.
Files changed (107) hide show
  1. package/dist/base-command.d.ts +1 -1
  2. package/dist/base-command.js +6 -6
  3. package/dist/commands/branch/create/index.d.ts +17 -0
  4. package/dist/commands/branch/create/index.js +164 -0
  5. package/dist/commands/branch/delete/index.d.ts +18 -0
  6. package/dist/commands/branch/delete/index.js +156 -0
  7. package/dist/commands/branch/edit/index.d.ts +19 -0
  8. package/dist/commands/branch/edit/index.js +166 -0
  9. package/dist/commands/branch/get/index.d.ts +16 -0
  10. package/dist/commands/branch/get/index.js +135 -0
  11. package/dist/commands/branch/list/index.d.ts +18 -0
  12. package/dist/commands/branch/list/index.js +138 -0
  13. package/dist/commands/branch/set-live/index.d.ts +18 -0
  14. package/dist/commands/branch/set-live/index.js +155 -0
  15. package/dist/commands/function/create/index.d.ts +6 -6
  16. package/dist/commands/function/create/index.js +55 -55
  17. package/dist/commands/function/edit/index.d.ts +10 -10
  18. package/dist/commands/function/edit/index.js +155 -162
  19. package/dist/commands/function/get/index.d.ts +5 -5
  20. package/dist/commands/function/get/index.js +55 -60
  21. package/dist/commands/function/list/index.d.ts +5 -5
  22. package/dist/commands/function/list/index.js +52 -52
  23. package/dist/commands/profile/create/index.d.ts +6 -6
  24. package/dist/commands/profile/create/index.js +37 -37
  25. package/dist/commands/profile/delete/index.d.ts +2 -2
  26. package/dist/commands/profile/delete/index.js +9 -9
  27. package/dist/commands/profile/edit/index.d.ts +7 -7
  28. package/dist/commands/profile/edit/index.js +47 -47
  29. package/dist/commands/profile/get-default/index.js +1 -1
  30. package/dist/commands/profile/list/index.d.ts +2 -2
  31. package/dist/commands/profile/list/index.js +9 -9
  32. package/dist/commands/profile/me/index.d.ts +3 -3
  33. package/dist/commands/profile/me/index.js +21 -21
  34. package/dist/commands/profile/project/index.js +1 -1
  35. package/dist/commands/profile/set-default/index.js +1 -1
  36. package/dist/commands/profile/token/index.js +1 -1
  37. package/dist/commands/profile/wizard/index.d.ts +4 -4
  38. package/dist/commands/profile/wizard/index.js +118 -122
  39. package/dist/commands/run/env/delete/index.d.ts +2 -2
  40. package/dist/commands/run/env/delete/index.js +9 -9
  41. package/dist/commands/run/env/get/index.d.ts +2 -2
  42. package/dist/commands/run/env/get/index.js +10 -10
  43. package/dist/commands/run/env/list/index.d.ts +2 -2
  44. package/dist/commands/run/env/list/index.js +16 -18
  45. package/dist/commands/run/env/set/index.d.ts +2 -2
  46. package/dist/commands/run/env/set/index.js +4 -4
  47. package/dist/commands/run/exec/index.d.ts +11 -11
  48. package/dist/commands/run/exec/index.js +109 -109
  49. package/dist/commands/run/info/index.d.ts +4 -4
  50. package/dist/commands/run/info/index.js +26 -26
  51. package/dist/commands/run/projects/create/index.d.ts +3 -3
  52. package/dist/commands/run/projects/create/index.js +22 -22
  53. package/dist/commands/run/projects/delete/index.d.ts +2 -2
  54. package/dist/commands/run/projects/delete/index.js +9 -9
  55. package/dist/commands/run/projects/list/index.d.ts +2 -2
  56. package/dist/commands/run/projects/list/index.js +11 -11
  57. package/dist/commands/run/projects/update/index.d.ts +3 -3
  58. package/dist/commands/run/projects/update/index.js +20 -20
  59. package/dist/commands/run/secrets/delete/index.d.ts +2 -2
  60. package/dist/commands/run/secrets/delete/index.js +9 -9
  61. package/dist/commands/run/secrets/get/index.d.ts +2 -2
  62. package/dist/commands/run/secrets/get/index.js +10 -10
  63. package/dist/commands/run/secrets/list/index.d.ts +2 -2
  64. package/dist/commands/run/secrets/list/index.js +21 -23
  65. package/dist/commands/run/secrets/set/index.d.ts +3 -3
  66. package/dist/commands/run/secrets/set/index.js +15 -15
  67. package/dist/commands/run/sessions/delete/index.d.ts +2 -2
  68. package/dist/commands/run/sessions/delete/index.js +9 -9
  69. package/dist/commands/run/sessions/get/index.d.ts +2 -2
  70. package/dist/commands/run/sessions/get/index.js +10 -10
  71. package/dist/commands/run/sessions/list/index.d.ts +2 -2
  72. package/dist/commands/run/sessions/list/index.js +10 -10
  73. package/dist/commands/run/sessions/start/index.d.ts +2 -2
  74. package/dist/commands/run/sessions/start/index.js +10 -10
  75. package/dist/commands/run/sessions/stop/index.d.ts +2 -2
  76. package/dist/commands/run/sessions/stop/index.js +10 -10
  77. package/dist/commands/run/sink/get/index.d.ts +2 -2
  78. package/dist/commands/run/sink/get/index.js +10 -10
  79. package/dist/commands/static_host/build/create/index.d.ts +4 -4
  80. package/dist/commands/static_host/build/create/index.js +33 -33
  81. package/dist/commands/static_host/build/get/index.d.ts +4 -4
  82. package/dist/commands/static_host/build/get/index.js +20 -20
  83. package/dist/commands/static_host/build/list/index.d.ts +3 -3
  84. package/dist/commands/static_host/build/list/index.js +31 -31
  85. package/dist/commands/static_host/list/index.d.ts +3 -3
  86. package/dist/commands/static_host/list/index.js +31 -31
  87. package/dist/commands/workspace/create/index.d.ts +14 -0
  88. package/dist/commands/workspace/create/index.js +131 -0
  89. package/dist/commands/workspace/delete/index.d.ts +20 -0
  90. package/dist/commands/workspace/delete/index.js +141 -0
  91. package/dist/commands/workspace/edit/index.d.ts +22 -0
  92. package/dist/commands/workspace/edit/index.js +176 -0
  93. package/dist/commands/workspace/get/index.d.ts +18 -0
  94. package/dist/commands/workspace/get/index.js +136 -0
  95. package/dist/commands/workspace/list/index.d.ts +2 -2
  96. package/dist/commands/workspace/list/index.js +15 -15
  97. package/dist/commands/workspace/pull/index.d.ts +4 -4
  98. package/dist/commands/workspace/pull/index.js +46 -51
  99. package/dist/commands/workspace/push/index.js +3 -3
  100. package/dist/help.d.ts +1 -1
  101. package/dist/lib/base-run-command.d.ts +4 -4
  102. package/dist/lib/base-run-command.js +3 -3
  103. package/dist/lib/run-http-client.d.ts +21 -21
  104. package/dist/lib/run-http-client.js +72 -72
  105. package/dist/lib/run-types.d.ts +80 -80
  106. package/oclif.manifest.json +1633 -791
  107. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
+ import * as yaml from 'js-yaml';
2
3
  import * as fs from 'node:fs';
3
4
  import * as os from 'node:os';
4
5
  import * as path from 'node:path';
5
- import * as yaml from 'js-yaml';
6
6
  import BaseCommand from '../../../base-command.js';
7
7
  export default class Pull extends BaseCommand {
8
8
  static args = {
@@ -11,24 +11,6 @@ export default class Pull extends BaseCommand {
11
11
  required: true,
12
12
  }),
13
13
  };
14
- static flags = {
15
- ...BaseCommand.baseFlags,
16
- workspace: Flags.string({
17
- char: 'w',
18
- description: 'Workspace ID (optional if set in profile)',
19
- required: false,
20
- }),
21
- env: Flags.boolean({
22
- description: 'Include environment variables',
23
- required: false,
24
- default: false,
25
- }),
26
- records: Flags.boolean({
27
- description: 'Include records',
28
- required: false,
29
- default: false,
30
- }),
31
- };
32
14
  static description = 'Pull a workspace multidoc from the Xano Metadata API and split into individual files';
33
15
  static examples = [
34
16
  `$ xano workspace pull ./my-workspace
@@ -41,6 +23,24 @@ Pulled 15 documents to ./output
41
23
  Pulled 58 documents to ./backup
42
24
  `,
43
25
  ];
26
+ static flags = {
27
+ ...BaseCommand.baseFlags,
28
+ env: Flags.boolean({
29
+ default: false,
30
+ description: 'Include environment variables',
31
+ required: false,
32
+ }),
33
+ records: Flags.boolean({
34
+ default: false,
35
+ description: 'Include records',
36
+ required: false,
37
+ }),
38
+ workspace: Flags.string({
39
+ char: 'w',
40
+ description: 'Workspace ID (optional if set in profile)',
41
+ required: false,
42
+ }),
43
+ };
44
44
  async run() {
45
45
  const { args, flags } = await this.parse(Pull);
46
46
  // Get profile name (default or from flag/env)
@@ -84,11 +84,11 @@ Pulled 58 documents to ./backup
84
84
  let responseText;
85
85
  try {
86
86
  const response = await fetch(apiUrl, {
87
- method: 'GET',
88
87
  headers: {
89
88
  'accept': 'application/json',
90
89
  'Authorization': `Bearer ${profile.access_token}`,
91
90
  },
91
+ method: 'GET',
92
92
  });
93
93
  if (!response.ok) {
94
94
  const errorText = await response.text();
@@ -147,18 +147,34 @@ Pulled 58 documents to ./backup
147
147
  typeCounters.set(baseName, count + 1);
148
148
  // Append numeric suffix for duplicates
149
149
  let filename;
150
- if (count === 0) {
151
- filename = `${baseName}.xs`;
152
- }
153
- else {
154
- filename = `${baseName}_${count + 1}.xs`;
155
- }
150
+ filename = count === 0 ? `${baseName}.xs` : `${baseName}_${count + 1}.xs`;
156
151
  const filePath = path.join(typeDir, filename);
157
152
  fs.writeFileSync(filePath, doc.content, 'utf8');
158
153
  writtenCount++;
159
154
  }
160
155
  this.log(`Pulled ${writtenCount} documents to ${args.directory}`);
161
156
  }
157
+ loadCredentials() {
158
+ const configDir = path.join(os.homedir(), '.xano');
159
+ const credentialsPath = path.join(configDir, 'credentials.yaml');
160
+ // Check if credentials file exists
161
+ if (!fs.existsSync(credentialsPath)) {
162
+ this.error(`Credentials file not found at ${credentialsPath}\n` +
163
+ `Create a profile using 'xano profile:create'`);
164
+ }
165
+ // Read credentials file
166
+ try {
167
+ const fileContent = fs.readFileSync(credentialsPath, 'utf8');
168
+ const parsed = yaml.load(fileContent);
169
+ if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
170
+ this.error('Credentials file has invalid format.');
171
+ }
172
+ return parsed;
173
+ }
174
+ catch (error) {
175
+ this.error(`Failed to parse credentials file: ${error}`);
176
+ }
177
+ }
162
178
  /**
163
179
  * Parse a single document to extract its type, name, and optional verb.
164
180
  * Skips leading comment lines (starting with //) to find the first
@@ -201,7 +217,7 @@ Pulled 58 documents to ./backup
201
217
  if (verbMatch) {
202
218
  verb = verbMatch[1];
203
219
  }
204
- return { type, name, verb, content };
220
+ return { content, name, type, verb };
205
221
  }
206
222
  /**
207
223
  * Sanitize a document name for use as a filename.
@@ -210,29 +226,8 @@ Pulled 58 documents to ./backup
210
226
  */
211
227
  sanitizeFilename(name) {
212
228
  return name
213
- .replace(/"/g, '')
214
- .replace(/\s+/g, '_')
215
- .replace(/[<>:"/\\|?*]/g, '_');
216
- }
217
- loadCredentials() {
218
- const configDir = path.join(os.homedir(), '.xano');
219
- const credentialsPath = path.join(configDir, 'credentials.yaml');
220
- // Check if credentials file exists
221
- if (!fs.existsSync(credentialsPath)) {
222
- this.error(`Credentials file not found at ${credentialsPath}\n` +
223
- `Create a profile using 'xano profile:create'`);
224
- }
225
- // Read credentials file
226
- try {
227
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
228
- const parsed = yaml.load(fileContent);
229
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
230
- this.error('Credentials file has invalid format.');
231
- }
232
- return parsed;
233
- }
234
- catch (error) {
235
- this.error(`Failed to parse credentials file: ${error}`);
236
- }
229
+ .replaceAll('"', '')
230
+ .replaceAll(/\s+/g, '_')
231
+ .replaceAll(/[<>:"/\\|?*]/g, '_');
237
232
  }
238
233
  }
@@ -1,8 +1,8 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
+ import * as yaml from 'js-yaml';
2
3
  import * as fs from 'node:fs';
3
4
  import * as os from 'node:os';
4
5
  import * as path from 'node:path';
5
- import * as yaml from 'js-yaml';
6
6
  import BaseCommand from '../../../base-command.js';
7
7
  export default class Push extends BaseCommand {
8
8
  static args = {
@@ -93,13 +93,13 @@ Pushed 58 documents from ./backup
93
93
  // POST the multidoc to the API
94
94
  try {
95
95
  const response = await fetch(apiUrl, {
96
- method: 'POST',
96
+ body: multidoc,
97
97
  headers: {
98
98
  'accept': 'application/json',
99
99
  'Authorization': `Bearer ${profile.access_token}`,
100
100
  'Content-Type': 'text/x-xanoscript',
101
101
  },
102
- body: multidoc,
102
+ method: 'POST',
103
103
  });
104
104
  if (!response.ok) {
105
105
  const errorText = await response.text();
package/dist/help.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Command, Help as BaseHelp } from '@oclif/core';
1
+ import { Help as BaseHelp, Command } from '@oclif/core';
2
2
  import { CommandHelp as BaseCommandHelp } from '@oclif/core/help';
3
3
  /**
4
4
  * Custom CommandHelp class that extends the default to display environment variables
@@ -4,19 +4,19 @@
4
4
  import BaseCommand from '../base-command.js';
5
5
  import { RunHttpClient } from './run-http-client.js';
6
6
  export interface ProfileConfig {
7
- account_origin?: string;
8
- instance_origin: string;
9
7
  access_token: string;
10
- workspace?: string;
8
+ account_origin?: string;
11
9
  branch?: string;
10
+ instance_origin: string;
12
11
  project?: string;
13
12
  run_base_url?: string;
13
+ workspace?: string;
14
14
  }
15
15
  export interface CredentialsFile {
16
+ default?: string;
16
17
  profiles: {
17
18
  [key: string]: ProfileConfig;
18
19
  };
19
- default?: string;
20
20
  }
21
21
  export default abstract class BaseRunCommand extends BaseCommand {
22
22
  protected httpClient: RunHttpClient;
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Base command for all run commands
3
3
  */
4
+ import * as yaml from 'js-yaml';
4
5
  import * as fs from 'node:fs';
5
6
  import * as os from 'node:os';
6
7
  import * as path from 'node:path';
7
- import * as yaml from 'js-yaml';
8
8
  import BaseCommand from '../base-command.js';
9
9
  import { DEFAULT_RUN_BASE_URL, RunHttpClient } from './run-http-client.js';
10
10
  export default class BaseRunCommand extends BaseCommand {
@@ -27,11 +27,11 @@ export default class BaseRunCommand extends BaseCommand {
27
27
  }
28
28
  const baseUrl = this.profile.run_base_url || DEFAULT_RUN_BASE_URL;
29
29
  this.httpClient = new RunHttpClient({
30
- baseUrl,
31
30
  authToken: this.profile.access_token,
31
+ baseUrl,
32
+ logger: (msg) => this.log(msg),
32
33
  projectId: this.profile.project,
33
34
  verbose,
34
- logger: (msg) => this.log(msg),
35
35
  });
36
36
  }
37
37
  /**
@@ -2,49 +2,49 @@
2
2
  * HTTP client for Xano Run API
3
3
  * Based on @xano/run-sdk HttpClient
4
4
  */
5
- export declare const DEFAULT_RUN_BASE_URL = "https://app.xano.com/";
5
+ export declare const DEFAULT_RUN_BASE_URL = "https://app.dev.xano.com/";
6
6
  export interface RunHttpClientConfig {
7
- baseUrl: string;
8
7
  authToken: string;
8
+ baseUrl: string;
9
+ logger?: (message: string) => void;
9
10
  projectId?: string;
10
11
  verbose?: boolean;
11
- logger?: (message: string) => void;
12
12
  }
13
13
  export declare class RunHttpClient {
14
14
  private readonly config;
15
15
  constructor(config: RunHttpClientConfig);
16
16
  /**
17
- * Get the project ID
17
+ * Build a URL scoped to the current project
18
18
  */
19
- getProjectId(): string | undefined;
19
+ buildProjectUrl(path: string, queryParams?: Record<string, unknown>): string;
20
20
  /**
21
- * Build headers for a request
21
+ * Build a URL scoped to a specific session
22
22
  */
23
- getHeaders(contentType?: string): HeadersInit;
23
+ buildSessionUrl(sessionId: string, path?: string, queryParams?: Record<string, unknown>): string;
24
24
  /**
25
25
  * Build a URL with optional query parameters
26
26
  */
27
27
  buildUrl(path: string, queryParams?: Record<string, unknown>): string;
28
28
  /**
29
- * Build a URL scoped to the current project
29
+ * Make a DELETE request
30
30
  */
31
- buildProjectUrl(path: string, queryParams?: Record<string, unknown>): string;
31
+ delete<T>(url: string, body?: unknown): Promise<T>;
32
32
  /**
33
- * Build a URL scoped to a specific session
33
+ * Make a GET request
34
34
  */
35
- buildSessionUrl(sessionId: string, path?: string, queryParams?: Record<string, unknown>): string;
35
+ get<T>(url: string): Promise<T>;
36
36
  /**
37
- * Log a message if verbose mode is enabled
37
+ * Build headers for a request
38
38
  */
39
- private log;
39
+ getHeaders(contentType?: string): HeadersInit;
40
40
  /**
41
- * Make an HTTP request
41
+ * Get the project ID
42
42
  */
43
- request<T>(url: string, options: RequestInit): Promise<T>;
43
+ getProjectId(): string | undefined;
44
44
  /**
45
- * Make a GET request
45
+ * Make a PATCH request
46
46
  */
47
- get<T>(url: string): Promise<T>;
47
+ patch<T>(url: string, body: unknown): Promise<T>;
48
48
  /**
49
49
  * Make a POST request with JSON body
50
50
  */
@@ -54,11 +54,11 @@ export declare class RunHttpClient {
54
54
  */
55
55
  postXanoScript<T>(url: string, code: string): Promise<T>;
56
56
  /**
57
- * Make a PATCH request
57
+ * Make an HTTP request
58
58
  */
59
- patch<T>(url: string, body: unknown): Promise<T>;
59
+ request<T>(url: string, options: RequestInit): Promise<T>;
60
60
  /**
61
- * Make a DELETE request
61
+ * Log a message if verbose mode is enabled
62
62
  */
63
- delete<T>(url: string, body?: unknown): Promise<T>;
63
+ private log;
64
64
  }
@@ -2,27 +2,27 @@
2
2
  * HTTP client for Xano Run API
3
3
  * Based on @xano/run-sdk HttpClient
4
4
  */
5
- export const DEFAULT_RUN_BASE_URL = 'https://app.xano.com/';
5
+ export const DEFAULT_RUN_BASE_URL = 'https://app.dev.xano.com/';
6
6
  export class RunHttpClient {
7
7
  config;
8
8
  constructor(config) {
9
9
  this.config = config;
10
10
  }
11
11
  /**
12
- * Get the project ID
12
+ * Build a URL scoped to the current project
13
13
  */
14
- getProjectId() {
15
- return this.config.projectId;
14
+ buildProjectUrl(path, queryParams) {
15
+ const { projectId } = this.config;
16
+ if (!projectId) {
17
+ throw new Error('Project ID is required. Set it in your profile.');
18
+ }
19
+ return this.buildUrl(`/project/${projectId}${path}`, queryParams);
16
20
  }
17
21
  /**
18
- * Build headers for a request
22
+ * Build a URL scoped to a specific session
19
23
  */
20
- getHeaders(contentType = 'application/json') {
21
- const headers = {
22
- 'Content-Type': contentType,
23
- 'Authorization': `Bearer ${this.config.authToken}`,
24
- };
25
- return headers;
24
+ buildSessionUrl(sessionId, path = '', queryParams) {
25
+ return this.buildUrl(`/session/${sessionId}${path}`, queryParams);
26
26
  }
27
27
  /**
28
28
  * Build a URL with optional query parameters
@@ -47,28 +47,69 @@ export class RunHttpClient {
47
47
  return url.toString();
48
48
  }
49
49
  /**
50
- * Build a URL scoped to the current project
50
+ * Make a DELETE request
51
51
  */
52
- buildProjectUrl(path, queryParams) {
53
- const projectId = this.config.projectId;
54
- if (!projectId) {
55
- throw new Error('Project ID is required. Set it in your profile.');
56
- }
57
- return this.buildUrl(`/project/${projectId}${path}`, queryParams);
52
+ async delete(url, body) {
53
+ return this.request(url, {
54
+ body: body ? JSON.stringify(body) : undefined,
55
+ headers: this.getHeaders(),
56
+ method: 'DELETE',
57
+ });
58
58
  }
59
59
  /**
60
- * Build a URL scoped to a specific session
60
+ * Make a GET request
61
61
  */
62
- buildSessionUrl(sessionId, path = '', queryParams) {
63
- return this.buildUrl(`/session/${sessionId}${path}`, queryParams);
62
+ async get(url) {
63
+ return this.request(url, {
64
+ headers: this.getHeaders(),
65
+ method: 'GET',
66
+ });
64
67
  }
65
68
  /**
66
- * Log a message if verbose mode is enabled
69
+ * Build headers for a request
67
70
  */
68
- log(message) {
69
- if (this.config.verbose && this.config.logger) {
70
- this.config.logger(message);
71
- }
71
+ getHeaders(contentType = 'application/json') {
72
+ const headers = {
73
+ 'Authorization': `Bearer ${this.config.authToken}`,
74
+ 'Content-Type': contentType,
75
+ };
76
+ return headers;
77
+ }
78
+ /**
79
+ * Get the project ID
80
+ */
81
+ getProjectId() {
82
+ return this.config.projectId;
83
+ }
84
+ /**
85
+ * Make a PATCH request
86
+ */
87
+ async patch(url, body) {
88
+ return this.request(url, {
89
+ body: JSON.stringify(body),
90
+ headers: this.getHeaders(),
91
+ method: 'PATCH',
92
+ });
93
+ }
94
+ /**
95
+ * Make a POST request with JSON body
96
+ */
97
+ async post(url, body) {
98
+ return this.request(url, {
99
+ body: body ? JSON.stringify(body) : undefined,
100
+ headers: this.getHeaders(),
101
+ method: 'POST',
102
+ });
103
+ }
104
+ /**
105
+ * Make a POST request with XanoScript body
106
+ */
107
+ async postXanoScript(url, code) {
108
+ return this.request(url, {
109
+ body: code,
110
+ headers: this.getHeaders('text/x-xanoscript'),
111
+ method: 'POST',
112
+ });
72
113
  }
73
114
  /**
74
115
  * Make an HTTP request
@@ -120,52 +161,11 @@ export class RunHttpClient {
120
161
  return parsed;
121
162
  }
122
163
  /**
123
- * Make a GET request
124
- */
125
- async get(url) {
126
- return this.request(url, {
127
- method: 'GET',
128
- headers: this.getHeaders(),
129
- });
130
- }
131
- /**
132
- * Make a POST request with JSON body
133
- */
134
- async post(url, body) {
135
- return this.request(url, {
136
- method: 'POST',
137
- headers: this.getHeaders(),
138
- body: body ? JSON.stringify(body) : undefined,
139
- });
140
- }
141
- /**
142
- * Make a POST request with XanoScript body
143
- */
144
- async postXanoScript(url, code) {
145
- return this.request(url, {
146
- method: 'POST',
147
- headers: this.getHeaders('text/x-xanoscript'),
148
- body: code,
149
- });
150
- }
151
- /**
152
- * Make a PATCH request
153
- */
154
- async patch(url, body) {
155
- return this.request(url, {
156
- method: 'PATCH',
157
- headers: this.getHeaders(),
158
- body: JSON.stringify(body),
159
- });
160
- }
161
- /**
162
- * Make a DELETE request
164
+ * Log a message if verbose mode is enabled
163
165
  */
164
- async delete(url, body) {
165
- return this.request(url, {
166
- method: 'DELETE',
167
- headers: this.getHeaders(),
168
- body: body ? JSON.stringify(body) : undefined,
169
- });
166
+ log(message) {
167
+ if (this.config.verbose && this.config.logger) {
168
+ this.config.logger(message);
169
+ }
170
170
  }
171
171
  }