@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/src/index.ts CHANGED
@@ -4,3 +4,30 @@ export { DpdpGuardApiError, ERROR_CATALOG } from './errorCatalog';
4
4
  export type { ApiErrorCode, ErrorCatalogEntry } from './errorCatalog';
5
5
  export { hasConsent } from './consentGate';
6
6
  export type { ConsentRecord } from './consentGate';
7
+
8
+ // The openapi-typescript output generated from the installed
9
+ // @dpdpguard/contract's openapi/v1.yaml, re-exported so consumers can name
10
+ // the wire types this client returns (and reach endpoints `DpdpGuardClient`
11
+ // deliberately doesn't wrap) instead of re-declaring them by hand. Mirrors
12
+ // dpdpguard-ios-sdk, which exposes its whole generated `DPDPGuardConsentAPI`
13
+ // target alongside the hand-written facade.
14
+ export type {
15
+ components,
16
+ operations,
17
+ paths,
18
+ } from './generated/api-types';
19
+
20
+ import type { components } from './generated/api-types';
21
+
22
+ export type OrgSummary = components['schemas']['OrgSummary'];
23
+ export type Notice = components['schemas']['Notice'];
24
+ export type DsrRequest = components['schemas']['DsrRequest'];
25
+ export type Grievance = components['schemas']['Grievance'];
26
+ export type Nomination = components['schemas']['Nomination'];
27
+ export type ApiError = components['schemas']['ApiError'];
28
+ /**
29
+ * The wire-level consent record from `/cm/v1/consent`. Distinct from this
30
+ * package's own {@link ConsentRecord}, which is the minimal shape
31
+ * {@link hasConsent} gates on.
32
+ */
33
+ export type ApiConsentRecord = components['schemas']['ConsentRecord'];
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawnSync } from "node:child_process";
3
- import { existsSync } from "node:fs";
4
- import { dirname, join } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
-
7
- /**
8
- * Regenerates src/generated/api-types.ts from the installed
9
- * @dpdpguard/contract's openapi/v1.yaml. Run after every install/update of
10
- * @dpdpguard/contract, or via `npm run codegen`.
11
- *
12
- * Uses `npx openapi-typescript` rather than a devDependency, matching
13
- * dpdpguard-server-sdk's approach — keeps this repo's own TypeScript
14
- * version free of a forced peer-dependency resolution.
15
- */
16
- const repoRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
17
- const specPath = join(repoRoot, "node_modules", "@dpdpguard", "contract", "openapi", "v1.yaml");
18
- const outPath = join(repoRoot, "src", "generated", "api-types.ts");
19
-
20
- if (!existsSync(specPath)) {
21
- console.error(`codegen: ${specPath} not found — is @dpdpguard/contract installed? Run npm install first.`);
22
- process.exit(1);
23
- }
24
-
25
- const result = spawnSync(
26
- "npx",
27
- ["--yes", "openapi-typescript@7", specPath, "-o", outPath],
28
- { stdio: "inherit", shell: process.platform === "win32" },
29
- );
30
-
31
- process.exit(result.status ?? 1);