@cellaware/utils 5.3.4 → 5.3.5
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/azure/cosmos.d.ts +4 -0
- package/dist/azure/cosmos.js +11 -0
- package/package.json +1 -1
package/dist/azure/cosmos.d.ts
CHANGED
|
@@ -92,3 +92,7 @@ export declare function cosmosDelete(databaseId: string, collectionId: string, p
|
|
|
92
92
|
* Will only update a **single** record. If multiple records are returned from `query`, we will only update the first one.
|
|
93
93
|
*/
|
|
94
94
|
export declare function cosmosUpdate(databaseId: string, collectionId: string, partitionKey: string, query: string, data: any): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Simply deletes an existing record(s) then inserts a new one.
|
|
97
|
+
*/
|
|
98
|
+
export declare function cosmosUpsert(databaseId: string, collectionId: string, partitionKey: string, query: string, data: any): Promise<boolean>;
|
package/dist/azure/cosmos.js
CHANGED
|
@@ -247,3 +247,14 @@ export async function cosmosUpdate(databaseId, collectionId, partitionKey, query
|
|
|
247
247
|
return false;
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Simply deletes an existing record(s) then inserts a new one.
|
|
252
|
+
*/
|
|
253
|
+
export async function cosmosUpsert(databaseId, collectionId, partitionKey, query, data) {
|
|
254
|
+
const delRes = await cosmosDelete(databaseId, collectionId, partitionKey, query);
|
|
255
|
+
if (!delRes) {
|
|
256
|
+
return delRes;
|
|
257
|
+
}
|
|
258
|
+
const insRes = await cosmosInsert(databaseId, collectionId, partitionKey, data);
|
|
259
|
+
return insRes;
|
|
260
|
+
}
|