gigadrive 2.5.5 → 2.5.7
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/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +82 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -32,7 +32,7 @@ var import_effect29 = require("effect");
|
|
|
32
32
|
// package.json
|
|
33
33
|
var package_default = {
|
|
34
34
|
name: "gigadrive",
|
|
35
|
-
version: "2.5.
|
|
35
|
+
version: "2.5.7",
|
|
36
36
|
repository: {
|
|
37
37
|
type: "git",
|
|
38
38
|
url: "https://github.com/Gigadrive/sdk.git",
|
|
@@ -956,6 +956,12 @@ and enter the code:
|
|
|
956
956
|
|
|
957
957
|
// src/services/api-client.ts
|
|
958
958
|
var ApiBaseUrl = import_effect6.Config.string("GIGADRIVE_API_BASE_URL").pipe(import_effect6.Config.withDefault("https://api.gigadrive.network"));
|
|
959
|
+
var ServiceCredentials = import_effect6.Config.all({
|
|
960
|
+
bearerToken: import_effect6.Config.redacted("GIGADRIVE_BEARER_TOKEN").pipe(import_effect6.Config.option),
|
|
961
|
+
clientId: import_effect6.Config.string("GIGADRIVE_CLIENT_ID").pipe(import_effect6.Config.option),
|
|
962
|
+
clientSecret: import_effect6.Config.redacted("GIGADRIVE_CLIENT_SECRET").pipe(import_effect6.Config.option),
|
|
963
|
+
refreshToken: import_effect6.Config.redacted("GIGADRIVE_REFRESH_TOKEN").pipe(import_effect6.Config.option)
|
|
964
|
+
});
|
|
959
965
|
var toApiRequestError = (error) => {
|
|
960
966
|
if (error instanceof import_sdk.ApiError) {
|
|
961
967
|
return new ApiRequestError({ message: error.message, statusCode: error.status, code: error.code });
|
|
@@ -966,8 +972,18 @@ var ApiClientService = class extends import_effect6.Effect.Service()("ApiClientS
|
|
|
966
972
|
accessors: true,
|
|
967
973
|
effect: import_effect6.Effect.gen(function* () {
|
|
968
974
|
const baseUrl = yield* ApiBaseUrl;
|
|
975
|
+
const serviceCredentials = yield* ServiceCredentials;
|
|
969
976
|
const authService = yield* AuthService;
|
|
970
|
-
const
|
|
977
|
+
const hasServiceCredentials = import_effect6.Option.isSome(serviceCredentials.bearerToken) || import_effect6.Option.isSome(serviceCredentials.clientId) || import_effect6.Option.isSome(serviceCredentials.clientSecret) || import_effect6.Option.isSome(serviceCredentials.refreshToken);
|
|
978
|
+
const getClient = hasServiceCredentials ? import_effect6.Effect.succeed(
|
|
979
|
+
new import_sdk.GigadriveClient({
|
|
980
|
+
baseUrl,
|
|
981
|
+
bearerToken: import_effect6.Option.map(serviceCredentials.bearerToken, import_effect6.Redacted.value).pipe(import_effect6.Option.getOrUndefined),
|
|
982
|
+
clientId: import_effect6.Option.getOrUndefined(serviceCredentials.clientId),
|
|
983
|
+
clientSecret: import_effect6.Option.map(serviceCredentials.clientSecret, import_effect6.Redacted.value).pipe(import_effect6.Option.getOrUndefined),
|
|
984
|
+
refreshToken: import_effect6.Option.map(serviceCredentials.refreshToken, import_effect6.Redacted.value).pipe(import_effect6.Option.getOrUndefined)
|
|
985
|
+
})
|
|
986
|
+
) : import_effect6.Effect.gen(function* () {
|
|
971
987
|
const token = yield* authService.getAccessToken;
|
|
972
988
|
return new import_sdk.GigadriveClient({ bearerToken: token, baseUrl });
|
|
973
989
|
});
|