@socketsecurity/sdk 1.7.0 → 1.8.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/CHANGELOG.md +15 -0
- package/README.md +42 -1
- package/package.json +24 -23
- package/types/api.d.ts +137 -111
- package/dist/constants.d.ts +0 -8
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -128
- package/dist/constants.js.map +0 -1
- package/dist/file-upload.d.ts +0 -22
- package/dist/file-upload.d.ts.map +0 -1
- package/dist/file-upload.js +0 -152
- package/dist/file-upload.js.map +0 -1
- package/dist/http-client.d.ts +0 -79
- package/dist/http-client.d.ts.map +0 -1
- package/dist/http-client.js +0 -262
- package/dist/http-client.js.map +0 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -42
- package/dist/index.js.map +0 -1
- package/dist/socket-sdk-class.d.ts +0 -422
- package/dist/socket-sdk-class.d.ts.map +0 -1
- package/dist/socket-sdk-class.js +0 -1342
- package/dist/socket-sdk-class.js.map +0 -1
- package/dist/types.d.ts +0 -155
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -4
- package/dist/types.js.map +0 -1
- package/dist/user-agent.d.ts +0 -14
- package/dist/user-agent.d.ts.map +0 -1
- package/dist/user-agent.js +0 -18
- package/dist/user-agent.js.map +0 -1
- package/dist/utils.d.ts +0 -29
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -94
- package/dist/utils.js.map +0 -1
package/dist/http-client.js
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ResponseError = void 0;
|
|
7
|
-
exports.createDeleteRequest = createDeleteRequest;
|
|
8
|
-
exports.createGetRequest = createGetRequest;
|
|
9
|
-
exports.createRequestWithJson = createRequestWithJson;
|
|
10
|
-
exports.getErrorResponseBody = getErrorResponseBody;
|
|
11
|
-
exports.getHttpModule = getHttpModule;
|
|
12
|
-
exports.getResponse = getResponse;
|
|
13
|
-
exports.getResponseJson = getResponseJson;
|
|
14
|
-
exports.isResponseOk = isResponseOk;
|
|
15
|
-
exports.reshapeArtifactForPublicPolicy = reshapeArtifactForPublicPolicy;
|
|
16
|
-
/**
|
|
17
|
-
* @fileoverview HTTP client utilities for Socket API communication.
|
|
18
|
-
* Provides low-level HTTP request handling with proper error management and response parsing.
|
|
19
|
-
*/
|
|
20
|
-
const node_http_1 = __importDefault(require("node:http"));
|
|
21
|
-
const node_https_1 = __importDefault(require("node:https"));
|
|
22
|
-
const debug_1 = require("@socketsecurity/registry/lib/debug");
|
|
23
|
-
const json_1 = require("@socketsecurity/registry/lib/json");
|
|
24
|
-
/**
|
|
25
|
-
* HTTP response error for Socket API requests.
|
|
26
|
-
* Extends Error with response details for debugging failed API calls.
|
|
27
|
-
*/
|
|
28
|
-
class ResponseError extends Error {
|
|
29
|
-
response;
|
|
30
|
-
/**
|
|
31
|
-
* Create a new ResponseError from an HTTP response.
|
|
32
|
-
* Automatically formats error message with status code and message.
|
|
33
|
-
*/
|
|
34
|
-
constructor(response, message = '') {
|
|
35
|
-
/* c8 ignore next 2 - statusCode and statusMessage may be undefined in edge cases */
|
|
36
|
-
const statusCode = response.statusCode ?? 'unknown';
|
|
37
|
-
const statusMessage = response.statusMessage ?? 'No status message';
|
|
38
|
-
super(
|
|
39
|
-
/* c8 ignore next - fallback empty message if not provided */
|
|
40
|
-
`Socket API ${message || 'Request failed'} (${statusCode}): ${statusMessage}`);
|
|
41
|
-
this.name = 'ResponseError';
|
|
42
|
-
this.response = response;
|
|
43
|
-
Error.captureStackTrace(this, ResponseError);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.ResponseError = ResponseError;
|
|
47
|
-
/**
|
|
48
|
-
* Create and execute an HTTP DELETE request.
|
|
49
|
-
* Returns the response stream for further processing.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error} When network or timeout errors occur
|
|
52
|
-
*/
|
|
53
|
-
async function createDeleteRequest(baseUrl, urlPath, options) {
|
|
54
|
-
const req = getHttpModule(baseUrl)
|
|
55
|
-
.request(`${baseUrl}${urlPath}`, {
|
|
56
|
-
method: 'DELETE',
|
|
57
|
-
...options,
|
|
58
|
-
})
|
|
59
|
-
.end();
|
|
60
|
-
return await getResponse(req);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Create and execute an HTTP GET request.
|
|
64
|
-
* Returns the response stream for further processing.
|
|
65
|
-
*
|
|
66
|
-
* @throws {Error} When network or timeout errors occur
|
|
67
|
-
*/
|
|
68
|
-
async function createGetRequest(baseUrl, urlPath, options) {
|
|
69
|
-
const req = getHttpModule(baseUrl)
|
|
70
|
-
.request(`${baseUrl}${urlPath}`, {
|
|
71
|
-
method: 'GET',
|
|
72
|
-
...options,
|
|
73
|
-
})
|
|
74
|
-
.end();
|
|
75
|
-
return await getResponse(req);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Create and execute an HTTP request with JSON payload.
|
|
79
|
-
* Automatically sets appropriate content headers and serializes the body.
|
|
80
|
-
*
|
|
81
|
-
* @throws {Error} When network or timeout errors occur
|
|
82
|
-
*/
|
|
83
|
-
async function createRequestWithJson(method, baseUrl, urlPath, json, options) {
|
|
84
|
-
const body = JSON.stringify(json);
|
|
85
|
-
const req = getHttpModule(baseUrl).request(`${baseUrl}${urlPath}`, {
|
|
86
|
-
method,
|
|
87
|
-
...options,
|
|
88
|
-
headers: {
|
|
89
|
-
...options.headers,
|
|
90
|
-
'Content-Length': Buffer.byteLength(body, 'utf8'),
|
|
91
|
-
'Content-Type': 'application/json',
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
req.write(body);
|
|
95
|
-
req.end();
|
|
96
|
-
return await getResponse(req);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Read the response body from an HTTP error response.
|
|
100
|
-
* Accumulates all chunks into a complete string for error handling.
|
|
101
|
-
*
|
|
102
|
-
* @throws {Error} When stream errors occur during reading
|
|
103
|
-
*/
|
|
104
|
-
async function getErrorResponseBody(response) {
|
|
105
|
-
return await new Promise((resolve, reject) => {
|
|
106
|
-
let body = '';
|
|
107
|
-
response.setEncoding('utf8');
|
|
108
|
-
response.on('data', (chunk) => (body += chunk));
|
|
109
|
-
response.on('end', () => resolve(body));
|
|
110
|
-
/* c8 ignore next - Extremely rare network or stream error during error response reading. */
|
|
111
|
-
response.on('error', e => reject(e));
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Get the appropriate HTTP module based on URL protocol.
|
|
116
|
-
* Returns http module for http: URLs, https module for https: URLs.
|
|
117
|
-
*/
|
|
118
|
-
function getHttpModule(url) {
|
|
119
|
-
return url.startsWith('https:') ? node_https_1.default : node_http_1.default;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Wait for and return the HTTP response from a request.
|
|
123
|
-
* Handles timeout and error conditions during request processing.
|
|
124
|
-
*
|
|
125
|
-
* @throws {Error} When request times out or network errors occur
|
|
126
|
-
*/
|
|
127
|
-
async function getResponse(req) {
|
|
128
|
-
return await new Promise((resolve, reject) => {
|
|
129
|
-
let timedOut = false;
|
|
130
|
-
req.on('response', (response) => {
|
|
131
|
-
/* c8 ignore next 3 - Race condition where response arrives after timeout. */
|
|
132
|
-
if (timedOut) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
resolve(response);
|
|
136
|
-
});
|
|
137
|
-
req.on('timeout', () => {
|
|
138
|
-
timedOut = true;
|
|
139
|
-
req.destroy();
|
|
140
|
-
reject(new Error('Request timed out'));
|
|
141
|
-
});
|
|
142
|
-
/* c8 ignore start - Network error handling during request, difficult to test reliably. */
|
|
143
|
-
req.on('error', e => {
|
|
144
|
-
if (!timedOut) {
|
|
145
|
-
reject(e);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
/* c8 ignore stop */
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Parse HTTP response body as JSON.
|
|
153
|
-
* Validates response status and handles empty responses gracefully.
|
|
154
|
-
*
|
|
155
|
-
* @throws {ResponseError} When response has non-2xx status code
|
|
156
|
-
* @throws {SyntaxError} When response body contains invalid JSON
|
|
157
|
-
*/
|
|
158
|
-
async function getResponseJson(response, method) {
|
|
159
|
-
if (!isResponseOk(response)) {
|
|
160
|
-
throw new ResponseError(response, method ? `${method} Request failed` : undefined);
|
|
161
|
-
}
|
|
162
|
-
const responseBody = await getErrorResponseBody(response);
|
|
163
|
-
// Handle truly empty responses (not whitespace) as valid empty objects.
|
|
164
|
-
if (responseBody === '') {
|
|
165
|
-
(0, debug_1.debugLog)('API response: empty response treated as {}');
|
|
166
|
-
return {};
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
const responseJson = (0, json_1.jsonParse)(responseBody);
|
|
170
|
-
(0, debug_1.debugLog)('API response:', responseJson);
|
|
171
|
-
return responseJson;
|
|
172
|
-
}
|
|
173
|
-
catch (e) {
|
|
174
|
-
if (e instanceof SyntaxError) {
|
|
175
|
-
// Attach the original response text for better error reporting.
|
|
176
|
-
const enhancedError = new Error(`Socket API - Invalid JSON response:\n${responseBody}\n→ ${e.message}`);
|
|
177
|
-
enhancedError.name = 'SyntaxError';
|
|
178
|
-
enhancedError.originalResponse = responseBody;
|
|
179
|
-
Object.setPrototypeOf(enhancedError, SyntaxError.prototype);
|
|
180
|
-
throw enhancedError;
|
|
181
|
-
}
|
|
182
|
-
/* c8 ignore start - Error instanceof check and unknown error handling for JSON parsing edge cases. */
|
|
183
|
-
if (e instanceof Error) {
|
|
184
|
-
throw e;
|
|
185
|
-
}
|
|
186
|
-
// Handle non-Error objects thrown by JSON parsing.
|
|
187
|
-
const unknownError = new Error('Unknown error');
|
|
188
|
-
unknownError.name = 'SyntaxError';
|
|
189
|
-
unknownError.originalResponse = responseBody;
|
|
190
|
-
Object.setPrototypeOf(unknownError, SyntaxError.prototype);
|
|
191
|
-
throw unknownError;
|
|
192
|
-
/* c8 ignore stop */
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Check if HTTP response has a successful status code (2xx range).
|
|
197
|
-
* Returns true for status codes between 200-299, false otherwise.
|
|
198
|
-
*/
|
|
199
|
-
function isResponseOk(response) {
|
|
200
|
-
const { statusCode } = response;
|
|
201
|
-
/* c8 ignore next - Defensive fallback for edge cases where statusCode might be undefined. */
|
|
202
|
-
return statusCode ? statusCode >= 200 && statusCode < 300 : false;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Transform artifact data based on authentication status.
|
|
206
|
-
* Filters and compacts response data for public/free-tier users.
|
|
207
|
-
*/
|
|
208
|
-
function reshapeArtifactForPublicPolicy(data, isAuthenticated, actions) {
|
|
209
|
-
/* c8 ignore start - Public policy artifact reshaping for unauthenticated users, difficult to test edge cases. */
|
|
210
|
-
// If user is not authenticated, provide a different response structure
|
|
211
|
-
// optimized for the public free-tier experience.
|
|
212
|
-
if (!isAuthenticated) {
|
|
213
|
-
// Parse actions parameter for alert filtering.
|
|
214
|
-
const allowedActions = actions ? actions.split(',') : undefined;
|
|
215
|
-
const reshapeArtifact = (artifact) => ({
|
|
216
|
-
name: artifact.name,
|
|
217
|
-
version: artifact.version,
|
|
218
|
-
size: artifact.size,
|
|
219
|
-
author: artifact.author,
|
|
220
|
-
type: artifact.type,
|
|
221
|
-
supplyChainRisk: artifact.supplyChainRisk,
|
|
222
|
-
scorecards: artifact.scorecards,
|
|
223
|
-
topLevelAncestors: artifact.topLevelAncestors,
|
|
224
|
-
// Compact the alerts array to reduce response size for non-authenticated
|
|
225
|
-
// requests.
|
|
226
|
-
alerts: artifact.alerts
|
|
227
|
-
?.filter((alert) => {
|
|
228
|
-
// Filter by severity (remove low severity alerts).
|
|
229
|
-
if (alert.severity === 'low') {
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
// Filter by actions if specified.
|
|
233
|
-
if (allowedActions &&
|
|
234
|
-
alert.action &&
|
|
235
|
-
!allowedActions.includes(alert.action)) {
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
return true;
|
|
239
|
-
})
|
|
240
|
-
.map((alert) => ({
|
|
241
|
-
type: alert.type,
|
|
242
|
-
severity: alert.severity,
|
|
243
|
-
key: alert.key,
|
|
244
|
-
})),
|
|
245
|
-
});
|
|
246
|
-
// Handle both single artifacts and objects with artifacts arrays.
|
|
247
|
-
if (data['artifacts']) {
|
|
248
|
-
// Object with artifacts array.
|
|
249
|
-
return {
|
|
250
|
-
...data,
|
|
251
|
-
artifacts: data['artifacts']?.map(reshapeArtifact),
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
else if (data['alerts']) {
|
|
255
|
-
// Single artifact with alerts.
|
|
256
|
-
return reshapeArtifact(data);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return data;
|
|
260
|
-
/* c8 ignore stop */
|
|
261
|
-
}
|
|
262
|
-
//# sourceMappingURL=http-client.js.map
|
package/dist/http-client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,0DAA4B;AAC5B,4DAA8B;AAE9B,8DAA6D;AAC7D,4DAA6D;AAU7D;;;GAGG;AACH,mBAA2B,SAAQ,KAAK;IACtC,QAAQ,CAAiB;IAEzB;;;OAGG;IACH,YAAY,QAAyB,EAAE,OAAO,GAAW,EAAE,EAAE;QAC3D,oFAAoF;QACpF,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAA;QACnD,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,IAAI,mBAAmB,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C,QAAQ,CAAC,EAAE,CAAC;YAC1B,+BAA+B;YAC/B,OAAO,eAAe,CACpB,IAA2C,CAC5B,CAAA;QACnB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;IACX,oBAAoB;AADT,CAEZ"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Main entry point for the Socket SDK.
|
|
3
|
-
* Provides the SocketSdk class and utility functions for Socket security analysis API interactions.
|
|
4
|
-
*/
|
|
5
|
-
// Import from our modules
|
|
6
|
-
import { DEFAULT_USER_AGENT, httpAgentNames, publicPolicy } from './constants';
|
|
7
|
-
import { normalizeBaseUrl, promiseWithResolvers, queryToSearchParams, resolveAbsPaths, resolveBasePath } from './utils';
|
|
8
|
-
// Re-export types from modules
|
|
9
|
-
export type * from './types';
|
|
10
|
-
// Re-export functions from modules
|
|
11
|
-
export { createUserAgentFromPkgJson } from './user-agent';
|
|
12
|
-
// Re-export HTTP client functions
|
|
13
|
-
export { createDeleteRequest, createGetRequest, createRequestWithJson, getErrorResponseBody, getHttpModule, getResponse, getResponseJson, isResponseOk, reshapeArtifactForPublicPolicy, ResponseError, } from './http-client';
|
|
14
|
-
// Re-export file upload functions
|
|
15
|
-
export { createRequestBodyForFilepaths, createRequestBodyForJson, createUploadRequest, } from './file-upload';
|
|
16
|
-
// Re-export the main SocketSdk class
|
|
17
|
-
export { SocketSdk } from './socket-sdk-class';
|
|
18
|
-
// Re-export utility functions
|
|
19
|
-
export { normalizeBaseUrl, promiseWithResolvers, queryToSearchParams, resolveAbsPaths, resolveBasePath, };
|
|
20
|
-
// Re-export constants
|
|
21
|
-
export { DEFAULT_USER_AGENT, httpAgentNames, publicPolicy };
|
|
22
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0BAA0B;AAC1B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,+BAA+B;AAC/B,mBAAmB,SAAS,CAAA;AAE5B,mCAAmC;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AAEzD,kCAAkC;AAClC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,eAAe,EACf,YAAY,EACZ,8BAA8B,EAC9B,aAAa,GACd,MAAM,eAAe,CAAA;AAEtB,kCAAkC;AAClC,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,eAAe,CAAA;AAEtB,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,8BAA8B;AAC9B,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,CAAA;AAED,sBAAsB;AACtB,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/index.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.publicPolicy = exports.httpAgentNames = exports.DEFAULT_USER_AGENT = exports.resolveBasePath = exports.resolveAbsPaths = exports.queryToSearchParams = exports.promiseWithResolvers = exports.normalizeBaseUrl = exports.SocketSdk = exports.createUploadRequest = exports.createRequestBodyForJson = exports.createRequestBodyForFilepaths = exports.ResponseError = exports.reshapeArtifactForPublicPolicy = exports.isResponseOk = exports.getResponseJson = exports.getResponse = exports.getHttpModule = exports.getErrorResponseBody = exports.createRequestWithJson = exports.createGetRequest = exports.createDeleteRequest = exports.createUserAgentFromPkgJson = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview Main entry point for the Socket SDK.
|
|
6
|
-
* Provides the SocketSdk class and utility functions for Socket security analysis API interactions.
|
|
7
|
-
*/
|
|
8
|
-
// Import from our modules
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
|
-
Object.defineProperty(exports, "DEFAULT_USER_AGENT", { enumerable: true, get: function () { return constants_1.DEFAULT_USER_AGENT; } });
|
|
11
|
-
Object.defineProperty(exports, "httpAgentNames", { enumerable: true, get: function () { return constants_1.httpAgentNames; } });
|
|
12
|
-
Object.defineProperty(exports, "publicPolicy", { enumerable: true, get: function () { return constants_1.publicPolicy; } });
|
|
13
|
-
const utils_1 = require("./utils");
|
|
14
|
-
Object.defineProperty(exports, "normalizeBaseUrl", { enumerable: true, get: function () { return utils_1.normalizeBaseUrl; } });
|
|
15
|
-
Object.defineProperty(exports, "promiseWithResolvers", { enumerable: true, get: function () { return utils_1.promiseWithResolvers; } });
|
|
16
|
-
Object.defineProperty(exports, "queryToSearchParams", { enumerable: true, get: function () { return utils_1.queryToSearchParams; } });
|
|
17
|
-
Object.defineProperty(exports, "resolveAbsPaths", { enumerable: true, get: function () { return utils_1.resolveAbsPaths; } });
|
|
18
|
-
Object.defineProperty(exports, "resolveBasePath", { enumerable: true, get: function () { return utils_1.resolveBasePath; } });
|
|
19
|
-
// Re-export functions from modules
|
|
20
|
-
const user_agent_1 = require("./user-agent");
|
|
21
|
-
Object.defineProperty(exports, "createUserAgentFromPkgJson", { enumerable: true, get: function () { return user_agent_1.createUserAgentFromPkgJson; } });
|
|
22
|
-
// Re-export HTTP client functions
|
|
23
|
-
const http_client_1 = require("./http-client");
|
|
24
|
-
Object.defineProperty(exports, "createDeleteRequest", { enumerable: true, get: function () { return http_client_1.createDeleteRequest; } });
|
|
25
|
-
Object.defineProperty(exports, "createGetRequest", { enumerable: true, get: function () { return http_client_1.createGetRequest; } });
|
|
26
|
-
Object.defineProperty(exports, "createRequestWithJson", { enumerable: true, get: function () { return http_client_1.createRequestWithJson; } });
|
|
27
|
-
Object.defineProperty(exports, "getErrorResponseBody", { enumerable: true, get: function () { return http_client_1.getErrorResponseBody; } });
|
|
28
|
-
Object.defineProperty(exports, "getHttpModule", { enumerable: true, get: function () { return http_client_1.getHttpModule; } });
|
|
29
|
-
Object.defineProperty(exports, "getResponse", { enumerable: true, get: function () { return http_client_1.getResponse; } });
|
|
30
|
-
Object.defineProperty(exports, "getResponseJson", { enumerable: true, get: function () { return http_client_1.getResponseJson; } });
|
|
31
|
-
Object.defineProperty(exports, "isResponseOk", { enumerable: true, get: function () { return http_client_1.isResponseOk; } });
|
|
32
|
-
Object.defineProperty(exports, "reshapeArtifactForPublicPolicy", { enumerable: true, get: function () { return http_client_1.reshapeArtifactForPublicPolicy; } });
|
|
33
|
-
Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return http_client_1.ResponseError; } });
|
|
34
|
-
// Re-export file upload functions
|
|
35
|
-
const file_upload_1 = require("./file-upload");
|
|
36
|
-
Object.defineProperty(exports, "createRequestBodyForFilepaths", { enumerable: true, get: function () { return file_upload_1.createRequestBodyForFilepaths; } });
|
|
37
|
-
Object.defineProperty(exports, "createRequestBodyForJson", { enumerable: true, get: function () { return file_upload_1.createRequestBodyForJson; } });
|
|
38
|
-
Object.defineProperty(exports, "createUploadRequest", { enumerable: true, get: function () { return file_upload_1.createUploadRequest; } });
|
|
39
|
-
// Re-export the main SocketSdk class
|
|
40
|
-
const socket_sdk_class_1 = require("./socket-sdk-class");
|
|
41
|
-
Object.defineProperty(exports, "SocketSdk", { enumerable: true, get: function () { return socket_sdk_class_1.SocketSdk; } });
|
|
42
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AAEH,0BAA0B;AAC1B,2CAA8E;mGAArE,8BAAkB;+FAAE,0BAAc;6FAAE,wBAAY;AACzD,mCAMgB;iGALd,wBAAgB;qGAChB,4BAAoB;oGACpB,2BAAmB;gGACnB,uBAAe;gGACf,uBAAe;AAMjB,mCAAmC;AACnC,6CAAyD;AAAhD,wHAAA,0BAA0B,OAAA;AAEnC,kCAAkC;AAClC,+CAWsB;AAVpB,kHAAA,mBAAmB,OAAA;AACnB,+GAAA,gBAAgB,OAAA;AAChB,oHAAA,qBAAqB,OAAA;AACrB,mHAAA,oBAAoB,OAAA;AACpB,4GAAA,aAAa,OAAA;AACb,0GAAA,WAAW,OAAA;AACX,8GAAA,eAAe,OAAA;AACf,2GAAA,YAAY,OAAA;AACZ,6HAAA,8BAA8B,OAAA;AAC9B,4GAAA,aAAa,OAAA;AAGf,kCAAkC;AAClC,+CAIsB;AAHpB,4HAAA,6BAA6B,OAAA;AAC7B,uHAAA,wBAAwB,OAAA;AACxB,kHAAA,mBAAmB,OAAA;AAGrB,qCAAqC;AACrC,yDAA8C;AAArC,6GAAA,SAAS,OAAA"}
|