@pi-r/azure 0.9.2 → 0.9.3

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 (2) hide show
  1. package/client/index.js +8 -4
  2. package/package.json +6 -6
package/client/index.js CHANGED
@@ -193,6 +193,10 @@ async function executeBatchQuery(credential, batch, sessionKey) {
193
193
  client ||= createDatabaseClient.call(this, credential);
194
194
  return client.database(name).container(table);
195
195
  };
196
+ const attachSignal = (opts) => {
197
+ (opts ||= {}).abortSignal ||= this.signal;
198
+ return opts;
199
+ };
196
200
  const closeClient = () => client?.dispose();
197
201
  for (let i = 0; i < length; ++i) {
198
202
  const item = batch[i];
@@ -209,7 +213,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
209
213
  result[i] = rows;
210
214
  continue;
211
215
  }
212
- const { statusCode, resource } = await createClient(name, table).scripts.storedProcedure(storedProcedureId).execute(partitionKey, params, options);
216
+ const { statusCode, resource } = await createClient(name, table).scripts.storedProcedure(storedProcedureId).execute(partitionKey, params, attachSignal(options));
213
217
  if (statusCode === 200) {
214
218
  rows = Array.isArray(resource) ? resource : [resource];
215
219
  }
@@ -224,7 +228,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
224
228
  }
225
229
  }
226
230
  const db = createClient(name, table).item(id, partitionKey);
227
- const { statusCode, resource } = update ? await db.patch(update, options) : await db.read(options);
231
+ const { statusCode, resource } = update ? await db.patch(update, attachSignal(options)) : await db.read(attachSignal(options));
228
232
  if (statusCode === 200) {
229
233
  rows = [resource];
230
234
  }
@@ -247,9 +251,9 @@ async function executeBatchQuery(credential, batch, sessionKey) {
247
251
  }
248
252
  const items = createClient(name, table).items;
249
253
  if (update) {
250
- await items.upsert(update, { accessCondition: options.accessCondition, sessionToken: options.sessionToken, initialHeaders: options.initialHeaders, priorityLevel: options.priorityLevel });
254
+ await items.upsert(update, { accessCondition: options.accessCondition, sessionToken: options.sessionToken, initialHeaders: options.initialHeaders, priorityLevel: options.priorityLevel, abortSignal: this.signal });
251
255
  }
252
- ({ resources: rows } = await (query ? items.query(query, options).fetchAll() : items.readAll(options).fetchAll()));
256
+ ({ resources: rows } = await (query ? items.query(query, attachSignal(options)).fetchAll() : items.readAll(attachSignal(options)).fetchAll()));
253
257
  }
254
258
  else {
255
259
  closeClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/azure",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Azure cloud functions for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "publishConfig": {
@@ -19,11 +19,11 @@
19
19
  "license": "MIT",
20
20
  "homepage": "https://github.com/anpham6/pi-r#readme",
21
21
  "dependencies": {
22
- "@e-mc/cloud": "^0.11.2",
23
- "@e-mc/module": "^0.11.2",
24
- "@e-mc/types": "^0.11.2",
25
- "@azure/cosmos": "^4.2.0",
22
+ "@e-mc/cloud": "^0.11.4",
23
+ "@e-mc/module": "^0.11.4",
24
+ "@e-mc/types": "^0.11.4",
25
+ "@azure/cosmos": "^4.3.0",
26
26
  "@azure/identity": "4.6.0",
27
- "@azure/storage-blob": "^12.26.0"
27
+ "@azure/storage-blob": "^12.27.0"
28
28
  }
29
29
  }