@dpdpguard/react-native 1.1.0 → 1.2.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.
- package/README.md +19 -0
- package/package.json +5 -8
- package/src/CONTRACT_VERSION +1 -0
- package/src/generated/api-types.ts +2877 -0
- package/src/index.ts +27 -0
- package/scripts/codegen.mjs +0 -31
package/README.md
CHANGED
|
@@ -78,6 +78,25 @@ Every non-2xx response throws a `DpdpGuardApiError` with a `code` from the
|
|
|
78
78
|
ADR-002 error catalog (`err.code`, e.g. `"NOT_FOUND"`) and the HTTP
|
|
79
79
|
`status`.
|
|
80
80
|
|
|
81
|
+
### Types
|
|
82
|
+
|
|
83
|
+
The wire types are generated from `@dpdpguard/contract`'s `openapi/v1.yaml`
|
|
84
|
+
and re-exported, so you can name what the client returns instead of
|
|
85
|
+
re-declaring it:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import type { DsrRequest, Notice, components } from '@dpdpguard/react-native';
|
|
89
|
+
|
|
90
|
+
const notice: Notice = await client.getNotice(noticeId);
|
|
91
|
+
|
|
92
|
+
// Endpoints this SDK deliberately doesn't wrap are still typed:
|
|
93
|
+
type GateDecision = components['schemas']['ConsentGateDecision'];
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The contract version these were generated from is recorded in
|
|
97
|
+
`src/CONTRACT_VERSION`; `src/contractVersion.test.ts` fails if an install
|
|
98
|
+
drifts off it.
|
|
99
|
+
|
|
81
100
|
## Contract
|
|
82
101
|
|
|
83
102
|
Depends on
|
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dpdpguard/react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "DPDP Guard React Native SDK - typed HTTP client over the DPDP Guard /api/v1 surface, usable via plain fetch (no native module)",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
8
|
-
"!src/**/*.test.ts"
|
|
9
|
-
"!src/generated",
|
|
10
|
-
"scripts/codegen.mjs"
|
|
8
|
+
"!src/**/*.test.ts"
|
|
11
9
|
],
|
|
12
10
|
"scripts": {
|
|
13
11
|
"codegen": "node scripts/codegen.mjs",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"typecheck": "tsc --noEmit"
|
|
12
|
+
"test": "npm run codegen && jest",
|
|
13
|
+
"typecheck": "npm run codegen && tsc --noEmit"
|
|
17
14
|
},
|
|
18
15
|
"publishConfig": {
|
|
19
16
|
"access": "public",
|
|
@@ -34,6 +31,6 @@
|
|
|
34
31
|
"typescript": "~5.8"
|
|
35
32
|
},
|
|
36
33
|
"dependencies": {
|
|
37
|
-
"@dpdpguard/contract": "^1.
|
|
34
|
+
"@dpdpguard/contract": "^1.6.0"
|
|
38
35
|
}
|
|
39
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.6.0
|