@procivis/react-native-one-core 1.41710.0 → 1.52682.0

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.
Files changed (36) hide show
  1. package/android/src/main/java/ch/procivis/one/core/DeserializeSpecific.kt +4 -2
  2. package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +45 -12
  3. package/android/src/main/java/ch/procivis/one/core/Serialize.kt +3 -1
  4. package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +13 -0
  5. package/core-sdk.json +6 -6
  6. package/dist/src/config.d.ts +17 -2
  7. package/dist/src/config.js +9 -0
  8. package/dist/src/core.d.ts +15 -9
  9. package/dist/src/core.js +6 -1
  10. package/dist/src/credential.d.ts +6 -6
  11. package/dist/src/history.d.ts +6 -3
  12. package/dist/src/history.js +3 -0
  13. package/dist/src/identifier.d.ts +125 -0
  14. package/dist/src/identifier.js +29 -0
  15. package/dist/src/key.d.ts +0 -3
  16. package/dist/src/organisation.d.ts +2 -1
  17. package/dist/src/proof.d.ts +11 -9
  18. package/dist/src/trust.d.ts +44 -4
  19. package/dist/src/trust.js +5 -0
  20. package/ios/Deserialize.swift +140 -813
  21. package/ios/EventEmitter.swift +84 -72
  22. package/ios/ProcivisOneCoreModule.m +23 -6
  23. package/ios/ProcivisOneCoreModule.swift +981 -805
  24. package/ios/ProcivisRNOneCore.xcodeproj/project.pbxproj +9 -1
  25. package/ios/RNDecoder/RNDecoder.swift +191 -0
  26. package/ios/RNDecoder/RNDecodingStorage.swift +33 -0
  27. package/ios/RNDecoder/RNKeyedDecodingContainer.swift +133 -0
  28. package/ios/RNDecoder/RNUnkeyedDecodingContainer.swift +175 -0
  29. package/ios/RNEncoder/RNAnyCodingKey.swift +31 -0
  30. package/ios/RNEncoder/RNEncoder.swift +95 -0
  31. package/ios/RNEncoder/RNKeyedEncodingContainer.swift +81 -0
  32. package/ios/RNEncoder/RNSingleValueEncodingContainer.swift +78 -0
  33. package/ios/RNEncoder/RNUnkeyedEncodingContainer.swift +84 -0
  34. package/ios/Serialize.swift +46 -615
  35. package/ios/Util.swift +35 -25
  36. package/package.json +4 -2
package/ios/Util.swift CHANGED
@@ -9,36 +9,46 @@ import Foundation
9
9
  import ProcivisOneCore
10
10
 
11
11
  // Error handling
12
- func syncCall<Result>(_ resolve: @escaping RCTPromiseResolveBlock,
13
- _ reject: @escaping RCTPromiseRejectBlock, _ function: () throws -> Result) {
14
- do {
15
- resolve(try function());
16
- } catch {
17
- handleError(error: error, reject);
18
- }
12
+ func syncCall<Result>(
13
+ _ resolve: @escaping RCTPromiseResolveBlock,
14
+ _ reject: @escaping RCTPromiseRejectBlock,
15
+ _ function: () throws -> Result
16
+ ) {
17
+ do {
18
+ resolve(try function())
19
+ } catch {
20
+ handleError(error: error, reject)
21
+ }
19
22
  }
20
23
 
21
- func asyncCall<Result>(_ resolve: @escaping RCTPromiseResolveBlock,
22
- _ reject: @escaping RCTPromiseRejectBlock, _ function: @escaping () async throws -> Result) {
23
- Task {
24
- do {
25
- resolve(try await function());
26
- } catch {
27
- handleError(error: error, reject);
28
- }
24
+ func asyncCall<Result>(
25
+ _ resolve: @escaping RCTPromiseResolveBlock,
26
+ _ reject: @escaping RCTPromiseRejectBlock,
27
+ _ function: @escaping () async throws -> Result
28
+ ) {
29
+ Task {
30
+ do {
31
+ resolve(try await function())
32
+ } catch {
33
+ handleError(error: error, reject)
29
34
  }
35
+ }
30
36
  }
31
37
 
32
38
  private func handleError(error: Error, _ reject: @escaping RCTPromiseRejectBlock) {
33
- if case BindingError.ErrorResponse(data: let errorResponse) = error {
34
- var userInfo: [String: Any] = [NSUnderlyingErrorKey: error]
35
- if let cause = errorResponse.cause?.message {
36
- userInfo["cause"] = cause
37
- }
38
-
39
- reject(errorResponse.code, errorResponse.message, NSError(domain: "one-core", code: 1, userInfo: userInfo))
40
- return
39
+ if case BindingError.ErrorResponse(data: let errorResponse) = error {
40
+ var userInfo: [String: Any] = [NSUnderlyingErrorKey: error]
41
+ if let cause = errorResponse.cause?.message {
42
+ userInfo["cause"] = cause
41
43
  }
42
-
43
- reject("UnknownError", String(describing: error), error)
44
+
45
+ reject(
46
+ errorResponse.code,
47
+ errorResponse.message,
48
+ NSError(domain: "one-core", code: 1, userInfo: userInfo)
49
+ )
50
+ return
51
+ }
52
+
53
+ reject("UnknownError", String(describing: error), error)
44
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procivis/react-native-one-core",
3
- "version": "1.41710.0",
3
+ "version": "1.52682.0",
4
4
  "author": "Procivis AG (https://procivis.ch)",
5
5
  "license": "Apache-2.0",
6
6
  "description": "ONE core bindings for React Native",
@@ -22,6 +22,7 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "compile": "tsc",
25
+ "documentation": "typedoc",
25
26
  "postinstall": "node ./bin/postinstall",
26
27
  "test": "jest"
27
28
  },
@@ -31,10 +32,11 @@
31
32
  "devDependencies": {
32
33
  "@babel/core": "^7.21.0",
33
34
  "@babel/preset-env": "^7.20.2",
34
- "react-native": "0.72.17",
35
35
  "babel-jest": "^29.5.0",
36
36
  "husky": "^7.0.4",
37
37
  "jest": "^29.5.0",
38
+ "react-native": "0.72.17",
39
+ "typedoc": "^0.28.6",
38
40
  "typescript": "^5.1.6"
39
41
  },
40
42
  "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"