@pgxsinkit/client 0.1.28 → 0.1.30
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/index.js +43 -30
- package/dist/index.js.map +5 -5
- package/package.json +3 -3
- package/src/mutation.ts +9 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgxsinkit/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"build": "bun --cwd ../.. run build:public-packages"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@pgxsinkit/contracts": "^0.1.
|
|
26
|
-
"@pgxsinkit/sync-engine": "^0.1.
|
|
25
|
+
"@pgxsinkit/contracts": "^0.1.30",
|
|
26
|
+
"@pgxsinkit/sync-engine": "^0.1.30"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@electric-sql/pglite": "0.5.1",
|
package/src/mutation.ts
CHANGED
|
@@ -842,12 +842,12 @@ function createOptimisticRecordFromContext<TCreate, TRecord>(context: TableConte
|
|
|
842
842
|
};
|
|
843
843
|
const nowUs = nowMicroseconds();
|
|
844
844
|
|
|
845
|
-
if (hasProperty(context, "createdAtUs") && record
|
|
846
|
-
record
|
|
845
|
+
if (hasProperty(context, "createdAtUs") && record["createdAtUs"] === undefined) {
|
|
846
|
+
record["createdAtUs"] = nowUs;
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
-
if (hasProperty(context, "updatedAtUs") && record
|
|
850
|
-
record
|
|
849
|
+
if (hasProperty(context, "updatedAtUs") && record["updatedAtUs"] === undefined) {
|
|
850
|
+
record["updatedAtUs"] = nowUs;
|
|
851
851
|
}
|
|
852
852
|
|
|
853
853
|
for (const { propertyKey, column } of context.columns) {
|
|
@@ -1326,7 +1326,7 @@ async function flushBatch(
|
|
|
1326
1326
|
context,
|
|
1327
1327
|
stripManagedFields(
|
|
1328
1328
|
context,
|
|
1329
|
-
(rawPayload
|
|
1329
|
+
(rawPayload["value"] ?? rawPayload["patch"] ?? rawPayload) as Record<string, unknown>,
|
|
1330
1330
|
row.mutationKind as "create" | "update",
|
|
1331
1331
|
),
|
|
1332
1332
|
),
|
|
@@ -1825,11 +1825,11 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
|
|
1827
1827
|
class MutationRequestError extends Error {
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
) {
|
|
1828
|
+
readonly status: number;
|
|
1829
|
+
|
|
1830
|
+
constructor(message: string, status: number) {
|
|
1832
1831
|
super(message);
|
|
1833
1832
|
this.name = "MutationRequestError";
|
|
1833
|
+
this.status = status;
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|