@socketsecurity/sdk 1.11.0 → 1.11.2
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 +18 -0
- package/README.md +153 -312
- package/dist/constants.js +23 -117
- package/dist/file-upload.js +118 -127
- package/dist/http-client.d.ts +3 -0
- package/dist/http-client.js +269 -211
- package/dist/index.js +43 -48
- package/dist/package.json.js +207 -0
- package/dist/quota-utils.d.ts +13 -6
- package/dist/quota-utils.js +128 -105
- package/dist/socket-sdk-class.js +1488 -1430
- package/dist/testing.d.ts +453 -0
- package/dist/testing.js +387 -0
- package/dist/user-agent.js +11 -7
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +68 -60
- package/package.json +47 -31
- package/requirements.json +2 -2
- package/types/api-helpers.d.ts +5 -0
- package/dist/promise-queue.js +0 -91
- package/dist/types.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/sdk",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "SDK for the Socket API client",
|
|
6
6
|
"author": {
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"default": "./dist/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./testing": {
|
|
25
|
+
"types": "./dist/testing.d.ts",
|
|
26
|
+
"default": "./dist/testing.js"
|
|
27
|
+
},
|
|
24
28
|
"./types/api-helpers": "./types/api-helpers.d.ts",
|
|
25
29
|
"./types/api-helpers.d.ts": "./types/api-helpers.d.ts",
|
|
26
30
|
"./types/api": "./types/api.d.ts",
|
|
@@ -28,63 +32,70 @@
|
|
|
28
32
|
"./package.json": "./package.json"
|
|
29
33
|
},
|
|
30
34
|
"scripts": {
|
|
31
|
-
"build": "
|
|
32
|
-
"
|
|
35
|
+
"build": "node scripts/build.mjs",
|
|
36
|
+
"build:dist": "node scripts/build.mjs",
|
|
37
|
+
"build:dist:src": "node scripts/build.mjs --src-only",
|
|
38
|
+
"build:dist:types": "node scripts/build.mjs --types-only",
|
|
39
|
+
"check": "node scripts/check.mjs",
|
|
33
40
|
"check:lint": "eslint --config .config/eslint.config.mjs --report-unused-disable-directives .",
|
|
34
41
|
"check:lint:fix": "pnpm run check:lint -- --fix",
|
|
35
42
|
"check:tsc": "tsgo --noEmit -p .config/tsconfig.check.json",
|
|
36
43
|
"lint-ci": "pnpm run check:lint",
|
|
37
|
-
"coverage": "
|
|
38
|
-
"coverage:test": "
|
|
44
|
+
"coverage": "node scripts/coverage.mjs",
|
|
45
|
+
"coverage:test": "node scripts/coverage.mjs --code-only",
|
|
39
46
|
"coverage:type": "type-coverage",
|
|
40
47
|
"coverage:type:verbose": "type-coverage --detail",
|
|
41
|
-
"coverage:percent": "node scripts/
|
|
42
|
-
"clean": "
|
|
43
|
-
"clean:cache": "
|
|
44
|
-
"clean:coverage": "
|
|
45
|
-
"clean:dist": "
|
|
46
|
-
"clean:
|
|
47
|
-
"clean:
|
|
48
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"coverage:percent": "node scripts/coverage.mjs --percent",
|
|
49
|
+
"clean": "node scripts/clean.mjs",
|
|
50
|
+
"clean:cache": "node scripts/clean.mjs --cache",
|
|
51
|
+
"clean:coverage": "node scripts/clean.mjs --coverage",
|
|
52
|
+
"clean:dist": "node scripts/clean.mjs --dist",
|
|
53
|
+
"clean:dist:types": "node scripts/clean.mjs --dist-types",
|
|
54
|
+
"clean:declarations": "node scripts/clean.mjs --declarations",
|
|
55
|
+
"clean:node_modules": "node scripts/clean.mjs --node-modules",
|
|
56
|
+
"fix": "node scripts/lint-fix.mjs",
|
|
57
|
+
"generate-sdk": "node scripts/generate-sdk.mjs",
|
|
50
58
|
"generate-sdk:01-prettify": "node scripts/prettify-base-json.mjs",
|
|
51
59
|
"generate-sdk:02-generate": "node scripts/generate-types.mjs > types/api.d.ts",
|
|
52
60
|
"generate-sdk:03-clean-api": "pnpm run fix && pnpm run fix",
|
|
53
61
|
"knip:dependencies": "knip --dependencies",
|
|
54
62
|
"knip:exports": "knip --include exports,duplicates",
|
|
55
63
|
"lint": "oxlint -c=.config/.oxlintrc.json --ignore-path=.config/.oxlintignore --tsconfig=.config/tsconfig.json .",
|
|
56
|
-
"lint:fix": "
|
|
57
|
-
"lint:fix:oxlint": "oxlint -c=.config/.oxlintrc.json --ignore-path=.config/.oxlintignore --tsconfig=.config/tsconfig.json --quiet --fix . | dev-null",
|
|
58
|
-
"lint:fix:biome": "biome format --log-level=none --fix . | dev-null",
|
|
59
|
-
"lint:fix:eslint": "eslint --config .config/eslint.config.mjs --report-unused-disable-directives --fix . | dev-null",
|
|
64
|
+
"lint:fix": "node scripts/lint-fix.mjs",
|
|
60
65
|
"lint-staged": "lint-staged",
|
|
61
66
|
"precommit": "lint-staged",
|
|
62
67
|
"prepare": "husky",
|
|
63
68
|
"prepublishOnly": "echo 'ERROR: Use GitHub Actions workflow for publishing' && exit 1",
|
|
64
69
|
"pretest:unit": "pnpm run build",
|
|
65
|
-
"test": "run-s check test
|
|
70
|
+
"test": "run-s check test:run",
|
|
66
71
|
"test:run": "node scripts/test.mjs",
|
|
67
72
|
"test:unit": "dotenvx -q run -f .env.test -- vitest --run",
|
|
68
73
|
"test:unit:update": "dotenvx -q run -f .env.test -- vitest --run --update",
|
|
69
74
|
"test:unit:coverage": "dotenvx -q run -f .env.test -- vitest run --coverage",
|
|
70
75
|
"test-ci": "dotenvx -q run -f .env.test -- vitest --run",
|
|
71
76
|
"type-ci": "pnpm run check:tsc",
|
|
72
|
-
"test-pre-commit": "dotenvx -q run -f .env.precommit --
|
|
73
|
-
"update": "run-p --aggregate-output update
|
|
77
|
+
"test-pre-commit": "dotenvx -q run -f .env.precommit -- node scripts/test-with-build.mjs",
|
|
78
|
+
"update": "run-p --aggregate-output update:*",
|
|
74
79
|
"update:deps": "node scripts/taze.mjs",
|
|
75
80
|
"update:socket": "pnpm -r update '@socketsecurity/*' --latest"
|
|
76
81
|
},
|
|
77
82
|
"dependencies": {
|
|
78
|
-
"@socketsecurity/registry": "1.
|
|
83
|
+
"@socketsecurity/registry": "1.5.3"
|
|
79
84
|
},
|
|
80
85
|
"devDependencies": {
|
|
86
|
+
"@babel/core": "7.28.4",
|
|
87
|
+
"@babel/plugin-transform-runtime": "7.28.3",
|
|
88
|
+
"@babel/preset-typescript": "7.27.1",
|
|
89
|
+
"@babel/runtime": "7.28.4",
|
|
81
90
|
"@biomejs/biome": "2.2.4",
|
|
82
91
|
"@dotenvx/dotenvx": "1.49.0",
|
|
83
92
|
"@eslint/compat": "1.3.2",
|
|
84
93
|
"@eslint/js": "9.35.0",
|
|
85
|
-
"@
|
|
86
|
-
"@
|
|
87
|
-
"@
|
|
94
|
+
"@rollup/plugin-babel": "6.0.4",
|
|
95
|
+
"@rollup/plugin-commonjs": "28.0.6",
|
|
96
|
+
"@rollup/plugin-json": "6.1.0",
|
|
97
|
+
"@rollup/plugin-node-resolve": "16.0.1",
|
|
98
|
+
"@types/node": "24.6.2",
|
|
88
99
|
"@typescript/native-preview": "7.0.0-dev.20250926.1",
|
|
89
100
|
"@vitest/coverage-v8": "3.2.4",
|
|
90
101
|
"del-cli": "6.0.0",
|
|
@@ -106,18 +117,23 @@
|
|
|
106
117
|
"npm-run-all2": "8.0.4",
|
|
107
118
|
"openapi-typescript": "6.7.6",
|
|
108
119
|
"oxlint": "1.15.0",
|
|
120
|
+
"rollup": "4.50.1",
|
|
109
121
|
"taze": "19.6.0",
|
|
110
122
|
"trash": "10.0.0",
|
|
111
123
|
"type-coverage": "2.29.7",
|
|
112
124
|
"typescript-eslint": "8.44.1",
|
|
113
125
|
"vitest": "3.2.4",
|
|
114
126
|
"yargs-parser": "22.0.0",
|
|
115
|
-
"yoctocolors": "2.1.
|
|
127
|
+
"yoctocolors-cjs": "2.1.3"
|
|
116
128
|
},
|
|
117
129
|
"pnpm": {
|
|
118
130
|
"overrides": {
|
|
119
|
-
"vite": "7.1.
|
|
120
|
-
}
|
|
131
|
+
"vite": "7.1.7"
|
|
132
|
+
},
|
|
133
|
+
"ignoredBuiltDependencies": [
|
|
134
|
+
"esbuild",
|
|
135
|
+
"unrs-resolver"
|
|
136
|
+
]
|
|
121
137
|
},
|
|
122
138
|
"engines": {
|
|
123
139
|
"node": ">=18",
|
|
@@ -131,13 +147,13 @@
|
|
|
131
147
|
],
|
|
132
148
|
"lint-staged": {
|
|
133
149
|
"*.{cjs,js,json,md,mjs,mts,ts}": [
|
|
134
|
-
"
|
|
135
|
-
"
|
|
150
|
+
"oxlint -c=.config/.oxlintrc.json --ignore-path=.config/.oxlintignore --tsconfig=.config/tsconfig.json --quiet --fix",
|
|
151
|
+
"biome format --log-level=none --fix --no-errors-on-unmatched --files-ignore-unknown=true --colors=off"
|
|
136
152
|
]
|
|
137
153
|
},
|
|
138
154
|
"typeCoverage": {
|
|
139
155
|
"cache": true,
|
|
140
|
-
"atLeast": 99.
|
|
156
|
+
"atLeast": 99.64,
|
|
141
157
|
"ignoreAsAssertion": true,
|
|
142
158
|
"ignoreCatch": true,
|
|
143
159
|
"ignoreEmptyType": true,
|
package/requirements.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"getOrgAnalytics": {
|
|
52
52
|
"quota": 10,
|
|
53
|
-
"permissions": ["
|
|
53
|
+
"permissions": ["report:write"]
|
|
54
54
|
},
|
|
55
55
|
"getOrganizations": {
|
|
56
56
|
"quota": 0,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
"getRepoAnalytics": {
|
|
100
100
|
"quota": 10,
|
|
101
|
-
"permissions": ["
|
|
101
|
+
"permissions": ["report:write"]
|
|
102
102
|
},
|
|
103
103
|
"getScan": {
|
|
104
104
|
"quota": 0,
|
package/types/api-helpers.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TypeScript type helpers for OpenAPI operation responses.
|
|
3
|
+
* Utility types for extracting return types and error types from OpenAPI operations.
|
|
4
|
+
* Based on openapi-typescript-fetch patterns.
|
|
5
|
+
*/
|
|
1
6
|
declare type ValueOf<
|
|
2
7
|
ObjectType,
|
|
3
8
|
ValueType extends keyof ObjectType = keyof ObjectType,
|
package/dist/promise-queue.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PromiseQueue = void 0;
|
|
4
|
-
class PromiseQueue {
|
|
5
|
-
queue = [];
|
|
6
|
-
running = 0;
|
|
7
|
-
maxConcurrency;
|
|
8
|
-
maxQueueLength;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a new PromiseQueue
|
|
11
|
-
* @param maxConcurrency - Maximum number of promises that can run concurrently
|
|
12
|
-
* @param maxQueueLength - Maximum queue size (older tasks are dropped if exceeded)
|
|
13
|
-
*/
|
|
14
|
-
constructor(maxConcurrency, maxQueueLength) {
|
|
15
|
-
this.maxConcurrency = maxConcurrency;
|
|
16
|
-
this.maxQueueLength = maxQueueLength;
|
|
17
|
-
if (maxConcurrency < 1) {
|
|
18
|
-
throw new Error('maxConcurrency must be at least 1');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Add a task to the queue
|
|
23
|
-
* @param fn - Async function to execute
|
|
24
|
-
* @returns Promise that resolves with the function's result
|
|
25
|
-
*/
|
|
26
|
-
async add(fn) {
|
|
27
|
-
return await new Promise((resolve, reject) => {
|
|
28
|
-
const task = { fn, resolve, reject };
|
|
29
|
-
if (this.maxQueueLength && this.queue.length >= this.maxQueueLength) {
|
|
30
|
-
// Drop oldest task to prevent memory buildup
|
|
31
|
-
this.queue.shift();
|
|
32
|
-
}
|
|
33
|
-
this.queue.push(task);
|
|
34
|
-
this.runNext();
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
runNext() {
|
|
38
|
-
if (this.running >= this.maxConcurrency || this.queue.length === 0) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const task = this.queue.shift();
|
|
42
|
-
/* c8 ignore next 3 - Defensive check; unreachable since we verify queue.length above */
|
|
43
|
-
if (!task) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
this.running++;
|
|
47
|
-
task
|
|
48
|
-
.fn()
|
|
49
|
-
.then(task.resolve)
|
|
50
|
-
.catch(task.reject)
|
|
51
|
-
.finally(() => {
|
|
52
|
-
this.running--;
|
|
53
|
-
this.runNext();
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Wait for all queued and running tasks to complete
|
|
58
|
-
*/
|
|
59
|
-
async onIdle() {
|
|
60
|
-
return await new Promise(resolve => {
|
|
61
|
-
const check = () => {
|
|
62
|
-
if (this.running === 0 && this.queue.length === 0) {
|
|
63
|
-
resolve();
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
setImmediate(check);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
check();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the number of tasks currently running
|
|
74
|
-
*/
|
|
75
|
-
get activeCount() {
|
|
76
|
-
return this.running;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get the number of tasks waiting in the queue
|
|
80
|
-
*/
|
|
81
|
-
get pendingCount() {
|
|
82
|
-
return this.queue.length;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Clear all pending tasks from the queue (does not affect running tasks)
|
|
86
|
-
*/
|
|
87
|
-
clear() {
|
|
88
|
-
this.queue = [];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.PromiseQueue = PromiseQueue;
|
package/dist/types.js
DELETED