@regressionproof/client 0.2.21 → 0.2.23
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 +16 -0
- package/package.json +30 -4
- package/src/.spruce/errors/errors.types.ts +37 -0
- package/src/.spruce/errors/options.types.ts +10 -0
- package/src/.spruce/errors/regressionproofClient/gitServerError.schema.ts +22 -0
- package/src/.spruce/schemas/fields/fieldClassMap.ts +6 -0
- package/src/.spruce/schemas/fields/fields.types.ts +1 -0
- package/src/.spruce/settings.json +9 -1
- package/src/RegressionProofClient.ts +6 -3
- package/src/errors/SpruceError.ts +24 -0
- package/src/errors/gitServerError.builder.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.2.23](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.22...v0.2.23) (2026-01-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @regressionproof/client
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.2.22](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.21...v0.2.22) (2026-01-12)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @regressionproof/client
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.2.21](https://github.com/sprucelabsai-community/regressionproof/compare/v0.2.20...v0.2.21) (2026-01-12)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @regressionproof/client
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regressionproof/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,15 +45,23 @@
|
|
|
45
45
|
"watch.tsc": "tsc -w"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@
|
|
48
|
+
"@sprucelabs/error": "^8.1.2",
|
|
49
|
+
"@sprucelabs/schema": "^33.1.3",
|
|
50
|
+
"@sprucelabs/spruce-core-schemas": "^42.1.3",
|
|
51
|
+
"@sprucelabs/spruce-skill-utils": "^34.0.3"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
54
|
"@sprucelabs/esm-postbuild": "^9.0.13",
|
|
52
|
-
"@sprucelabs/
|
|
55
|
+
"@sprucelabs/jest-json-reporter": "^10.0.19",
|
|
56
|
+
"@sprucelabs/resolve-path-aliases": "^4.0.13",
|
|
57
|
+
"@sprucelabs/test": "^11.1.0",
|
|
58
|
+
"@sprucelabs/test-utils": "^7.2.3",
|
|
53
59
|
"@types/node": "^25.0.3",
|
|
54
60
|
"chokidar-cli": "^3.0.0",
|
|
55
61
|
"eslint": "^9.39.2",
|
|
56
62
|
"eslint-config-spruce": "^11.2.26",
|
|
63
|
+
"jest": "^30.2.0",
|
|
64
|
+
"jest-circus": "^30.2.0",
|
|
57
65
|
"prettier": "^3.7.4",
|
|
58
66
|
"ts-node": "^10.9.2",
|
|
59
67
|
"tsc-watch": "^7.2.0",
|
|
@@ -63,5 +71,23 @@
|
|
|
63
71
|
"skill": {
|
|
64
72
|
"namespace": "regressionproof-client"
|
|
65
73
|
},
|
|
66
|
-
"
|
|
74
|
+
"jest": {
|
|
75
|
+
"testRunner": "jest-circus/runner",
|
|
76
|
+
"maxWorkers": 4,
|
|
77
|
+
"testTimeout": 120000,
|
|
78
|
+
"testEnvironment": "node",
|
|
79
|
+
"testPathIgnorePatterns": [
|
|
80
|
+
"<rootDir>/tmp/",
|
|
81
|
+
"<rootDir>/src/",
|
|
82
|
+
"<rootDir>/node_modules/",
|
|
83
|
+
"<rootDir>/build/__tests__/testDirsAndFiles/"
|
|
84
|
+
],
|
|
85
|
+
"testMatch": [
|
|
86
|
+
"**/__tests__/**/*.test.js?(x)"
|
|
87
|
+
],
|
|
88
|
+
"moduleNameMapper": {
|
|
89
|
+
"^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"gitHead": "17d51dfc1f2260698f347609f97e3e0c9ef2fc52"
|
|
67
93
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as SchemaEntity } from '@sprucelabs/schema'
|
|
2
|
+
import * as SpruceSchema from '@sprucelabs/schema'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export declare namespace SpruceErrors.RegressionproofClient {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export interface GitServerError {
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
'message': string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GitServerErrorSchema extends SpruceSchema.Schema {
|
|
18
|
+
id: 'gitServerError',
|
|
19
|
+
namespace: 'RegressionproofClient',
|
|
20
|
+
name: 'git server error',
|
|
21
|
+
fields: {
|
|
22
|
+
/** . */
|
|
23
|
+
'message': {
|
|
24
|
+
type: 'text',
|
|
25
|
+
isRequired: true,
|
|
26
|
+
options: undefined
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type GitServerErrorEntity = SchemaEntity<SpruceErrors.RegressionproofClient.GitServerErrorSchema>
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SpruceErrors } from "#spruce/errors/errors.types"
|
|
2
|
+
import { ErrorOptions as ISpruceErrorOptions} from "@sprucelabs/error"
|
|
3
|
+
|
|
4
|
+
export interface GitServerErrorErrorOptions extends SpruceErrors.RegressionproofClient.GitServerError, ISpruceErrorOptions {
|
|
5
|
+
code: 'GIT_SERVER_ERROR'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type ErrorOptions = | GitServerErrorErrorOptions
|
|
9
|
+
|
|
10
|
+
export default ErrorOptions
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
|
+
import { SpruceErrors } from '../errors.types'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const gitServerErrorSchema: SpruceErrors.RegressionproofClient.GitServerErrorSchema = {
|
|
7
|
+
id: 'gitServerError',
|
|
8
|
+
namespace: 'RegressionproofClient',
|
|
9
|
+
name: 'git server error',
|
|
10
|
+
fields: {
|
|
11
|
+
/** . */
|
|
12
|
+
'message': {
|
|
13
|
+
type: 'text',
|
|
14
|
+
isRequired: true,
|
|
15
|
+
options: undefined
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
SchemaRegistry.getInstance().trackSchema(gitServerErrorSchema)
|
|
21
|
+
|
|
22
|
+
export default gitServerErrorSchema
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldDefinitions, FieldDefinitionMap, FieldValueTypeGeneratorMap, FieldMap } from '@sprucelabs/schema'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SpruceError from './errors/SpruceError'
|
|
2
2
|
|
|
3
3
|
export default class RegressionProofClient {
|
|
4
4
|
private baseUrl: string
|
|
@@ -52,17 +52,20 @@ export default class RegressionProofClient {
|
|
|
52
52
|
private async parseErrorResponse(response: Response): Promise<SpruceError> {
|
|
53
53
|
try {
|
|
54
54
|
const body = await response.json()
|
|
55
|
+
if (body.error?.options) {
|
|
56
|
+
return SpruceError.parse(body.error, SpruceError)
|
|
57
|
+
}
|
|
55
58
|
if (body.error?.code) {
|
|
56
59
|
return new SpruceError(body.error)
|
|
57
60
|
}
|
|
58
61
|
return new SpruceError({
|
|
59
62
|
code: 'GIT_SERVER_ERROR',
|
|
60
|
-
message:
|
|
63
|
+
message: `${response.statusText}`,
|
|
61
64
|
})
|
|
62
65
|
} catch {
|
|
63
66
|
return new SpruceError({
|
|
64
67
|
code: 'GIT_SERVER_ERROR',
|
|
65
|
-
message:
|
|
68
|
+
message: `${response.statusText}`,
|
|
66
69
|
})
|
|
67
70
|
}
|
|
68
71
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BaseSpruceError from '@sprucelabs/error'
|
|
2
|
+
import ErrorOptions from '#spruce/errors/options.types'
|
|
3
|
+
|
|
4
|
+
export default class SpruceError extends BaseSpruceError<ErrorOptions> {
|
|
5
|
+
/** an easy to understand version of the errors */
|
|
6
|
+
public friendlyMessage(): string {
|
|
7
|
+
const { options } = this
|
|
8
|
+
let message
|
|
9
|
+
switch (options?.code) {
|
|
10
|
+
case 'GIT_SERVER_ERROR':
|
|
11
|
+
message = `A request to the Git server failed: ${options.message}!`
|
|
12
|
+
break
|
|
13
|
+
|
|
14
|
+
default:
|
|
15
|
+
message = super.friendlyMessage()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const fullMessage = options.friendlyMessage
|
|
19
|
+
? options.friendlyMessage
|
|
20
|
+
: message
|
|
21
|
+
|
|
22
|
+
return fullMessage
|
|
23
|
+
}
|
|
24
|
+
}
|