@tantainnovative/ndpr-toolkit 4.1.0 → 5.0.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/CHANGELOG.md +75 -0
- package/README.md +76 -12
- package/dist/chunk-4FXRJH37.js +1 -0
- package/dist/{chunk-UJGNW6CH.js → chunk-ASEUTU45.js} +1 -1
- package/dist/chunk-BRJKIF7E.mjs +1 -0
- package/dist/chunk-CSE36REY.js +6 -0
- package/dist/chunk-DKLJ5DYN.js +1 -0
- package/dist/chunk-FRMVSG4N.mjs +1 -0
- package/dist/chunk-MAD7QYRK.js +1 -0
- package/dist/chunk-NBOJ2KGN.mjs +1 -0
- package/dist/chunk-PQ5IPUJN.mjs +1 -0
- package/dist/chunk-QKXGVT2Q.js +1 -0
- package/dist/chunk-R2ZZMATR.js +1 -0
- package/dist/chunk-R3ZKV2J7.mjs +1 -0
- package/dist/chunk-RRVML7CU.mjs +1 -0
- package/dist/{chunk-6H6IXTHA.mjs → chunk-SBSYHCPK.mjs} +1 -1
- package/dist/chunk-TLIHFGIJ.js +1 -0
- package/dist/{chunk-O4ATGGVK.js → chunk-TVA6D6S4.js} +1 -1
- package/dist/chunk-WPH6CJDL.mjs +6 -0
- package/dist/{chunk-6OPGI27L.mjs → chunk-ZSRO4L3C.mjs} +1 -1
- package/dist/consent.d.mts +59 -21
- package/dist/consent.d.ts +59 -21
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +116 -74
- package/dist/core.d.ts +116 -74
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border.d.mts +4 -27
- package/dist/cross-border.d.ts +4 -27
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/dsr.d.mts +86 -57
- package/dist/dsr.d.ts +86 -57
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/headless.d.mts +20 -27
- package/dist/headless.d.ts +20 -27
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.d.mts +20 -27
- package/dist/hooks.d.ts +20 -27
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +37 -202
- package/dist/index.d.ts +37 -202
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis.d.mts +3 -24
- package/dist/lawful-basis.d.ts +3 -24
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/presets.d.mts +1 -9
- package/dist/presets.d.ts +1 -9
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa-lite.d.mts +2 -11
- package/dist/ropa-lite.d.ts +2 -11
- package/dist/ropa-lite.js +1 -1
- package/dist/ropa-lite.mjs +1 -1
- package/dist/ropa.d.mts +10 -52
- package/dist/ropa.d.ts +10 -52
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/server.d.mts +20 -100
- package/dist/server.d.ts +20 -100
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3APT25XO.mjs +0 -1
- package/dist/chunk-45D7AMB3.js +0 -1
- package/dist/chunk-65J4P5ID.js +0 -1
- package/dist/chunk-7Z7NURIA.mjs +0 -1
- package/dist/chunk-D3HHDWBR.js +0 -1
- package/dist/chunk-DSIIEUAD.mjs +0 -1
- package/dist/chunk-H2FDWK4F.js +0 -6
- package/dist/chunk-HLFS3NXG.js +0 -1
- package/dist/chunk-JGY65SHX.mjs +0 -1
- package/dist/chunk-NI54X543.mjs +0 -1
- package/dist/chunk-P5MPUC5F.js +0 -1
- package/dist/chunk-ROOUYQD4.js +0 -1
- package/dist/chunk-UTXDZDYF.mjs +0 -6
- package/dist/chunk-W6VVLHRQ.mjs +0 -1
package/dist/core.d.ts
CHANGED
|
@@ -815,7 +815,7 @@ export declare type DSRStatus = 'pending' | 'awaitingVerification' | 'inProgress
|
|
|
815
815
|
/**
|
|
816
816
|
* Validated DSR submission shape — matches what `<DSRRequestForm onSubmit>`
|
|
817
817
|
* emits client-side. Use this as the typed parameter for your server-side
|
|
818
|
-
* handler after `
|
|
818
|
+
* handler after `validateDsrSubmissionStructured` returns `valid: true`.
|
|
819
819
|
*/
|
|
820
820
|
export declare interface DsrSubmissionPayload {
|
|
821
821
|
requestType: string;
|
|
@@ -830,16 +830,6 @@ export declare interface DsrSubmissionPayload {
|
|
|
830
830
|
submittedAt: number;
|
|
831
831
|
}
|
|
832
832
|
|
|
833
|
-
/** Result of validating a raw DSR submission payload. */
|
|
834
|
-
export declare interface DsrSubmissionValidationResult {
|
|
835
|
-
/** True when the payload conforms to the DSR submission contract. */
|
|
836
|
-
valid: boolean;
|
|
837
|
-
/** Field-keyed error messages. Empty when `valid` is true. */
|
|
838
|
-
errors: Record<string, string>;
|
|
839
|
-
/** The narrowed, typed payload — only populated when `valid` is true. */
|
|
840
|
-
data?: DsrSubmissionPayload;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
833
|
/**
|
|
844
834
|
* Data Subject Rights types aligned with NDPA 2023 Part VI (Sections 34-38)
|
|
845
835
|
* and the related provisions in Part V (Section 27 — information to the data subject)
|
|
@@ -936,16 +926,29 @@ export declare function exportROPAToCSV(ropa: RecordOfProcessingActivities): str
|
|
|
936
926
|
export declare function findUnfilledTokens(rendered: string): string[];
|
|
937
927
|
|
|
938
928
|
/**
|
|
939
|
-
*
|
|
940
|
-
*
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
|
|
944
|
-
|
|
929
|
+
* Format a DSR request for display or submission. Returns the formatted
|
|
930
|
+
* payload plus a typed `errors` array of `{ field, code, message }` for any
|
|
931
|
+
* required fields missing from the source request.
|
|
932
|
+
*
|
|
933
|
+
* Codes emitted:
|
|
934
|
+
* - `request_id_required`
|
|
935
|
+
* - `request_type_required`
|
|
936
|
+
* - `request_status_required`
|
|
937
|
+
* - `created_at_required`
|
|
938
|
+
* - `subject_name_required`
|
|
939
|
+
* - `subject_email_required`
|
|
940
|
+
*/
|
|
941
|
+
export declare function formatDSRRequestStructured(request: DSRRequest): FormatDSRRequestStructuredResult;
|
|
942
|
+
|
|
943
|
+
/** Result of {@link formatDSRRequestStructured}. */
|
|
944
|
+
export declare interface FormatDSRRequestStructuredResult {
|
|
945
|
+
valid: boolean;
|
|
946
|
+
errors: StructuredValidationError[];
|
|
947
|
+
/** Formatted request payload — always populated regardless of `valid`. */
|
|
945
948
|
formattedRequest: Record<string, unknown>;
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
+
/** Narrowed input — populated only on `valid: true`. */
|
|
950
|
+
data?: DSRRequest;
|
|
951
|
+
}
|
|
949
952
|
|
|
950
953
|
export declare const frenchLocale: Required<{
|
|
951
954
|
[K in keyof NDPRLocale]: Required<NonNullable<NDPRLocale[K]>>;
|
|
@@ -2016,6 +2019,30 @@ export declare interface StorageAdapter<T = unknown> {
|
|
|
2016
2019
|
remove(): void | Promise<void>;
|
|
2017
2020
|
}
|
|
2018
2021
|
|
|
2022
|
+
/**
|
|
2023
|
+
* Single structured validation error with a stable, locale-independent
|
|
2024
|
+
* `code` consumers can switch on programmatically.
|
|
2025
|
+
*/
|
|
2026
|
+
export declare interface StructuredValidationError {
|
|
2027
|
+
/** Dot-path of the offending field (e.g. `'timestamp'`, `'dataSubject.email'`, `'options[0].purpose'`). */
|
|
2028
|
+
field: string;
|
|
2029
|
+
/** Stable, snake_case error code — safe to switch on across locales. */
|
|
2030
|
+
code: string;
|
|
2031
|
+
/** Human-readable English message — informational only; do not regex-match. */
|
|
2032
|
+
message: string;
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
/**
|
|
2036
|
+
* Result of a structured validator. `errors` is an array (one entry per
|
|
2037
|
+
* failed rule). `data` is the narrowed, typed payload, only populated on
|
|
2038
|
+
* `valid: true`.
|
|
2039
|
+
*/
|
|
2040
|
+
export declare interface StructuredValidationResult<T> {
|
|
2041
|
+
valid: boolean;
|
|
2042
|
+
errors: StructuredValidationError[];
|
|
2043
|
+
data?: T;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2019
2046
|
/** Full context used to generate an adaptive privacy policy. */
|
|
2020
2047
|
export declare interface TemplateContext {
|
|
2021
2048
|
/** Organisation details, extended with industry and size. */
|
|
@@ -2155,70 +2182,43 @@ export declare function useNDPRConfig(): NDPRConfig;
|
|
|
2155
2182
|
export declare function useNDPRLocale(): typeof defaultLocale;
|
|
2156
2183
|
|
|
2157
2184
|
/**
|
|
2158
|
-
* Validates consent
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2185
|
+
* Validates consent options against NDPA Section 26 requirements. Each option
|
|
2186
|
+
* is checked for a non-empty `purpose`. Failing options are reported with
|
|
2187
|
+
* `field: 'options[i].purpose'` so consumers can map errors back to the
|
|
2188
|
+
* originating option index.
|
|
2189
|
+
*
|
|
2190
|
+
* Codes emitted:
|
|
2191
|
+
* - `options_required` — empty / missing options array
|
|
2192
|
+
* - `purpose_required` — single option missing a purpose
|
|
2162
2193
|
*/
|
|
2163
|
-
export declare function
|
|
2164
|
-
valid: boolean;
|
|
2165
|
-
errors: string[];
|
|
2166
|
-
};
|
|
2194
|
+
export declare function validateConsentOptionsStructured(options: ConsentOption[]): StructuredValidationResult<ConsentOption[]>;
|
|
2167
2195
|
|
|
2168
2196
|
/**
|
|
2169
|
-
* Validates
|
|
2170
|
-
*
|
|
2171
|
-
*
|
|
2172
|
-
* @param options The consent options to validate
|
|
2173
|
-
* @returns An object containing validation result and any error messages
|
|
2174
|
-
* @deprecated Use `validateConsentOptionsStructured()` for typed `{ field, code, message }[]` errors. The legacy string-returning shape will be removed in 5.0.
|
|
2175
|
-
*/
|
|
2176
|
-
export declare function validateConsentOptions(options: ConsentOption[]): {
|
|
2177
|
-
valid: boolean;
|
|
2178
|
-
errors: string[];
|
|
2179
|
-
};
|
|
2180
|
-
|
|
2181
|
-
/**
|
|
2182
|
-
* Validate a raw DSR submission payload against the same rules
|
|
2183
|
-
* `<DSRRequestForm />` enforces client-side. Designed to be called from a
|
|
2184
|
-
* server-side handler (Next.js Route Handler, NestJS controller, Express
|
|
2185
|
-
* middleware, Cloudflare Worker) so client and server stay in sync without
|
|
2186
|
-
* the consumer hand-rolling zod / class-validator schemas.
|
|
2197
|
+
* Validates consent settings against NDPA requirements. Returns structured
|
|
2198
|
+
* `{ field, code, message }[]` errors so consumers can switch on `code`
|
|
2199
|
+
* across locales without regex-matching English strings.
|
|
2187
2200
|
*
|
|
2188
|
-
*
|
|
2189
|
-
* `
|
|
2201
|
+
* Codes emitted:
|
|
2202
|
+
* - `consents_required`
|
|
2203
|
+
* - `timestamp_required`
|
|
2204
|
+
* - `timestamp_invalid`
|
|
2205
|
+
* - `version_required`
|
|
2206
|
+
* - `method_required`
|
|
2207
|
+
* - `has_interacted_required`
|
|
2208
|
+
* - `consent_stale`
|
|
2190
2209
|
*
|
|
2191
|
-
* @example
|
|
2210
|
+
* @example
|
|
2192
2211
|
* ```ts
|
|
2193
|
-
*
|
|
2194
|
-
*
|
|
2195
|
-
*
|
|
2196
|
-
*
|
|
2197
|
-
* const { valid, errors, data } = validateDsrSubmission(await req.json());
|
|
2198
|
-
* if (!valid) return Response.json({ errors }, { status: 422 });
|
|
2199
|
-
* // `data` is the typed DsrSubmissionPayload
|
|
2200
|
-
* await dsrStore.create(data);
|
|
2201
|
-
* return Response.json({ ok: true }, { status: 201 });
|
|
2212
|
+
* const { valid, errors, data } = validateConsentStructured(settings);
|
|
2213
|
+
* if (!valid) {
|
|
2214
|
+
* const stale = errors.find((e) => e.code === 'consent_stale');
|
|
2215
|
+
* if (stale) showRefreshBanner();
|
|
2202
2216
|
* }
|
|
2203
2217
|
* ```
|
|
2204
|
-
*
|
|
2205
|
-
* @example **Lock to specific request types**
|
|
2206
|
-
* ```ts
|
|
2207
|
-
* validateDsrSubmission(payload, {
|
|
2208
|
-
* allowedRequestTypes: ['access', 'erasure', 'rectification'],
|
|
2209
|
-
* });
|
|
2210
|
-
* ```
|
|
2211
|
-
*
|
|
2212
|
-
* @example **Skip identity verification (e.g. authenticated session)**
|
|
2213
|
-
* ```ts
|
|
2214
|
-
* validateDsrSubmission(payload, { requireIdentityVerification: false });
|
|
2215
|
-
* ```
|
|
2216
|
-
*
|
|
2217
|
-
* @deprecated Use `validateDsrSubmissionStructured()` for typed `{ field, code, message }[]` errors. The legacy string-returning shape will be removed in 5.0.
|
|
2218
2218
|
*/
|
|
2219
|
-
export declare function
|
|
2219
|
+
export declare function validateConsentStructured(settings: ConsentSettings): StructuredValidationResult<ConsentSettings>;
|
|
2220
2220
|
|
|
2221
|
-
/** Options for {@link
|
|
2221
|
+
/** Options for {@link validateDsrSubmissionStructured}. */
|
|
2222
2222
|
export declare interface ValidateDsrSubmissionOptions {
|
|
2223
2223
|
/**
|
|
2224
2224
|
* Whether the data subject is required to provide an identifier
|
|
@@ -2235,6 +2235,48 @@ export declare interface ValidateDsrSubmissionOptions {
|
|
|
2235
2235
|
allowedRequestTypes?: string[];
|
|
2236
2236
|
}
|
|
2237
2237
|
|
|
2238
|
+
/**
|
|
2239
|
+
* Validate a raw DSR submission payload against the same rules
|
|
2240
|
+
* `<DSRRequestForm />` enforces client-side. Designed to be called from a
|
|
2241
|
+
* server-side handler (Next.js Route Handler, NestJS controller, Express
|
|
2242
|
+
* middleware, Cloudflare Worker) so client and server stay in sync without
|
|
2243
|
+
* the consumer hand-rolling zod / class-validator schemas.
|
|
2244
|
+
*
|
|
2245
|
+
* Defensive — accepts `unknown` and narrows. Safe to call directly on
|
|
2246
|
+
* `await request.json()`. Returns `{ field, code, message }[]` errors so
|
|
2247
|
+
* callers can switch on `code` programmatically across locales.
|
|
2248
|
+
*
|
|
2249
|
+
* Codes emitted:
|
|
2250
|
+
* - `payload_not_object`
|
|
2251
|
+
* - `request_type_required`
|
|
2252
|
+
* - `request_type_not_allowed`
|
|
2253
|
+
* - `data_subject_required`
|
|
2254
|
+
* - `full_name_required`
|
|
2255
|
+
* - `email_required`
|
|
2256
|
+
* - `email_invalid_format`
|
|
2257
|
+
* - `phone_invalid_type`
|
|
2258
|
+
* - `identifier_type_required`
|
|
2259
|
+
* - `identifier_value_required`
|
|
2260
|
+
* - `submitted_at_invalid`
|
|
2261
|
+
* - `additional_info_invalid_type`
|
|
2262
|
+
* - `payload_final_narrowing_failed`
|
|
2263
|
+
*
|
|
2264
|
+
* @example **Next.js Route Handler**
|
|
2265
|
+
* ```ts
|
|
2266
|
+
* import { validateDsrSubmissionStructured } from '@tantainnovative/ndpr-toolkit/server';
|
|
2267
|
+
*
|
|
2268
|
+
* export async function POST(req: Request) {
|
|
2269
|
+
* const { valid, errors, data } = validateDsrSubmissionStructured(await req.json());
|
|
2270
|
+
* if (!valid) {
|
|
2271
|
+
* return Response.json({ errors }, { status: 422 });
|
|
2272
|
+
* }
|
|
2273
|
+
* await dsrStore.create(data);
|
|
2274
|
+
* return Response.json({ ok: true }, { status: 201 });
|
|
2275
|
+
* }
|
|
2276
|
+
* ```
|
|
2277
|
+
*/
|
|
2278
|
+
export declare function validateDsrSubmissionStructured(payload: unknown, options?: ValidateDsrSubmissionOptions): StructuredValidationResult<DsrSubmissionPayload>;
|
|
2279
|
+
|
|
2238
2280
|
/**
|
|
2239
2281
|
* Validates that all required fields are present on a processing activity
|
|
2240
2282
|
* and that the lawful basis is properly documented.
|
package/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunk6YFPDGNB_js=require('./chunk-6YFPDGNB.js'),chunkNUOHT3LO_js=require('./chunk-NUOHT3LO.js'),chunkRDALAH3Y_js=require('./chunk-RDALAH3Y.js'),chunk3YTAOT5O_js=require('./chunk-3YTAOT5O.js'),chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunk6LJHLE6G_js=require('./chunk-6LJHLE6G.js'),chunkYFBDJ4FH_js=require('./chunk-YFBDJ4FH.js'),chunkWZYCBW2R_js=require('./chunk-WZYCBW2R.js'),chunk4CVBQC66_js=require('./chunk-4CVBQC66.js'),chunk3IA3KDII_js=require('./chunk-3IA3KDII.js'),
|
|
1
|
+
'use strict';var chunk6YFPDGNB_js=require('./chunk-6YFPDGNB.js'),chunkNUOHT3LO_js=require('./chunk-NUOHT3LO.js'),chunkRDALAH3Y_js=require('./chunk-RDALAH3Y.js'),chunk3YTAOT5O_js=require('./chunk-3YTAOT5O.js'),chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunk6LJHLE6G_js=require('./chunk-6LJHLE6G.js'),chunkYFBDJ4FH_js=require('./chunk-YFBDJ4FH.js'),chunkWZYCBW2R_js=require('./chunk-WZYCBW2R.js'),chunk4CVBQC66_js=require('./chunk-4CVBQC66.js'),chunk3IA3KDII_js=require('./chunk-3IA3KDII.js'),chunkDKLJ5DYN_js=require('./chunk-DKLJ5DYN.js'),chunkUXUMYP4L_js=require('./chunk-UXUMYP4L.js'),chunkR2ZZMATR_js=require('./chunk-R2ZZMATR.js'),chunkTQZWJGJ2_js=require('./chunk-TQZWJGJ2.js'),chunkZVOIR4QH_js=require('./chunk-ZVOIR4QH.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),chunkTTMGFC6C_js=require('./chunk-TTMGFC6C.js');require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"arabicLocale",{enumerable:true,get:function(){return chunk6YFPDGNB_js.e}});Object.defineProperty(exports,"frenchLocale",{enumerable:true,get:function(){return chunk6YFPDGNB_js.f}});Object.defineProperty(exports,"hausaLocale",{enumerable:true,get:function(){return chunk6YFPDGNB_js.c}});Object.defineProperty(exports,"igboLocale",{enumerable:true,get:function(){return chunk6YFPDGNB_js.b}});Object.defineProperty(exports,"pidginLocale",{enumerable:true,get:function(){return chunk6YFPDGNB_js.d}});Object.defineProperty(exports,"yorubaLocale",{enumerable:true,get:function(){return chunk6YFPDGNB_js.a}});Object.defineProperty(exports,"ORG_POLICY_TEMPLATE_REGISTRY",{enumerable:true,get:function(){return chunkNUOHT3LO_js.a}});Object.defineProperty(exports,"createOrgTemplate",{enumerable:true,get:function(){return chunkNUOHT3LO_js.b}});Object.defineProperty(exports,"templateContextFor",{enumerable:true,get:function(){return chunkNUOHT3LO_js.b}});Object.defineProperty(exports,"getComplianceScore",{enumerable:true,get:function(){return chunkRDALAH3Y_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunk3YTAOT5O_js.a}});Object.defineProperty(exports,"DEFAULT_POLICY_SECTIONS",{enumerable:true,get:function(){return chunkD2ZKDQVL_js.c}});Object.defineProperty(exports,"DEFAULT_POLICY_VARIABLES",{enumerable:true,get:function(){return chunkD2ZKDQVL_js.d}});Object.defineProperty(exports,"createBusinessPolicyTemplate",{enumerable:true,get:function(){return chunkD2ZKDQVL_js.e}});Object.defineProperty(exports,"findUnfilledTokens",{enumerable:true,get:function(){return chunkD2ZKDQVL_js.a}});Object.defineProperty(exports,"generatePolicyText",{enumerable:true,get:function(){return chunkD2ZKDQVL_js.b}});Object.defineProperty(exports,"assemblePolicy",{enumerable:true,get:function(){return chunk6LJHLE6G_js.c}});Object.defineProperty(exports,"createDefaultContext",{enumerable:true,get:function(){return chunk6LJHLE6G_js.e}});Object.defineProperty(exports,"evaluatePolicyCompliance",{enumerable:true,get:function(){return chunk6LJHLE6G_js.f}});Object.defineProperty(exports,"assessTransferRisk",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.h}});Object.defineProperty(exports,"getTransferMechanismDescription",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.f}});Object.defineProperty(exports,"isNDPCApprovalRequired",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.e}});Object.defineProperty(exports,"validateTransfer",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.g}});Object.defineProperty(exports,"assessComplianceGaps",{enumerable:true,get:function(){return chunkWZYCBW2R_js.c}});Object.defineProperty(exports,"generateLawfulBasisSummary",{enumerable:true,get:function(){return chunkWZYCBW2R_js.d}});Object.defineProperty(exports,"getLawfulBasisDescription",{enumerable:true,get:function(){return chunkWZYCBW2R_js.b}});Object.defineProperty(exports,"validateProcessingActivity",{enumerable:true,get:function(){return chunkWZYCBW2R_js.a}});Object.defineProperty(exports,"exportROPAToCSV",{enumerable:true,get:function(){return chunk4CVBQC66_js.c}});Object.defineProperty(exports,"generateROPASummary",{enumerable:true,get:function(){return chunk4CVBQC66_js.b}});Object.defineProperty(exports,"identifyComplianceGaps",{enumerable:true,get:function(){return chunk4CVBQC66_js.d}});Object.defineProperty(exports,"validateProcessingRecord",{enumerable:true,get:function(){return chunk4CVBQC66_js.a}});Object.defineProperty(exports,"appendAuditEntry",{enumerable:true,get:function(){return chunk3IA3KDII_js.c}});Object.defineProperty(exports,"createAuditEntry",{enumerable:true,get:function(){return chunk3IA3KDII_js.a}});Object.defineProperty(exports,"getAuditLog",{enumerable:true,get:function(){return chunk3IA3KDII_js.b}});Object.defineProperty(exports,"validateConsentOptionsStructured",{enumerable:true,get:function(){return chunkDKLJ5DYN_js.b}});Object.defineProperty(exports,"validateConsentStructured",{enumerable:true,get:function(){return chunkDKLJ5DYN_js.a}});Object.defineProperty(exports,"sanitizeInput",{enumerable:true,get:function(){return chunkUXUMYP4L_js.a}});Object.defineProperty(exports,"formatDSRRequestStructured",{enumerable:true,get:function(){return chunkR2ZZMATR_js.b}});Object.defineProperty(exports,"validateDsrSubmissionStructured",{enumerable:true,get:function(){return chunkR2ZZMATR_js.a}});Object.defineProperty(exports,"assessDPIARisk",{enumerable:true,get:function(){return chunkTQZWJGJ2_js.a}});Object.defineProperty(exports,"LEGAL_DISCLAIMER_LONG",{enumerable:true,get:function(){return chunkZVOIR4QH_js.b}});Object.defineProperty(exports,"LEGAL_DISCLAIMER_SHORT",{enumerable:true,get:function(){return chunkZVOIR4QH_js.a}});Object.defineProperty(exports,"legalDisclaimerBlock",{enumerable:true,get:function(){return chunkZVOIR4QH_js.c}});Object.defineProperty(exports,"NDPRProvider",{enumerable:true,get:function(){return chunkYDKWD6MQ_js.a}});Object.defineProperty(exports,"useNDPRConfig",{enumerable:true,get:function(){return chunkYDKWD6MQ_js.b}});Object.defineProperty(exports,"useNDPRLocale",{enumerable:true,get:function(){return chunkYDKWD6MQ_js.c}});Object.defineProperty(exports,"defaultLocale",{enumerable:true,get:function(){return chunkTTMGFC6C_js.a}});Object.defineProperty(exports,"mergeLocale",{enumerable:true,get:function(){return chunkTTMGFC6C_js.b}});
|
package/dist/core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{e as arabicLocale,f as frenchLocale,c as hausaLocale,b as igboLocale,d as pidginLocale,a as yorubaLocale}from'./chunk-PSPYIRIF.mjs';export{a as ORG_POLICY_TEMPLATE_REGISTRY,b as createOrgTemplate,b as templateContextFor}from'./chunk-CWY2FMIC.mjs';export{a as getComplianceScore}from'./chunk-7RBO42IW.mjs';export{a as calculateBreachSeverity}from'./chunk-WTGKZX7J.mjs';export{c as DEFAULT_POLICY_SECTIONS,d as DEFAULT_POLICY_VARIABLES,e as createBusinessPolicyTemplate,a as findUnfilledTokens,b as generatePolicyText}from'./chunk-NBQQ2GN3.mjs';export{c as assemblePolicy,e as createDefaultContext,f as evaluatePolicyCompliance}from'./chunk-BIJSMSUU.mjs';export{h as assessTransferRisk,f as getTransferMechanismDescription,e as isNDPCApprovalRequired,g as validateTransfer}from'./chunk-7BJXI2HI.mjs';export{c as assessComplianceGaps,d as generateLawfulBasisSummary,b as getLawfulBasisDescription,a as validateProcessingActivity}from'./chunk-LWIKDDSU.mjs';export{c as exportROPAToCSV,b as generateROPASummary,d as identifyComplianceGaps,a as validateProcessingRecord}from'./chunk-XP5PL6K7.mjs';export{c as appendAuditEntry,a as createAuditEntry,b as getAuditLog}from'./chunk-V7UFP6QU.mjs';export{
|
|
1
|
+
export{e as arabicLocale,f as frenchLocale,c as hausaLocale,b as igboLocale,d as pidginLocale,a as yorubaLocale}from'./chunk-PSPYIRIF.mjs';export{a as ORG_POLICY_TEMPLATE_REGISTRY,b as createOrgTemplate,b as templateContextFor}from'./chunk-CWY2FMIC.mjs';export{a as getComplianceScore}from'./chunk-7RBO42IW.mjs';export{a as calculateBreachSeverity}from'./chunk-WTGKZX7J.mjs';export{c as DEFAULT_POLICY_SECTIONS,d as DEFAULT_POLICY_VARIABLES,e as createBusinessPolicyTemplate,a as findUnfilledTokens,b as generatePolicyText}from'./chunk-NBQQ2GN3.mjs';export{c as assemblePolicy,e as createDefaultContext,f as evaluatePolicyCompliance}from'./chunk-BIJSMSUU.mjs';export{h as assessTransferRisk,f as getTransferMechanismDescription,e as isNDPCApprovalRequired,g as validateTransfer}from'./chunk-7BJXI2HI.mjs';export{c as assessComplianceGaps,d as generateLawfulBasisSummary,b as getLawfulBasisDescription,a as validateProcessingActivity}from'./chunk-LWIKDDSU.mjs';export{c as exportROPAToCSV,b as generateROPASummary,d as identifyComplianceGaps,a as validateProcessingRecord}from'./chunk-XP5PL6K7.mjs';export{c as appendAuditEntry,a as createAuditEntry,b as getAuditLog}from'./chunk-V7UFP6QU.mjs';export{b as validateConsentOptionsStructured,a as validateConsentStructured}from'./chunk-R3ZKV2J7.mjs';export{a as sanitizeInput}from'./chunk-EWVK45Z3.mjs';export{b as formatDSRRequestStructured,a as validateDsrSubmissionStructured}from'./chunk-RRVML7CU.mjs';export{a as assessDPIARisk}from'./chunk-LRRENTT5.mjs';export{b as LEGAL_DISCLAIMER_LONG,a as LEGAL_DISCLAIMER_SHORT,c as legalDisclaimerBlock}from'./chunk-ITCY2Z66.mjs';export{a as NDPRProvider,b as useNDPRConfig,c as useNDPRLocale}from'./chunk-FRQFU44F.mjs';export{a as defaultLocale,b as mergeLocale}from'./chunk-V5TZJJWU.mjs';import'./chunk-ZJYULEER.mjs';
|
package/dist/cross-border.d.mts
CHANGED
|
@@ -215,39 +215,16 @@ declare interface CrossBorderTransferManagerProps {
|
|
|
215
215
|
*/
|
|
216
216
|
transfers: CrossBorderTransfer[];
|
|
217
217
|
/**
|
|
218
|
-
* Callback when a new transfer is added
|
|
219
|
-
* @deprecated Renamed to `onAdd` in 4.1. The legacy name still fires
|
|
220
|
-
* for backward compatibility and will be removed in 5.0.
|
|
221
|
-
*/
|
|
222
|
-
onAddTransfer?: (transfer: Omit<CrossBorderTransfer, 'id' | 'createdAt' | 'updatedAt'>) => void;
|
|
223
|
-
/**
|
|
224
|
-
* Callback when a transfer is updated
|
|
225
|
-
* @deprecated Renamed to `onUpdate` in 4.1. The legacy name still fires
|
|
226
|
-
* for backward compatibility and will be removed in 5.0.
|
|
227
|
-
*/
|
|
228
|
-
onUpdateTransfer?: (id: string, updates: Partial<CrossBorderTransfer>) => void;
|
|
229
|
-
/**
|
|
230
|
-
* Callback when a transfer is removed
|
|
231
|
-
* @deprecated Renamed to `onArchive` in 4.1 (NDPA prefers soft-delete
|
|
232
|
-
* over hard delete). The legacy name still fires for backward
|
|
233
|
-
* compatibility and will be removed in 5.0.
|
|
234
|
-
*/
|
|
235
|
-
onRemoveTransfer?: (id: string) => void;
|
|
236
|
-
/**
|
|
237
|
-
* Callback when a new transfer is added (uniform 4.1+ name).
|
|
238
|
-
* Takes precedence over `onAddTransfer` when both are provided.
|
|
218
|
+
* Callback when a new transfer is added.
|
|
239
219
|
*/
|
|
240
220
|
onAdd?: (transfer: Omit<CrossBorderTransfer, 'id' | 'createdAt' | 'updatedAt'>) => void;
|
|
241
221
|
/**
|
|
242
|
-
* Callback when a transfer is updated
|
|
243
|
-
* Takes precedence over `onUpdateTransfer` when both are provided.
|
|
222
|
+
* Callback when a transfer is updated.
|
|
244
223
|
*/
|
|
245
224
|
onUpdate?: (id: string, updates: Partial<CrossBorderTransfer>) => void;
|
|
246
225
|
/**
|
|
247
|
-
* Callback when a transfer is archived
|
|
248
|
-
*
|
|
249
|
-
* this as an archive signal. Takes precedence over `onRemoveTransfer`
|
|
250
|
-
* when both are provided.
|
|
226
|
+
* Callback when a transfer is archived. NDPA preference is soft-delete
|
|
227
|
+
* over hard-delete; consumers should treat this as an archive signal.
|
|
251
228
|
*/
|
|
252
229
|
onArchive?: (id: string) => void;
|
|
253
230
|
/**
|
package/dist/cross-border.d.ts
CHANGED
|
@@ -215,39 +215,16 @@ declare interface CrossBorderTransferManagerProps {
|
|
|
215
215
|
*/
|
|
216
216
|
transfers: CrossBorderTransfer[];
|
|
217
217
|
/**
|
|
218
|
-
* Callback when a new transfer is added
|
|
219
|
-
* @deprecated Renamed to `onAdd` in 4.1. The legacy name still fires
|
|
220
|
-
* for backward compatibility and will be removed in 5.0.
|
|
221
|
-
*/
|
|
222
|
-
onAddTransfer?: (transfer: Omit<CrossBorderTransfer, 'id' | 'createdAt' | 'updatedAt'>) => void;
|
|
223
|
-
/**
|
|
224
|
-
* Callback when a transfer is updated
|
|
225
|
-
* @deprecated Renamed to `onUpdate` in 4.1. The legacy name still fires
|
|
226
|
-
* for backward compatibility and will be removed in 5.0.
|
|
227
|
-
*/
|
|
228
|
-
onUpdateTransfer?: (id: string, updates: Partial<CrossBorderTransfer>) => void;
|
|
229
|
-
/**
|
|
230
|
-
* Callback when a transfer is removed
|
|
231
|
-
* @deprecated Renamed to `onArchive` in 4.1 (NDPA prefers soft-delete
|
|
232
|
-
* over hard delete). The legacy name still fires for backward
|
|
233
|
-
* compatibility and will be removed in 5.0.
|
|
234
|
-
*/
|
|
235
|
-
onRemoveTransfer?: (id: string) => void;
|
|
236
|
-
/**
|
|
237
|
-
* Callback when a new transfer is added (uniform 4.1+ name).
|
|
238
|
-
* Takes precedence over `onAddTransfer` when both are provided.
|
|
218
|
+
* Callback when a new transfer is added.
|
|
239
219
|
*/
|
|
240
220
|
onAdd?: (transfer: Omit<CrossBorderTransfer, 'id' | 'createdAt' | 'updatedAt'>) => void;
|
|
241
221
|
/**
|
|
242
|
-
* Callback when a transfer is updated
|
|
243
|
-
* Takes precedence over `onUpdateTransfer` when both are provided.
|
|
222
|
+
* Callback when a transfer is updated.
|
|
244
223
|
*/
|
|
245
224
|
onUpdate?: (id: string, updates: Partial<CrossBorderTransfer>) => void;
|
|
246
225
|
/**
|
|
247
|
-
* Callback when a transfer is archived
|
|
248
|
-
*
|
|
249
|
-
* this as an archive signal. Takes precedence over `onRemoveTransfer`
|
|
250
|
-
* when both are provided.
|
|
226
|
+
* Callback when a transfer is archived. NDPA preference is soft-delete
|
|
227
|
+
* over hard-delete; consumers should treat this as an archive signal.
|
|
251
228
|
*/
|
|
252
229
|
onArchive?: (id: string) => void;
|
|
253
230
|
/**
|
package/dist/cross-border.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunkCSE36REY_js=require('./chunk-CSE36REY.js'),chunkHHK5LHEG_js=require('./chunk-HHK5LHEG.js'),chunkYFBDJ4FH_js=require('./chunk-YFBDJ4FH.js');require('./chunk-AME4HJR4.js'),require('./chunk-YDKWD6MQ.js'),require('./chunk-TTMGFC6C.js'),require('./chunk-VWED6UTN.js'),require('./chunk-RFPLZDIO.js');var react=require('react'),jsxRuntime=require('react/jsx-runtime');var s=react.createContext(null);function A(){let r=react.useContext(s);if(!r)throw new Error("CrossBorder compound components must be wrapped in <CrossBorder.Provider>. Example: <CrossBorder.Provider><CrossBorder.Manager /></CrossBorder.Provider>");return r}var t=({adapter:r,storageKey:d,useLocalStorage:a,initialTransfers:n,onAdd:p,onUpdate:C,onRemove:f,children:i})=>{let m=chunkHHK5LHEG_js.a({adapter:r,storageKey:d,useLocalStorage:a,initialTransfers:n,onAdd:p,onUpdate:C,onRemove:f});return jsxRuntime.jsx(s.Provider,{value:m,children:i})};var q={Provider:t,Manager:chunkCSE36REY_js.a};Object.defineProperty(exports,"CrossBorderTransferManager",{enumerable:true,get:function(){return chunkCSE36REY_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunkHHK5LHEG_js.a}});Object.defineProperty(exports,"COUNTRY_ADEQUACY_MAP",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.a}});Object.defineProperty(exports,"assessTransferRisk",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.h}});Object.defineProperty(exports,"getAdequateCountries",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.c}});Object.defineProperty(exports,"getCountryAdequacy",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.b}});Object.defineProperty(exports,"getTransferMechanismDescription",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.f}});Object.defineProperty(exports,"isNDPCApprovalRequired",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.e}});Object.defineProperty(exports,"requiresNDPCApproval",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.d}});Object.defineProperty(exports,"validateTransfer",{enumerable:true,get:function(){return chunkYFBDJ4FH_js.g}});exports.CrossBorder=q;exports.CrossBorderProvider=t;exports.useCrossBorderCompound=A;
|
package/dist/cross-border.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {a}from'./chunk-
|
|
2
|
+
import {a}from'./chunk-WPH6CJDL.mjs';export{a as CrossBorderTransferManager}from'./chunk-WPH6CJDL.mjs';import {a as a$1}from'./chunk-KDAZQO3N.mjs';export{a as useCrossBorderTransfer}from'./chunk-KDAZQO3N.mjs';export{a as COUNTRY_ADEQUACY_MAP,h as assessTransferRisk,c as getAdequateCountries,b as getCountryAdequacy,f as getTransferMechanismDescription,e as isNDPCApprovalRequired,d as requiresNDPCApproval,g as validateTransfer}from'./chunk-7BJXI2HI.mjs';import'./chunk-SFGW37LE.mjs';import'./chunk-FRQFU44F.mjs';import'./chunk-V5TZJJWU.mjs';import'./chunk-DBZSN4WP.mjs';import'./chunk-ZJYULEER.mjs';import {createContext,useContext}from'react';import {jsx}from'react/jsx-runtime';var s=createContext(null);function A(){let r=useContext(s);if(!r)throw new Error("CrossBorder compound components must be wrapped in <CrossBorder.Provider>. Example: <CrossBorder.Provider><CrossBorder.Manager /></CrossBorder.Provider>");return r}var t=({adapter:r,storageKey:d,useLocalStorage:a,initialTransfers:n,onAdd:p,onUpdate:C,onRemove:f,children:i})=>{let m=a$1({adapter:r,storageKey:d,useLocalStorage:a,initialTransfers:n,onAdd:p,onUpdate:C,onRemove:f});return jsx(s.Provider,{value:m,children:i})};var q={Provider:t,Manager:a};export{q as CrossBorder,t as CrossBorderProvider,A as useCrossBorderCompound};
|
package/dist/dsr.d.mts
CHANGED
|
@@ -331,7 +331,7 @@ export declare type DSRStatus = 'pending' | 'awaitingVerification' | 'inProgress
|
|
|
331
331
|
/**
|
|
332
332
|
* Validated DSR submission shape — matches what `<DSRRequestForm onSubmit>`
|
|
333
333
|
* emits client-side. Use this as the typed parameter for your server-side
|
|
334
|
-
* handler after `
|
|
334
|
+
* handler after `validateDsrSubmissionStructured` returns `valid: true`.
|
|
335
335
|
*/
|
|
336
336
|
export declare interface DsrSubmissionPayload {
|
|
337
337
|
requestType: string;
|
|
@@ -346,16 +346,6 @@ export declare interface DsrSubmissionPayload {
|
|
|
346
346
|
submittedAt: number;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
/** Result of validating a raw DSR submission payload. */
|
|
350
|
-
export declare interface DsrSubmissionValidationResult {
|
|
351
|
-
/** True when the payload conforms to the DSR submission contract. */
|
|
352
|
-
valid: boolean;
|
|
353
|
-
/** Field-keyed error messages. Empty when `valid` is true. */
|
|
354
|
-
errors: Record<string, string>;
|
|
355
|
-
/** The narrowed, typed payload — only populated when `valid` is true. */
|
|
356
|
-
data?: DsrSubmissionPayload;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
349
|
/**
|
|
360
350
|
* DSR tracking and analytics component. Supports compliance with NDPA Part IV,
|
|
361
351
|
* providing summary statistics, deadline tracking, and compliance metrics for data subject requests.
|
|
@@ -459,16 +449,29 @@ declare interface DSRTrackerProps {
|
|
|
459
449
|
export declare type DSRType = 'information' | 'access' | 'rectification' | 'erasure' | 'restriction' | 'portability' | 'objection' | 'automated_decision_making' | 'withdraw_consent';
|
|
460
450
|
|
|
461
451
|
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
452
|
+
* Format a DSR request for display or submission. Returns the formatted
|
|
453
|
+
* payload plus a typed `errors` array of `{ field, code, message }` for any
|
|
454
|
+
* required fields missing from the source request.
|
|
455
|
+
*
|
|
456
|
+
* Codes emitted:
|
|
457
|
+
* - `request_id_required`
|
|
458
|
+
* - `request_type_required`
|
|
459
|
+
* - `request_status_required`
|
|
460
|
+
* - `created_at_required`
|
|
461
|
+
* - `subject_name_required`
|
|
462
|
+
* - `subject_email_required`
|
|
466
463
|
*/
|
|
467
|
-
export declare function
|
|
464
|
+
export declare function formatDSRRequestStructured(request: DSRRequest): FormatDSRRequestStructuredResult;
|
|
465
|
+
|
|
466
|
+
/** Result of {@link formatDSRRequestStructured}. */
|
|
467
|
+
export declare interface FormatDSRRequestStructuredResult {
|
|
468
|
+
valid: boolean;
|
|
469
|
+
errors: StructuredValidationError[];
|
|
470
|
+
/** Formatted request payload — always populated regardless of `valid`. */
|
|
468
471
|
formattedRequest: Record<string, unknown>;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
+
/** Narrowed input — populated only on `valid: true`. */
|
|
473
|
+
data?: DSRRequest;
|
|
474
|
+
}
|
|
472
475
|
|
|
473
476
|
/**
|
|
474
477
|
* Legacy status of a data subject request
|
|
@@ -519,6 +522,30 @@ export declare interface StorageAdapter<T = unknown> {
|
|
|
519
522
|
remove(): void | Promise<void>;
|
|
520
523
|
}
|
|
521
524
|
|
|
525
|
+
/**
|
|
526
|
+
* Single structured validation error with a stable, locale-independent
|
|
527
|
+
* `code` consumers can switch on programmatically.
|
|
528
|
+
*/
|
|
529
|
+
declare interface StructuredValidationError {
|
|
530
|
+
/** Dot-path of the offending field (e.g. `'timestamp'`, `'dataSubject.email'`, `'options[0].purpose'`). */
|
|
531
|
+
field: string;
|
|
532
|
+
/** Stable, snake_case error code — safe to switch on across locales. */
|
|
533
|
+
code: string;
|
|
534
|
+
/** Human-readable English message — informational only; do not regex-match. */
|
|
535
|
+
message: string;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Result of a structured validator. `errors` is an array (one entry per
|
|
540
|
+
* failed rule). `data` is the narrowed, typed payload, only populated on
|
|
541
|
+
* `valid: true`.
|
|
542
|
+
*/
|
|
543
|
+
declare interface StructuredValidationResult<T> {
|
|
544
|
+
valid: boolean;
|
|
545
|
+
errors: StructuredValidationError[];
|
|
546
|
+
data?: T;
|
|
547
|
+
}
|
|
548
|
+
|
|
522
549
|
/**
|
|
523
550
|
* Hook for managing Data Subject Requests in compliance with the NDPA.
|
|
524
551
|
*
|
|
@@ -639,6 +666,23 @@ declare interface UseDSRReturn {
|
|
|
639
666
|
isLoading: boolean;
|
|
640
667
|
}
|
|
641
668
|
|
|
669
|
+
/** Options for {@link validateDsrSubmissionStructured}. */
|
|
670
|
+
export declare interface ValidateDsrSubmissionOptions {
|
|
671
|
+
/**
|
|
672
|
+
* Whether the data subject is required to provide an identifier
|
|
673
|
+
* (NDPC's recommended verification step). Mirror whatever you set on
|
|
674
|
+
* the client-side `<DSRRequestForm requireIdentityVerification>`.
|
|
675
|
+
* @default true
|
|
676
|
+
*/
|
|
677
|
+
requireIdentityVerification?: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Allowed request types. When provided, the payload's `requestType`
|
|
680
|
+
* must be one of these — useful for locking the server to a specific
|
|
681
|
+
* set of supported NDPA Part VI §34-38 (plus §35, §36, §37) data-subject rights.
|
|
682
|
+
*/
|
|
683
|
+
allowedRequestTypes?: string[];
|
|
684
|
+
}
|
|
685
|
+
|
|
642
686
|
/**
|
|
643
687
|
* Validate a raw DSR submission payload against the same rules
|
|
644
688
|
* `<DSRRequestForm />` enforces client-side. Designed to be called from a
|
|
@@ -647,53 +691,38 @@ declare interface UseDSRReturn {
|
|
|
647
691
|
* the consumer hand-rolling zod / class-validator schemas.
|
|
648
692
|
*
|
|
649
693
|
* Defensive — accepts `unknown` and narrows. Safe to call directly on
|
|
650
|
-
* `await request.json()`.
|
|
694
|
+
* `await request.json()`. Returns `{ field, code, message }[]` errors so
|
|
695
|
+
* callers can switch on `code` programmatically across locales.
|
|
696
|
+
*
|
|
697
|
+
* Codes emitted:
|
|
698
|
+
* - `payload_not_object`
|
|
699
|
+
* - `request_type_required`
|
|
700
|
+
* - `request_type_not_allowed`
|
|
701
|
+
* - `data_subject_required`
|
|
702
|
+
* - `full_name_required`
|
|
703
|
+
* - `email_required`
|
|
704
|
+
* - `email_invalid_format`
|
|
705
|
+
* - `phone_invalid_type`
|
|
706
|
+
* - `identifier_type_required`
|
|
707
|
+
* - `identifier_value_required`
|
|
708
|
+
* - `submitted_at_invalid`
|
|
709
|
+
* - `additional_info_invalid_type`
|
|
710
|
+
* - `payload_final_narrowing_failed`
|
|
651
711
|
*
|
|
652
712
|
* @example **Next.js Route Handler**
|
|
653
713
|
* ```ts
|
|
654
|
-
*
|
|
655
|
-
* import { validateDsrSubmission } from '@tantainnovative/ndpr-toolkit/server';
|
|
714
|
+
* import { validateDsrSubmissionStructured } from '@tantainnovative/ndpr-toolkit/server';
|
|
656
715
|
*
|
|
657
716
|
* export async function POST(req: Request) {
|
|
658
|
-
* const { valid, errors, data } =
|
|
659
|
-
* if (!valid)
|
|
660
|
-
*
|
|
717
|
+
* const { valid, errors, data } = validateDsrSubmissionStructured(await req.json());
|
|
718
|
+
* if (!valid) {
|
|
719
|
+
* return Response.json({ errors }, { status: 422 });
|
|
720
|
+
* }
|
|
661
721
|
* await dsrStore.create(data);
|
|
662
722
|
* return Response.json({ ok: true }, { status: 201 });
|
|
663
723
|
* }
|
|
664
724
|
* ```
|
|
665
|
-
*
|
|
666
|
-
* @example **Lock to specific request types**
|
|
667
|
-
* ```ts
|
|
668
|
-
* validateDsrSubmission(payload, {
|
|
669
|
-
* allowedRequestTypes: ['access', 'erasure', 'rectification'],
|
|
670
|
-
* });
|
|
671
|
-
* ```
|
|
672
|
-
*
|
|
673
|
-
* @example **Skip identity verification (e.g. authenticated session)**
|
|
674
|
-
* ```ts
|
|
675
|
-
* validateDsrSubmission(payload, { requireIdentityVerification: false });
|
|
676
|
-
* ```
|
|
677
|
-
*
|
|
678
|
-
* @deprecated Use `validateDsrSubmissionStructured()` for typed `{ field, code, message }[]` errors. The legacy string-returning shape will be removed in 5.0.
|
|
679
725
|
*/
|
|
680
|
-
export declare function
|
|
681
|
-
|
|
682
|
-
/** Options for {@link validateDsrSubmission}. */
|
|
683
|
-
export declare interface ValidateDsrSubmissionOptions {
|
|
684
|
-
/**
|
|
685
|
-
* Whether the data subject is required to provide an identifier
|
|
686
|
-
* (NDPC's recommended verification step). Mirror whatever you set on
|
|
687
|
-
* the client-side `<DSRRequestForm requireIdentityVerification>`.
|
|
688
|
-
* @default true
|
|
689
|
-
*/
|
|
690
|
-
requireIdentityVerification?: boolean;
|
|
691
|
-
/**
|
|
692
|
-
* Allowed request types. When provided, the payload's `requestType`
|
|
693
|
-
* must be one of these — useful for locking the server to a specific
|
|
694
|
-
* set of supported NDPA Part VI §34-38 (plus §35, §36, §37) data-subject rights.
|
|
695
|
-
*/
|
|
696
|
-
allowedRequestTypes?: string[];
|
|
697
|
-
}
|
|
726
|
+
export declare function validateDsrSubmissionStructured(payload: unknown, options?: ValidateDsrSubmissionOptions): StructuredValidationResult<DsrSubmissionPayload>;
|
|
698
727
|
|
|
699
728
|
export { }
|