@watasu/sdk 0.1.30 → 0.1.40

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.
package/dist/volume.js CHANGED
@@ -26,6 +26,7 @@ export class Volume {
26
26
  const payload = await control.post('/volumes', {
27
27
  json: compactRecord({ name, team: opts.team }),
28
28
  requestTimeoutMs: opts.requestTimeoutMs,
29
+ signal: opts.signal,
29
30
  });
30
31
  return volumeFromPayload(payload, config, control);
31
32
  }
@@ -35,6 +36,7 @@ export class Volume {
35
36
  const control = new ControlClient(config);
36
37
  const payload = await control.get(`/volumes/${encodeURIComponent(volumeId)}`, {
37
38
  requestTimeoutMs: opts.requestTimeoutMs,
39
+ signal: opts.signal,
38
40
  });
39
41
  return volumeFromPayload(payload, config, control);
40
42
  }
@@ -44,6 +46,7 @@ export class Volume {
44
46
  const control = new ControlClient(config);
45
47
  const payload = await control.get(`/volumes/${encodeURIComponent(volumeId)}`, {
46
48
  requestTimeoutMs: opts.requestTimeoutMs,
49
+ signal: opts.signal,
47
50
  });
48
51
  return volumeInfo(record(payload.volume ?? payload));
49
52
  }
@@ -52,7 +55,10 @@ export class Volume {
52
55
  const config = new ConnectionConfig(opts);
53
56
  const control = new ControlClient(config);
54
57
  const path = withQuery('/volumes', { team: opts.team });
55
- const payload = await control.get(path, { requestTimeoutMs: opts.requestTimeoutMs });
58
+ const payload = await control.get(path, {
59
+ requestTimeoutMs: opts.requestTimeoutMs,
60
+ signal: opts.signal,
61
+ });
56
62
  const volumes = Array.isArray(payload.volumes) ? payload.volumes : [];
57
63
  return volumes.map((item) => volumeInfo(record(item)));
58
64
  }
@@ -63,6 +69,7 @@ export class Volume {
63
69
  try {
64
70
  await control.delete(`/volumes/${encodeURIComponent(volumeId)}`, {
65
71
  requestTimeoutMs: opts.requestTimeoutMs,
72
+ signal: opts.signal,
66
73
  });
67
74
  return true;
68
75
  }
@@ -72,16 +79,13 @@ export class Volume {
72
79
  throw error;
73
80
  }
74
81
  }
75
- /** Alias for `destroy`. */
76
- static async delete(volumeId, opts = {}) {
77
- return this.destroy(volumeId, opts);
78
- }
79
82
  async getInfo(path, opts = {}) {
80
83
  if (path === undefined) {
81
84
  return Volume.getInfo(this.volumeId, this.configOptions(opts));
82
85
  }
83
86
  const payload = await this.control.get(withQuery(`/volumes/${this.volumeId}/path`, { path }), {
84
87
  requestTimeoutMs: opts.requestTimeoutMs,
88
+ signal: opts.signal,
85
89
  });
86
90
  return volumeEntry(record(payload.file ?? payload));
87
91
  }
@@ -92,6 +96,7 @@ export class Volume {
92
96
  depth: opts.depth,
93
97
  }), {
94
98
  requestTimeoutMs: opts.requestTimeoutMs,
99
+ signal: opts.signal,
95
100
  });
96
101
  const entries = Array.isArray(payload.entries) ? payload.entries : [];
97
102
  return entries.map((item) => volumeEntry(record(item)));
@@ -101,6 +106,7 @@ export class Volume {
101
106
  const payload = await this.control.post(`/volumes/${this.volumeId}/directories`, {
102
107
  json: compactRecord({ path, ...metadataPayload(opts) }),
103
108
  requestTimeoutMs: opts.requestTimeoutMs,
109
+ signal: opts.signal,
104
110
  });
105
111
  return volumeEntry(record(payload.file ?? payload));
106
112
  }
@@ -121,12 +127,14 @@ export class Volume {
121
127
  const payload = await this.control.patch(`/volumes/${this.volumeId}/path`, {
122
128
  json: compactRecord({ path, ...metadataPayload(opts) }),
123
129
  requestTimeoutMs: opts.requestTimeoutMs,
130
+ signal: opts.signal,
124
131
  });
125
132
  return volumeEntry(record(payload.file ?? payload));
126
133
  }
127
134
  async readFile(path, opts = {}) {
128
135
  const payload = await this.control.get(withQuery(`/volumes/${this.volumeId}/files`, { path }), {
129
136
  requestTimeoutMs: opts.requestTimeoutMs,
137
+ signal: opts.signal,
130
138
  });
131
139
  const file = record(payload.file ?? payload);
132
140
  const content = file.content_b64 ?? file.contentBase64 ?? file.content ?? '';
@@ -154,6 +162,7 @@ export class Volume {
154
162
  force: opts.force,
155
163
  }),
156
164
  requestTimeoutMs: opts.requestTimeoutMs,
165
+ signal: opts.signal,
157
166
  });
158
167
  return volumeEntry(record(payload.file ?? payload));
159
168
  }
@@ -161,6 +170,7 @@ export class Volume {
161
170
  async remove(path, opts = {}) {
162
171
  await this.control.delete(withQuery(`/volumes/${this.volumeId}/path`, { path }), {
163
172
  requestTimeoutMs: opts.requestTimeoutMs,
173
+ signal: opts.signal,
164
174
  });
165
175
  return true;
166
176
  }
@@ -168,16 +178,17 @@ export class Volume {
168
178
  async destroy(opts = {}) {
169
179
  return Volume.destroy(this.volumeId, this.configOptions(opts));
170
180
  }
171
- /** Alias for `destroy`. */
172
- async delete(opts = {}) {
173
- return this.destroy(opts);
174
- }
175
181
  configOptions(opts = {}) {
176
182
  return {
177
183
  apiKey: this.config.apiKey,
178
184
  apiUrl: this.config.apiUrl,
179
185
  dataPlaneDomain: this.config.dataPlaneDomain,
180
186
  requestTimeoutMs: this.config.requestTimeoutMs,
187
+ headers: this.config.headers,
188
+ apiHeaders: this.config.apiHeaders,
189
+ debug: this.config.debug,
190
+ signal: this.config.signal,
191
+ proxy: this.config.proxy,
181
192
  ...opts,
182
193
  };
183
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@watasu/sdk",
3
- "version": "0.1.30",
3
+ "version": "0.1.40",
4
4
  "type": "module",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "description": "TypeScript SDK for Watasu",