@enterprisestandard/valibot 0.0.8-beta.20260214.2
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/dist/index.d.ts +157 -0
- package/dist/index.js +1 -0
- package/package.json +30 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { BaseUser, CreateTenantRequest, CreateTenantResponse, ESValidators, GroupResource, IdTokenClaims, JWTAssertionClaims, OidcCallbackParams, ScimUser, TokenResponse, WorkloadTokenResponse } from "@enterprisestandard/core";
|
|
2
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
+
/**
|
|
4
|
+
* Individual Valibot schema factories for custom usage
|
|
5
|
+
*/
|
|
6
|
+
declare const valibotValidators: {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Valibot validator for OIDC callback parameters
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
13
|
+
*
|
|
14
|
+
* const callbackParams = valibotValidators.oidcCallbackParams();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
oidcCallbackParams: () => StandardSchemaV1<unknown, OidcCallbackParams>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a Valibot validator for ID token claims
|
|
20
|
+
* Use v.object() with looseObject to extend with custom claims
|
|
21
|
+
*
|
|
22
|
+
* @example Extending with custom claims
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
25
|
+
* import * as v from 'valibot';
|
|
26
|
+
*
|
|
27
|
+
* const customClaimsSchema = v.looseObject({
|
|
28
|
+
* ...(valibotValidators.idTokenClaims() as any).entries,
|
|
29
|
+
* custom_claim: v.string(),
|
|
30
|
+
* roles: v.array(v.string()),
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
idTokenClaims: () => StandardSchemaV1<unknown, IdTokenClaims>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a Valibot validator for token responses from IdP
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
41
|
+
*
|
|
42
|
+
* const tokenResponse = valibotValidators.tokenResponse();
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
tokenResponse: () => StandardSchemaV1<unknown, TokenResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a Valibot validator for SCIM User resources
|
|
48
|
+
* Use v.object() to extend with custom SCIM extensions
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
53
|
+
*
|
|
54
|
+
* const userValidator = valibotValidators.scimUser();
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example Extending with custom SCIM schema extensions
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
60
|
+
* import * as v from 'valibot';
|
|
61
|
+
*
|
|
62
|
+
* const customUserSchema = v.object({
|
|
63
|
+
* ...(valibotValidators.scimUser() as any).entries,
|
|
64
|
+
* 'urn:ietf:params:scim:schemas:extension:custom:2.0:User': v.object({
|
|
65
|
+
* customField: v.string(),
|
|
66
|
+
* }),
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
scimUser: () => StandardSchemaV1<unknown, ScimUser>;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a Valibot validator for SCIM Group resources
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
77
|
+
*
|
|
78
|
+
* const groupValidator = valibotValidators.scimGroup();
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
scimGroup: () => StandardSchemaV1<unknown, GroupResource>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a Valibot validator for JWT Assertion Claims (workload identity)
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
88
|
+
*
|
|
89
|
+
* const jwtClaims = valibotValidators.jwtAssertionClaims();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
jwtAssertionClaims: () => StandardSchemaV1<unknown, JWTAssertionClaims>;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a Valibot validator for workload token responses
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
99
|
+
*
|
|
100
|
+
* const workloadToken = valibotValidators.workloadTokenResponse();
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
workloadTokenResponse: () => StandardSchemaV1<unknown, WorkloadTokenResponse>;
|
|
104
|
+
/**
|
|
105
|
+
* Creates a Valibot validator for tenant creation requests
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
110
|
+
*
|
|
111
|
+
* const tenantRequest = valibotValidators.createTenantRequest();
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
createTenantRequest: () => StandardSchemaV1<unknown, CreateTenantRequest>;
|
|
115
|
+
/**
|
|
116
|
+
* Creates a Valibot validator for BaseUser (CIAM magic link request body).
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
121
|
+
*
|
|
122
|
+
* const baseUser = valibotValidators.baseUser();
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
baseUser: () => StandardSchemaV1<unknown, BaseUser>;
|
|
126
|
+
/**
|
|
127
|
+
* Creates a Valibot validator for tenant creation responses
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* import { valibotValidators } from '@enterprisestandard/valibot';
|
|
132
|
+
*
|
|
133
|
+
* const tenantResponse = valibotValidators.createTenantResponse();
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
createTenantResponse: () => StandardSchemaV1<unknown, CreateTenantResponse>;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Pre-built Valibot validators for Enterprise Standard
|
|
140
|
+
*
|
|
141
|
+
* These validators implement the StandardSchemaV1 interface and can be used
|
|
142
|
+
* directly in Enterprise Standard configuration
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* import { createValidators } from '@enterprisestandard/valibot';
|
|
147
|
+
*
|
|
148
|
+
* const validators = createValidators();
|
|
149
|
+
*
|
|
150
|
+
* const es = await enterpriseStandard(configSource, {
|
|
151
|
+
* validators: createValidators(),
|
|
152
|
+
* // ... other config
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
declare function createValidators(): ESValidators;
|
|
157
|
+
export { valibotValidators, createValidators };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withValidate as k}from"@enterprisestandard/core";import*as j from"valibot";var q={oidcCallbackParams:()=>j.object({code:j.string(),state:j.optional(j.string()),session_state:j.optional(j.string()),error:j.optional(j.string()),error_description:j.optional(j.string()),error_uri:j.optional(j.string()),iss:j.optional(j.string())}),idTokenClaims:()=>j.looseObject({sub:j.optional(j.string()),iss:j.optional(j.string()),aud:j.optional(j.string()),exp:j.optional(j.number()),iat:j.optional(j.number()),sid:j.optional(j.string()),name:j.optional(j.string()),email:j.optional(j.union([j.pipe(j.string(),j.email()),j.pipe(j.string(),j.regex(/^[^@]+@localhost$/i))])),preferred_username:j.optional(j.string()),picture:j.optional(j.pipe(j.string(),j.url()))}),tokenResponse:()=>j.object({access_token:j.string(),id_token:j.string(),refresh_token:j.optional(j.string()),token_type:j.string(),expires_in:j.optional(j.number()),scope:j.optional(j.string()),refresh_expires_in:j.optional(j.number()),session_state:j.optional(j.string()),expires:j.optional(j.string())}),scimUser:()=>{let z=j.object({formatted:j.optional(j.string()),familyName:j.optional(j.string()),givenName:j.optional(j.string()),middleName:j.optional(j.string()),honorificPrefix:j.optional(j.string()),honorificSuffix:j.optional(j.string())}),A=j.object({value:j.pipe(j.string(),j.email()),display:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}),B=j.object({value:j.string(),display:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}),C=j.object({formatted:j.optional(j.string()),streetAddress:j.optional(j.string()),locality:j.optional(j.string()),region:j.optional(j.string()),postalCode:j.optional(j.string()),country:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}),D=j.object({value:j.string(),$ref:j.optional(j.string()),display:j.optional(j.string()),type:j.optional(j.string())}),F=j.object({value:j.string(),display:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}),G=j.object({employeeNumber:j.optional(j.string()),costCenter:j.optional(j.string()),organization:j.optional(j.string()),division:j.optional(j.string()),department:j.optional(j.string()),manager:j.optional(j.object({value:j.optional(j.string()),$ref:j.optional(j.string()),displayName:j.optional(j.string())}))});return j.object({id:j.optional(j.string()),externalId:j.optional(j.string()),meta:j.optional(j.object({resourceType:j.optional(j.string()),created:j.optional(j.string()),lastModified:j.optional(j.string()),location:j.optional(j.string()),version:j.optional(j.string())})),userName:j.string(),name:j.optional(z),displayName:j.optional(j.string()),nickName:j.optional(j.string()),profileUrl:j.optional(j.pipe(j.string(),j.url())),title:j.optional(j.string()),userType:j.optional(j.string()),preferredLanguage:j.optional(j.string()),locale:j.optional(j.string()),timezone:j.optional(j.string()),active:j.optional(j.boolean()),password:j.optional(j.string()),emails:j.optional(j.array(A)),phoneNumbers:j.optional(j.array(B)),ims:j.optional(j.array(j.object({value:j.string(),display:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}))),photos:j.optional(j.array(j.object({value:j.string(),display:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}))),addresses:j.optional(j.array(C)),groups:j.optional(j.array(D)),entitlements:j.optional(j.array(j.object({value:j.string(),display:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}))),roles:j.optional(j.array(F)),x509Certificates:j.optional(j.array(j.object({value:j.string(),display:j.optional(j.string()),type:j.optional(j.string()),primary:j.optional(j.boolean())}))),"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User":j.optional(G),schemas:j.optional(j.array(j.string()))})},scimGroup:()=>{let z=j.object({value:j.string(),$ref:j.optional(j.string()),display:j.optional(j.string()),type:j.optional(j.picklist(["User","Group"]))});return j.object({id:j.optional(j.string()),externalId:j.optional(j.string()),meta:j.optional(j.object({resourceType:j.optional(j.string()),created:j.optional(j.string()),lastModified:j.optional(j.string()),location:j.optional(j.string()),version:j.optional(j.string())})),displayName:j.string(),members:j.optional(j.array(z)),schemas:j.optional(j.array(j.string()))})},jwtAssertionClaims:()=>j.looseObject({iss:j.string(),sub:j.string(),aud:j.optional(j.union([j.string(),j.array(j.string())])),exp:j.number(),iat:j.number(),jti:j.optional(j.string()),scope:j.optional(j.string())}),workloadTokenResponse:()=>j.object({access_token:j.string(),token_type:j.string(),expires_in:j.optional(j.number()),scope:j.optional(j.string()),refresh_token:j.optional(j.string()),expires:j.optional(j.string())}),createTenantRequest:()=>j.object({tenantId:j.string(),companyId:j.string(),companyName:j.string(),environmentType:j.picklist(["POC","DEV","QA","PROD"]),email:j.pipe(j.string(),j.email()),webhookUrl:j.pipe(j.string(),j.url()),callbackUrl:j.pipe(j.string(),j.url()),tenantUrl:j.optional(j.pipe(j.string(),j.url()))}),baseUser:()=>j.object({userName:j.string(),name:j.string(),email:j.pipe(j.string(),j.email()),id:j.optional(j.string()),avatar:j.optional(j.union([j.pipe(j.string(),j.url()),j.literal("")]))}),createTenantResponse:()=>j.variant("status",[j.object({tenantUrl:j.pipe(j.string(),j.url()),status:j.picklist(["pending","processing","completed","failed"])}),j.object({status:j.literal("action_required"),actionUrl:j.pipe(j.string(),j.url()),requestToken:j.string(),expiresAt:j.string()})])};function I(){return{sso:{callbackParams:k(q.oidcCallbackParams()),idTokenClaims:k(q.idTokenClaims()),tokenResponse:k(q.tokenResponse())},iam:{user:k(q.scimUser()),group:k(q.scimGroup())},workload:{jwtAssertionClaims:k(q.jwtAssertionClaims()),tokenResponse:k(q.workloadTokenResponse())},tenant:{createTenantRequest:k(q.createTenantRequest())},ciam:{baseUser:k(q.baseUser())}}}export{q as valibotValidators,I as createValidators};
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@enterprisestandard/valibot",
|
|
3
|
+
"version": "0.0.8-beta.20260214.2",
|
|
4
|
+
"description": "Valibot validators for Enterprise Standard (SSO, IAM, workload, tenant, CIAM)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"author": "Enterprise Standard",
|
|
7
|
+
"license": "Proprietary",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@enterprisestandard/core": "0.0.8-beta.20260214.2",
|
|
10
|
+
"valibot": "^1.2.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"typescript": "^5.7.3"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"./styles.css": "./dist/index.css",
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
}
|
|
30
|
+
}
|