oracledb 3.1.2 → 4.2.0
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/CHANGELOG.md +277 -4
- package/LICENSE.md +5906 -360
- package/README.md +7 -8
- package/build/Release/oracledb-4.2.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-4.2.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-4.2.0-linux-x64.node +0 -0
- package/build/Release/oracledb-4.2.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-4.2.0-win32-x64.node +0 -0
- package/build/Release/oracledb-4.2.0-win32-x64.node-buildinfo.txt +1 -0
- package/lib/aqDeqOptions.js +29 -0
- package/lib/aqEnqOptions.js +29 -0
- package/lib/aqMessage.js +29 -0
- package/lib/aqQueue.js +84 -0
- package/lib/connection.js +294 -326
- package/lib/dbObject.js +144 -0
- package/lib/lob.js +125 -132
- package/lib/oracledb.js +162 -483
- package/lib/pool.js +95 -109
- package/lib/{querystream.js → queryStream.js} +31 -30
- package/lib/resultset.js +75 -125
- package/lib/sodaCollection.js +99 -165
- package/lib/sodaDatabase.js +58 -133
- package/lib/sodaDocCursor.js +27 -70
- package/lib/sodaDocument.js +35 -65
- package/lib/sodaOperation.js +96 -252
- package/lib/util.js +78 -71
- package/package/README.md +41 -36
- package/package/install.js +30 -24
- package/package.json +2 -2
- package/build/Release/oracledb-abi48-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi48-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi48-linux-x64.node +0 -0
- package/build/Release/oracledb-abi48-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi48-win32-x64.node +0 -0
- package/build/Release/oracledb-abi48-win32-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi57-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi57-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi57-linux-x64.node +0 -0
- package/build/Release/oracledb-abi57-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi57-win32-x64.node +0 -0
- package/build/Release/oracledb-abi57-win32-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi64-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi64-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi64-linux-x64.node +0 -0
- package/build/Release/oracledb-abi64-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi64-win32-x64.node +0 -0
- package/build/Release/oracledb-abi64-win32-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi67-darwin-x64.node +0 -0
- package/build/Release/oracledb-abi67-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi67-linux-x64.node +0 -0
- package/build/Release/oracledb-abi67-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-abi67-win32-x64.node +0 -0
- package/build/Release/oracledb-abi67-win32-x64.node-buildinfo.txt +0 -1
package/lib/sodaDatabase.js
CHANGED
|
@@ -1,55 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
// Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved
|
|
2
|
+
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// You may not use the identified files except in compliance with the Apache
|
|
6
|
+
// License, Version 2.0 (the "License.")
|
|
7
|
+
//
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
13
|
+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
//
|
|
15
|
+
// See the License for the specific language governing permissions and
|
|
16
|
+
// limitations under the License.
|
|
17
|
+
//
|
|
18
|
+
//-----------------------------------------------------------------------------
|
|
19
19
|
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
22
|
const nodbUtil = require('./util.js');
|
|
23
|
-
const sodaCollection = require('./sodaCollection.js');
|
|
24
|
-
const sodaDocument = require('./sodaDocument.js');
|
|
25
|
-
|
|
26
|
-
var createCollectionPromisified;
|
|
27
|
-
var openCollectionPromisified;
|
|
28
|
-
var getCollectionNamesPromisified;
|
|
29
|
-
|
|
30
23
|
|
|
31
24
|
// To create a SODA collection object
|
|
32
25
|
function createCollection(name, a2, a3) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var createCollCb;
|
|
26
|
+
let options = {};
|
|
27
|
+
let createCollCb;
|
|
36
28
|
|
|
37
|
-
nodbUtil.
|
|
38
|
-
nodbUtil.assert(typeof name === 'string', 'NJS-
|
|
29
|
+
nodbUtil.checkAsyncArgs(arguments, 2, 3);
|
|
30
|
+
nodbUtil.assert(typeof name === 'string', 'NJS-005', 1);
|
|
39
31
|
|
|
40
32
|
switch (arguments.length) {
|
|
41
33
|
case 2:
|
|
42
|
-
nodbUtil.assert(typeof a2 === 'function', 'NJS-006', 2);
|
|
43
34
|
createCollCb = a2;
|
|
44
35
|
break;
|
|
45
36
|
case 3:
|
|
46
|
-
nodbUtil.assert(nodbUtil.isObject(a2), 'NJS-
|
|
47
|
-
nodbUtil.assert(typeof a3 === 'function', 'NJS-006', 3);
|
|
37
|
+
nodbUtil.assert(nodbUtil.isObject(a2), 'NJS-005', 2);
|
|
48
38
|
options = a2;
|
|
49
39
|
createCollCb = a3;
|
|
50
40
|
if (options.metaData) {
|
|
51
41
|
if (!nodbUtil.isObject(options.metaData)) {
|
|
52
|
-
createCollCb(Error(nodbUtil.getErrorMessage('NJS-
|
|
42
|
+
createCollCb(Error(nodbUtil.getErrorMessage('NJS-005', 2)));
|
|
53
43
|
return;
|
|
54
44
|
}
|
|
55
45
|
options.metaData = JSON.stringify(options.metaData);
|
|
@@ -57,139 +47,74 @@ function createCollection(name, a2, a3) {
|
|
|
57
47
|
break;
|
|
58
48
|
}
|
|
59
49
|
|
|
60
|
-
|
|
61
|
-
if (err) {
|
|
62
|
-
createCollCb(err);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
sodaCollection.extend(coll, self._oracledb);
|
|
66
|
-
createCollCb(null, coll);
|
|
67
|
-
});
|
|
50
|
+
this._createCollection(name, options, createCollCb);
|
|
68
51
|
}
|
|
69
52
|
|
|
70
|
-
createCollectionPromisified = nodbUtil.promisify(createCollection);
|
|
71
|
-
|
|
72
53
|
|
|
73
54
|
// To open a collection using given name
|
|
74
55
|
// if the collection does not exist, undefined is returned
|
|
75
56
|
function openCollection(name, openCollCb) {
|
|
76
|
-
|
|
57
|
+
nodbUtil.checkAsyncArgs(arguments, 2, 2);
|
|
58
|
+
nodbUtil.assert(typeof name === 'string', 'NJS-005', 1);
|
|
77
59
|
|
|
78
|
-
|
|
79
|
-
nodbUtil.assert(typeof name === 'string', 'NJS-006', 1);
|
|
80
|
-
nodbUtil.assert(typeof openCollCb === 'function', 'NJS-006', 2);
|
|
81
|
-
|
|
82
|
-
self._openCollection.call(self, name, function (err, coll) {
|
|
83
|
-
if (coll) {
|
|
84
|
-
sodaCollection.extend(coll, self._oracledb);
|
|
85
|
-
}
|
|
86
|
-
openCollCb(err, coll);
|
|
87
|
-
});
|
|
60
|
+
this._openCollection(name, openCollCb);
|
|
88
61
|
}
|
|
89
62
|
|
|
90
|
-
openCollectionPromisified = nodbUtil.promisify(openCollection);
|
|
91
|
-
|
|
92
63
|
|
|
93
64
|
// To obtain a list of collection names.
|
|
94
65
|
function getCollectionNames(a1, a2) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var getCollNamesCb;
|
|
66
|
+
let options = {};
|
|
67
|
+
let getCollNamesCb;
|
|
98
68
|
|
|
99
|
-
nodbUtil.
|
|
69
|
+
nodbUtil.checkAsyncArgs(arguments, 1, 2);
|
|
100
70
|
|
|
101
71
|
switch(arguments.length) {
|
|
102
72
|
case 1:
|
|
103
|
-
nodbUtil.assert(typeof a1 === 'function', 'NJS-006', 1);
|
|
104
73
|
getCollNamesCb = a1;
|
|
105
74
|
break;
|
|
106
75
|
case 2:
|
|
107
|
-
nodbUtil.assert(nodbUtil.isObject(a1), 'NJS-
|
|
108
|
-
nodbUtil.assert(typeof a2 === 'function', 'NJS-006', 2);
|
|
76
|
+
nodbUtil.assert(nodbUtil.isObject(a1), 'NJS-005', 1);
|
|
109
77
|
options = a1;
|
|
110
78
|
getCollNamesCb = a2;
|
|
111
79
|
break;
|
|
112
80
|
}
|
|
113
81
|
|
|
114
|
-
|
|
82
|
+
this._getCollectionNames(options, getCollNamesCb);
|
|
115
83
|
}
|
|
116
84
|
|
|
117
|
-
getCollectionNamesPromisified = nodbUtil.promisify(getCollectionNames);
|
|
118
85
|
|
|
119
86
|
|
|
120
|
-
// To create a SODA document object based content and (optional) other fields
|
|
121
|
-
function createDocument(content, a2) {
|
|
122
|
-
var self = this;
|
|
123
|
-
var options = {};
|
|
124
87
|
|
|
125
|
-
|
|
126
|
-
nodbUtil.assert(Buffer.isBuffer(content) || typeof content === 'string' ||
|
|
127
|
-
nodbUtil.isObject(content), 'NJS-006', 1);
|
|
128
|
-
if (arguments.length > 1) {
|
|
129
|
-
nodbUtil.assert(nodbUtil.isObject(a2), 'NJS-006', 2);
|
|
130
|
-
options = a2;
|
|
131
|
-
}
|
|
88
|
+
class SodaDatabase {
|
|
132
89
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
90
|
+
_extend(oracledb) {
|
|
91
|
+
this.createCollection = nodbUtil.promisify(oracledb, createCollection);
|
|
92
|
+
this.getCollectionNames = nodbUtil.promisify(oracledb, getCollectionNames);
|
|
93
|
+
this.openCollection = nodbUtil.promisify(oracledb, openCollection);
|
|
137
94
|
}
|
|
138
95
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
96
|
+
// To create a SODA document object based content and (optional) other fields
|
|
97
|
+
createDocument(content, a2) {
|
|
98
|
+
let options = {};
|
|
143
99
|
|
|
100
|
+
nodbUtil.checkArgCount(arguments, 1, 2);
|
|
101
|
+
nodbUtil.assert(Buffer.isBuffer(content) || typeof content === 'string' ||
|
|
102
|
+
nodbUtil.isObject(content), 'NJS-005', 1);
|
|
103
|
+
if (arguments.length > 1) {
|
|
104
|
+
nodbUtil.assert(nodbUtil.isObject(a2), 'NJS-005', 2);
|
|
105
|
+
options = a2;
|
|
106
|
+
}
|
|
144
107
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
function extend(db, conn) {
|
|
150
|
-
// Using Object.defineProperties to add properties to the soda instance with
|
|
151
|
-
// special properties.
|
|
152
|
-
Object.defineProperties (
|
|
153
|
-
db,
|
|
154
|
-
{
|
|
155
|
-
_oracledb: { // storing a reference to the base instance to avoid circular
|
|
156
|
-
// references with require
|
|
157
|
-
value: conn._oracledb
|
|
158
|
-
},
|
|
159
|
-
_createCollection: {
|
|
160
|
-
value: db.createCollection
|
|
161
|
-
},
|
|
162
|
-
_openCollection: {
|
|
163
|
-
value: db.openCollection
|
|
164
|
-
},
|
|
165
|
-
_getCollectionNames: {
|
|
166
|
-
value: db.getCollectionNames
|
|
167
|
-
},
|
|
168
|
-
_createDocument: {
|
|
169
|
-
value: db.createDocument
|
|
170
|
-
},
|
|
171
|
-
createCollection: {
|
|
172
|
-
value: createCollectionPromisified,
|
|
173
|
-
enumerable: true,
|
|
174
|
-
writable: true
|
|
175
|
-
},
|
|
176
|
-
openCollection: {
|
|
177
|
-
value: openCollectionPromisified,
|
|
178
|
-
enumerable: true,
|
|
179
|
-
writable: true
|
|
180
|
-
},
|
|
181
|
-
getCollectionNames: {
|
|
182
|
-
value: getCollectionNamesPromisified,
|
|
183
|
-
enumerable: true,
|
|
184
|
-
writable: true
|
|
185
|
-
},
|
|
186
|
-
createDocument: {
|
|
187
|
-
value: createDocument,
|
|
188
|
-
enumerable: true,
|
|
189
|
-
writable: true
|
|
190
|
-
}
|
|
108
|
+
if (typeof content === 'string') {
|
|
109
|
+
content = Buffer.from(content);
|
|
110
|
+
} else if (nodbUtil.isObject(content)) {
|
|
111
|
+
content = Buffer.from(JSON.stringify(content));
|
|
191
112
|
}
|
|
192
|
-
|
|
113
|
+
|
|
114
|
+
return this._createDocument(content, options);
|
|
115
|
+
}
|
|
116
|
+
|
|
193
117
|
}
|
|
194
118
|
|
|
195
|
-
|
|
119
|
+
|
|
120
|
+
module.exports = SodaDatabase;
|
package/lib/sodaDocCursor.js
CHANGED
|
@@ -1,98 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// You may not use the identified files except in compliance with the Apache
|
|
6
|
+
// License, Version 2.0 (the "License.")
|
|
7
|
+
//
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
13
|
+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
//
|
|
15
|
+
// See the License for the specific language governing permissions and
|
|
16
|
+
// limitations under the License.
|
|
17
|
+
//
|
|
18
|
+
//-----------------------------------------------------------------------------
|
|
19
19
|
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
22
|
const nodbUtil = require('./util.js');
|
|
23
|
-
const sodaDocument = require('./sodaDocument.js');
|
|
24
|
-
|
|
25
|
-
var getNextPromisified;
|
|
26
|
-
var closePromisified;
|
|
27
|
-
|
|
28
23
|
|
|
29
24
|
//-----------------------------------------------------------------------------
|
|
30
25
|
// getNext
|
|
31
26
|
// To obtain the next document from the cursor
|
|
32
27
|
//-----------------------------------------------------------------------------
|
|
33
28
|
function getNext(cb) {
|
|
34
|
-
|
|
29
|
+
nodbUtil.checkAsyncArgs(arguments, 1, 1);
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
nodbUtil.assert(typeof cb === 'function', 'NJS-006', 1);
|
|
38
|
-
|
|
39
|
-
self._getNext(function(err, doc) {
|
|
40
|
-
if (doc) {
|
|
41
|
-
sodaDocument.extend(doc);
|
|
42
|
-
}
|
|
43
|
-
cb(err, doc);
|
|
44
|
-
});
|
|
31
|
+
this._getNext(cb);
|
|
45
32
|
}
|
|
46
33
|
|
|
47
|
-
getNextPromisified = nodbUtil.promisify(getNext);
|
|
48
|
-
|
|
49
34
|
|
|
50
35
|
//-----------------------------------------------------------------------------
|
|
51
36
|
// close
|
|
52
37
|
// to close an open cursor to clear of the resources allocated
|
|
53
38
|
//----------------------------------------------------------------------------
|
|
54
39
|
function close(cb) {
|
|
55
|
-
|
|
56
|
-
nodbUtil.assert(arguments.length === 1, 'NJS-009');
|
|
57
|
-
nodbUtil.assert(typeof cb === 'function', 'NJS-006', 1);
|
|
40
|
+
nodbUtil.checkAsyncArgs(arguments, 1, 1);
|
|
58
41
|
|
|
59
42
|
this._close(cb);
|
|
60
43
|
}
|
|
61
44
|
|
|
62
|
-
closePromisified = nodbUtil.promisify(close);
|
|
63
45
|
|
|
46
|
+
class SodaDocCursor {
|
|
47
|
+
|
|
48
|
+
_extend(oracledb) {
|
|
49
|
+
this.close = nodbUtil.promisify(oracledb, close);
|
|
50
|
+
this.getNext = nodbUtil.promisify(oracledb, getNext);
|
|
51
|
+
}
|
|
64
52
|
|
|
65
|
-
// The extend method is used to extend the SodaDocCursor instance from C Layer
|
|
66
|
-
// with custom properties and method overrides. References to the original
|
|
67
|
-
// methods are maintained so they can be invoked by the overriding method at
|
|
68
|
-
// the right time
|
|
69
|
-
function extend(cursor, oracledb) {
|
|
70
|
-
// Using Object.defineProperties to add properties to the soda instance with
|
|
71
|
-
// special properties
|
|
72
|
-
Object.defineProperties (
|
|
73
|
-
cursor,
|
|
74
|
-
{
|
|
75
|
-
_oracledb: {
|
|
76
|
-
value: oracledb
|
|
77
|
-
},
|
|
78
|
-
_getNext: {
|
|
79
|
-
value: cursor.getNext
|
|
80
|
-
},
|
|
81
|
-
getNext: {
|
|
82
|
-
value: getNextPromisified,
|
|
83
|
-
enumerable: true,
|
|
84
|
-
writable: true
|
|
85
|
-
},
|
|
86
|
-
_close: {
|
|
87
|
-
value: cursor.close
|
|
88
|
-
},
|
|
89
|
-
close: {
|
|
90
|
-
value: closePromisified,
|
|
91
|
-
enumerable: true,
|
|
92
|
-
writable: true
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
53
|
}
|
|
97
54
|
|
|
98
|
-
module.exports
|
|
55
|
+
module.exports = SodaDocCursor;
|
package/lib/sodaDocument.js
CHANGED
|
@@ -1,75 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
// Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved
|
|
2
|
+
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// You may not use the identified files except in compliance with the Apache
|
|
6
|
+
// License, Version 2.0 (the "License.")
|
|
7
|
+
//
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
13
|
+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
//
|
|
15
|
+
// See the License for the specific language governing permissions and
|
|
16
|
+
// limitations under the License.
|
|
17
|
+
//
|
|
18
|
+
//-----------------------------------------------------------------------------
|
|
19
19
|
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
function getContent() {
|
|
24
|
-
return JSON.parse(this._getContentAsString());
|
|
25
|
-
}
|
|
22
|
+
class SodaDocument {
|
|
26
23
|
|
|
24
|
+
_extend() {
|
|
25
|
+
this._sodaDocumentMarker = true;
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
// returns the document content as a
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
28
|
+
// returns the document content as a Javascript object
|
|
29
|
+
getContent() {
|
|
30
|
+
return JSON.parse(this._getContentAsString());
|
|
31
|
+
}
|
|
32
32
|
|
|
33
|
+
// returns the document content as a buffer
|
|
34
|
+
getContentAsBuffer() {
|
|
35
|
+
return this._getContentAsBuffer();
|
|
36
|
+
}
|
|
33
37
|
|
|
34
|
-
// returns the document content as a
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
38
|
+
// returns the document content as a string
|
|
39
|
+
getContentAsString() {
|
|
40
|
+
return this._getContentAsString();
|
|
41
|
+
}
|
|
39
42
|
|
|
40
|
-
// extends the SodaDocument instance from the C layer with custom properties
|
|
41
|
-
// and method overrides; references to the original methods are maintained so
|
|
42
|
-
// that they can be invoked by the overriding method at the right time
|
|
43
|
-
function extend(doc) {
|
|
44
|
-
Object.defineProperties (
|
|
45
|
-
doc,
|
|
46
|
-
{
|
|
47
|
-
_sodaDocumentMarker: {
|
|
48
|
-
value: true
|
|
49
|
-
},
|
|
50
|
-
_getContentAsString: {
|
|
51
|
-
value: doc.getContentAsString
|
|
52
|
-
},
|
|
53
|
-
_getContentAsBuffer: {
|
|
54
|
-
value: doc.getContentAsBuffer
|
|
55
|
-
},
|
|
56
|
-
getContent: {
|
|
57
|
-
value: getContent,
|
|
58
|
-
enumerable: true,
|
|
59
|
-
writable: true
|
|
60
|
-
},
|
|
61
|
-
getContentAsString: {
|
|
62
|
-
value: getContentAsString,
|
|
63
|
-
enumerable: true,
|
|
64
|
-
writable: true
|
|
65
|
-
},
|
|
66
|
-
getContentAsBuffer: {
|
|
67
|
-
value: getContentAsBuffer,
|
|
68
|
-
enumerable: true,
|
|
69
|
-
writable: true
|
|
70
|
-
},
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
43
|
}
|
|
74
44
|
|
|
75
|
-
module.exports
|
|
45
|
+
module.exports = SodaDocument;
|