@regressionproof/client 0.3.8 → 0.3.9

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.
@@ -1,11 +1,11 @@
1
- export default class RegressionProofClient {
2
- private baseUrl;
3
- constructor(baseUrl: string);
4
- checkNameAvailability(name: string): Promise<boolean>;
5
- registerProject(options: RegisterProjectOptions): Promise<ProjectCredentials>;
6
- refreshCredentials(options: RegisterProjectOptions): Promise<ProjectCredentials>;
7
- private parseErrorResponse;
1
+ import SpruceError from './errors/SpruceError';
2
+ export default abstract class RegressionProofClient {
3
+ abstract checkNameAvailability(name: string): Promise<boolean>;
4
+ abstract registerProject(options: RegisterProjectOptions): Promise<ProjectCredentials>;
5
+ abstract refreshCredentials(options: RegisterProjectOptions): Promise<ProjectCredentials>;
6
+ protected parseErrorResponse(response: Response): Promise<SpruceError>;
8
7
  }
8
+ export declare function buildRegressionProofClient(baseUrl: string): RegressionProofClient;
9
9
  export interface RegisterProjectOptions {
10
10
  name: string;
11
11
  }
@@ -3,9 +3,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildRegressionProofClient = buildRegressionProofClient;
6
7
  const SpruceError_1 = __importDefault(require("./errors/SpruceError"));
7
8
  class RegressionProofClient {
9
+ async parseErrorResponse(response) {
10
+ try {
11
+ const body = await response.json();
12
+ if (body.error?.options) {
13
+ return SpruceError_1.default.parse(body.error, SpruceError_1.default);
14
+ }
15
+ if (body.error?.code) {
16
+ return new SpruceError_1.default(body.error);
17
+ }
18
+ return new SpruceError_1.default({
19
+ code: 'GIT_SERVER_ERROR',
20
+ message: `${response.statusText}`,
21
+ });
22
+ }
23
+ catch {
24
+ return new SpruceError_1.default({
25
+ code: 'GIT_SERVER_ERROR',
26
+ message: `${response.statusText}`,
27
+ });
28
+ }
29
+ }
30
+ }
31
+ exports.default = RegressionProofClient;
32
+ function buildRegressionProofClient(baseUrl) {
33
+ return new RegressionProofClientImpl(baseUrl);
34
+ }
35
+ class RegressionProofClientImpl extends RegressionProofClient {
8
36
  constructor(baseUrl) {
37
+ super();
9
38
  this.baseUrl = baseUrl;
10
39
  }
11
40
  async checkNameAvailability(name) {
@@ -39,26 +68,4 @@ class RegressionProofClient {
39
68
  }
40
69
  return response.json();
41
70
  }
42
- async parseErrorResponse(response) {
43
- try {
44
- const body = await response.json();
45
- if (body.error?.options) {
46
- return SpruceError_1.default.parse(body.error, SpruceError_1.default);
47
- }
48
- if (body.error?.code) {
49
- return new SpruceError_1.default(body.error);
50
- }
51
- return new SpruceError_1.default({
52
- code: 'GIT_SERVER_ERROR',
53
- message: `${response.statusText}`,
54
- });
55
- }
56
- catch {
57
- return new SpruceError_1.default({
58
- code: 'GIT_SERVER_ERROR',
59
- message: `${response.statusText}`,
60
- });
61
- }
62
- }
63
71
  }
64
- exports.default = RegressionProofClient;
@@ -1,11 +1,11 @@
1
- export default class RegressionProofClient {
2
- private baseUrl;
3
- constructor(baseUrl: string);
4
- checkNameAvailability(name: string): Promise<boolean>;
5
- registerProject(options: RegisterProjectOptions): Promise<ProjectCredentials>;
6
- refreshCredentials(options: RegisterProjectOptions): Promise<ProjectCredentials>;
7
- private parseErrorResponse;
1
+ import SpruceError from './errors/SpruceError';
2
+ export default abstract class RegressionProofClient {
3
+ abstract checkNameAvailability(name: string): Promise<boolean>;
4
+ abstract registerProject(options: RegisterProjectOptions): Promise<ProjectCredentials>;
5
+ abstract refreshCredentials(options: RegisterProjectOptions): Promise<ProjectCredentials>;
6
+ protected parseErrorResponse(response: Response): Promise<SpruceError>;
8
7
  }
8
+ export declare function buildRegressionProofClient(baseUrl: string): RegressionProofClient;
9
9
  export interface RegisterProjectOptions {
10
10
  name: string;
11
11
  }
@@ -9,7 +9,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import SpruceError from './errors/SpruceError.js';
11
11
  export default class RegressionProofClient {
12
+ parseErrorResponse(response) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ var _a, _b;
15
+ try {
16
+ const body = yield response.json();
17
+ if ((_a = body.error) === null || _a === void 0 ? void 0 : _a.options) {
18
+ return SpruceError.parse(body.error, SpruceError);
19
+ }
20
+ if ((_b = body.error) === null || _b === void 0 ? void 0 : _b.code) {
21
+ return new SpruceError(body.error);
22
+ }
23
+ return new SpruceError({
24
+ code: 'GIT_SERVER_ERROR',
25
+ message: `${response.statusText}`,
26
+ });
27
+ }
28
+ catch (_c) {
29
+ return new SpruceError({
30
+ code: 'GIT_SERVER_ERROR',
31
+ message: `${response.statusText}`,
32
+ });
33
+ }
34
+ });
35
+ }
36
+ }
37
+ export function buildRegressionProofClient(baseUrl) {
38
+ return new RegressionProofClientImpl(baseUrl);
39
+ }
40
+ class RegressionProofClientImpl extends RegressionProofClient {
12
41
  constructor(baseUrl) {
42
+ super();
13
43
  this.baseUrl = baseUrl;
14
44
  }
15
45
  checkNameAvailability(name) {
@@ -49,28 +79,4 @@ export default class RegressionProofClient {
49
79
  return response.json();
50
80
  });
51
81
  }
