@jsforce/jsforce-node 0.0.1 → 3.0.0-next.1
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/LICENSE +22 -0
- package/README.md +54 -0
- package/index.d.ts +4 -0
- package/index.js +1 -0
- package/lib/VERSION.d.ts +2 -0
- package/lib/VERSION.js +3 -0
- package/lib/api/analytics/types.d.ts +509 -0
- package/lib/api/analytics/types.js +2 -0
- package/lib/api/analytics.d.ts +163 -0
- package/lib/api/analytics.js +342 -0
- package/lib/api/apex.d.ts +44 -0
- package/lib/api/apex.js +86 -0
- package/lib/api/bulk.d.ts +444 -0
- package/lib/api/bulk.js +1372 -0
- package/lib/api/chatter.d.ts +133 -0
- package/lib/api/chatter.js +248 -0
- package/lib/api/metadata/schema.d.ts +16117 -0
- package/lib/api/metadata/schema.js +9094 -0
- package/lib/api/metadata.d.ts +189 -0
- package/lib/api/metadata.js +406 -0
- package/lib/api/soap/schema.d.ts +3167 -0
- package/lib/api/soap/schema.js +1787 -0
- package/lib/api/soap.d.ts +76 -0
- package/lib/api/soap.js +155 -0
- package/lib/api/streaming/extension.d.ts +94 -0
- package/lib/api/streaming/extension.js +151 -0
- package/lib/api/streaming.d.ts +160 -0
- package/lib/api/streaming.js +252 -0
- package/lib/api/tooling.d.ts +284 -0
- package/lib/api/tooling.js +202 -0
- package/lib/api/wsdl/wsdl2schema.d.ts +1 -0
- package/lib/api/wsdl/wsdl2schema.js +354 -0
- package/lib/browser/canvas.d.ts +12 -0
- package/lib/browser/canvas.js +77 -0
- package/lib/browser/client.d.ts +82 -0
- package/lib/browser/client.js +244 -0
- package/lib/browser/jsonp.d.ts +12 -0
- package/lib/browser/jsonp.js +69 -0
- package/lib/browser/registry.d.ts +3 -0
- package/lib/browser/registry.js +5 -0
- package/lib/browser/request.d.ts +10 -0
- package/lib/browser/request.js +202 -0
- package/lib/cache.d.ts +74 -0
- package/lib/cache.js +159 -0
- package/lib/connection.d.ts +355 -0
- package/lib/connection.js +1153 -0
- package/lib/core.d.ts +17 -0
- package/lib/core.js +55 -0
- package/lib/csv.d.ts +23 -0
- package/lib/csv.js +35 -0
- package/lib/date.d.ts +82 -0
- package/lib/date.js +201 -0
- package/lib/http-api.d.ts +75 -0
- package/lib/http-api.js +257 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +31 -0
- package/lib/jsforce.d.ts +26 -0
- package/lib/jsforce.js +67 -0
- package/lib/jwtOAuth2.d.ts +8 -0
- package/lib/jwtOAuth2.js +23 -0
- package/lib/oauth2.d.ts +92 -0
- package/lib/oauth2.js +245 -0
- package/lib/process.d.ts +157 -0
- package/lib/process.js +143 -0
- package/lib/query.d.ts +341 -0
- package/lib/query.js +817 -0
- package/lib/quick-action.d.ts +44 -0
- package/lib/quick-action.js +46 -0
- package/lib/record-reference.d.ts +46 -0
- package/lib/record-reference.js +65 -0
- package/lib/record-stream.d.ts +83 -0
- package/lib/record-stream.js +233 -0
- package/lib/registry/base.d.ts +43 -0
- package/lib/registry/base.js +96 -0
- package/lib/registry/empty.d.ts +7 -0
- package/lib/registry/empty.js +13 -0
- package/lib/registry/file.d.ts +11 -0
- package/lib/registry/file.js +51 -0
- package/lib/registry/index.d.ts +8 -0
- package/lib/registry/index.js +21 -0
- package/lib/registry/sfdx.d.ts +56 -0
- package/lib/registry/sfdx.js +133 -0
- package/lib/registry/types.d.ts +47 -0
- package/lib/registry/types.js +2 -0
- package/lib/request-helper.d.ts +23 -0
- package/lib/request-helper.js +102 -0
- package/lib/request.d.ts +11 -0
- package/lib/request.js +75 -0
- package/lib/session-refresh-delegate.d.ts +31 -0
- package/lib/session-refresh-delegate.js +69 -0
- package/lib/soap.d.ts +60 -0
- package/lib/soap.js +246 -0
- package/lib/sobject.d.ts +258 -0
- package/lib/sobject.js +376 -0
- package/lib/soql-builder.d.ts +25 -0
- package/lib/soql-builder.js +226 -0
- package/lib/transport.d.ts +63 -0
- package/lib/transport.js +175 -0
- package/lib/types/common.d.ts +560 -0
- package/lib/types/common.js +2 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.js +23 -0
- package/lib/types/projection.d.ts +26 -0
- package/lib/types/projection.js +2 -0
- package/lib/types/record.d.ts +44 -0
- package/lib/types/record.js +2 -0
- package/lib/types/schema.d.ts +50 -0
- package/lib/types/schema.js +2 -0
- package/lib/types/soap.d.ts +43 -0
- package/lib/types/soap.js +2 -0
- package/lib/types/standard-schema.d.ts +16199 -0
- package/lib/types/standard-schema.js +2 -0
- package/lib/types/util.d.ts +7 -0
- package/lib/types/util.js +2 -0
- package/lib/util/formatter.d.ts +8 -0
- package/lib/util/formatter.js +24 -0
- package/lib/util/function.d.ts +32 -0
- package/lib/util/function.js +52 -0
- package/lib/util/logger.d.ts +29 -0
- package/lib/util/logger.js +102 -0
- package/lib/util/promise.d.ts +19 -0
- package/lib/util/promise.js +25 -0
- package/lib/util/stream.d.ts +12 -0
- package/lib/util/stream.js +88 -0
- package/package.json +260 -6
- package/typings/faye/index.d.ts +16 -0
- package/typings/index.d.ts +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Optional<T> = T | null | undefined;
|
|
2
|
+
export type StringKeys<O> = Extract<keyof O, string>;
|
|
3
|
+
export type PickIfMatch<O extends {
|
|
4
|
+
[name: string]: any;
|
|
5
|
+
}, P extends string> = Pick<O, Extract<P, keyof O>>;
|
|
6
|
+
export type IsEqualType<S, T> = [S] extends [T] ? [T] extends [S] ? true : false : false;
|
|
7
|
+
export type ConditionalPartial<O, IsPartial extends boolean> = IsPartial extends true ? Partial<O> : O;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDate = exports.zeroPad = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
function zeroPad(num, digits = 2) {
|
|
8
|
+
let nstr = '';
|
|
9
|
+
for (let d = digits - 1; d > 0; d--) {
|
|
10
|
+
if (num >= 10 ** d) {
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
nstr += '0';
|
|
14
|
+
}
|
|
15
|
+
return nstr + String(num);
|
|
16
|
+
}
|
|
17
|
+
exports.zeroPad = zeroPad;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
function formatDate(date) {
|
|
22
|
+
return `${date.getUTCFullYear()}-${zeroPad(date.getUTCMonth() + 1)}-${zeroPad(date.getUTCDate())}T${zeroPad(date.getUTCHours())}:${zeroPad(date.getUTCMinutes())}:${zeroPad(date.getUTCSeconds())}+00:00`;
|
|
23
|
+
}
|
|
24
|
+
exports.formatDate = formatDate;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export declare function isObject(v: any): v is object;
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare function isMapObject(v: any): v is {
|
|
9
|
+
[name: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare function isFunction(v: any): v is (...args: any[]) => any;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare function isNumber(v: any): v is number;
|
|
19
|
+
/**
|
|
20
|
+
* Detect whether the value has CommonJS Promise/A+ interface or not
|
|
21
|
+
*/
|
|
22
|
+
export declare function isPromiseLike(v: any): v is {
|
|
23
|
+
then: Function;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export declare function identityFunc<T>(a: T): T;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export declare function emptyFunc(): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emptyFunc = exports.identityFunc = exports.isPromiseLike = exports.isNumber = exports.isFunction = exports.isMapObject = exports.isObject = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
function isObject(v) {
|
|
8
|
+
const t = typeof v;
|
|
9
|
+
return v != null && (t == 'object' || t == 'function');
|
|
10
|
+
}
|
|
11
|
+
exports.isObject = isObject;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
function isMapObject(v) {
|
|
16
|
+
const t = typeof v;
|
|
17
|
+
return v != null && t == 'object';
|
|
18
|
+
}
|
|
19
|
+
exports.isMapObject = isMapObject;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
function isFunction(v) {
|
|
24
|
+
return typeof v == 'function';
|
|
25
|
+
}
|
|
26
|
+
exports.isFunction = isFunction;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
function isNumber(v) {
|
|
31
|
+
return typeof v == 'number';
|
|
32
|
+
}
|
|
33
|
+
exports.isNumber = isNumber;
|
|
34
|
+
/**
|
|
35
|
+
* Detect whether the value has CommonJS Promise/A+ interface or not
|
|
36
|
+
*/
|
|
37
|
+
function isPromiseLike(v) {
|
|
38
|
+
return isObject(v) && isFunction(v.then);
|
|
39
|
+
}
|
|
40
|
+
exports.isPromiseLike = isPromiseLike;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
function identityFunc(a) {
|
|
45
|
+
return a;
|
|
46
|
+
}
|
|
47
|
+
exports.identityFunc = identityFunc;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
function emptyFunc() { }
|
|
52
|
+
exports.emptyFunc = emptyFunc;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export declare const LogLevels: {
|
|
5
|
+
[level: string]: number;
|
|
6
|
+
};
|
|
7
|
+
export type LogLevelConfig = string | number | {
|
|
8
|
+
[name: string]: string | number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare class Logger {
|
|
14
|
+
_moduleName: string;
|
|
15
|
+
_logLevel: number;
|
|
16
|
+
constructor(moduleName: string, logLevelConfig?: LogLevelConfig);
|
|
17
|
+
createInstance(logLevelConfig?: LogLevelConfig): Logger;
|
|
18
|
+
setLogLevel(logLevel: string | number): void;
|
|
19
|
+
log(logLevel: number, ...messages: Array<any>): void;
|
|
20
|
+
debug(...messages: Array<any>): void;
|
|
21
|
+
info(...messages: Array<any>): void;
|
|
22
|
+
warn(...messages: Array<any>): void;
|
|
23
|
+
error(...messages: Array<any>): void;
|
|
24
|
+
fatal(...messages: Array<any>): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare function getLogger(moduleName: string): Logger;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLogger = exports.Logger = exports.LogLevels = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
exports.LogLevels = {
|
|
8
|
+
DEBUG: 1,
|
|
9
|
+
INFO: 2,
|
|
10
|
+
WARN: 3,
|
|
11
|
+
ERROR: 4,
|
|
12
|
+
FATAL: 5,
|
|
13
|
+
NONE: 6,
|
|
14
|
+
};
|
|
15
|
+
const LogLevelLabels = ['', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'NONE'];
|
|
16
|
+
const globalLogLevelConfig = (() => {
|
|
17
|
+
const globalLogLevelStr = process.env.JSFORCE_LOG_LEVEL ||
|
|
18
|
+
global.__JSFORCE_LOG_LEVEL__ ||
|
|
19
|
+
'NONE';
|
|
20
|
+
if (/^(DEBUG|INFO|WARN|ERROR|FATAL|NONE)$/i.test(globalLogLevelStr)) {
|
|
21
|
+
return { '*': globalLogLevelStr };
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(globalLogLevelStr);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
return { '*': 'NONE' };
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
function getModuleLogLevel(logLevelConfig, moduleName) {
|
|
31
|
+
const logLevel = logLevelConfig[moduleName] || logLevelConfig['*'];
|
|
32
|
+
return typeof logLevel === 'number'
|
|
33
|
+
? logLevel
|
|
34
|
+
: exports.LogLevels[logLevel] || exports.LogLevels.NONE;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
class Logger {
|
|
40
|
+
_moduleName;
|
|
41
|
+
_logLevel;
|
|
42
|
+
constructor(moduleName, logLevelConfig = globalLogLevelConfig) {
|
|
43
|
+
this._moduleName = moduleName;
|
|
44
|
+
this._logLevel =
|
|
45
|
+
typeof logLevelConfig === 'number'
|
|
46
|
+
? logLevelConfig
|
|
47
|
+
: typeof logLevelConfig === 'string'
|
|
48
|
+
? exports.LogLevels[logLevelConfig] || exports.LogLevels.NONE
|
|
49
|
+
: getModuleLogLevel(logLevelConfig, moduleName);
|
|
50
|
+
}
|
|
51
|
+
createInstance(logLevelConfig = this._logLevel) {
|
|
52
|
+
return new Logger(this._moduleName, logLevelConfig);
|
|
53
|
+
}
|
|
54
|
+
setLogLevel(logLevel) {
|
|
55
|
+
if (typeof logLevel === 'string') {
|
|
56
|
+
this._logLevel = exports.LogLevels[logLevel] || exports.LogLevels.NONE;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this._logLevel = logLevel;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
log(logLevel, ...messages) {
|
|
63
|
+
if (this._logLevel <= logLevel) {
|
|
64
|
+
const msgs = [
|
|
65
|
+
`${LogLevelLabels[logLevel]}\t[${this._moduleName}] `,
|
|
66
|
+
...messages,
|
|
67
|
+
];
|
|
68
|
+
if (logLevel < exports.LogLevels.ERROR) {
|
|
69
|
+
console.log(...msgs); // eslint-disable-line no-console
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
console.error(...msgs); // eslint-disable-line no-console
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
debug(...messages) {
|
|
77
|
+
this.log(exports.LogLevels.DEBUG, ...messages);
|
|
78
|
+
}
|
|
79
|
+
info(...messages) {
|
|
80
|
+
this.log(exports.LogLevels.INFO, ...messages);
|
|
81
|
+
}
|
|
82
|
+
warn(...messages) {
|
|
83
|
+
this.log(exports.LogLevels.WARN, ...messages);
|
|
84
|
+
}
|
|
85
|
+
error(...messages) {
|
|
86
|
+
this.log(exports.LogLevels.ERROR, ...messages);
|
|
87
|
+
}
|
|
88
|
+
fatal(...messages) {
|
|
89
|
+
this.log(exports.LogLevels.FATAL, ...messages);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.Logger = Logger;
|
|
93
|
+
const loggers = {};
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
function getLogger(moduleName) {
|
|
98
|
+
const logger = loggers[moduleName] || new Logger(moduleName);
|
|
99
|
+
loggers[moduleName] = logger;
|
|
100
|
+
return logger;
|
|
101
|
+
}
|
|
102
|
+
exports.getLogger = getLogger;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
import { Duplex } from 'stream';
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export type StreamPromiseBuilder<T> = () => {
|
|
10
|
+
stream: Duplex;
|
|
11
|
+
promise: Promise<T>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare class StreamPromise<T> extends Promise<T> {
|
|
17
|
+
stream(): Duplex;
|
|
18
|
+
static create<T>(builder: StreamPromiseBuilder<T>): StreamPromise<T>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamPromise = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
const stream_1 = require("stream");
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
class StreamPromise extends Promise {
|
|
12
|
+
stream() {
|
|
13
|
+
// dummy
|
|
14
|
+
return new stream_1.Duplex();
|
|
15
|
+
}
|
|
16
|
+
static create(builder) {
|
|
17
|
+
const { stream, promise } = builder();
|
|
18
|
+
const streamPromise = new StreamPromise((resolve, reject) => {
|
|
19
|
+
promise.then(resolve, reject);
|
|
20
|
+
});
|
|
21
|
+
streamPromise.stream = () => stream;
|
|
22
|
+
return streamPromise;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.StreamPromise = StreamPromise;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Duplex, Readable, Writable } from 'stream';
|
|
4
|
+
export declare function createLazyStream(): {
|
|
5
|
+
stream: Duplex;
|
|
6
|
+
setStream: (str: Duplex) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function readAll(rs: Readable, encoding?: BufferEncoding): Promise<string>;
|
|
9
|
+
export declare function concatStreamsAsDuplex(ws: Writable, rs: Readable, opts?: {
|
|
10
|
+
writableObjectMode?: boolean;
|
|
11
|
+
readableObjectMode?: boolean;
|
|
12
|
+
}): Duplex;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.concatStreamsAsDuplex = exports.readAll = exports.createLazyStream = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
function createLazyStream() {
|
|
6
|
+
const ins = new stream_1.PassThrough();
|
|
7
|
+
const outs = new stream_1.PassThrough();
|
|
8
|
+
const stream = concatStreamsAsDuplex(ins, outs);
|
|
9
|
+
let piped = false;
|
|
10
|
+
const setStream = (str) => {
|
|
11
|
+
if (piped) {
|
|
12
|
+
throw new Error('stream is already piped to actual stream');
|
|
13
|
+
}
|
|
14
|
+
piped = true;
|
|
15
|
+
ins.pipe(str).pipe(outs);
|
|
16
|
+
};
|
|
17
|
+
return { stream, setStream };
|
|
18
|
+
}
|
|
19
|
+
exports.createLazyStream = createLazyStream;
|
|
20
|
+
class MemoryWriteStream extends stream_1.Writable {
|
|
21
|
+
_buf;
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this._buf = Buffer.alloc(0);
|
|
25
|
+
}
|
|
26
|
+
_write(chunk, encoding, callback) {
|
|
27
|
+
this._buf = Buffer.concat([this._buf, chunk]);
|
|
28
|
+
callback();
|
|
29
|
+
}
|
|
30
|
+
_writev(data, callback) {
|
|
31
|
+
this._buf = Buffer.concat([this._buf, ...data.map(({ chunk }) => chunk)]);
|
|
32
|
+
callback();
|
|
33
|
+
}
|
|
34
|
+
toString(encoding = 'utf-8') {
|
|
35
|
+
return this._buf.toString(encoding);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function readAll(rs, encoding = 'utf-8') {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const ws = new MemoryWriteStream();
|
|
41
|
+
rs.on('error', reject)
|
|
42
|
+
.pipe(ws)
|
|
43
|
+
.on('finish', () => resolve(ws.toString(encoding)));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.readAll = readAll;
|
|
47
|
+
class DuplexifiedStream extends stream_1.Duplex {
|
|
48
|
+
_writable;
|
|
49
|
+
_readable;
|
|
50
|
+
constructor(ws, rs, opts = {}) {
|
|
51
|
+
super({
|
|
52
|
+
writableObjectMode: opts.writableObjectMode ?? ws.writableObjectMode,
|
|
53
|
+
readableObjectMode: opts.readableObjectMode ?? rs.readableObjectMode,
|
|
54
|
+
});
|
|
55
|
+
this._writable = ws;
|
|
56
|
+
this._readable = rs;
|
|
57
|
+
ws.once('finish', () => {
|
|
58
|
+
this.end();
|
|
59
|
+
});
|
|
60
|
+
this.once('finish', () => {
|
|
61
|
+
ws.end();
|
|
62
|
+
});
|
|
63
|
+
rs.on('readable', () => {
|
|
64
|
+
this._readStream();
|
|
65
|
+
});
|
|
66
|
+
rs.once('end', () => {
|
|
67
|
+
this.push(null);
|
|
68
|
+
});
|
|
69
|
+
ws.on('error', (err) => this.emit('error', err));
|
|
70
|
+
rs.on('error', (err) => this.emit('error', err));
|
|
71
|
+
}
|
|
72
|
+
_write(chunk, encoding, callback) {
|
|
73
|
+
this._writable.write(chunk, encoding, callback);
|
|
74
|
+
}
|
|
75
|
+
_read(n) {
|
|
76
|
+
this._readStream(n);
|
|
77
|
+
}
|
|
78
|
+
_readStream(n) {
|
|
79
|
+
let data;
|
|
80
|
+
while ((data = this._readable.read(n)) !== null) {
|
|
81
|
+
this.push(data);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function concatStreamsAsDuplex(ws, rs, opts) {
|
|
86
|
+
return new DuplexifiedStream(ws, rs, opts);
|
|
87
|
+
}
|
|
88
|
+
exports.concatStreamsAsDuplex = concatStreamsAsDuplex;
|
package/package.json
CHANGED
|
@@ -1,11 +1,265 @@
|
|
|
1
1
|
{
|
|
2
|
+
"author": "Shinichi Tomita <shinichi.tomita@gmail.com>",
|
|
2
3
|
"name": "@jsforce/jsforce-node",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
4
|
+
"description": "Salesforce API Library for JavaScript",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"salesforce",
|
|
7
|
+
"salesforce.com",
|
|
8
|
+
"sfdc",
|
|
9
|
+
"force.com",
|
|
10
|
+
"database.com"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "http://github.com/jsforce/jsforce",
|
|
13
|
+
"version": "3.0.0-next.1",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git://github.com/jsforce/jsforce.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"licenses": [
|
|
20
|
+
{
|
|
21
|
+
"type": "MIT",
|
|
22
|
+
"url": "http://github.com/jsforce/jsforce/raw/master/LICENSE"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"main": "./index",
|
|
26
|
+
"module": "./module/index",
|
|
27
|
+
"types": "./index",
|
|
28
|
+
"wireit": {
|
|
29
|
+
"build": {
|
|
30
|
+
"dependencies": [
|
|
31
|
+
"build:transpile",
|
|
32
|
+
"build:bundle"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"build:transpile": {
|
|
36
|
+
"dependencies": [
|
|
37
|
+
"build:node:cjs",
|
|
38
|
+
"build:browser"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"build:node:cjs": {
|
|
42
|
+
"command": "tsc -p . --pretty --incremental",
|
|
43
|
+
"files": [
|
|
44
|
+
"src/**/*.ts",
|
|
45
|
+
"**/tsconfig.json"
|
|
46
|
+
],
|
|
47
|
+
"output": [
|
|
48
|
+
"lib/**",
|
|
49
|
+
"*.tsbuildinfo"
|
|
50
|
+
],
|
|
51
|
+
"clean": "if-file-deleted"
|
|
52
|
+
},
|
|
53
|
+
"build:browser": {
|
|
54
|
+
"command": "babel src --extensions .ts --source-maps inline --env-name browser --out-dir browser",
|
|
55
|
+
"files": [
|
|
56
|
+
"src/**/*.ts",
|
|
57
|
+
"babel.config.js"
|
|
58
|
+
],
|
|
59
|
+
"output": [
|
|
60
|
+
"browser/**"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"build:bundle": {
|
|
64
|
+
"command": "webpack",
|
|
65
|
+
"dependencies": [
|
|
66
|
+
"build:browser"
|
|
67
|
+
],
|
|
68
|
+
"files": [
|
|
69
|
+
"browser/**/*.js",
|
|
70
|
+
"webpack.config.js"
|
|
71
|
+
],
|
|
72
|
+
"output": [
|
|
73
|
+
"dist"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"lint": {
|
|
77
|
+
"command": "eslint --ext .ts src test --color --cache --cache-location .eslintcache",
|
|
78
|
+
"files": [
|
|
79
|
+
"src/**/*.ts",
|
|
80
|
+
"test/**/*.ts",
|
|
81
|
+
"**/.eslint*"
|
|
82
|
+
],
|
|
83
|
+
"output": []
|
|
84
|
+
},
|
|
85
|
+
"test": {
|
|
86
|
+
"dependencies": [
|
|
87
|
+
"test:node",
|
|
88
|
+
"test:browser",
|
|
89
|
+
"lint"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"test:node": {
|
|
93
|
+
"command": "jest --forceExit",
|
|
94
|
+
"dependencies": [
|
|
95
|
+
"build:node:cjs"
|
|
96
|
+
],
|
|
97
|
+
"files": [
|
|
98
|
+
"test/**/*.ts",
|
|
99
|
+
"jest.setup.js",
|
|
100
|
+
"jest.config.js"
|
|
101
|
+
],
|
|
102
|
+
"output": []
|
|
103
|
+
},
|
|
104
|
+
"test:browser": {
|
|
105
|
+
"command": "karma start",
|
|
106
|
+
"dependencies": [
|
|
107
|
+
"clean-test-failures-file",
|
|
108
|
+
"build:bundle"
|
|
109
|
+
],
|
|
110
|
+
"files": [
|
|
111
|
+
"test/**/*.ts",
|
|
112
|
+
"karma.conf.js",
|
|
113
|
+
"webpack.config.test.js"
|
|
114
|
+
],
|
|
115
|
+
"output": []
|
|
116
|
+
},
|
|
117
|
+
"test:browser-ci": {
|
|
118
|
+
"command": "karma start",
|
|
119
|
+
"dependencies": [
|
|
120
|
+
"clean-test-failures-file",
|
|
121
|
+
"build:bundle",
|
|
122
|
+
"proxy-server"
|
|
123
|
+
],
|
|
124
|
+
"files": [
|
|
125
|
+
"test/**/*.ts",
|
|
126
|
+
"karma.conf.js",
|
|
127
|
+
"webpack.config.test.js"
|
|
128
|
+
],
|
|
129
|
+
"output": []
|
|
130
|
+
},
|
|
131
|
+
"test:browser-ci:retry": {
|
|
132
|
+
"command": "karma start --retry-failed",
|
|
133
|
+
"dependencies": [
|
|
134
|
+
"build:bundle",
|
|
135
|
+
"proxy-server"
|
|
136
|
+
],
|
|
137
|
+
"files": [
|
|
138
|
+
"test/**/*.ts",
|
|
139
|
+
"karma.conf.js",
|
|
140
|
+
"webpack.config.test.js"
|
|
141
|
+
],
|
|
142
|
+
"output": []
|
|
143
|
+
},
|
|
144
|
+
"proxy-server": {
|
|
145
|
+
"command": "node node_modules/jsforce-ajax-proxy/lib/server.js",
|
|
146
|
+
"service": {
|
|
147
|
+
"readyWhen": {
|
|
148
|
+
"lineMatches": "Express server listening on port \\d+"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"typecheck": {
|
|
153
|
+
"command": "npm run build:node:cjs && npx tsc -p test --pretty",
|
|
154
|
+
"files": [
|
|
155
|
+
"src/**/*.ts",
|
|
156
|
+
"test/**/*.ts",
|
|
157
|
+
"**/tsconfig.json"
|
|
158
|
+
],
|
|
159
|
+
"output": []
|
|
160
|
+
}
|
|
161
|
+
},
|
|
6
162
|
"scripts": {
|
|
7
|
-
"
|
|
163
|
+
"build": "wireit",
|
|
164
|
+
"build:node:cjs": "wireit",
|
|
165
|
+
"build:transpile": "wireit",
|
|
166
|
+
"build:browser": "wireit",
|
|
167
|
+
"build:bundle": "wireit",
|
|
168
|
+
"lint": "wireit",
|
|
169
|
+
"test": "wireit",
|
|
170
|
+
"test:node": "wireit",
|
|
171
|
+
"test:browser": "wireit",
|
|
172
|
+
"test:browser-ci": "wireit",
|
|
173
|
+
"test:browser-ci:retry": "wireit",
|
|
174
|
+
"typecheck": "wireit",
|
|
175
|
+
"proxy-server": "wireit",
|
|
176
|
+
"clean": "rimraf --glob lib/* module/* browser/*",
|
|
177
|
+
"clean-test-failures-file": "rimraf test/karma/karma-failed-tests.txt",
|
|
178
|
+
"jsforce-node": "ts-node scripts/jsforce-node.ts",
|
|
179
|
+
"jsforce-node:dev": "ts-node scripts/jsforce-node.ts --dev"
|
|
180
|
+
},
|
|
181
|
+
"files": [
|
|
182
|
+
"README.md",
|
|
183
|
+
"LICENSE",
|
|
184
|
+
"package.json",
|
|
185
|
+
"lib",
|
|
186
|
+
"typings",
|
|
187
|
+
"index.js",
|
|
188
|
+
"index.d.ts"
|
|
189
|
+
],
|
|
190
|
+
"engines": {
|
|
191
|
+
"node": ">=18"
|
|
192
|
+
},
|
|
193
|
+
"dependencies": {
|
|
194
|
+
"@types/node": "^18.15.3",
|
|
195
|
+
"abort-controller": "^3.0.0",
|
|
196
|
+
"base64url": "^3.0.1",
|
|
197
|
+
"csv-parse": "^5.5.2",
|
|
198
|
+
"csv-stringify": "^6.4.4",
|
|
199
|
+
"faye": "^1.4.0",
|
|
200
|
+
"form-data": "^4.0.0",
|
|
201
|
+
"fs-extra": "^8.1.0",
|
|
202
|
+
"https-proxy-agent": "^5.0.0",
|
|
203
|
+
"multistream": "^3.1.0",
|
|
204
|
+
"node-fetch": "^2.6.1",
|
|
205
|
+
"strip-ansi": "^6.0.0",
|
|
206
|
+
"xml2js": "^0.6.2"
|
|
8
207
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
208
|
+
"devDependencies": {
|
|
209
|
+
"@babel/cli": "^7.23.0",
|
|
210
|
+
"@babel/core": "^7.23.0",
|
|
211
|
+
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
212
|
+
"@babel/preset-env": "^7.22.20",
|
|
213
|
+
"@babel/preset-typescript": "^7.23.0",
|
|
214
|
+
"@babel/register": "^7.22.15",
|
|
215
|
+
"@types/fs-extra": "^8.0.1",
|
|
216
|
+
"@types/inquirer": "^6.5.0",
|
|
217
|
+
"@types/jest": "^29.5.5",
|
|
218
|
+
"@types/multistream": "^2.1.1",
|
|
219
|
+
"@types/node-fetch": "^2.5.7",
|
|
220
|
+
"@types/shelljs": "^0.8.15",
|
|
221
|
+
"@types/through2": "^2.0.34",
|
|
222
|
+
"@types/xml2js": "^0.4.5",
|
|
223
|
+
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
|
224
|
+
"@typescript-eslint/parser": "^6.7.5",
|
|
225
|
+
"archiver": "^5.1.0",
|
|
226
|
+
"assert": "^2.0.0",
|
|
227
|
+
"babel-loader": "^9.1.3",
|
|
228
|
+
"babel-preset-power-assert": "^3.0.0",
|
|
229
|
+
"buffer": "^6.0.3",
|
|
230
|
+
"conditional-type-checks": "^1.0.5",
|
|
231
|
+
"crypto-browserify": "^3.12.0",
|
|
232
|
+
"eslint": "^8.51.0",
|
|
233
|
+
"eslint-config-prettier": "^6.15.0",
|
|
234
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
235
|
+
"jest": "^29.5.0",
|
|
236
|
+
"jsforce-ajax-proxy": "^2.0.0",
|
|
237
|
+
"karma": "^6.4.2",
|
|
238
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
239
|
+
"karma-jasmine": "^5.1.0",
|
|
240
|
+
"karma-jasmine-html-reporter": "^2.0.0",
|
|
241
|
+
"karma-sourcemap-loader": "^0.4.0",
|
|
242
|
+
"karma-webpack": "^5.0.0",
|
|
243
|
+
"path-browserify": "^1.0.1",
|
|
244
|
+
"power-assert": "^1.6.1",
|
|
245
|
+
"prettier": "^2.2.1",
|
|
246
|
+
"process": "^0.11.10",
|
|
247
|
+
"puppeteer": "^21.0.1",
|
|
248
|
+
"querystring-es3": "^0.2.1",
|
|
249
|
+
"rimraf": "^5.0.5",
|
|
250
|
+
"shelljs": "^0.8.5",
|
|
251
|
+
"source-map-loader": "^1.1.3",
|
|
252
|
+
"stream-browserify": "^3.0.0",
|
|
253
|
+
"terser-webpack-plugin": "^5.3.7",
|
|
254
|
+
"through2": "^3.0.1",
|
|
255
|
+
"timers-browserify": "^2.0.12",
|
|
256
|
+
"ts-node": "^10.9.1",
|
|
257
|
+
"typedoc": "^0.25.1",
|
|
258
|
+
"typescript": "^4.9.5",
|
|
259
|
+
"util": "^0.12.5",
|
|
260
|
+
"webpack": "^5.82.0",
|
|
261
|
+
"webpack-cli": "^5.0.2",
|
|
262
|
+
"wireit": "^0.14.0",
|
|
263
|
+
"zx": "^7.2.3"
|
|
264
|
+
}
|
|
11
265
|
}
|