velocious 1.0.576 → 1.0.577
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/README.md +46 -1
- package/build/background-jobs/main.js +13 -2
- package/build/background-jobs/scheduler.js +11 -7
- package/build/background-jobs/store.js +18 -13
- package/build/environment-handlers/node/cli/commands/test.js +2 -0
- package/build/environment-handlers/node/source-peer-package.js +172 -0
- package/build/routes/resolver.js +3 -50
- package/build/src/background-jobs/main.d.ts.map +1 -1
- package/build/src/background-jobs/main.js +13 -3
- package/build/src/background-jobs/scheduler.d.ts +2 -2
- package/build/src/background-jobs/scheduler.d.ts.map +1 -1
- package/build/src/background-jobs/scheduler.js +11 -8
- package/build/src/background-jobs/store.d.ts +5 -4
- package/build/src/background-jobs/store.d.ts.map +1 -1
- package/build/src/background-jobs/store.js +17 -12
- package/build/src/environment-handlers/node/cli/commands/test.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/test.js +3 -1
- package/build/src/environment-handlers/node/source-peer-package.d.ts +46 -0
- package/build/src/environment-handlers/node/source-peer-package.d.ts.map +1 -0
- package/build/src/environment-handlers/node/source-peer-package.js +148 -0
- package/build/src/routes/resolver.d.ts.map +1 -1
- package/build/src/routes/resolver.js +4 -45
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/scripts/run-tests.js +61 -20
- package/scripts/test-browser.js +6 -1
- package/src/background-jobs/main.js +13 -2
- package/src/background-jobs/scheduler.js +11 -7
- package/src/background-jobs/store.js +18 -13
- package/src/environment-handlers/node/cli/commands/test.js +2 -0
- package/src/environment-handlers/node/source-peer-package.js +172 -0
- package/src/routes/resolver.js +3 -50
- package/build/deployment-api/controller.js +0 -437
- package/build/deployment-api/index.js +0 -210
- package/build/deployment-api/path-matcher.js +0 -45
- package/build/deployment-api/registry.js +0 -84
- package/build/deployment-api/run-store.js +0 -798
- package/build/deployment-api/sanitize.js +0 -114
- package/build/src/deployment-api/controller.d.ts +0 -117
- package/build/src/deployment-api/controller.d.ts.map +0 -1
- package/build/src/deployment-api/controller.js +0 -384
- package/build/src/deployment-api/index.d.ts +0 -46
- package/build/src/deployment-api/index.d.ts.map +0 -1
- package/build/src/deployment-api/index.js +0 -178
- package/build/src/deployment-api/path-matcher.d.ts +0 -31
- package/build/src/deployment-api/path-matcher.d.ts.map +0 -1
- package/build/src/deployment-api/path-matcher.js +0 -39
- package/build/src/deployment-api/registry.d.ts +0 -106
- package/build/src/deployment-api/registry.d.ts.map +0 -1
- package/build/src/deployment-api/registry.js +0 -74
- package/build/src/deployment-api/run-store.d.ts +0 -402
- package/build/src/deployment-api/run-store.d.ts.map +0 -1
- package/build/src/deployment-api/run-store.js +0 -711
- package/build/src/deployment-api/sanitize.d.ts +0 -27
- package/build/src/deployment-api/sanitize.d.ts.map +0 -1
- package/build/src/deployment-api/sanitize.js +0 -100
- package/src/deployment-api/controller.js +0 -437
- package/src/deployment-api/index.js +0 -210
- package/src/deployment-api/path-matcher.js +0 -45
- package/src/deployment-api/registry.js +0 -84
- package/src/deployment-api/run-store.js +0 -798
- package/src/deployment-api/sanitize.js +0 -114
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
const MAX_STRING_LENGTH = 4000
|
|
4
|
-
const MAX_DEPTH = 20
|
|
5
|
-
const REDACTED = "[redacted]"
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Replaces every occurrence of each configured secret in a string so tokens
|
|
9
|
-
* never leak into persisted run state, audit payloads, or API responses.
|
|
10
|
-
* @param {string} value - Raw string.
|
|
11
|
-
* @param {string[]} secrets - Secret values to redact.
|
|
12
|
-
* @returns {string} - Redacted string.
|
|
13
|
-
*/
|
|
14
|
-
function redactString(value, secrets) {
|
|
15
|
-
let result = value
|
|
16
|
-
|
|
17
|
-
for (const secret of secrets) {
|
|
18
|
-
if (secret.length > 0) result = result.split(secret).join(REDACTED)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (result.length > MAX_STRING_LENGTH) {
|
|
22
|
-
result = `${result.slice(0, MAX_STRING_LENGTH)}…`
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return result
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Converts an integration-owned value (adapter report, live status, audit
|
|
30
|
-
* payload fragment) into a bounded JSON-safe structure: plain objects, arrays,
|
|
31
|
-
* strings, finite numbers, booleans, and null survive; everything else
|
|
32
|
-
* (functions, class instances, undefined) is dropped. String values and object
|
|
33
|
-
* keys are redacted and capped in length; deterministic suffixes preserve every
|
|
34
|
-
* value when redacted keys collide.
|
|
35
|
-
* @param {?} value - Raw value from the integration.
|
|
36
|
-
* @param {string[]} secrets - Secret values to redact.
|
|
37
|
-
* @param {number} [depth] - Current recursion depth.
|
|
38
|
-
* @returns {?} - JSON-safe redacted value, or undefined when the value cannot be represented.
|
|
39
|
-
*/
|
|
40
|
-
export function sanitizeAdapterValue(value, secrets, depth = 0) {
|
|
41
|
-
if (value === null) return null
|
|
42
|
-
if (depth > MAX_DEPTH) return undefined
|
|
43
|
-
|
|
44
|
-
const valueType = typeof value
|
|
45
|
-
|
|
46
|
-
if (valueType === "string") return redactString(value, secrets)
|
|
47
|
-
if (valueType === "number") return Number.isFinite(value) ? value : null
|
|
48
|
-
if (valueType === "boolean") return value
|
|
49
|
-
|
|
50
|
-
if (Array.isArray(value)) {
|
|
51
|
-
/** @type {Array<?>} */
|
|
52
|
-
const result = []
|
|
53
|
-
|
|
54
|
-
for (const entry of value) {
|
|
55
|
-
const sanitized = sanitizeAdapterValue(entry, secrets, depth + 1)
|
|
56
|
-
|
|
57
|
-
if (sanitized !== undefined) result.push(sanitized)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return result
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (valueType === "object") {
|
|
64
|
-
const prototype = Object.getPrototypeOf(value)
|
|
65
|
-
|
|
66
|
-
if (prototype !== Object.prototype && prototype !== null) return undefined
|
|
67
|
-
|
|
68
|
-
/** @type {Record<string, ?>} */
|
|
69
|
-
const result = {}
|
|
70
|
-
|
|
71
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
72
|
-
const sanitized = sanitizeAdapterValue(entry, secrets, depth + 1)
|
|
73
|
-
|
|
74
|
-
if (sanitized === undefined) continue
|
|
75
|
-
|
|
76
|
-
const redactedKey = redactString(key, secrets)
|
|
77
|
-
let availableKey = redactedKey
|
|
78
|
-
let collisionNumber = 2
|
|
79
|
-
|
|
80
|
-
while (Object.hasOwn(result, availableKey)) {
|
|
81
|
-
availableKey = `${redactedKey}#${collisionNumber}`
|
|
82
|
-
collisionNumber++
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
Object.defineProperty(result, availableKey, {
|
|
86
|
-
configurable: true,
|
|
87
|
-
enumerable: true,
|
|
88
|
-
value: sanitized,
|
|
89
|
-
writable: true
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return result
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return undefined
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Builds the sanitized failure payload persisted for a failed run. The message
|
|
101
|
-
* is redacted; an integration-provided plain-object `error.recovery` (e.g.
|
|
102
|
-
* Rampway reporting restoration of the previous release) is included after
|
|
103
|
-
* sanitization.
|
|
104
|
-
* @param {?} error - Thrown error from the adapter.
|
|
105
|
-
* @param {string[]} secrets - Secret values to redact.
|
|
106
|
-
* @returns {{message: string, recovery: (? | undefined)}} - Sanitized failure payload.
|
|
107
|
-
*/
|
|
108
|
-
export function sanitizeErrorPayload(error, secrets) {
|
|
109
|
-
const rawMessage = error instanceof Error ? error.message : String(error)
|
|
110
|
-
const rawRecovery = error instanceof Error ? /** @type {Record<string, ?>} */ (error).recovery : undefined
|
|
111
|
-
const recovery = sanitizeAdapterValue(rawRecovery, secrets)
|
|
112
|
-
|
|
113
|
-
return {message: redactString(rawMessage, secrets), recovery}
|
|
114
|
-
}
|