@velocitycareerlabs/vcl-react-native 2.8.2 → 2.9.1
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/VclReactNative.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/velocitycareerlabs/reactnative/VclReactNativeModule.kt +58 -74
- package/android/src/main/java/io/velocitycareerlabs/reactnative/extensions/VCLErrorExtensions.kt +62 -2
- package/ios/VCLErrorBridge.swift +89 -0
- package/ios/VclReactNativeImpl.swift +29 -23
- package/lib/module/api/VCLApi.js +44 -18
- package/lib/module/api/VCLApi.js.map +1 -1
- package/lib/module/api/entities/error/VCLError.js +9 -13
- package/lib/module/api/entities/error/VCLError.js.map +1 -1
- package/lib/module/api/entities/error/VCLErrorDeserializer.js +98 -0
- package/lib/module/api/entities/error/VCLErrorDeserializer.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/api/VCLApi.d.ts.map +1 -1
- package/lib/typescript/src/api/entities/error/VCLError.d.ts +22 -1
- package/lib/typescript/src/api/entities/error/VCLError.d.ts.map +1 -1
- package/lib/typescript/src/api/entities/error/VCLErrorDeserializer.d.ts +19 -0
- package/lib/typescript/src/api/entities/error/VCLErrorDeserializer.d.ts.map +1 -0
- package/lib/typescript/src/api/entities/initialization/VCLInitializationDescriptor.d.ts +6 -0
- package/lib/typescript/src/api/entities/initialization/VCLInitializationDescriptor.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/VCLApi.ts +58 -18
- package/src/api/entities/error/VCLError.ts +33 -13
- package/src/api/entities/error/VCLErrorDeserializer.ts +151 -0
- package/src/api/entities/initialization/VCLInitializationDescriptor.ts +6 -0
- package/src/index.tsx +8 -0
|
@@ -67,7 +67,8 @@ import { VCLStatusCode } from './api/entities/error/VCLStatusCode';
|
|
|
67
67
|
import { VCLErrorCode } from './api/entities/error/VCLErrorCode';
|
|
68
68
|
import type { VCLAuthToken } from './api/entities/VCLAuthToken';
|
|
69
69
|
import type { VCLAuthTokenDescriptor } from './api/entities/VCLAuthTokenDescriptor';
|
|
70
|
+
import type { VCLDiagnostics, VCLNativeCauseDiagnostics, VCLErrorInit } from './api/entities/error/VCLError';
|
|
70
71
|
export default VclApi;
|
|
71
72
|
export { VCLEnvironment, VCLCryptoServiceType, VCLSignatureAlgorithm, VCLXVnfProtocolVersion, VCLCountryCodes, VCLServiceType, VCLIssuingType, VCLError, VCLStatusCode, VCLErrorCode, };
|
|
72
|
-
export type { Dictionary, VCLCountry, VCLCountries, VCLRegion, VCLRegions, VCLCredentialManifest, VCLCredentialManifestDescriptor, VCLCredentialManifestDescriptorByDeepLink, VCLCredentialManifestDescriptorByService, VCLCredentialType, VCLCredentialTypes, VCLCredentialTypeSchema, VCLCredentialTypeSchemas, VCLCredentialTypesUIFormSchema, VCLCredentialTypesUIFormSchemaDescriptor, VCLCredentialManifestDescriptorRefresh, VCLDeepLink, VCLExchange, VCLExchangeDescriptor, VCLFilter, VCLFinalizeOffersDescriptor, VCLGenerateOffersDescriptor, VCLJwt, VCLJwtVerifiableCredentials, VCLOffers, VCLOffer, VCLOrganization, VCLOrganizations, VCLOrganizationsSearchDescriptor, VCLPage, VCLPresentationRequest, VCLPresentationSubmission, VCLPublicJwk, VCLPushDelegate, VCLService, VCLServiceTypes, VCLSubmissionResult, VCLToken, VCLVerifiableCredential, VCLVerifiedProfile, VCLVerifiedProfileDescriptor, VCLInitializationDescriptor, VCLPresentationRequestDescriptor, VCLJwtDescriptor, VCLDidJwkDescriptor, VCLDidJwk, VCLCryptoServicesDescriptor, VCLJwtServiceUrls, VCLKeyServiceUrls, VCLRemoteCryptoServicesUrlsDescriptor, VCLAuthToken, VCLAuthTokenDescriptor, };
|
|
73
|
+
export type { Dictionary, VCLCountry, VCLCountries, VCLRegion, VCLRegions, VCLCredentialManifest, VCLCredentialManifestDescriptor, VCLCredentialManifestDescriptorByDeepLink, VCLCredentialManifestDescriptorByService, VCLCredentialType, VCLCredentialTypes, VCLCredentialTypeSchema, VCLCredentialTypeSchemas, VCLCredentialTypesUIFormSchema, VCLCredentialTypesUIFormSchemaDescriptor, VCLCredentialManifestDescriptorRefresh, VCLDeepLink, VCLExchange, VCLExchangeDescriptor, VCLFilter, VCLFinalizeOffersDescriptor, VCLGenerateOffersDescriptor, VCLJwt, VCLJwtVerifiableCredentials, VCLOffers, VCLOffer, VCLOrganization, VCLOrganizations, VCLOrganizationsSearchDescriptor, VCLPage, VCLPresentationRequest, VCLPresentationSubmission, VCLPublicJwk, VCLPushDelegate, VCLService, VCLServiceTypes, VCLSubmissionResult, VCLToken, VCLVerifiableCredential, VCLVerifiedProfile, VCLVerifiedProfileDescriptor, VCLInitializationDescriptor, VCLPresentationRequestDescriptor, VCLJwtDescriptor, VCLDidJwkDescriptor, VCLDidJwk, VCLCryptoServicesDescriptor, VCLJwtServiceUrls, VCLKeyServiceUrls, VCLRemoteCryptoServicesUrlsDescriptor, VCLAuthToken, VCLAuthTokenDescriptor, VCLDiagnostics, VCLNativeCauseDiagnostics, VCLErrorInit, };
|
|
73
74
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AAC7G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAi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AC9B,wCAAwC,EACxC,sCAAsC,EACtC,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,2BAA2B,EAC3B,2BAA2B,EAC3B,MAAM,EACN,2BAA2B,EAC3B,SAAS,EACT,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,gCAAgC,EAChC,OAAO,EACP,sBAAsB,EACtB,yBAAyB,EACzB,YAAY,EACZ,eAAe,EACf,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,gCAAgC,EAChC,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,qCAAqC,EACrC,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,yBAAyB,EACzB,YAAY,GACb,CAAC"}
|
package/package.json
CHANGED
package/src/api/VCLApi.ts
CHANGED
|
@@ -39,6 +39,10 @@ import {
|
|
|
39
39
|
type VCLDidJwkDescriptor,
|
|
40
40
|
VCLError,
|
|
41
41
|
} from '@velocitycareerlabs/vcl-react-native';
|
|
42
|
+
import {
|
|
43
|
+
BRIDGED_VCL_ERROR_CODE,
|
|
44
|
+
VCLErrorDeserializer,
|
|
45
|
+
} from './entities/error/VCLErrorDeserializer';
|
|
42
46
|
|
|
43
47
|
const { VclReactNative } = NativeModules;
|
|
44
48
|
|
|
@@ -49,7 +53,7 @@ export const VclApi = {
|
|
|
49
53
|
try {
|
|
50
54
|
return await VclReactNative.initialize(initializationDescriptor);
|
|
51
55
|
} catch (e) {
|
|
52
|
-
throw
|
|
56
|
+
throw toVCLError(e);
|
|
53
57
|
}
|
|
54
58
|
},
|
|
55
59
|
|
|
@@ -57,7 +61,7 @@ export const VclApi = {
|
|
|
57
61
|
try {
|
|
58
62
|
return await VclReactNative.getCountries();
|
|
59
63
|
} catch (e) {
|
|
60
|
-
throw
|
|
64
|
+
throw toVCLError(e);
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
67
|
|
|
@@ -65,7 +69,7 @@ export const VclApi = {
|
|
|
65
69
|
try {
|
|
66
70
|
return await VclReactNative.getCredentialTypes();
|
|
67
71
|
} catch (e) {
|
|
68
|
-
throw
|
|
72
|
+
throw toVCLError(e);
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
75
|
|
|
@@ -73,7 +77,7 @@ export const VclApi = {
|
|
|
73
77
|
try {
|
|
74
78
|
return await VclReactNative.getCredentialTypeSchemas();
|
|
75
79
|
} catch (e) {
|
|
76
|
-
throw
|
|
80
|
+
throw toVCLError(e);
|
|
77
81
|
}
|
|
78
82
|
},
|
|
79
83
|
|
|
@@ -85,7 +89,7 @@ export const VclApi = {
|
|
|
85
89
|
presentationRequestDescriptor
|
|
86
90
|
);
|
|
87
91
|
} catch (e) {
|
|
88
|
-
throw
|
|
92
|
+
throw toVCLError(e);
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
95
|
|
|
@@ -99,7 +103,7 @@ export const VclApi = {
|
|
|
99
103
|
authToken
|
|
100
104
|
);
|
|
101
105
|
} catch (e) {
|
|
102
|
-
throw
|
|
106
|
+
throw toVCLError(e);
|
|
103
107
|
}
|
|
104
108
|
},
|
|
105
109
|
|
|
@@ -109,7 +113,7 @@ export const VclApi = {
|
|
|
109
113
|
try {
|
|
110
114
|
return await VclReactNative.getExchangeProgress(exchangeDescriptor);
|
|
111
115
|
} catch (e) {
|
|
112
|
-
throw
|
|
116
|
+
throw toVCLError(e);
|
|
113
117
|
}
|
|
114
118
|
},
|
|
115
119
|
|
|
@@ -121,7 +125,7 @@ export const VclApi = {
|
|
|
121
125
|
organizationsSearchDescriptor
|
|
122
126
|
);
|
|
123
127
|
} catch (e) {
|
|
124
|
-
throw
|
|
128
|
+
throw toVCLError(e);
|
|
125
129
|
}
|
|
126
130
|
},
|
|
127
131
|
|
|
@@ -133,7 +137,7 @@ export const VclApi = {
|
|
|
133
137
|
credentialManifestDescriptor
|
|
134
138
|
);
|
|
135
139
|
} catch (e) {
|
|
136
|
-
throw
|
|
140
|
+
throw toVCLError(e);
|
|
137
141
|
}
|
|
138
142
|
},
|
|
139
143
|
|
|
@@ -143,7 +147,7 @@ export const VclApi = {
|
|
|
143
147
|
try {
|
|
144
148
|
return await VclReactNative.generateOffers(generateOffersDescriptor);
|
|
145
149
|
} catch (e) {
|
|
146
|
-
throw
|
|
150
|
+
throw toVCLError(e);
|
|
147
151
|
}
|
|
148
152
|
},
|
|
149
153
|
|
|
@@ -157,7 +161,7 @@ export const VclApi = {
|
|
|
157
161
|
sessionToken
|
|
158
162
|
);
|
|
159
163
|
} catch (e) {
|
|
160
|
-
throw
|
|
164
|
+
throw toVCLError(e);
|
|
161
165
|
}
|
|
162
166
|
},
|
|
163
167
|
|
|
@@ -171,7 +175,7 @@ export const VclApi = {
|
|
|
171
175
|
sessionToken
|
|
172
176
|
);
|
|
173
177
|
} catch (e) {
|
|
174
|
-
throw
|
|
178
|
+
throw toVCLError(e);
|
|
175
179
|
}
|
|
176
180
|
},
|
|
177
181
|
|
|
@@ -181,7 +185,7 @@ export const VclApi = {
|
|
|
181
185
|
try {
|
|
182
186
|
return await VclReactNative.getAuthToken(authTokenDescriptor);
|
|
183
187
|
} catch (e) {
|
|
184
|
-
throw
|
|
188
|
+
throw toVCLError(e);
|
|
185
189
|
}
|
|
186
190
|
},
|
|
187
191
|
|
|
@@ -193,7 +197,7 @@ export const VclApi = {
|
|
|
193
197
|
credentialTypesUIFormSchemaDescriptor
|
|
194
198
|
);
|
|
195
199
|
} catch (e) {
|
|
196
|
-
throw
|
|
200
|
+
throw toVCLError(e);
|
|
197
201
|
}
|
|
198
202
|
},
|
|
199
203
|
|
|
@@ -203,7 +207,7 @@ export const VclApi = {
|
|
|
203
207
|
try {
|
|
204
208
|
return await VclReactNative.getVerifiedProfile(verifiedProfileDescriptor);
|
|
205
209
|
} catch (e) {
|
|
206
|
-
throw
|
|
210
|
+
throw toVCLError(e);
|
|
207
211
|
}
|
|
208
212
|
},
|
|
209
213
|
|
|
@@ -219,7 +223,7 @@ export const VclApi = {
|
|
|
219
223
|
remoteCryptoServicesToken
|
|
220
224
|
);
|
|
221
225
|
} catch (e) {
|
|
222
|
-
throw
|
|
226
|
+
throw toVCLError(e);
|
|
223
227
|
}
|
|
224
228
|
},
|
|
225
229
|
|
|
@@ -235,7 +239,7 @@ export const VclApi = {
|
|
|
235
239
|
remoteCryptoServicesToken
|
|
236
240
|
);
|
|
237
241
|
} catch (e) {
|
|
238
|
-
throw
|
|
242
|
+
throw toVCLError(e);
|
|
239
243
|
}
|
|
240
244
|
},
|
|
241
245
|
|
|
@@ -245,7 +249,43 @@ export const VclApi = {
|
|
|
245
249
|
try {
|
|
246
250
|
return await VclReactNative.generateDidJwk(didJwkDescriptor);
|
|
247
251
|
} catch (e) {
|
|
248
|
-
throw
|
|
252
|
+
throw toVCLError(e);
|
|
249
253
|
}
|
|
250
254
|
},
|
|
251
255
|
};
|
|
256
|
+
|
|
257
|
+
const toVCLError = (error: unknown): VCLError => {
|
|
258
|
+
if (error instanceof VCLError) {
|
|
259
|
+
return error;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (isBridgedVCLError(error)) {
|
|
263
|
+
return VCLErrorDeserializer.fromJsonString(error.message);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return new VCLError({ message: toErrorMessage(error) });
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const isBridgedVCLError = (
|
|
270
|
+
error: unknown
|
|
271
|
+
): error is { code: typeof BRIDGED_VCL_ERROR_CODE; message: string } =>
|
|
272
|
+
typeof error === 'object' &&
|
|
273
|
+
error != null &&
|
|
274
|
+
(error as { code?: unknown }).code === BRIDGED_VCL_ERROR_CODE &&
|
|
275
|
+
typeof (error as { message?: unknown }).message === 'string';
|
|
276
|
+
|
|
277
|
+
const toErrorMessage = (error: unknown): string => {
|
|
278
|
+
if (error instanceof Error) {
|
|
279
|
+
return error.message;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (typeof error === 'string') {
|
|
283
|
+
return error;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
try {
|
|
287
|
+
return JSON.stringify(error) ?? String(error);
|
|
288
|
+
} catch (_stringifyError) {
|
|
289
|
+
return String(error);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
@@ -5,25 +5,45 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
export type VCLNativeCauseDiagnostics = {
|
|
9
|
+
type?: string;
|
|
10
|
+
message?: string;
|
|
11
|
+
stackFrames?: string[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type VCLDiagnostics = {
|
|
15
|
+
nativePlatform?: 'ios' | 'android';
|
|
16
|
+
nativeType?: string;
|
|
17
|
+
nativeStackFrames?: string[];
|
|
18
|
+
nativeCause?: VCLNativeCauseDiagnostics;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type VCLErrorInit = {
|
|
22
|
+
payload?: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
errorCode?: string;
|
|
25
|
+
requestId?: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
statusCode?: number;
|
|
28
|
+
diagnostics?: VCLDiagnostics;
|
|
29
|
+
};
|
|
30
|
+
|
|
8
31
|
export class VCLError extends Error {
|
|
9
32
|
payload?: string;
|
|
10
33
|
error?: string;
|
|
11
34
|
errorCode?: string;
|
|
12
35
|
requestId?: string;
|
|
13
36
|
statusCode?: number;
|
|
37
|
+
diagnostics?: VCLDiagnostics;
|
|
14
38
|
|
|
15
|
-
constructor(error:
|
|
16
|
-
super(error);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.statusCode = parseInt(errorJson.statusCode, 10);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
this.message = JSON.stringify(error);
|
|
27
|
-
}
|
|
39
|
+
constructor(error: VCLErrorInit = {}) {
|
|
40
|
+
super(error.message);
|
|
41
|
+
this.name = 'VCLError';
|
|
42
|
+
this.payload = error.payload;
|
|
43
|
+
this.error = error.error;
|
|
44
|
+
this.errorCode = error.errorCode;
|
|
45
|
+
this.requestId = error.requestId;
|
|
46
|
+
this.statusCode = error.statusCode;
|
|
47
|
+
this.diagnostics = error.diagnostics;
|
|
28
48
|
}
|
|
29
49
|
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Michael Avoyan.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
VCLError,
|
|
10
|
+
type VCLDiagnostics,
|
|
11
|
+
type VCLNativeCauseDiagnostics,
|
|
12
|
+
} from './VCLError';
|
|
13
|
+
|
|
14
|
+
export const BRIDGED_VCL_ERROR_CODE = 'VCL_BRIDGED_ERROR_V1';
|
|
15
|
+
|
|
16
|
+
type SerializedVCLError = {
|
|
17
|
+
payload?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
errorCode?: string;
|
|
20
|
+
requestId?: string;
|
|
21
|
+
message?: string;
|
|
22
|
+
statusCode?: unknown;
|
|
23
|
+
diagnostics?: unknown;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export class VCLErrorDeserializer {
|
|
27
|
+
static fromJsonString(jsonString: string): VCLError {
|
|
28
|
+
try {
|
|
29
|
+
const parsedError = JSON.parse(jsonString);
|
|
30
|
+
|
|
31
|
+
if (!VCLErrorDeserializer.isSerializedVCLError(parsedError)) {
|
|
32
|
+
return new VCLError({ message: jsonString });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const error = parsedError as SerializedVCLError;
|
|
36
|
+
return new VCLError({
|
|
37
|
+
payload: error.payload,
|
|
38
|
+
error: error.error,
|
|
39
|
+
errorCode: error.errorCode,
|
|
40
|
+
requestId: error.requestId,
|
|
41
|
+
message: error.message,
|
|
42
|
+
statusCode: VCLErrorDeserializer.parseStatusCode(error.statusCode),
|
|
43
|
+
diagnostics: VCLErrorDeserializer.parseDiagnostics(error.diagnostics),
|
|
44
|
+
});
|
|
45
|
+
} catch (_parseError) {
|
|
46
|
+
return new VCLError({ message: jsonString });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private static isSerializedVCLError(
|
|
51
|
+
value: unknown
|
|
52
|
+
): value is SerializedVCLError {
|
|
53
|
+
return typeof value === 'object' && value != null && !Array.isArray(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private static parseStatusCode(statusCode: unknown): number | undefined {
|
|
57
|
+
if (statusCode == null) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const parsedStatusCode = parseInt(String(statusCode), 10);
|
|
62
|
+
return Number.isNaN(parsedStatusCode) ? undefined : parsedStatusCode;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private static parseDiagnostics(
|
|
66
|
+
diagnostics: unknown
|
|
67
|
+
): VCLDiagnostics | undefined {
|
|
68
|
+
if (typeof diagnostics !== 'object' || diagnostics == null) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const nativePlatform = VCLErrorDeserializer.parseNativePlatform(
|
|
73
|
+
(diagnostics as { nativePlatform?: unknown }).nativePlatform
|
|
74
|
+
);
|
|
75
|
+
const nativeType = VCLErrorDeserializer.parseString(
|
|
76
|
+
(diagnostics as { nativeType?: unknown }).nativeType
|
|
77
|
+
);
|
|
78
|
+
const nativeStackFrames = VCLErrorDeserializer.parseStringArray(
|
|
79
|
+
(diagnostics as { nativeStackFrames?: unknown }).nativeStackFrames
|
|
80
|
+
);
|
|
81
|
+
const nativeCause = VCLErrorDeserializer.parseNativeCause(
|
|
82
|
+
(diagnostics as { nativeCause?: unknown }).nativeCause
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (
|
|
86
|
+
nativePlatform == null &&
|
|
87
|
+
nativeType == null &&
|
|
88
|
+
nativeStackFrames == null &&
|
|
89
|
+
nativeCause == null
|
|
90
|
+
) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
nativePlatform,
|
|
96
|
+
nativeType,
|
|
97
|
+
nativeStackFrames,
|
|
98
|
+
nativeCause,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private static parseNativeCause(
|
|
103
|
+
nativeCause: unknown
|
|
104
|
+
): VCLNativeCauseDiagnostics | undefined {
|
|
105
|
+
if (typeof nativeCause !== 'object' || nativeCause == null) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const type = VCLErrorDeserializer.parseString(
|
|
110
|
+
(nativeCause as { type?: unknown }).type
|
|
111
|
+
);
|
|
112
|
+
const message = VCLErrorDeserializer.parseString(
|
|
113
|
+
(nativeCause as { message?: unknown }).message
|
|
114
|
+
);
|
|
115
|
+
const stackFrames = VCLErrorDeserializer.parseStringArray(
|
|
116
|
+
(nativeCause as { stackFrames?: unknown }).stackFrames
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
if (type == null && message == null && stackFrames == null) {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return { type, message, stackFrames };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private static parseNativePlatform(
|
|
127
|
+
nativePlatform: unknown
|
|
128
|
+
): VCLDiagnostics['nativePlatform'] {
|
|
129
|
+
if (nativePlatform === 'ios' || nativePlatform === 'android') {
|
|
130
|
+
return nativePlatform;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private static parseString(value: unknown): string | undefined {
|
|
137
|
+
return typeof value === 'string' ? value : undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private static parseStringArray(value: unknown): string[] | undefined {
|
|
141
|
+
if (!Array.isArray(value)) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const stackFrames = value.filter(
|
|
146
|
+
(stackFrame): stackFrame is string => typeof stackFrame === 'string'
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
return stackFrames.length > 0 ? stackFrames : undefined;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -16,4 +16,10 @@ export interface VCLInitializationDescriptor {
|
|
|
16
16
|
isDebugOn?: boolean;
|
|
17
17
|
cryptoServicesDescriptor?: VCLCryptoServicesDescriptor;
|
|
18
18
|
isDirectIssuerCheckOn?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum number of native stack frames to include in bridged error diagnostics.
|
|
21
|
+
* Native implementations clamp values to the range `0..20`.
|
|
22
|
+
* Use `0` to disable native stack frames.
|
|
23
|
+
*/
|
|
24
|
+
nativeErrorStackFrameLimit?: number;
|
|
19
25
|
}
|
package/src/index.tsx
CHANGED
|
@@ -68,6 +68,11 @@ import { VCLStatusCode } from './api/entities/error/VCLStatusCode';
|
|
|
68
68
|
import { VCLErrorCode } from './api/entities/error/VCLErrorCode';
|
|
69
69
|
import type { VCLAuthToken } from './api/entities/VCLAuthToken';
|
|
70
70
|
import type { VCLAuthTokenDescriptor } from './api/entities/VCLAuthTokenDescriptor';
|
|
71
|
+
import type {
|
|
72
|
+
VCLDiagnostics,
|
|
73
|
+
VCLNativeCauseDiagnostics,
|
|
74
|
+
VCLErrorInit,
|
|
75
|
+
} from './api/entities/error/VCLError';
|
|
71
76
|
|
|
72
77
|
export default VclApi;
|
|
73
78
|
export {
|
|
@@ -135,4 +140,7 @@ export type {
|
|
|
135
140
|
VCLRemoteCryptoServicesUrlsDescriptor,
|
|
136
141
|
VCLAuthToken,
|
|
137
142
|
VCLAuthTokenDescriptor,
|
|
143
|
+
VCLDiagnostics,
|
|
144
|
+
VCLNativeCauseDiagnostics,
|
|
145
|
+
VCLErrorInit,
|
|
138
146
|
};
|