@reddb-io/client 1.20.0-rc.186 → 1.20.0-rc.191
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/package.json +1 -1
- package/src/documents.js +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reddb-io/client",
|
|
3
|
-
"version": "1.20.0-rc.
|
|
3
|
+
"version": "1.20.0-rc.191",
|
|
4
4
|
"description": "Thin remote-only RedDB driver. Downloads the `red_client` binary on install. Speaks RedWire/gRPC/HTTP. Embedded URIs (memory://, file://, red:///path) are rejected — use @reddb-io/sdk for those.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/documents.js
CHANGED
|
@@ -9,7 +9,7 @@ export class DocumentClient {
|
|
|
9
9
|
validateObject(document, 'documents.insert document')
|
|
10
10
|
await this.ensureCollection(collection)
|
|
11
11
|
const result = await this.db.query(
|
|
12
|
-
`INSERT INTO ${sqlIdentifierPath(collection)} DOCUMENT
|
|
12
|
+
`INSERT INTO ${sqlIdentifierPath(collection)} DOCUMENT VALUES (${sqlJsonInlineLiteral(document)}) RETURNING *`,
|
|
13
13
|
)
|
|
14
14
|
const item = result.rows?.[0]
|
|
15
15
|
if (!item || item.rid == null) {
|
|
@@ -113,6 +113,12 @@ function sqlJsonLiteral(value) {
|
|
|
113
113
|
return sqlString(JSON.stringify(value))
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
// ADR 0067 (#1709): a document body is written as an inline strict-JSON
|
|
117
|
+
// literal (no surrounding quotes) — the quoted-string coercion is removed.
|
|
118
|
+
function sqlJsonInlineLiteral(value) {
|
|
119
|
+
return JSON.stringify(value)
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
function sqlValueLiteral(value) {
|
|
117
123
|
if (value == null) return 'NULL'
|
|
118
124
|
if (typeof value === 'number' || typeof value === 'boolean') return String(value)
|