@azure/cosmos
Version:
Microsoft Azure Cosmos DB Service Node.js SDK for NOSQL API
74 lines (73 loc) • 2.67 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Conflicts_exports = {};
__export(Conflicts_exports, {
Conflicts: () => Conflicts
});
module.exports = __toCommonJS(Conflicts_exports);
var import_common = require("../../common/index.js");
var import_queryIterator = require("../../queryIterator.js");
class Conflicts {
constructor(container, clientContext) {
this.container = container;
this.clientContext = clientContext;
}
query(query, options) {
const path = (0, import_common.getPathFromLink)(this.container.url, import_common.ResourceType.conflicts);
const id = (0, import_common.getIdFromLink)(this.container.url);
return new import_queryIterator.QueryIterator(
this.clientContext,
query,
options,
(diagNode, innerOptions) => {
return this.clientContext.queryFeed({
path,
resourceType: import_common.ResourceType.conflicts,
resourceId: id,
resultFn: (result) => result.Conflicts,
query,
options: innerOptions,
diagnosticNode: diagNode
});
}
);
}
/**
* Reads all conflicts
* @param options - Use to set options like response page size, continuation tokens, etc.
* @example
* ```ts snippet:ConflictsReadAll
* import { CosmosClient } from "@azure/cosmos";
*
* const endpoint = "https://your-account.documents.azure.com";
* const key = "<database account masterkey>";
* const client = new CosmosClient({ endpoint, key });
* const { database } = await client.databases.createIfNotExists({ id: "Test Database" });
* const container = database.container("Test Container");
*
* const { resources: conflicts } = await container.conflicts.readAll().fetchAll();
* ```
*/
readAll(options) {
return this.query(void 0, options);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Conflicts
});