couchset 0.2.5 → 0.2.7
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/connection.d.ts +1 -0
- package/dist/connection.js +6 -2
- package/dist/connection.js.map +1 -1
- package/package.json +4 -2
package/dist/connection.d.ts
CHANGED
package/dist/connection.js
CHANGED
|
@@ -109,10 +109,14 @@ var CouchbaseConnection = /** @class */ (function () {
|
|
|
109
109
|
_this.bucketName = bucketName;
|
|
110
110
|
_this.username = username;
|
|
111
111
|
_this.password = password;
|
|
112
|
-
var
|
|
112
|
+
var connectionOpt = {
|
|
113
113
|
username: username,
|
|
114
114
|
password: password,
|
|
115
|
-
}
|
|
115
|
+
};
|
|
116
|
+
if (args.proxy) {
|
|
117
|
+
connectionOpt['proxy'] = args.proxy;
|
|
118
|
+
}
|
|
119
|
+
var cluster = new couchbase.Cluster(connectionString, connectionOpt);
|
|
116
120
|
_this.cluster = cluster;
|
|
117
121
|
_this.bucket = _this.cluster.bucket(bucketName);
|
|
118
122
|
return _this;
|
package/dist/connection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAAuC;
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAAuC;AAUvC;;;GAGG;AACH;IAgBI;QAAA,iBAAwB;QAbxB,WAAM,GAAW,IAAI,CAAC;QACtB,YAAO,GAAY,IAAI,CAAC;QAExB,OAAO;QACP,qBAAgB,GAAW,IAAI,CAAC;QAChC,eAAU,GAAW,IAAI,CAAC;QAC1B,aAAQ,GAAW,IAAI,CAAC;QACxB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,KAAK,EAAE,CAAC;gBACb,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YACxC,CAAC;YAED,IAAM,OAAO,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;YAEvE,KAAI,CAAC,OAAO,GAAG,OAAc,CAAC;YAC9B,KAAI,CAAC,MAAM,GAAG,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAE9C,OAAO,KAAI,CAAC;QAChB,CAAC,CAAC;QAEF;;WAEG;QACI,kBAAa,GAAG;YACnB,OAAO,KAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC3C,CAAC,CAAC;QAEK,eAAU,GAAG;YAChB,OAAO,KAAI,CAAC,OAAO,CAAC;QACxB,CAAC,CAAC;QAEK,cAAS,GAAG;YACf,OAAO,KAAI,CAAC,UAAU,CAAC;QAC3B,CAAC,CAAC;QAEF;;WAEG;QACI,aAAQ,GAAG;;gBACd,sBAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAC;;aAC/B,CAAC;IAxEqB,CAAC;IAJxB,sBAAkB,+BAAQ;aAA1B;YACI,OAAO,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC;QAC3D,CAAC;;;OAAA;IA2EL,0BAAC;AAAD,CAAC,AAzFD,IAyFC;AAzFY,kDAAmB;AA2FhC,kBAAe,mBAAmB,CAAC","sourcesContent":["import type {Collection, Cluster, Bucket} from 'couchbase';\nimport * as couchbase from 'couchbase';\n\nexport interface CouchsetArgs {\n connectionString: string;\n bucketName: string;\n username: string;\n password: string;\n proxy?: string;\n}\n\n/**\n * CouchbaseConnection class\n * Only one CouchbaseConnection can exist that's why it's a singleton\n */\nexport class CouchbaseConnection implements CouchsetArgs {\n private static _instance: CouchbaseConnection;\n\n bucket: Bucket = null;\n cluster: Cluster = null;\n\n // Args\n connectionString: string = null;\n bucketName: string = null;\n username: string = null;\n password: string = null;\n\n public static get Instance(): CouchbaseConnection {\n return this._instance || (this._instance = new this());\n }\n\n private constructor() {}\n\n /**\n * start\n */\n public init = async (args: CouchsetArgs): Promise<CouchbaseConnection> => {\n const {connectionString, password, username, bucketName = 'default'} = args;\n\n this.connectionString = connectionString;\n this.bucketName = bucketName;\n this.username = username;\n this.password = password;\n\n const cluster = await couchbase.connect(connectionString, {\n username,\n password,\n });\n\n this.cluster = cluster as any;\n this.bucket = this.cluster.bucket(bucketName);\n\n return this;\n };\n\n /**\n * start serverless start\n */\n public initServerless = (args: CouchsetArgs): CouchbaseConnection => {\n const {connectionString, password, username, bucketName = 'default'} = args;\n\n this.connectionString = connectionString;\n this.bucketName = bucketName;\n this.username = username;\n this.password = password;\n\n const connectionOpt = {\n username,\n password,\n };\n\n if (args.proxy) {\n connectionOpt['proxy'] = args.proxy;\n }\n\n const cluster = new couchbase.Cluster(connectionString, connectionOpt);\n\n this.cluster = cluster as any;\n this.bucket = this.cluster.bucket(bucketName);\n\n return this;\n };\n\n /**\n * getCollection\n */\n public getCollection = (): Collection => {\n return this.bucket.defaultCollection();\n };\n\n public getCluster = (): Cluster => {\n return this.cluster;\n };\n\n public getBucket = (): string => {\n return this.bucketName;\n };\n\n /**\n * shutdown cluster\n */\n public shutdown = async (): Promise<void> => {\n return this.cluster.close();\n };\n}\n\nexport default CouchbaseConnection;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "couchset",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Couchbase ORM",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"@types/chai": "^4.2.14",
|
|
63
63
|
"@types/couchbase": "^2.4.9",
|
|
64
64
|
"@types/debug": "^4.1.7",
|
|
65
|
+
"@types/dotenv": "^6.1.1",
|
|
65
66
|
"@types/express": "^4.17.13",
|
|
66
67
|
"@types/lodash": "^4.17.10",
|
|
67
68
|
"@types/mocha": "^8.2.0",
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
"@typescript-eslint/eslint-plugin": "^3.4.0",
|
|
72
73
|
"@typescript-eslint/parser": "^3.4.0",
|
|
73
74
|
"chai": "^4.2.0",
|
|
75
|
+
"dotenv": "^16.4.5",
|
|
74
76
|
"eslint": "7.32.0",
|
|
75
77
|
"eslint-config-prettier": "^6.11.0",
|
|
76
78
|
"eslint-loader": "^4.0.2",
|
|
@@ -93,7 +95,7 @@
|
|
|
93
95
|
},
|
|
94
96
|
"dependencies": {
|
|
95
97
|
"couchbase": "^4.4.2",
|
|
96
|
-
"couchbase-serverless": "^0.0.
|
|
98
|
+
"couchbase-serverless": "^0.0.4",
|
|
97
99
|
"debug": "^4.3.1",
|
|
98
100
|
"lodash": "^4.17.21",
|
|
99
101
|
"uuid": "^8.3.2"
|