@axinom/mosaic-id-link-be 0.13.4-rc.8 → 0.13.4

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,8 +1,3 @@
1
- import {
2
- assertError,
3
- Logger,
4
- skipMaskTag,
5
- } from '@axinom/mosaic-service-common';
6
1
  import { getGqlClient } from '../common/gql-client';
7
2
  import {
8
3
  DevCreateServiceAccountDocument,
@@ -36,54 +31,43 @@ export const devCreateServiceAccount = async (
36
31
  permissions?: string[];
37
32
  }[],
38
33
  ): Promise<DevServiceAccount> => {
39
- const logger = new Logger({ context: devCreateServiceAccount.name });
40
- try {
41
- const client = getGqlClient(
42
- (await getWellKnownEndpoints(authEndpoint)).authGraphQlEndpoint,
43
- 'Bearer token-not-needed-for-DEV-endpoints',
44
- );
34
+ const client = getGqlClient(
35
+ (await getWellKnownEndpoints(authEndpoint)).authGraphQlEndpoint,
36
+ 'Bearer token-not-needed-for-DEV-endpoints',
37
+ );
45
38
 
46
- const result = await client.mutate<
47
- DevCreateServiceAccountMutation,
48
- DevCreateServiceAccountMutationVariables
49
- >({
50
- mutation: DevCreateServiceAccountDocument,
51
- variables: {
52
- input: {
53
- serviceAccountName,
54
- tenantId,
55
- environmentId: environmentId,
56
- permissionStructure: permissions,
57
- },
39
+ const result = await client.mutate<
40
+ DevCreateServiceAccountMutation,
41
+ DevCreateServiceAccountMutationVariables
42
+ >({
43
+ mutation: DevCreateServiceAccountDocument,
44
+ variables: {
45
+ input: {
46
+ serviceAccountName,
47
+ tenantId,
48
+ environmentId: environmentId,
49
+ permissionStructure: permissions,
58
50
  },
59
- errorPolicy: 'all',
60
- fetchPolicy: 'no-cache',
61
- });
62
-
63
- if (!result.errors) {
64
- if (result.data?._DEV_createServiceAccount) {
65
- return result.data._DEV_createServiceAccount;
66
- }
67
- throw new Error(
68
- `Unexpected null or undefined value received for '_DEV_createServiceAccount' result.`,
69
- );
70
- } else {
71
- const aggregatedErrorMessage = result.errors?.reduce(
72
- (aggregatedError, gqlError) => {
73
- return (aggregatedError += gqlError.message);
74
- },
75
- '',
76
- );
51
+ },
52
+ errorPolicy: 'all',
53
+ fetchPolicy: 'no-cache',
54
+ });
77
55
 
78
- throw new Error(aggregatedErrorMessage);
56
+ if (!result.errors) {
57
+ if (result.data?._DEV_createServiceAccount) {
58
+ return result.data._DEV_createServiceAccount;
79
59
  }
80
- } catch (error) {
81
- assertError(error);
82
- logger.error(error, {
83
- message: 'Error during call to devCreateServiceAccount',
84
- details: { skipMaskTag },
85
- });
60
+ throw new Error(
61
+ `Unexpected null or undefined value received for '_DEV_createServiceAccount' result.`,
62
+ );
63
+ } else {
64
+ const aggregatedErrorMessage = result.errors.reduce(
65
+ (aggregatedError, gqlError) => {
66
+ return (aggregatedError += gqlError.message);
67
+ },
68
+ '',
69
+ );
86
70
 
87
- throw error;
71
+ throw new Error(aggregatedErrorMessage);
88
72
  }
89
73
  };