@hot-updater/azure 1.1.13 → 1.1.15
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/functions/index.mjs +34 -9
- package/dist/index.cjs +43 -8
- package/dist/index.mjs +43 -8
- package/dist/init/index.cjs +43 -8
- package/dist/init/index.mjs +43 -8
- package/package.json +6 -6
package/dist/functions/index.mjs
CHANGED
|
@@ -7998,7 +7998,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
7998
7998
|
};
|
|
7999
7999
|
//#endregion
|
|
8000
8000
|
//#region ../../packages/server/dist/version.mjs
|
|
8001
|
-
const HOT_UPDATER_SERVER_VERSION = "1.1.
|
|
8001
|
+
const HOT_UPDATER_SERVER_VERSION = "1.1.15";
|
|
8002
8002
|
//#endregion
|
|
8003
8003
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
8004
8004
|
const createVersionRouteHandlers = (plugins = []) => {
|
|
@@ -70348,6 +70348,7 @@ const statusOf = (error) => {
|
|
|
70348
70348
|
if (typeof status === "number") return status;
|
|
70349
70349
|
}
|
|
70350
70350
|
};
|
|
70351
|
+
const POINT_READS = 2;
|
|
70351
70352
|
const missingContainer = (error) => {
|
|
70352
70353
|
throw statusOf(error) === 404 ? Object.assign(new Error(error.message, { cause: error }), { code: "42P01" }) : error;
|
|
70353
70354
|
};
|
|
@@ -70399,16 +70400,36 @@ const isWideAdd = (op) => op.type === "add" && Object.keys(op.by).length + (op.e
|
|
|
70399
70400
|
const emulatorAborted = (error) => statusOf(error) === 500 && /PostgresError\(SqlState\(E(25P02|40001|40P01)\)/.test(String(error instanceof Error ? error.message : error));
|
|
70400
70401
|
const createCosmosStore = ({ client, databaseId, containerId, engine, nativePageSize }) => {
|
|
70401
70402
|
const container = client.database(databaseId).container(containerId);
|
|
70403
|
+
const pointRead = async (id) => {
|
|
70404
|
+
const response = await container.item(id, COSMOS_PARTITION).read().catch(missingContainer);
|
|
70405
|
+
if (response.statusCode !== 404) return response.resource;
|
|
70406
|
+
const headers = response.headers;
|
|
70407
|
+
if (headers["x-ms-documentdb-partitionkeyrangeid"] === void 0 && headers["x-ms-substatus"] !== void 0) missingContainer(Object.assign(/* @__PURE__ */ new Error(`Cosmos DB container ${containerId} is missing.`), { code: 404 }));
|
|
70408
|
+
};
|
|
70402
70409
|
const readStates = async (ids, rowIds) => {
|
|
70403
70410
|
const states = /* @__PURE__ */ new Map();
|
|
70404
|
-
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]])
|
|
70405
|
-
|
|
70406
|
-
|
|
70407
|
-
|
|
70408
|
-
|
|
70409
|
-
|
|
70410
|
-
|
|
70411
|
-
|
|
70411
|
+
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]]) {
|
|
70412
|
+
if (group.length <= POINT_READS) {
|
|
70413
|
+
for (const item of await Promise.all(group.map(pointRead))) {
|
|
70414
|
+
if (item === void 0) continue;
|
|
70415
|
+
states.set(item.id, {
|
|
70416
|
+
etag: item._etag,
|
|
70417
|
+
v: item.row?._v,
|
|
70418
|
+
expireAt: item.expireAt ?? null,
|
|
70419
|
+
row: projection === "" ? void 0 : item.row
|
|
70420
|
+
});
|
|
70421
|
+
}
|
|
70422
|
+
continue;
|
|
70423
|
+
}
|
|
70424
|
+
for (let at = 0; at < group.length; at += GET_BATCH) {
|
|
70425
|
+
const { resources } = await container.items.query(`SELECT c.id, c._etag AS etag, c.row._v AS v, c.expireAt${projection} FROM c WHERE c.id IN (${idList(group.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
70426
|
+
for (const { id, etag, v, expireAt, row } of resources) states.set(id, {
|
|
70427
|
+
etag,
|
|
70428
|
+
v,
|
|
70429
|
+
expireAt: expireAt ?? null,
|
|
70430
|
+
row
|
|
70431
|
+
});
|
|
70432
|
+
}
|
|
70412
70433
|
}
|
|
70413
70434
|
return states;
|
|
70414
70435
|
};
|
|
@@ -70533,6 +70554,10 @@ const createCosmosStore = ({ client, databaseId, containerId, engine, nativePage
|
|
|
70533
70554
|
async get(keys) {
|
|
70534
70555
|
const found = /* @__PURE__ */ new Map();
|
|
70535
70556
|
const ids = [...new Set(keys.map(cosmosItemId))];
|
|
70557
|
+
if (ids.length <= POINT_READS) {
|
|
70558
|
+
for (const item of await Promise.all(ids.map(pointRead))) if (item !== void 0) found.set(item.id, toRow(item.row));
|
|
70559
|
+
return keys.map((key) => found.get(cosmosItemId(key)) ?? null);
|
|
70560
|
+
}
|
|
70536
70561
|
for (let at = 0; at < ids.length; at += GET_BATCH) {
|
|
70537
70562
|
const { resources } = await container.items.query(`SELECT c.id, c.row FROM c WHERE c.id IN (${idList(ids.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
70538
70563
|
for (const resource of resources) found.set(resource.id, toRow(resource.row));
|
package/dist/index.cjs
CHANGED
|
@@ -271,6 +271,12 @@ const statusOf = (error) => {
|
|
|
271
271
|
if (typeof status === "number") return status;
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
|
+
/**
|
|
275
|
+
* The most items read by point reads rather than one query. On Strong
|
|
276
|
+
* consistency a point read costs 2 RU and a query of 1, 3, or 10 ids 5.9,
|
|
277
|
+
* 6.4, and 8.3 RU (Azure Cosmos DB, 2026-11-14).
|
|
278
|
+
*/
|
|
279
|
+
const POINT_READS = 2;
|
|
274
280
|
/** A missing database or container reads as a missing schema, like SQL's 42P01. */
|
|
275
281
|
const missingContainer = (error) => {
|
|
276
282
|
throw statusOf(error) === 404 ? Object.assign(new Error(error.message, { cause: error }), { code: "42P01" }) : error;
|
|
@@ -366,19 +372,44 @@ const emulatorAborted = (error) => statusOf(error) === 500 && /PostgresError\(Sq
|
|
|
366
372
|
const createCosmosStore = ({ client, databaseId, containerId, engine, nativePageSize }) => {
|
|
367
373
|
const container = client.database(databaseId).container(containerId);
|
|
368
374
|
/**
|
|
375
|
+
* The item `id` names, or undefined when it is missing. A missing item
|
|
376
|
+
* answers 404 from its partition; a missing container or database answers
|
|
377
|
+
* 404 with a substatus and no partition, and reads as a missing schema.
|
|
378
|
+
*/
|
|
379
|
+
const pointRead = async (id) => {
|
|
380
|
+
const response = await container.item(id, COSMOS_PARTITION).read().catch(missingContainer);
|
|
381
|
+
if (response.statusCode !== 404) return response.resource;
|
|
382
|
+
const headers = response.headers;
|
|
383
|
+
if (headers["x-ms-documentdb-partitionkeyrangeid"] === void 0 && headers["x-ms-substatus"] !== void 0) missingContainer(Object.assign(/* @__PURE__ */ new Error(`Cosmos DB container ${containerId} is missing.`), { code: 404 }));
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
369
386
|
* The state of the items `ids` names, by id, with the rows of `rowIds`;
|
|
370
387
|
* a missing item has none.
|
|
371
388
|
*/
|
|
372
389
|
const readStates = async (ids, rowIds) => {
|
|
373
390
|
const states = /* @__PURE__ */ new Map();
|
|
374
|
-
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]])
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
391
|
+
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]]) {
|
|
392
|
+
if (group.length <= POINT_READS) {
|
|
393
|
+
for (const item of await Promise.all(group.map(pointRead))) {
|
|
394
|
+
if (item === void 0) continue;
|
|
395
|
+
states.set(item.id, {
|
|
396
|
+
etag: item._etag,
|
|
397
|
+
v: item.row?._v,
|
|
398
|
+
expireAt: item.expireAt ?? null,
|
|
399
|
+
row: projection === "" ? void 0 : item.row
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
for (let at = 0; at < group.length; at += GET_BATCH) {
|
|
405
|
+
const { resources } = await container.items.query(`SELECT c.id, c._etag AS etag, c.row._v AS v, c.expireAt${projection} FROM c WHERE c.id IN (${idList(group.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
406
|
+
for (const { id, etag, v, expireAt, row } of resources) states.set(id, {
|
|
407
|
+
etag,
|
|
408
|
+
v,
|
|
409
|
+
expireAt: expireAt ?? null,
|
|
410
|
+
row
|
|
411
|
+
});
|
|
412
|
+
}
|
|
382
413
|
}
|
|
383
414
|
return states;
|
|
384
415
|
};
|
|
@@ -509,6 +540,10 @@ const createCosmosStore = ({ client, databaseId, containerId, engine, nativePage
|
|
|
509
540
|
async get(keys) {
|
|
510
541
|
const found = /* @__PURE__ */ new Map();
|
|
511
542
|
const ids = [...new Set(keys.map(cosmosItemId))];
|
|
543
|
+
if (ids.length <= POINT_READS) {
|
|
544
|
+
for (const item of await Promise.all(ids.map(pointRead))) if (item !== void 0) found.set(item.id, toRow(item.row));
|
|
545
|
+
return keys.map((key) => found.get(cosmosItemId(key)) ?? null);
|
|
546
|
+
}
|
|
512
547
|
for (let at = 0; at < ids.length; at += GET_BATCH) {
|
|
513
548
|
const { resources } = await container.items.query(`SELECT c.id, c.row FROM c WHERE c.id IN (${idList(ids.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
514
549
|
for (const resource of resources) found.set(resource.id, toRow(resource.row));
|
package/dist/index.mjs
CHANGED
|
@@ -270,6 +270,12 @@ const statusOf = (error) => {
|
|
|
270
270
|
if (typeof status === "number") return status;
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* The most items read by point reads rather than one query. On Strong
|
|
275
|
+
* consistency a point read costs 2 RU and a query of 1, 3, or 10 ids 5.9,
|
|
276
|
+
* 6.4, and 8.3 RU (Azure Cosmos DB, 2026-11-14).
|
|
277
|
+
*/
|
|
278
|
+
const POINT_READS = 2;
|
|
273
279
|
/** A missing database or container reads as a missing schema, like SQL's 42P01. */
|
|
274
280
|
const missingContainer = (error) => {
|
|
275
281
|
throw statusOf(error) === 404 ? Object.assign(new Error(error.message, { cause: error }), { code: "42P01" }) : error;
|
|
@@ -365,19 +371,44 @@ const emulatorAborted = (error) => statusOf(error) === 500 && /PostgresError\(Sq
|
|
|
365
371
|
const createCosmosStore = ({ client, databaseId, containerId, engine, nativePageSize }) => {
|
|
366
372
|
const container = client.database(databaseId).container(containerId);
|
|
367
373
|
/**
|
|
374
|
+
* The item `id` names, or undefined when it is missing. A missing item
|
|
375
|
+
* answers 404 from its partition; a missing container or database answers
|
|
376
|
+
* 404 with a substatus and no partition, and reads as a missing schema.
|
|
377
|
+
*/
|
|
378
|
+
const pointRead = async (id) => {
|
|
379
|
+
const response = await container.item(id, COSMOS_PARTITION).read().catch(missingContainer);
|
|
380
|
+
if (response.statusCode !== 404) return response.resource;
|
|
381
|
+
const headers = response.headers;
|
|
382
|
+
if (headers["x-ms-documentdb-partitionkeyrangeid"] === void 0 && headers["x-ms-substatus"] !== void 0) missingContainer(Object.assign(/* @__PURE__ */ new Error(`Cosmos DB container ${containerId} is missing.`), { code: 404 }));
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
368
385
|
* The state of the items `ids` names, by id, with the rows of `rowIds`;
|
|
369
386
|
* a missing item has none.
|
|
370
387
|
*/
|
|
371
388
|
const readStates = async (ids, rowIds) => {
|
|
372
389
|
const states = /* @__PURE__ */ new Map();
|
|
373
|
-
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]])
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
390
|
+
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]]) {
|
|
391
|
+
if (group.length <= POINT_READS) {
|
|
392
|
+
for (const item of await Promise.all(group.map(pointRead))) {
|
|
393
|
+
if (item === void 0) continue;
|
|
394
|
+
states.set(item.id, {
|
|
395
|
+
etag: item._etag,
|
|
396
|
+
v: item.row?._v,
|
|
397
|
+
expireAt: item.expireAt ?? null,
|
|
398
|
+
row: projection === "" ? void 0 : item.row
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
for (let at = 0; at < group.length; at += GET_BATCH) {
|
|
404
|
+
const { resources } = await container.items.query(`SELECT c.id, c._etag AS etag, c.row._v AS v, c.expireAt${projection} FROM c WHERE c.id IN (${idList(group.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
405
|
+
for (const { id, etag, v, expireAt, row } of resources) states.set(id, {
|
|
406
|
+
etag,
|
|
407
|
+
v,
|
|
408
|
+
expireAt: expireAt ?? null,
|
|
409
|
+
row
|
|
410
|
+
});
|
|
411
|
+
}
|
|
381
412
|
}
|
|
382
413
|
return states;
|
|
383
414
|
};
|
|
@@ -508,6 +539,10 @@ const createCosmosStore = ({ client, databaseId, containerId, engine, nativePage
|
|
|
508
539
|
async get(keys) {
|
|
509
540
|
const found = /* @__PURE__ */ new Map();
|
|
510
541
|
const ids = [...new Set(keys.map(cosmosItemId))];
|
|
542
|
+
if (ids.length <= POINT_READS) {
|
|
543
|
+
for (const item of await Promise.all(ids.map(pointRead))) if (item !== void 0) found.set(item.id, toRow(item.row));
|
|
544
|
+
return keys.map((key) => found.get(cosmosItemId(key)) ?? null);
|
|
545
|
+
}
|
|
511
546
|
for (let at = 0; at < ids.length; at += GET_BATCH) {
|
|
512
547
|
const { resources } = await container.items.query(`SELECT c.id, c.row FROM c WHERE c.id IN (${idList(ids.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
513
548
|
for (const resource of resources) found.set(resource.id, toRow(resource.row));
|
package/dist/init/index.cjs
CHANGED
|
@@ -173,6 +173,12 @@ const statusOf = (error) => {
|
|
|
173
173
|
if (typeof status === "number") return status;
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* The most items read by point reads rather than one query. On Strong
|
|
178
|
+
* consistency a point read costs 2 RU and a query of 1, 3, or 10 ids 5.9,
|
|
179
|
+
* 6.4, and 8.3 RU (Azure Cosmos DB, 2026-11-14).
|
|
180
|
+
*/
|
|
181
|
+
const POINT_READS = 2;
|
|
176
182
|
/** A missing database or container reads as a missing schema, like SQL's 42P01. */
|
|
177
183
|
const missingContainer = (error) => {
|
|
178
184
|
throw statusOf(error) === 404 ? Object.assign(new Error(error.message, { cause: error }), { code: "42P01" }) : error;
|
|
@@ -268,19 +274,44 @@ const emulatorAborted = (error) => statusOf(error) === 500 && /PostgresError\(Sq
|
|
|
268
274
|
const createCosmosStore = ({ client, databaseId, containerId, engine, nativePageSize }) => {
|
|
269
275
|
const container = client.database(databaseId).container(containerId);
|
|
270
276
|
/**
|
|
277
|
+
* The item `id` names, or undefined when it is missing. A missing item
|
|
278
|
+
* answers 404 from its partition; a missing container or database answers
|
|
279
|
+
* 404 with a substatus and no partition, and reads as a missing schema.
|
|
280
|
+
*/
|
|
281
|
+
const pointRead = async (id) => {
|
|
282
|
+
const response = await container.item(id, COSMOS_PARTITION).read().catch(missingContainer);
|
|
283
|
+
if (response.statusCode !== 404) return response.resource;
|
|
284
|
+
const headers = response.headers;
|
|
285
|
+
if (headers["x-ms-documentdb-partitionkeyrangeid"] === void 0 && headers["x-ms-substatus"] !== void 0) missingContainer(Object.assign(/* @__PURE__ */ new Error(`Cosmos DB container ${containerId} is missing.`), { code: 404 }));
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
271
288
|
* The state of the items `ids` names, by id, with the rows of `rowIds`;
|
|
272
289
|
* a missing item has none.
|
|
273
290
|
*/
|
|
274
291
|
const readStates = async (ids, rowIds) => {
|
|
275
292
|
const states = /* @__PURE__ */ new Map();
|
|
276
|
-
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]])
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
293
|
+
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]]) {
|
|
294
|
+
if (group.length <= POINT_READS) {
|
|
295
|
+
for (const item of await Promise.all(group.map(pointRead))) {
|
|
296
|
+
if (item === void 0) continue;
|
|
297
|
+
states.set(item.id, {
|
|
298
|
+
etag: item._etag,
|
|
299
|
+
v: item.row?._v,
|
|
300
|
+
expireAt: item.expireAt ?? null,
|
|
301
|
+
row: projection === "" ? void 0 : item.row
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
for (let at = 0; at < group.length; at += GET_BATCH) {
|
|
307
|
+
const { resources } = await container.items.query(`SELECT c.id, c._etag AS etag, c.row._v AS v, c.expireAt${projection} FROM c WHERE c.id IN (${idList(group.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
308
|
+
for (const { id, etag, v, expireAt, row } of resources) states.set(id, {
|
|
309
|
+
etag,
|
|
310
|
+
v,
|
|
311
|
+
expireAt: expireAt ?? null,
|
|
312
|
+
row
|
|
313
|
+
});
|
|
314
|
+
}
|
|
284
315
|
}
|
|
285
316
|
return states;
|
|
286
317
|
};
|
|
@@ -411,6 +442,10 @@ const createCosmosStore = ({ client, databaseId, containerId, engine, nativePage
|
|
|
411
442
|
async get(keys) {
|
|
412
443
|
const found = /* @__PURE__ */ new Map();
|
|
413
444
|
const ids = [...new Set(keys.map(cosmosItemId))];
|
|
445
|
+
if (ids.length <= POINT_READS) {
|
|
446
|
+
for (const item of await Promise.all(ids.map(pointRead))) if (item !== void 0) found.set(item.id, toRow(item.row));
|
|
447
|
+
return keys.map((key) => found.get(cosmosItemId(key)) ?? null);
|
|
448
|
+
}
|
|
414
449
|
for (let at = 0; at < ids.length; at += GET_BATCH) {
|
|
415
450
|
const { resources } = await container.items.query(`SELECT c.id, c.row FROM c WHERE c.id IN (${idList(ids.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
416
451
|
for (const resource of resources) found.set(resource.id, toRow(resource.row));
|
package/dist/init/index.mjs
CHANGED
|
@@ -168,6 +168,12 @@ const statusOf = (error) => {
|
|
|
168
168
|
if (typeof status === "number") return status;
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* The most items read by point reads rather than one query. On Strong
|
|
173
|
+
* consistency a point read costs 2 RU and a query of 1, 3, or 10 ids 5.9,
|
|
174
|
+
* 6.4, and 8.3 RU (Azure Cosmos DB, 2026-11-14).
|
|
175
|
+
*/
|
|
176
|
+
const POINT_READS = 2;
|
|
171
177
|
/** A missing database or container reads as a missing schema, like SQL's 42P01. */
|
|
172
178
|
const missingContainer = (error) => {
|
|
173
179
|
throw statusOf(error) === 404 ? Object.assign(new Error(error.message, { cause: error }), { code: "42P01" }) : error;
|
|
@@ -263,19 +269,44 @@ const emulatorAborted = (error) => statusOf(error) === 500 && /PostgresError\(Sq
|
|
|
263
269
|
const createCosmosStore = ({ client, databaseId, containerId, engine, nativePageSize }) => {
|
|
264
270
|
const container = client.database(databaseId).container(containerId);
|
|
265
271
|
/**
|
|
272
|
+
* The item `id` names, or undefined when it is missing. A missing item
|
|
273
|
+
* answers 404 from its partition; a missing container or database answers
|
|
274
|
+
* 404 with a substatus and no partition, and reads as a missing schema.
|
|
275
|
+
*/
|
|
276
|
+
const pointRead = async (id) => {
|
|
277
|
+
const response = await container.item(id, COSMOS_PARTITION).read().catch(missingContainer);
|
|
278
|
+
if (response.statusCode !== 404) return response.resource;
|
|
279
|
+
const headers = response.headers;
|
|
280
|
+
if (headers["x-ms-documentdb-partitionkeyrangeid"] === void 0 && headers["x-ms-substatus"] !== void 0) missingContainer(Object.assign(/* @__PURE__ */ new Error(`Cosmos DB container ${containerId} is missing.`), { code: 404 }));
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
266
283
|
* The state of the items `ids` names, by id, with the rows of `rowIds`;
|
|
267
284
|
* a missing item has none.
|
|
268
285
|
*/
|
|
269
286
|
const readStates = async (ids, rowIds) => {
|
|
270
287
|
const states = /* @__PURE__ */ new Map();
|
|
271
|
-
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]])
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
288
|
+
for (const [group, projection] of [[ids.filter((id) => !rowIds.has(id)), ""], [ids.filter((id) => rowIds.has(id)), ", c.row"]]) {
|
|
289
|
+
if (group.length <= POINT_READS) {
|
|
290
|
+
for (const item of await Promise.all(group.map(pointRead))) {
|
|
291
|
+
if (item === void 0) continue;
|
|
292
|
+
states.set(item.id, {
|
|
293
|
+
etag: item._etag,
|
|
294
|
+
v: item.row?._v,
|
|
295
|
+
expireAt: item.expireAt ?? null,
|
|
296
|
+
row: projection === "" ? void 0 : item.row
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
for (let at = 0; at < group.length; at += GET_BATCH) {
|
|
302
|
+
const { resources } = await container.items.query(`SELECT c.id, c._etag AS etag, c.row._v AS v, c.expireAt${projection} FROM c WHERE c.id IN (${idList(group.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
303
|
+
for (const { id, etag, v, expireAt, row } of resources) states.set(id, {
|
|
304
|
+
etag,
|
|
305
|
+
v,
|
|
306
|
+
expireAt: expireAt ?? null,
|
|
307
|
+
row
|
|
308
|
+
});
|
|
309
|
+
}
|
|
279
310
|
}
|
|
280
311
|
return states;
|
|
281
312
|
};
|
|
@@ -406,6 +437,10 @@ const createCosmosStore = ({ client, databaseId, containerId, engine, nativePage
|
|
|
406
437
|
async get(keys) {
|
|
407
438
|
const found = /* @__PURE__ */ new Map();
|
|
408
439
|
const ids = [...new Set(keys.map(cosmosItemId))];
|
|
440
|
+
if (ids.length <= POINT_READS) {
|
|
441
|
+
for (const item of await Promise.all(ids.map(pointRead))) if (item !== void 0) found.set(item.id, toRow(item.row));
|
|
442
|
+
return keys.map((key) => found.get(cosmosItemId(key)) ?? null);
|
|
443
|
+
}
|
|
409
444
|
for (let at = 0; at < ids.length; at += GET_BATCH) {
|
|
410
445
|
const { resources } = await container.items.query(`SELECT c.id, c.row FROM c WHERE c.id IN (${idList(ids.slice(at, at + GET_BATCH))})`, { partitionKey: COSMOS_PARTITION }).fetchAll().catch(missingContainer);
|
|
411
446
|
for (const resource of resources) found.set(resource.id, toRow(resource.row));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/azure",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.15",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@azure/core-auth": "1.11.0",
|
|
43
43
|
"@azure/cosmos": "4.10.1",
|
|
44
44
|
"@azure/storage-blob": "12.34.0",
|
|
45
|
-
"@hot-updater/
|
|
46
|
-
"@hot-updater/
|
|
47
|
-
"@hot-updater/server": "1.1.
|
|
48
|
-
"@hot-updater/
|
|
45
|
+
"@hot-updater/plugin-core": "1.1.15",
|
|
46
|
+
"@hot-updater/protocol": "1.1.15",
|
|
47
|
+
"@hot-updater/server": "1.1.15",
|
|
48
|
+
"@hot-updater/cli-tools": "1.1.15"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@azure/functions": "4.16.5",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"execa": "9.5.2",
|
|
54
54
|
"jszip": "^3.10.1",
|
|
55
55
|
"vitest": "4.1.4",
|
|
56
|
-
"@hot-updater/test-utils": "1.1.
|
|
56
|
+
"@hot-updater/test-utils": "1.1.15"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsdown",
|