@aneuhold/core-ts-api-lib 3.0.38 → 3.0.40
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/lib/browser.d.ts +1 -1
- package/lib/browser.d.ts.map +1 -1
- package/lib/browser.js +1 -1
- package/lib/browser.js.map +1 -1
- package/lib/browser.ts +1 -1
- package/lib/services/APIService/{APIService.d.ts → API.service.d.ts} +1 -1
- package/lib/services/APIService/API.service.d.ts.map +1 -0
- package/lib/services/APIService/{APIService.js → API.service.js} +2 -2
- package/lib/services/APIService/API.service.js.map +1 -0
- package/lib/services/APIService/{APIService.ts → API.service.ts} +1 -1
- package/lib/services/GCloudAPIService/{GCloudAPIService.d.ts → GCloudAPI.service.d.ts} +1 -29
- package/lib/services/GCloudAPIService/GCloudAPI.service.d.ts.map +1 -0
- package/lib/services/GCloudAPIService/{GCloudAPIService.js → GCloudAPI.service.js} +38 -38
- package/lib/services/GCloudAPIService/GCloudAPI.service.js.map +1 -0
- package/lib/services/GCloudAPIService/{GCloudAPIService.ts → GCloudAPI.service.ts} +42 -39
- package/package.json +5 -5
- package/lib/services/APIService/APIService.d.ts.map +0 -1
- package/lib/services/APIService/APIService.js.map +0 -1
- package/lib/services/GCloudAPIService/GCloudAPIService.d.ts.map +0 -1
- package/lib/services/GCloudAPIService/GCloudAPIService.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 🔖 [3.0.40] (2026-06-19)
|
|
9
|
+
|
|
10
|
+
### 🏗️ Changed
|
|
11
|
+
|
|
12
|
+
- Updated `@aneuhold/core-ts-db-lib` to `^5.0.10` and `@aneuhold/core-ts-lib` to `^2.4.6`.
|
|
13
|
+
|
|
14
|
+
## 🔖 [3.0.39] (2026-06-12)
|
|
15
|
+
|
|
16
|
+
### 🏗️ Changed
|
|
17
|
+
|
|
18
|
+
- Renamed service files to use the `.service.ts` naming convention (`APIService.ts` → `API.service.ts`, `GCloudAPIService.ts` → `GCloudAPI.service.ts`).
|
|
19
|
+
- Converted `private static` methods to native `#` private class fields in `GCloudAPIService`.
|
|
20
|
+
|
|
8
21
|
## 🔖 [3.0.38] (2026-05-10)
|
|
9
22
|
|
|
10
23
|
### 🏗️ Changed
|
|
@@ -426,6 +439,8 @@ No direct code changes; version bump for compatibility.
|
|
|
426
439
|
- Updated workflow permissions to allow repository write access
|
|
427
440
|
|
|
428
441
|
<!-- Link References -->
|
|
442
|
+
[3.0.40]: https://github.com/aneuhold/ts-libs/compare/core-ts-api-lib-v3.0.39...core-ts-api-lib-v3.0.40
|
|
443
|
+
[3.0.39]: https://github.com/aneuhold/ts-libs/compare/core-ts-api-lib-v3.0.38...core-ts-api-lib-v3.0.39
|
|
429
444
|
[3.0.38]: https://github.com/aneuhold/ts-libs/compare/core-ts-api-lib-v3.0.37...core-ts-api-lib-v3.0.38
|
|
430
445
|
[3.0.37]: https://github.com/aneuhold/ts-libs/compare/core-ts-api-lib-v3.0.36...core-ts-api-lib-v3.0.37
|
|
431
446
|
[3.0.36]: https://github.com/aneuhold/ts-libs/compare/core-ts-api-lib-v3.0.35...core-ts-api-lib-v3.0.36
|
package/lib/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import APIService from './services/APIService/
|
|
1
|
+
import APIService from './services/APIService/API.service.js';
|
|
2
2
|
import type { AdminInput, AdminOutput, AdminOutputUserDetail, AdminOutputUserDocumentCounts } from './types/Admin.js';
|
|
3
3
|
import type { APIResponse } from './types/APIResponse.js';
|
|
4
4
|
import type { AuthCheckPasswordInput, AuthCheckPasswordOutput } from './types/AuthCheckPassword.js';
|
package/lib/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EACV,oCAAoC,EACpC,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EACV,sCAAsC,EACtC,sCAAsC,EACtC,sBAAsB,EACtB,oCAAoC,EACpC,oCAAoC,EACrC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,YAAY,EACV,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,6BAA6B,EAC7B,WAAW,EACX,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,sCAAsC,EACtC,sCAAsC,EACtC,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,oCAAoC,EACpC,0BAA0B,EAC1B,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,oCAAoC,EACpC,oCAAoC,EACrC,CAAC"}
|
package/lib/browser.js
CHANGED
package/lib/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,sCAAsC,CAAC;AA+B9D,kEAAkE;AAClE,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/lib/browser.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"API.service.d.ts","sourceRoot":"","sources":["../../../src/services/APIService/API.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,+CAA+C,CAAC;AAGvD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;;OAMG;WACU,YAAY,CACvB,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAI/C;;;OAGG;WACU,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAItD;;;OAGG;WACU,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAI3E;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1C;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;;OAKG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,GAC3E,IAAI;IAIP;;;;OAIG;WACU,gBAAgB,CAC3B,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAI/C;;;;OAIG;WACU,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAI/E;;;;OAIG;WACU,cAAc,CACzB,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAIpD;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM;IAIjC;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAInC;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM;CAGlC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import GCloudAPIService from '../GCloudAPIService/
|
|
1
|
+
import GCloudAPIService from '../GCloudAPIService/GCloudAPI.service.js';
|
|
2
2
|
/**
|
|
3
3
|
* A service for making calls to the backend API for personal projects. This is
|
|
4
4
|
* abstracted so that the backend implementation can change over time.
|
|
@@ -98,4 +98,4 @@ export default class APIService {
|
|
|
98
98
|
return GCloudAPIService.defaultUrl;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
//# sourceMappingURL=
|
|
101
|
+
//# sourceMappingURL=API.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"API.service.js","sourceRoot":"","sources":["../../../src/services/APIService/API.service.ts"],"names":[],"mappings":"AAeA,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,KAA4B;QAE5B,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM;QACjB,OAAO,gBAAgB,CAAC,UAAU,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,aAAa;QACxB,OAAO,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAa;QACjC,gBAAgB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAa;QACxC,gBAAgB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4E;QAE5E,gBAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,KAA4B;QAE5B,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,KAAiB;QACzC,OAAO,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,KAAiC;QAEjC,OAAO,gBAAgB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,gBAAgB,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAW;QAC1B,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,gBAAgB,CAAC,UAAU,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
ProjectWorkoutPrimaryInput,
|
|
14
14
|
ProjectWorkoutPrimaryOutput
|
|
15
15
|
} from '../../types/project/workout/ProjectWorkout.js';
|
|
16
|
-
import GCloudAPIService from '../GCloudAPIService/
|
|
16
|
+
import GCloudAPIService from '../GCloudAPIService/GCloudAPI.service.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A service for making calls to the backend API for personal projects. This is
|
|
@@ -82,34 +82,6 @@ export default class GCloudAPIService {
|
|
|
82
82
|
* @param input - The input for the project workout function.
|
|
83
83
|
*/
|
|
84
84
|
static projectWorkout(input: ProjectWorkoutPrimaryInput): Promise<APIResponse<ProjectWorkoutPrimaryOutput>>;
|
|
85
|
-
/**
|
|
86
|
-
* Makes a call to the API. On a 401 response, automatically attempts to
|
|
87
|
-
* refresh the access token using the stored refresh token. If refresh
|
|
88
|
-
* succeeds, the original request is retried once.
|
|
89
|
-
*
|
|
90
|
-
* @param urlPath - The path to the endpoint.
|
|
91
|
-
* @param input - The input to the endpoint.
|
|
92
|
-
*/
|
|
93
|
-
private static call;
|
|
94
|
-
/**
|
|
95
|
-
* Attempts to refresh the access token using the stored refresh token.
|
|
96
|
-
* On success, updates the stored tokens and notifies via the
|
|
97
|
-
* {@link #onTokensRefreshed} callback.
|
|
98
|
-
*/
|
|
99
|
-
private static tryRefreshTokens;
|
|
100
|
-
/**
|
|
101
|
-
* Performs a POST request and decodes the JSON response.
|
|
102
|
-
*
|
|
103
|
-
* @param urlPath - The path to the endpoint.
|
|
104
|
-
* @param input - The input to the endpoint.
|
|
105
|
-
*/
|
|
106
|
-
private static fetchAndDecode;
|
|
107
|
-
/**
|
|
108
|
-
* Decodes a fetch Response into an APIResponse.
|
|
109
|
-
*
|
|
110
|
-
* @param response - The fetch response to decode.
|
|
111
|
-
*/
|
|
112
|
-
private static decodeResponse;
|
|
113
85
|
}
|
|
114
86
|
export {};
|
|
115
|
-
//# sourceMappingURL=
|
|
87
|
+
//# sourceMappingURL=GCloudAPI.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GCloudAPI.service.d.ts","sourceRoot":"","sources":["../../../src/services/GCloudAPIService/GCloudAPI.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,+CAA+C,CAAC;AAEvD;;;GAGG;AACH,KAAK,yBAAyB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;AAE3F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;;IACnC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAmC;IAcrE;;;;OAIG;IACH,MAAM,CAAC,MAAM,IAAI,MAAM;IAIvB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIhC;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI;IAI7E;;;;OAIG;WACU,gBAAgB,CAC3B,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAI/C;;;OAGG;WACU,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAa1D;;;OAGG;WACU,iBAAiB,IAAI,OAAO,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAO/E;;;;OAIG;WACU,gBAAgB,CAC3B,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAI/C;;;;OAIG;WACU,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAIxE;;;;OAIG;WACU,cAAc,CACzB,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;CA6IrD"}
|
|
@@ -61,7 +61,7 @@ export default class GCloudAPIService {
|
|
|
61
61
|
* @param input - The input for the validateUser endpoint.
|
|
62
62
|
*/
|
|
63
63
|
static async authValidateUser(input) {
|
|
64
|
-
return this
|
|
64
|
+
return this.#call('auth/validateUser', input);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Calls the auth logout endpoint to delete the current refresh token
|
|
@@ -71,7 +71,7 @@ export default class GCloudAPIService {
|
|
|
71
71
|
if (!this.#refreshTokenString) {
|
|
72
72
|
return { success: true, errors: [], data: undefined };
|
|
73
73
|
}
|
|
74
|
-
const { decoded } = await this
|
|
74
|
+
const { decoded } = await this.#fetchAndDecode('auth/logout', {
|
|
75
75
|
refreshTokenString: this.#refreshTokenString
|
|
76
76
|
});
|
|
77
77
|
return decoded;
|
|
@@ -81,7 +81,7 @@ export default class GCloudAPIService {
|
|
|
81
81
|
* currently-authenticated user and every per-user document tied to them.
|
|
82
82
|
*/
|
|
83
83
|
static async authDeleteAccount() {
|
|
84
|
-
return this
|
|
84
|
+
return this.#call('auth/deleteAccount', undefined);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* Calls the project dashboard endpoint to get, insert, update, or delete dashboard data.
|
|
@@ -89,7 +89,7 @@ export default class GCloudAPIService {
|
|
|
89
89
|
* @param input - The input for the project dashboard function.
|
|
90
90
|
*/
|
|
91
91
|
static async projectDashboard(input) {
|
|
92
|
-
return this
|
|
92
|
+
return this.#call('project/dashboard', input);
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Calls the admin endpoint. Requires super admin access.
|
|
@@ -97,7 +97,7 @@ export default class GCloudAPIService {
|
|
|
97
97
|
* @param input - The input for the admin endpoint.
|
|
98
98
|
*/
|
|
99
99
|
static async admin(input) {
|
|
100
|
-
return this
|
|
100
|
+
return this.#call('admin', input);
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Calls the project workout endpoint to get, insert, update, or delete workout data.
|
|
@@ -105,7 +105,7 @@ export default class GCloudAPIService {
|
|
|
105
105
|
* @param input - The input for the project workout function.
|
|
106
106
|
*/
|
|
107
107
|
static async projectWorkout(input) {
|
|
108
|
-
return this
|
|
108
|
+
return this.#call('project/workout', input);
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Makes a call to the API. On a 401 response, automatically attempts to
|
|
@@ -115,12 +115,12 @@ export default class GCloudAPIService {
|
|
|
115
115
|
* @param urlPath - The path to the endpoint.
|
|
116
116
|
* @param input - The input to the endpoint.
|
|
117
117
|
*/
|
|
118
|
-
static async call(urlPath, input) {
|
|
119
|
-
const { response, decoded } = await this
|
|
118
|
+
static async #call(urlPath, input) {
|
|
119
|
+
const { response, decoded } = await this.#fetchAndDecode(urlPath, input);
|
|
120
120
|
if (response.status === 401 && this.#refreshTokenString) {
|
|
121
|
-
const refreshed = await this
|
|
121
|
+
const refreshed = await this.#tryRefreshTokens();
|
|
122
122
|
if (refreshed) {
|
|
123
|
-
const retry = await this
|
|
123
|
+
const retry = await this.#fetchAndDecode(urlPath, input);
|
|
124
124
|
return retry.decoded;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -131,11 +131,11 @@ export default class GCloudAPIService {
|
|
|
131
131
|
* On success, updates the stored tokens and notifies via the
|
|
132
132
|
* {@link #onTokensRefreshed} callback.
|
|
133
133
|
*/
|
|
134
|
-
static async tryRefreshTokens() {
|
|
134
|
+
static async #tryRefreshTokens() {
|
|
135
135
|
if (!this.#refreshTokenString) {
|
|
136
136
|
return false;
|
|
137
137
|
}
|
|
138
|
-
const { decoded } = await this
|
|
138
|
+
const { decoded } = await this.#fetchAndDecode('auth/refresh', { refreshTokenString: this.#refreshTokenString });
|
|
139
139
|
if (!decoded.success) {
|
|
140
140
|
return false;
|
|
141
141
|
}
|
|
@@ -153,7 +153,7 @@ export default class GCloudAPIService {
|
|
|
153
153
|
* @param urlPath - The path to the endpoint.
|
|
154
154
|
* @param input - The input to the endpoint.
|
|
155
155
|
*/
|
|
156
|
-
static async fetchAndDecode(urlPath, input) {
|
|
156
|
+
static async #fetchAndDecode(urlPath, input) {
|
|
157
157
|
const headers = new Headers({
|
|
158
158
|
Connection: 'keep-alive',
|
|
159
159
|
'Content-Type': 'application/json',
|
|
@@ -167,7 +167,7 @@ export default class GCloudAPIService {
|
|
|
167
167
|
headers,
|
|
168
168
|
body: JSON.stringify(input)
|
|
169
169
|
});
|
|
170
|
-
const decoded = await this
|
|
170
|
+
const decoded = await this.#decodeResponse(response);
|
|
171
171
|
return { response, decoded };
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
@@ -175,11 +175,11 @@ export default class GCloudAPIService {
|
|
|
175
175
|
*
|
|
176
176
|
* @param response - The fetch response to decode.
|
|
177
177
|
*/
|
|
178
|
-
static async decodeResponse(response) {
|
|
178
|
+
static async #decodeResponse(response) {
|
|
179
179
|
try {
|
|
180
180
|
const text = await response.text();
|
|
181
181
|
const parsed = JSON.parse(text, DateService.dateReviver);
|
|
182
|
-
if (!isAPIResponseShape(parsed)) {
|
|
182
|
+
if (!this.#isAPIResponseShape(parsed)) {
|
|
183
183
|
return {
|
|
184
184
|
success: false,
|
|
185
185
|
errors: ['Response did not match the expected APIResponse shape'],
|
|
@@ -198,27 +198,27 @@ export default class GCloudAPIService {
|
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Type guard that validates the structural shape of an {@link APIResponse}.
|
|
203
|
+
* The generic `data` payload is trusted (not validated) since its shape is
|
|
204
|
+
* only known at the call site.
|
|
205
|
+
*
|
|
206
|
+
* @param value - The parsed JSON value to inspect.
|
|
207
|
+
*/
|
|
208
|
+
static #isAPIResponseShape(value) {
|
|
209
|
+
if (typeof value !== 'object' || value === null) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
if (!('success' in value) || typeof value.success !== 'boolean') {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
if (!('errors' in value) || !Array.isArray(value.errors)) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
if (!value.errors.every((err) => typeof err === 'string')) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
return 'data' in value;
|
|
221
222
|
}
|
|
222
|
-
return 'data' in value;
|
|
223
223
|
}
|
|
224
|
-
//# sourceMappingURL=
|
|
224
|
+
//# sourceMappingURL=GCloudAPI.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GCloudAPI.service.js","sourceRoot":"","sources":["../../../src/services/GCloudAPIService/GCloudAPI.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA8BhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,MAAM,CAAU,UAAU,GAAW,+BAA+B,CAAC;IAErE;;;OAGG;IACH,MAAM,CAAC,QAAQ,GAAW,IAAI,CAAC,UAAU,CAAC;IAE1C,MAAM,CAAC,YAAY,CAAqB;IAExC,MAAM,CAAC,mBAAmB,CAAqB;IAE/C,MAAM,CAAC,kBAAkB,GAAqC,IAAI,CAAC;IAEnE;;;;OAIG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,GAAW;QACvB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAa;QACjC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAa;QACxC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAA0C;QACpE,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;IACrC,C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;IAED;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAU,KAAc;QAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAChD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAChE,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,MAAM,IAAI,KAAK,CAAC;IACzB,CAAC"}
|
|
@@ -102,7 +102,7 @@ export default class GCloudAPIService {
|
|
|
102
102
|
static async authValidateUser(
|
|
103
103
|
input: AuthValidateUserInput
|
|
104
104
|
): Promise<APIResponse<AuthValidateUserOutput>> {
|
|
105
|
-
return this
|
|
105
|
+
return this.#call<AuthValidateUserInput, AuthValidateUserOutput>('auth/validateUser', input);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
@@ -113,9 +113,12 @@ export default class GCloudAPIService {
|
|
|
113
113
|
if (!this.#refreshTokenString) {
|
|
114
114
|
return { success: true, errors: [], data: undefined };
|
|
115
115
|
}
|
|
116
|
-
const { decoded } = await this
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const { decoded } = await this.#fetchAndDecode<AuthRefreshTokenInput, undefined>(
|
|
117
|
+
'auth/logout',
|
|
118
|
+
{
|
|
119
|
+
refreshTokenString: this.#refreshTokenString
|
|
120
|
+
}
|
|
121
|
+
);
|
|
119
122
|
return decoded;
|
|
120
123
|
}
|
|
121
124
|
|
|
@@ -124,7 +127,7 @@ export default class GCloudAPIService {
|
|
|
124
127
|
* currently-authenticated user and every per-user document tied to them.
|
|
125
128
|
*/
|
|
126
129
|
static async authDeleteAccount(): Promise<APIResponse<AuthDeleteAccountOutput>> {
|
|
127
|
-
return this
|
|
130
|
+
return this.#call<AuthDeleteAccountInput, AuthDeleteAccountOutput>(
|
|
128
131
|
'auth/deleteAccount',
|
|
129
132
|
undefined
|
|
130
133
|
);
|
|
@@ -138,7 +141,7 @@ export default class GCloudAPIService {
|
|
|
138
141
|
static async projectDashboard(
|
|
139
142
|
input: ProjectDashboardInput
|
|
140
143
|
): Promise<APIResponse<ProjectDashboardOutput>> {
|
|
141
|
-
return this
|
|
144
|
+
return this.#call<ProjectDashboardInput, ProjectDashboardOutput>('project/dashboard', input);
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
/**
|
|
@@ -147,7 +150,7 @@ export default class GCloudAPIService {
|
|
|
147
150
|
* @param input - The input for the admin endpoint.
|
|
148
151
|
*/
|
|
149
152
|
static async admin(input: AdminInput): Promise<APIResponse<AdminOutput>> {
|
|
150
|
-
return this
|
|
153
|
+
return this.#call<AdminInput, AdminOutput>('admin', input);
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
/**
|
|
@@ -158,7 +161,7 @@ export default class GCloudAPIService {
|
|
|
158
161
|
static async projectWorkout(
|
|
159
162
|
input: ProjectWorkoutPrimaryInput
|
|
160
163
|
): Promise<APIResponse<ProjectWorkoutPrimaryOutput>> {
|
|
161
|
-
return this
|
|
164
|
+
return this.#call<ProjectWorkoutPrimaryInput, ProjectWorkoutPrimaryOutput>(
|
|
162
165
|
'project/workout',
|
|
163
166
|
input
|
|
164
167
|
);
|
|
@@ -172,16 +175,16 @@ export default class GCloudAPIService {
|
|
|
172
175
|
* @param urlPath - The path to the endpoint.
|
|
173
176
|
* @param input - The input to the endpoint.
|
|
174
177
|
*/
|
|
175
|
-
|
|
178
|
+
static async #call<TInput, TOutput>(
|
|
176
179
|
urlPath: string,
|
|
177
180
|
input: TInput
|
|
178
181
|
): Promise<APIResponse<TOutput>> {
|
|
179
|
-
const { response, decoded } = await this
|
|
182
|
+
const { response, decoded } = await this.#fetchAndDecode<TInput, TOutput>(urlPath, input);
|
|
180
183
|
|
|
181
184
|
if (response.status === 401 && this.#refreshTokenString) {
|
|
182
|
-
const refreshed = await this
|
|
185
|
+
const refreshed = await this.#tryRefreshTokens();
|
|
183
186
|
if (refreshed) {
|
|
184
|
-
const retry = await this
|
|
187
|
+
const retry = await this.#fetchAndDecode<TInput, TOutput>(urlPath, input);
|
|
185
188
|
return retry.decoded;
|
|
186
189
|
}
|
|
187
190
|
}
|
|
@@ -194,12 +197,12 @@ export default class GCloudAPIService {
|
|
|
194
197
|
* On success, updates the stored tokens and notifies via the
|
|
195
198
|
* {@link #onTokensRefreshed} callback.
|
|
196
199
|
*/
|
|
197
|
-
|
|
200
|
+
static async #tryRefreshTokens(): Promise<boolean> {
|
|
198
201
|
if (!this.#refreshTokenString) {
|
|
199
202
|
return false;
|
|
200
203
|
}
|
|
201
204
|
|
|
202
|
-
const { decoded } = await this
|
|
205
|
+
const { decoded } = await this.#fetchAndDecode<AuthRefreshTokenInput, AuthRefreshTokenOutput>(
|
|
203
206
|
'auth/refresh',
|
|
204
207
|
{ refreshTokenString: this.#refreshTokenString }
|
|
205
208
|
);
|
|
@@ -225,7 +228,7 @@ export default class GCloudAPIService {
|
|
|
225
228
|
* @param urlPath - The path to the endpoint.
|
|
226
229
|
* @param input - The input to the endpoint.
|
|
227
230
|
*/
|
|
228
|
-
|
|
231
|
+
static async #fetchAndDecode<TInput, TOutput>(
|
|
229
232
|
urlPath: string,
|
|
230
233
|
input: TInput
|
|
231
234
|
): Promise<{ response: Response; decoded: APIResponse<TOutput> }> {
|
|
@@ -244,7 +247,7 @@ export default class GCloudAPIService {
|
|
|
244
247
|
headers,
|
|
245
248
|
body: JSON.stringify(input)
|
|
246
249
|
});
|
|
247
|
-
const decoded = await this
|
|
250
|
+
const decoded = await this.#decodeResponse<TOutput>(response);
|
|
248
251
|
return { response, decoded };
|
|
249
252
|
}
|
|
250
253
|
|
|
@@ -253,11 +256,11 @@ export default class GCloudAPIService {
|
|
|
253
256
|
*
|
|
254
257
|
* @param response - The fetch response to decode.
|
|
255
258
|
*/
|
|
256
|
-
|
|
259
|
+
static async #decodeResponse<TOutput>(response: Response): Promise<APIResponse<TOutput>> {
|
|
257
260
|
try {
|
|
258
261
|
const text = await response.text();
|
|
259
262
|
const parsed: unknown = JSON.parse(text, DateService.dateReviver);
|
|
260
|
-
if (!isAPIResponseShape<TOutput>(parsed)) {
|
|
263
|
+
if (!this.#isAPIResponseShape<TOutput>(parsed)) {
|
|
261
264
|
return {
|
|
262
265
|
success: false,
|
|
263
266
|
errors: ['Response did not match the expected APIResponse shape'],
|
|
@@ -275,27 +278,27 @@ export default class GCloudAPIService {
|
|
|
275
278
|
};
|
|
276
279
|
}
|
|
277
280
|
}
|
|
278
|
-
}
|
|
279
281
|
|
|
280
|
-
/**
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Type guard that validates the structural shape of an {@link APIResponse}.
|
|
284
|
+
* The generic `data` payload is trusted (not validated) since its shape is
|
|
285
|
+
* only known at the call site.
|
|
286
|
+
*
|
|
287
|
+
* @param value - The parsed JSON value to inspect.
|
|
288
|
+
*/
|
|
289
|
+
static #isAPIResponseShape<TOutput>(value: unknown): value is APIResponse<TOutput> {
|
|
290
|
+
if (typeof value !== 'object' || value === null) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
if (!('success' in value) || typeof value.success !== 'boolean') {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
if (!('errors' in value) || !Array.isArray(value.errors)) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
if (!value.errors.every((err) => typeof err === 'string')) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
return 'data' in value;
|
|
299
303
|
}
|
|
300
|
-
return 'data' in value;
|
|
301
304
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@aneuhold/core-ts-api-lib",
|
|
3
3
|
"author": "Anton G. Neuhold Jr.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.40",
|
|
6
6
|
"description": "A library for interacting with the backend and defining the backend API for personal projects.",
|
|
7
7
|
"packageManager": "pnpm@10.25.0",
|
|
8
8
|
"type": "module",
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"TypeScript"
|
|
73
73
|
],
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@aneuhold/core-ts-db-lib": "^5.0.
|
|
76
|
-
"@aneuhold/core-ts-lib": "^2.4.
|
|
75
|
+
"@aneuhold/core-ts-db-lib": "^5.0.10",
|
|
76
|
+
"@aneuhold/core-ts-lib": "^2.4.6",
|
|
77
77
|
"bson": "^7.0.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@aneuhold/local-npm-registry": "^0.2.
|
|
81
|
-
"@aneuhold/main-scripts": "^2.9.
|
|
80
|
+
"@aneuhold/local-npm-registry": "^0.2.34",
|
|
81
|
+
"@aneuhold/main-scripts": "^2.9.5",
|
|
82
82
|
"@types/node": "^25.0.2",
|
|
83
83
|
"eslint": "^9.39.2",
|
|
84
84
|
"jsr": "^0.13.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"APIService.d.ts","sourceRoot":"","sources":["../../../src/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,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAI/E;;;;OAIG;WACU,cAAc,CACzB,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAIpD;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM;IAIjC;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAInC;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM;CAGlC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"APIService.js","sourceRoot":"","sources":["../../../src/services/APIService/APIService.ts"],"names":[],"mappings":"AAeA,OAAO,gBAAgB,MAAM,yCAAyC,CAAC;AAEvE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,KAA4B;QAE5B,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM;QACjB,OAAO,gBAAgB,CAAC,UAAU,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,aAAa;QACxB,OAAO,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAa;QACjC,gBAAgB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAa;QACxC,gBAAgB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4E;QAE5E,gBAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,KAA4B;QAE5B,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,KAAiB;QACzC,OAAO,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,KAAiC;QAEjC,OAAO,gBAAgB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,gBAAgB,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,GAAW;QAC1B,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,gBAAgB,CAAC,UAAU,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GCloudAPIService.d.ts","sourceRoot":"","sources":["../../../src/services/GCloudAPIService/GCloudAPIService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,+CAA+C,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;mBACkB,gBAAgB;IAyBrC;;;;;OAKG;mBACkB,cAAc;IAuBnC;;;;OAIG;mBACkB,cAAc;CAsBpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GCloudAPIService.js","sourceRoot":"","sources":["../../../src/services/GCloudAPIService/GCloudAPIService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA8BhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,MAAM,CAAU,UAAU,GAAW,+BAA+B,CAAC;IAErE;;;OAGG;IACH,MAAM,CAAC,QAAQ,GAAW,IAAI,CAAC,UAAU,CAAC;IAE1C,MAAM,CAAC,YAAY,CAAqB;IAExC,MAAM,CAAC,mBAAmB,CAAqB;IAE/C,MAAM,CAAC,kBAAkB,GAAqC,IAAI,CAAC;IAEnE;;;;OAIG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,GAAW;QACvB,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAa;QACjC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAa;QACxC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAA0C;QACpE,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,KAA4B;QAE5B,OAAO,IAAI,CAAC,IAAI,CAAgD,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAED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