@docstack/client 0.1.4 → 0.1.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/lib/index.umd.js CHANGED
@@ -1102,7 +1102,7 @@
1102
1102
  };
1103
1103
  this.addOrUpdateCard = async (params, cardId) => {
1104
1104
  const fnLogger = this.logger.child({ method: "addOrUpdateCard", args: { params, cardId } });
1105
- return new Promise(async (resolve, reject) => {
1105
+ const document = await new Promise(async (resolve, reject) => {
1106
1106
  if (cardId) {
1107
1107
  fnLogger.info("Provided document's id, performing an update");
1108
1108
  const res = await this.updateCard(cardId, params);
@@ -1121,6 +1121,19 @@
1121
1121
  }
1122
1122
  }
1123
1123
  });
1124
+ fnLogger.warn("Updated document", { document });
1125
+ return document;
1126
+ };
1127
+ /**
1128
+ * Pushes a document to the database.
1129
+ * This is an alias for {@alias addOrUpdateCard}.
1130
+ *
1131
+ * @param params - The document data
1132
+ * @param docId - Optional document ID. If provided, performs an update.
1133
+ * @returns The created or updated document
1134
+ */
1135
+ this.push = async (params, docId) => {
1136
+ return this.addOrUpdateCard(params, docId);
1124
1137
  };
1125
1138
  /**
1126
1139
  * Updates an existing document (card) of this class.
@@ -6808,6 +6821,7 @@ async function execute(_stack, params) {
6808
6821
  fnLogger.info("Doc AFTER elaboration (i.e. merge)", { doc_ });
6809
6822
  await this.policyEngine.ensureWriteAllowed(type, doc_);
6810
6823
  let response = await db.put(doc_);
6824
+ doc = doc_;
6811
6825
  // Find me
6812
6826
  fnLogger.info("Response after put", { "response": response });
6813
6827
  if (response.ok && isNewDoc) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docstack/client",
3
3
  "description": "One does not simply stack documents.",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://onyx.ac/docstack",
41
41
  "dependencies": {
42
- "@docstack/shared": "^0.0.5",
42
+ "@docstack/shared": "^0.0.6",
43
43
  "jsondiffpatch": "^0.6.0",
44
44
  "pouchdb-browser": "^9.0.0",
45
45
  "pouchdb-find": "^9.0.0",