couchbase 4.2.5-dev.2 → 4.2.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/README.md +81 -9
- package/package.json +14 -14
- package/scripts/createPlatformPackages.js +1 -4
package/README.md
CHANGED
@@ -41,20 +41,92 @@ successfully established.
|
|
41
41
|
Here is a simple example of instantiating a connection, adding a new document
|
42
42
|
into the bucket and then retrieving its contents:
|
43
43
|
|
44
|
+
**Javascript:**
|
44
45
|
```javascript
|
45
|
-
|
46
|
+
const couchbase = require('couchbase')
|
47
|
+
|
48
|
+
async function main() {
|
49
|
+
const cluster = await couchbase.connect(
|
50
|
+
'couchbase://127.0.0.1',
|
51
|
+
{
|
52
|
+
username: 'username',
|
53
|
+
password: 'password',
|
54
|
+
})
|
55
|
+
|
56
|
+
const bucket = cluster.bucket('default')
|
57
|
+
const coll = bucket.defaultCollection()
|
58
|
+
await coll.upsert('testdoc', { foo: 'bar' })
|
59
|
+
|
60
|
+
const res = await coll.get('testdoc')
|
61
|
+
console.log(res.content)
|
62
|
+
}
|
63
|
+
|
64
|
+
// Run the main function
|
65
|
+
main()
|
66
|
+
.then((_) => {
|
67
|
+
console.log ('Success!')
|
68
|
+
})
|
69
|
+
.catch((err) => {
|
70
|
+
console.log('ERR:', err)
|
71
|
+
})
|
72
|
+
```
|
46
73
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
74
|
+
**Typescript:**
|
75
|
+
```javascript
|
76
|
+
import {
|
77
|
+
Bucket,
|
78
|
+
Cluster,
|
79
|
+
Collection,
|
80
|
+
connect,
|
81
|
+
GetResult,
|
82
|
+
} from 'couchbase'
|
83
|
+
|
84
|
+
async function main() {
|
85
|
+
const cluster: Cluster = await connect(
|
86
|
+
'couchbase://127.0.0.1',
|
87
|
+
{
|
88
|
+
username: 'username',
|
89
|
+
password: 'password',
|
90
|
+
})
|
91
|
+
|
92
|
+
const bucket: Bucket = cluster.bucket('default')
|
93
|
+
const coll: Collection = bucket.defaultCollection()
|
94
|
+
await coll.upsert('testdoc', { foo: 'bar' })
|
95
|
+
|
96
|
+
const res: GetResult = await coll.get('testdoc')
|
97
|
+
console.log(res.content)
|
98
|
+
}
|
99
|
+
|
100
|
+
// Run the main function
|
101
|
+
main()
|
102
|
+
.then((_) => {
|
103
|
+
console.log ('Success!')
|
52
104
|
})
|
105
|
+
.catch((err) => {
|
106
|
+
console.log('ERR:', err)
|
107
|
+
})
|
108
|
+
```
|
109
|
+
|
110
|
+
## AWS Lambda
|
111
|
+
|
112
|
+
Version 4.2.5 of the SDK significantly reduces the size of the prebuilt binary provided with the SDK on supported platforms. The reduction
|
113
|
+
enables the SDK to meet the [minimum size requirements](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html) for an AWS lambda deployment package without extra steps for reducing the size of the package. However, if further size reduction is desired, the SDK provides a script to provide recommendations for size reduction.
|
114
|
+
|
115
|
+
**Script:**
|
116
|
+
```bash
|
117
|
+
npm explore couchbase -- npm run help-prune
|
118
|
+
```
|
119
|
+
|
120
|
+
**Example output:**
|
121
|
+
```bash
|
122
|
+
Checking for platform packages in /tmp/couchnode-test/node_modules/@couchbase that do not match the expected platform package (couchbase-linux-x64-openssl1).
|
123
|
+
Found mismatch: Path=/tmp/couchnode-test/node_modules/@couchbase/couchbase-linuxmusl-x64-openssl1
|
53
124
|
|
54
|
-
|
125
|
+
Recommendations for pruning:
|
55
126
|
|
56
|
-
|
57
|
-
|
127
|
+
Removing mismatched platform=couchbase-linuxmusl-x64-openssl1 (path=/tmp/couchnode-test/node_modules/@couchbase/couchbase-linuxmusl-x64-openssl1) saves ~13.31 MB on disk.
|
128
|
+
Removing Couchbase deps/ (path=/tmp/couchnode-test/node_modules/couchbase/deps) saves ~45.51 MB on disk.
|
129
|
+
Removing Couchbase src/ (path=/tmp/couchnode-test/node_modules/couchbase/src) saves ~0.61 MB on disk.
|
58
130
|
```
|
59
131
|
|
60
132
|
## Documentation
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
},
|
5
5
|
"description": "The official Couchbase Node.js Client Library.",
|
6
6
|
"engines": {
|
7
|
-
"node": ">=
|
7
|
+
"node": ">=16"
|
8
8
|
},
|
9
9
|
"homepage": "http://www.couchbase.com/communities/nodejs",
|
10
10
|
"keywords": [
|
@@ -55,7 +55,7 @@
|
|
55
55
|
"type": "git",
|
56
56
|
"url": "http://github.com/couchbase/couchnode.git"
|
57
57
|
},
|
58
|
-
"version": "4.2.5
|
58
|
+
"version": "4.2.5",
|
59
59
|
"config": {
|
60
60
|
"native": false
|
61
61
|
},
|
@@ -80,17 +80,17 @@
|
|
80
80
|
]
|
81
81
|
},
|
82
82
|
"optionalDependencies": {
|
83
|
-
"@couchbase/couchbase-darwin-arm64-openssl1": "4.2.5
|
84
|
-
"@couchbase/couchbase-darwin-arm64-openssl3": "4.2.5
|
85
|
-
"@couchbase/couchbase-darwin-x64-openssl1": "4.2.5
|
86
|
-
"@couchbase/couchbase-darwin-x64-openssl3": "4.2.5
|
87
|
-
"@couchbase/couchbase-linux-arm64-openssl1": "4.2.5
|
88
|
-
"@couchbase/couchbase-linux-arm64-openssl3": "4.2.5
|
89
|
-
"@couchbase/couchbase-linux-x64-openssl1": "4.2.5
|
90
|
-
"@couchbase/couchbase-linux-x64-openssl3": "4.2.5
|
91
|
-
"@couchbase/couchbase-linuxmusl-x64-openssl1": "4.2.5
|
92
|
-
"@couchbase/couchbase-linuxmusl-x64-openssl3": "4.2.5
|
93
|
-
"@couchbase/couchbase-win32-x64-openssl1": "4.2.5
|
94
|
-
"@couchbase/couchbase-win32-x64-openssl3": "4.2.5
|
83
|
+
"@couchbase/couchbase-darwin-arm64-openssl1": "4.2.5",
|
84
|
+
"@couchbase/couchbase-darwin-arm64-openssl3": "4.2.5",
|
85
|
+
"@couchbase/couchbase-darwin-x64-openssl1": "4.2.5",
|
86
|
+
"@couchbase/couchbase-darwin-x64-openssl3": "4.2.5",
|
87
|
+
"@couchbase/couchbase-linux-arm64-openssl1": "4.2.5",
|
88
|
+
"@couchbase/couchbase-linux-arm64-openssl3": "4.2.5",
|
89
|
+
"@couchbase/couchbase-linux-x64-openssl1": "4.2.5",
|
90
|
+
"@couchbase/couchbase-linux-x64-openssl3": "4.2.5",
|
91
|
+
"@couchbase/couchbase-linuxmusl-x64-openssl1": "4.2.5",
|
92
|
+
"@couchbase/couchbase-linuxmusl-x64-openssl3": "4.2.5",
|
93
|
+
"@couchbase/couchbase-win32-x64-openssl1": "4.2.5",
|
94
|
+
"@couchbase/couchbase-win32-x64-openssl3": "4.2.5"
|
95
95
|
}
|
96
96
|
}
|
@@ -53,10 +53,7 @@ try {
|
|
53
53
|
fs.renameSync(oldPath, path.join(newPath, newPrebuildName))
|
54
54
|
const platformPackage = `@${packageName}/${platPkg}`
|
55
55
|
// build the platform package files: package.json, README and index.js
|
56
|
-
const engines = { node:
|
57
|
-
if (runtime === 'napi') {
|
58
|
-
engines.node = nodeVersion >= 18 ? '>=18.0.0' : '<18'
|
59
|
-
}
|
56
|
+
const engines = { node: nodeVersion >= 18 ? '>=18' : '<18' }
|
60
57
|
fs.writeFileSync(
|
61
58
|
path.join(newPath, 'package.json'),
|
62
59
|
JSON.stringify(
|