52
- parseErrorResponse(response) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- var _a, _b;
55
- try {
56
- const body = yield response.json();
57
- if ((_a = body.error) === null || _a === void 0 ? void 0 : _a.options) {
58
- return SpruceError.parse(body.error, SpruceError);
59
- }
60
- if ((_b = body.error) === null || _b === void 0 ? void 0 : _b.code) {
61
- return new SpruceError(body.error);
62
- }
63
- return new SpruceError({
64
- code: 'GIT_SERVER_ERROR',
65
- message: `${response.statusText}`,
66
- });
67
- }
68
- catch (_c) {
69
- return new SpruceError({
70
- code: 'GIT_SERVER_ERROR',
71
- message: `${response.statusText}`,
72
- });
73
- }
74
- });
75
- }
76
82
  }
@@ -1,2 +1,2 @@
1
- export { default as RegressionProofClient, RegisterProjectOptions, ProjectCredentials, } from './RegressionProofClient.js';
2
- export { default } from './RegressionProofClient.js';
1
+ export { default as RegressionProofClient, buildRegressionProofClient, } from './RegressionProofClient.js';
2
+ export type { RegisterProjectOptions, ProjectCredentials, } from './RegressionProofClient.js';
@@ -1,2 +1 @@
1
- export { default as RegressionProofClient, } from './RegressionProofClient.js.js';
2
- export { default } from './RegressionProofClient.js.js';
1
+ export { default as RegressionProofClient, buildRegressionProofClient, } from './RegressionProofClient.js.js';
package/build/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { default as RegressionProofClient, RegisterProjectOptions, ProjectCredentials, } from './RegressionProofClient.js';
2
- export { default } from './RegressionProofClient.js';
1
+ export { default as RegressionProofClient, buildRegressionProofClient, } from './RegressionProofClient.js';
2
+ export type { RegisterProjectOptions, ProjectCredentials, } from './RegressionProofClient.js';
package/build/index.js CHANGED
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = exports.RegressionProofClient = void 0;
6
+ exports.buildRegressionProofClient = exports.RegressionProofClient = void 0;
7
7
  var RegressionProofClient_js_1 = require("./RegressionProofClient.js");
8
8
  Object.defineProperty(exports, "RegressionProofClient", { enumerable: true, get: function () { return __importDefault(RegressionProofClient_js_1).default; } });
9
- var RegressionProofClient_js_2 = require("./RegressionProofClient.js");
10
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(RegressionProofClient_js_2).default; } });
9
+ Object.defineProperty(exports, "buildRegressionProofClient", { enumerable: true, get: function () { return RegressionProofClient_js_1.buildRegressionProofClient; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regressionproof/client",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -92,5 +92,5 @@
92
92
  "^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
93
93
  }
94
94
  },
95
- "gitHead": "b59db28cb04d4cf306b248c7816fd2b10a30f326"
95
+ "gitHead": "c89b77e22b9be85c3fa66c8669b4146c56aea3d0"
96
96
  }