@go-mondo/identity-sdk 0.0.2-beta.12 → 0.0.2-beta.13
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/.release-please-manifest.json +1 -1
- package/.tsbuildinfo/cjs.json +1 -1
- package/.tsbuildinfo/esm.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/cjs/action/schema/base.d.ts +22 -20
- package/dist/cjs/action/schema/base.d.ts.map +1 -1
- package/dist/cjs/action/schema/base.js +15 -8
- package/dist/cjs/action/schema/base.test.js +50 -34
- package/dist/cjs/action/schema/operations/set-password.d.ts +30 -30
- package/dist/cjs/action/schema/operations/set-password.d.ts.map +1 -1
- package/dist/cjs/action/schema/operations/set-password.js +9 -8
- package/dist/cjs/action/schema/operations/set-password.test.js +30 -29
- package/dist/cjs/action/schema/operations/sign-up-verification.d.ts +21 -21
- package/dist/cjs/action/schema/operations/sign-up-verification.d.ts.map +1 -1
- package/dist/cjs/action/schema/operations/sign-up-verification.js +8 -7
- package/dist/cjs/action/schema/operations/sign-up-verification.test.js +28 -29
- package/dist/cjs/action/schema/operations/sign-up.d.ts +40 -43
- package/dist/cjs/action/schema/operations/sign-up.d.ts.map +1 -1
- package/dist/cjs/action/schema/operations/sign-up.js +24 -15
- package/dist/cjs/action/schema/operations/sign-up.test.js +33 -34
- package/dist/cjs/action/schema/operations/user-attribute-verification.d.ts +19 -19
- package/dist/cjs/action/schema/operations/user-attribute-verification.d.ts.map +1 -1
- package/dist/cjs/action/schema/operations/user-attribute-verification.js +6 -5
- package/dist/cjs/action/schema/operations/user-attribute-verification.test.js +25 -26
- package/dist/cjs/action/schema/schema.d.ts +70 -76
- package/dist/cjs/action/schema/schema.d.ts.map +1 -1
- package/dist/cjs/action/schema/schema.test.js +26 -27
- package/dist/cjs/activity/resources.d.ts.map +1 -1
- package/dist/cjs/activity/resources.js +1 -1
- package/dist/cjs/activity/schema/base.d.ts +88 -69
- package/dist/cjs/activity/schema/base.d.ts.map +1 -1
- package/dist/cjs/activity/schema/base.js +30 -18
- package/dist/cjs/activity/schema/base.test.js +85 -55
- package/dist/cjs/activity/schema/schema.d.ts +293 -226
- package/dist/cjs/activity/schema/schema.d.ts.map +1 -1
- package/dist/cjs/activity/schema/schema.test.js +47 -48
- package/dist/cjs/activity/schema/types/authentication.d.ts +64 -46
- package/dist/cjs/activity/schema/types/authentication.d.ts.map +1 -1
- package/dist/cjs/activity/schema/types/authentication.js +16 -7
- package/dist/cjs/activity/schema/types/authentication.test.js +37 -38
- package/dist/cjs/activity/schema/types/authorization.d.ts +64 -46
- package/dist/cjs/activity/schema/types/authorization.d.ts.map +1 -1
- package/dist/cjs/activity/schema/types/authorization.js +16 -7
- package/dist/cjs/activity/schema/types/authorization.test.js +41 -42
- package/dist/cjs/activity/schema/types/note.d.ts +83 -70
- package/dist/cjs/activity/schema/types/note.d.ts.map +1 -1
- package/dist/cjs/activity/schema/types/note.js +20 -12
- package/dist/cjs/activity/schema/types/note.test.js +48 -49
- package/dist/cjs/activity/schema/types/operation.d.ts +64 -45
- package/dist/cjs/activity/schema/types/operation.d.ts.map +1 -1
- package/dist/cjs/activity/schema/types/operation.js +19 -8
- package/dist/cjs/activity/schema/types/operation.test.js +34 -35
- package/dist/cjs/activity/schema/types/unknown.d.ts +50 -41
- package/dist/cjs/activity/schema/types/unknown.d.ts.map +1 -1
- package/dist/cjs/activity/schema/types/unknown.js +12 -6
- package/dist/cjs/activity/schema/types/unknown.test.js +29 -30
- package/dist/cjs/app/authorization/resources.d.ts.map +1 -1
- package/dist/cjs/app/authorization/resources.js +2 -3
- package/dist/cjs/app/authorization/schema.d.ts +96 -52
- package/dist/cjs/app/authorization/schema.d.ts.map +1 -1
- package/dist/cjs/app/authorization/schema.js +61 -52
- package/dist/cjs/app/authorization/schema.test.js +96 -71
- package/dist/cjs/app/oauth/resources.d.ts.map +1 -1
- package/dist/cjs/app/oauth/resources.js +2 -3
- package/dist/cjs/app/oauth/schema.d.ts +34 -41
- package/dist/cjs/app/oauth/schema.d.ts.map +1 -1
- package/dist/cjs/app/oauth/schema.js +23 -17
- package/dist/cjs/app/oauth/schema.test.js +38 -39
- package/dist/cjs/app/oidc/resources.d.ts.map +1 -1
- package/dist/cjs/app/oidc/resources.js +4 -5
- package/dist/cjs/app/oidc/schema.d.ts +26 -37
- package/dist/cjs/app/oidc/schema.d.ts.map +1 -1
- package/dist/cjs/app/oidc/schema.js +17 -12
- package/dist/cjs/app/oidc/schema.test.js +45 -26
- package/dist/cjs/app/registration/resources.d.ts.map +1 -1
- package/dist/cjs/app/registration/resources.js +2 -3
- package/dist/cjs/app/registration/schema.d.ts +24 -31
- package/dist/cjs/app/registration/schema.d.ts.map +1 -1
- package/dist/cjs/app/registration/schema.js +23 -16
- package/dist/cjs/app/registration/schema.test.js +68 -150
- package/dist/cjs/app/resources.d.ts.map +1 -1
- package/dist/cjs/app/resources.js +5 -5
- package/dist/cjs/app/saml/resources.d.ts.map +1 -1
- package/dist/cjs/app/saml/resources.js +4 -5
- package/dist/cjs/app/saml/schema.d.ts +26 -37
- package/dist/cjs/app/saml/schema.d.ts.map +1 -1
- package/dist/cjs/app/saml/schema.js +17 -12
- package/dist/cjs/app/schema.d.ts +72 -68
- package/dist/cjs/app/schema.d.ts.map +1 -1
- package/dist/cjs/app/schema.js +34 -27
- package/dist/cjs/app/schema.test.js +38 -41
- package/dist/cjs/association/resources.d.ts.map +1 -1
- package/dist/cjs/association/resources.js +3 -5
- package/dist/cjs/association/schema.d.ts +225 -181
- package/dist/cjs/association/schema.d.ts.map +1 -1
- package/dist/cjs/association/schema.js +28 -22
- package/dist/cjs/association/schema.test.js +36 -28
- package/dist/cjs/authentication/factors/schema.d.ts +18 -55
- package/dist/cjs/authentication/factors/schema.d.ts.map +1 -1
- package/dist/cjs/authentication/factors/schema.js +21 -23
- package/dist/cjs/authentication/factors/schema.test.js +33 -34
- package/dist/cjs/authentication/providers/schema.d.ts +23 -22
- package/dist/cjs/authentication/providers/schema.d.ts.map +1 -1
- package/dist/cjs/authentication/providers/schema.js +10 -8
- package/dist/cjs/authentication/sessions/resources.d.ts.map +1 -1
- package/dist/cjs/authentication/sessions/resources.js +2 -2
- package/dist/cjs/authentication/sessions/schema.d.ts +101 -74
- package/dist/cjs/authentication/sessions/schema.d.ts.map +1 -1
- package/dist/cjs/authentication/sessions/schema.js +56 -25
- package/dist/cjs/authentication/settings/resources.d.ts.map +1 -1
- package/dist/cjs/authentication/settings/resources.js +2 -3
- package/dist/cjs/authentication/settings/schema.d.ts +25 -68
- package/dist/cjs/authentication/settings/schema.d.ts.map +1 -1
- package/dist/cjs/authentication/settings/schema.js +13 -10
- package/dist/cjs/authentication/settings/schema.test.js +28 -19
- package/dist/cjs/authentication/strategies/resources.d.ts.map +1 -1
- package/dist/cjs/authentication/strategies/resources.js +5 -5
- package/dist/cjs/authentication/strategies/schema/base.d.ts +59 -51
- package/dist/cjs/authentication/strategies/schema/base.d.ts.map +1 -1
- package/dist/cjs/authentication/strategies/schema/base.js +26 -15
- package/dist/cjs/authentication/strategies/schema/schema.d.ts +206 -197
- package/dist/cjs/authentication/strategies/schema/schema.d.ts.map +1 -1
- package/dist/cjs/authentication/strategies/schema/types/email.d.ts +61 -60
- package/dist/cjs/authentication/strategies/schema/types/email.d.ts.map +1 -1
- package/dist/cjs/authentication/strategies/schema/types/email.js +24 -14
- package/dist/cjs/authentication/strategies/schema/types/email.test.js +49 -50
- package/dist/cjs/authentication/strategies/schema/types/password.d.ts +129 -122
- package/dist/cjs/authentication/strategies/schema/types/password.d.ts.map +1 -1
- package/dist/cjs/authentication/strategies/schema/types/password.js +33 -25
- package/dist/cjs/authentication/strategies/schema/types/totp.d.ts +107 -94
- package/dist/cjs/authentication/strategies/schema/types/totp.d.ts.map +1 -1
- package/dist/cjs/authentication/strategies/schema/types/totp.js +50 -26
- package/dist/cjs/authorization/permissions/resources.d.ts.map +1 -1
- package/dist/cjs/authorization/permissions/resources.js +5 -5
- package/dist/cjs/authorization/permissions/schema.d.ts +92 -88
- package/dist/cjs/authorization/permissions/schema.d.ts.map +1 -1
- package/dist/cjs/authorization/permissions/schema.js +38 -28
- package/dist/cjs/authorization/permissions/schema.test.js +57 -59
- package/dist/cjs/authorization/roles/resources.d.ts.map +1 -1
- package/dist/cjs/authorization/roles/resources.js +5 -5
- package/dist/cjs/authorization/roles/schema.d.ts +102 -98
- package/dist/cjs/authorization/roles/schema.d.ts.map +1 -1
- package/dist/cjs/authorization/roles/schema.js +35 -32
- package/dist/cjs/authorization/roles/schema.test.js +58 -59
- package/dist/cjs/authorization/schema.d.ts +7 -6
- package/dist/cjs/authorization/schema.d.ts.map +1 -1
- package/dist/cjs/authorization/schema.js +9 -3
- package/dist/cjs/common/resources/init.d.ts +7 -6
- package/dist/cjs/common/resources/init.d.ts.map +1 -1
- package/dist/cjs/common/resources/init.js +17 -9
- package/dist/cjs/common/resources/utils.d.ts +0 -9
- package/dist/cjs/common/resources/utils.d.ts.map +1 -1
- package/dist/cjs/common/resources/utils.js +0 -26
- package/dist/cjs/common/resources/utils.test.js +0 -29
- package/dist/cjs/common/schema/aggregate.d.ts +6 -5
- package/dist/cjs/common/schema/aggregate.d.ts.map +1 -1
- package/dist/cjs/common/schema/aggregate.js +4 -4
- package/dist/cjs/common/schema/aggregate.test.js +21 -22
- package/dist/cjs/common/schema/collection.d.ts +11 -10
- package/dist/cjs/common/schema/collection.d.ts.map +1 -1
- package/dist/cjs/common/schema/collection.js +6 -4
- package/dist/cjs/common/schema/collection.test.js +66 -48
- package/dist/cjs/common/schema/dates.d.ts +27 -26
- package/dist/cjs/common/schema/dates.d.ts.map +1 -1
- package/dist/cjs/common/schema/dates.js +17 -11
- package/dist/cjs/common/schema/dates.test.js +24 -13
- package/dist/cjs/common/schema/id.d.ts +2 -1
- package/dist/cjs/common/schema/id.d.ts.map +1 -1
- package/dist/cjs/common/schema/id.js +2 -2
- package/dist/cjs/common/schema/id.test.js +70 -38
- package/dist/cjs/common/schema/jwt.d.ts +27 -14
- package/dist/cjs/common/schema/jwt.d.ts.map +1 -1
- package/dist/cjs/common/schema/jwt.js +14 -2
- package/dist/cjs/common/schema/jwt.test.js +25 -19
- package/dist/cjs/common/schema/metadata.d.ts +24 -41
- package/dist/cjs/common/schema/metadata.d.ts.map +1 -1
- package/dist/cjs/common/schema/metadata.js +38 -37
- package/dist/cjs/common/schema/metadata.test.js +36 -37
- package/dist/cjs/common/schema/pagination.d.ts +6 -5
- package/dist/cjs/common/schema/pagination.d.ts.map +1 -1
- package/dist/cjs/common/schema/pagination.js +4 -4
- package/dist/cjs/common/schema/pagination.test.js +19 -20
- package/dist/cjs/common/schema/schema.d.ts +4 -4
- package/dist/cjs/common/schema/schema.d.ts.map +1 -1
- package/dist/cjs/common/schema/schema.js +6 -5
- package/dist/cjs/common/schema/schema.test.js +9 -15
- package/dist/cjs/common/schema/sets.d.ts +3 -2
- package/dist/cjs/common/schema/sets.d.ts.map +1 -1
- package/dist/cjs/common/schema/sets.js +9 -6
- package/dist/cjs/common/schema/sets.test.js +52 -43
- package/dist/cjs/customer/organization/schema.d.ts +44 -46
- package/dist/cjs/customer/organization/schema.d.ts.map +1 -1
- package/dist/cjs/customer/organization/schema.js +26 -20
- package/dist/cjs/customer/schema.d.ts +7 -6
- package/dist/cjs/customer/schema.d.ts.map +1 -1
- package/dist/cjs/customer/schema.js +9 -3
- package/dist/cjs/customer/users/resources.d.ts.map +1 -1
- package/dist/cjs/customer/users/resources.js +5 -5
- package/dist/cjs/customer/users/schema.d.ts +140 -139
- package/dist/cjs/customer/users/schema.d.ts.map +1 -1
- package/dist/cjs/customer/users/schema.js +58 -46
- package/dist/cjs/customer/users/schema.test.js +22 -35
- package/dist/cjs/customer/users/utils.d.ts +3 -2
- package/dist/cjs/customer/users/utils.d.ts.map +1 -1
- package/dist/cjs/identity/schema.d.ts +5 -1
- package/dist/cjs/identity/schema.d.ts.map +1 -1
- package/dist/cjs/identity/schema.js +5 -2
- package/dist/cjs/identity/schema.test.js +21 -16
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.d.ts +31 -28
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.d.ts.map +1 -1
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.js +56 -37
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.test.js +44 -45
- package/dist/cjs/oauth/authorize/schema/grants/implicit.d.ts +16 -10
- package/dist/cjs/oauth/authorize/schema/grants/implicit.d.ts.map +1 -1
- package/dist/cjs/oauth/authorize/schema/grants/implicit.js +19 -10
- package/dist/cjs/oauth/authorize/schema/schema.d.ts +44 -36
- package/dist/cjs/oauth/authorize/schema/schema.d.ts.map +1 -1
- package/dist/cjs/oauth/common/schema.d.ts +21 -7
- package/dist/cjs/oauth/common/schema.d.ts.map +1 -1
- package/dist/cjs/oauth/common/schema.js +20 -7
- package/dist/cjs/oauth/common/schema.test.js +25 -26
- package/dist/cjs/oauth/token/schema/grants/authorization-code.d.ts +12 -9
- package/dist/cjs/oauth/token/schema/grants/authorization-code.d.ts.map +1 -1
- package/dist/cjs/oauth/token/schema/grants/authorization-code.js +11 -10
- package/dist/cjs/oauth/token/schema/grants/client-credentials.d.ts +20 -15
- package/dist/cjs/oauth/token/schema/grants/client-credentials.d.ts.map +1 -1
- package/dist/cjs/oauth/token/schema/grants/client-credentials.js +13 -8
- package/dist/cjs/oauth/token/schema/grants/refresh-token.d.ts +11 -8
- package/dist/cjs/oauth/token/schema/grants/refresh-token.d.ts.map +1 -1
- package/dist/cjs/oauth/token/schema/grants/refresh-token.js +6 -6
- package/dist/cjs/oauth/token/schema/schema.d.ts +28 -21
- package/dist/cjs/oauth/token/schema/schema.d.ts.map +1 -1
- package/dist/cjs/oauth/token/schema/schema.test.js +42 -28
- package/dist/cjs/workspace/authorization/schema.d.ts +44 -27
- package/dist/cjs/workspace/authorization/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/authorization/schema.js +16 -11
- package/dist/cjs/workspace/branding/schema.d.ts +30 -37
- package/dist/cjs/workspace/branding/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/branding/schema.js +20 -15
- package/dist/cjs/workspace/membership/schema.d.ts +21 -20
- package/dist/cjs/workspace/membership/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/membership/schema.js +6 -6
- package/dist/cjs/workspace/registration/schema.d.ts +26 -27
- package/dist/cjs/workspace/registration/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/registration/schema.js +13 -11
- package/dist/cjs/workspace/settings/schema.d.ts +12 -19
- package/dist/cjs/workspace/settings/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/settings/schema.js +7 -6
- package/dist/cjs/workspace/settings/schema.test.js +18 -19
- package/dist/cjs/workspace/tenant/schema.d.ts +55 -57
- package/dist/cjs/workspace/tenant/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/tenant/schema.js +17 -12
- package/dist/cjs/workspace/user/notifications/schema.d.ts +50 -56
- package/dist/cjs/workspace/user/notifications/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/user/notifications/schema.js +26 -23
- package/dist/cjs/workspace/user/preferences/schema.d.ts +18 -25
- package/dist/cjs/workspace/user/preferences/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/user/preferences/schema.js +16 -11
- package/dist/esm/action/schema/base.d.ts +22 -20
- package/dist/esm/action/schema/base.d.ts.map +1 -1
- package/dist/esm/action/schema/base.js +15 -8
- package/dist/esm/action/schema/base.test.js +50 -34
- package/dist/esm/action/schema/operations/set-password.d.ts +30 -30
- package/dist/esm/action/schema/operations/set-password.d.ts.map +1 -1
- package/dist/esm/action/schema/operations/set-password.js +9 -8
- package/dist/esm/action/schema/operations/set-password.test.js +30 -29
- package/dist/esm/action/schema/operations/sign-up-verification.d.ts +21 -21
- package/dist/esm/action/schema/operations/sign-up-verification.d.ts.map +1 -1
- package/dist/esm/action/schema/operations/sign-up-verification.js +8 -7
- package/dist/esm/action/schema/operations/sign-up-verification.test.js +28 -29
- package/dist/esm/action/schema/operations/sign-up.d.ts +40 -43
- package/dist/esm/action/schema/operations/sign-up.d.ts.map +1 -1
- package/dist/esm/action/schema/operations/sign-up.js +19 -10
- package/dist/esm/action/schema/operations/sign-up.test.js +33 -34
- package/dist/esm/action/schema/operations/user-attribute-verification.d.ts +19 -19
- package/dist/esm/action/schema/operations/user-attribute-verification.d.ts.map +1 -1
- package/dist/esm/action/schema/operations/user-attribute-verification.js +6 -5
- package/dist/esm/action/schema/operations/user-attribute-verification.test.js +25 -26
- package/dist/esm/action/schema/schema.d.ts +70 -76
- package/dist/esm/action/schema/schema.d.ts.map +1 -1
- package/dist/esm/action/schema/schema.test.js +26 -27
- package/dist/esm/activity/resources.d.ts.map +1 -1
- package/dist/esm/activity/resources.js +2 -2
- package/dist/esm/activity/schema/base.d.ts +88 -69
- package/dist/esm/activity/schema/base.d.ts.map +1 -1
- package/dist/esm/activity/schema/base.js +30 -18
- package/dist/esm/activity/schema/base.test.js +85 -55
- package/dist/esm/activity/schema/schema.d.ts +293 -226
- package/dist/esm/activity/schema/schema.d.ts.map +1 -1
- package/dist/esm/activity/schema/schema.test.js +47 -48
- package/dist/esm/activity/schema/types/authentication.d.ts +64 -46
- package/dist/esm/activity/schema/types/authentication.d.ts.map +1 -1
- package/dist/esm/activity/schema/types/authentication.js +16 -7
- package/dist/esm/activity/schema/types/authentication.test.js +37 -38
- package/dist/esm/activity/schema/types/authorization.d.ts +64 -46
- package/dist/esm/activity/schema/types/authorization.d.ts.map +1 -1
- package/dist/esm/activity/schema/types/authorization.js +16 -7
- package/dist/esm/activity/schema/types/authorization.test.js +41 -42
- package/dist/esm/activity/schema/types/note.d.ts +83 -70
- package/dist/esm/activity/schema/types/note.d.ts.map +1 -1
- package/dist/esm/activity/schema/types/note.js +20 -12
- package/dist/esm/activity/schema/types/note.test.js +48 -49
- package/dist/esm/activity/schema/types/operation.d.ts +64 -45
- package/dist/esm/activity/schema/types/operation.d.ts.map +1 -1
- package/dist/esm/activity/schema/types/operation.js +19 -8
- package/dist/esm/activity/schema/types/operation.test.js +34 -35
- package/dist/esm/activity/schema/types/unknown.d.ts +50 -41
- package/dist/esm/activity/schema/types/unknown.d.ts.map +1 -1
- package/dist/esm/activity/schema/types/unknown.js +12 -6
- package/dist/esm/activity/schema/types/unknown.test.js +29 -30
- package/dist/esm/app/authorization/resources.d.ts.map +1 -1
- package/dist/esm/app/authorization/resources.js +2 -3
- package/dist/esm/app/authorization/schema.d.ts +96 -52
- package/dist/esm/app/authorization/schema.d.ts.map +1 -1
- package/dist/esm/app/authorization/schema.js +61 -52
- package/dist/esm/app/authorization/schema.test.js +96 -71
- package/dist/esm/app/oauth/resources.d.ts.map +1 -1
- package/dist/esm/app/oauth/resources.js +2 -3
- package/dist/esm/app/oauth/schema.d.ts +34 -41
- package/dist/esm/app/oauth/schema.d.ts.map +1 -1
- package/dist/esm/app/oauth/schema.js +23 -17
- package/dist/esm/app/oauth/schema.test.js +38 -39
- package/dist/esm/app/oidc/resources.d.ts.map +1 -1
- package/dist/esm/app/oidc/resources.js +4 -5
- package/dist/esm/app/oidc/schema.d.ts +26 -37
- package/dist/esm/app/oidc/schema.d.ts.map +1 -1
- package/dist/esm/app/oidc/schema.js +17 -12
- package/dist/esm/app/oidc/schema.test.js +45 -26
- package/dist/esm/app/registration/resources.d.ts.map +1 -1
- package/dist/esm/app/registration/resources.js +2 -3
- package/dist/esm/app/registration/schema.d.ts +24 -31
- package/dist/esm/app/registration/schema.d.ts.map +1 -1
- package/dist/esm/app/registration/schema.js +23 -16
- package/dist/esm/app/registration/schema.test.js +68 -150
- package/dist/esm/app/resources.d.ts.map +1 -1
- package/dist/esm/app/resources.js +6 -6
- package/dist/esm/app/saml/resources.d.ts.map +1 -1
- package/dist/esm/app/saml/resources.js +4 -5
- package/dist/esm/app/saml/schema.d.ts +26 -37
- package/dist/esm/app/saml/schema.d.ts.map +1 -1
- package/dist/esm/app/saml/schema.js +17 -12
- package/dist/esm/app/schema.d.ts +72 -68
- package/dist/esm/app/schema.d.ts.map +1 -1
- package/dist/esm/app/schema.js +34 -27
- package/dist/esm/app/schema.test.js +38 -41
- package/dist/esm/association/resources.d.ts.map +1 -1
- package/dist/esm/association/resources.js +4 -6
- package/dist/esm/association/schema.d.ts +225 -181
- package/dist/esm/association/schema.d.ts.map +1 -1
- package/dist/esm/association/schema.js +28 -22
- package/dist/esm/association/schema.test.js +36 -28
- package/dist/esm/authentication/factors/schema.d.ts +18 -55
- package/dist/esm/authentication/factors/schema.d.ts.map +1 -1
- package/dist/esm/authentication/factors/schema.js +21 -23
- package/dist/esm/authentication/factors/schema.test.js +33 -34
- package/dist/esm/authentication/providers/schema.d.ts +23 -22
- package/dist/esm/authentication/providers/schema.d.ts.map +1 -1
- package/dist/esm/authentication/providers/schema.js +10 -8
- package/dist/esm/authentication/sessions/resources.d.ts.map +1 -1
- package/dist/esm/authentication/sessions/resources.js +3 -3
- package/dist/esm/authentication/sessions/schema.d.ts +101 -74
- package/dist/esm/authentication/sessions/schema.d.ts.map +1 -1
- package/dist/esm/authentication/sessions/schema.js +56 -25
- package/dist/esm/authentication/settings/resources.d.ts.map +1 -1
- package/dist/esm/authentication/settings/resources.js +2 -3
- package/dist/esm/authentication/settings/schema.d.ts +25 -68
- package/dist/esm/authentication/settings/schema.d.ts.map +1 -1
- package/dist/esm/authentication/settings/schema.js +13 -10
- package/dist/esm/authentication/settings/schema.test.js +28 -19
- package/dist/esm/authentication/strategies/resources.d.ts.map +1 -1
- package/dist/esm/authentication/strategies/resources.js +6 -6
- package/dist/esm/authentication/strategies/schema/base.d.ts +59 -51
- package/dist/esm/authentication/strategies/schema/base.d.ts.map +1 -1
- package/dist/esm/authentication/strategies/schema/base.js +26 -15
- package/dist/esm/authentication/strategies/schema/schema.d.ts +206 -197
- package/dist/esm/authentication/strategies/schema/schema.d.ts.map +1 -1
- package/dist/esm/authentication/strategies/schema/types/email.d.ts +61 -60
- package/dist/esm/authentication/strategies/schema/types/email.d.ts.map +1 -1
- package/dist/esm/authentication/strategies/schema/types/email.js +24 -14
- package/dist/esm/authentication/strategies/schema/types/email.test.js +49 -50
- package/dist/esm/authentication/strategies/schema/types/password.d.ts +129 -122
- package/dist/esm/authentication/strategies/schema/types/password.d.ts.map +1 -1
- package/dist/esm/authentication/strategies/schema/types/password.js +33 -25
- package/dist/esm/authentication/strategies/schema/types/totp.d.ts +107 -94
- package/dist/esm/authentication/strategies/schema/types/totp.d.ts.map +1 -1
- package/dist/esm/authentication/strategies/schema/types/totp.js +50 -26
- package/dist/esm/authorization/permissions/resources.d.ts.map +1 -1
- package/dist/esm/authorization/permissions/resources.js +6 -6
- package/dist/esm/authorization/permissions/schema.d.ts +92 -88
- package/dist/esm/authorization/permissions/schema.d.ts.map +1 -1
- package/dist/esm/authorization/permissions/schema.js +38 -28
- package/dist/esm/authorization/permissions/schema.test.js +57 -59
- package/dist/esm/authorization/roles/resources.d.ts.map +1 -1
- package/dist/esm/authorization/roles/resources.js +6 -6
- package/dist/esm/authorization/roles/schema.d.ts +102 -98
- package/dist/esm/authorization/roles/schema.d.ts.map +1 -1
- package/dist/esm/authorization/roles/schema.js +35 -32
- package/dist/esm/authorization/roles/schema.test.js +58 -59
- package/dist/esm/authorization/schema.d.ts +7 -6
- package/dist/esm/authorization/schema.d.ts.map +1 -1
- package/dist/esm/authorization/schema.js +9 -3
- package/dist/esm/common/resources/init.d.ts +7 -6
- package/dist/esm/common/resources/init.d.ts.map +1 -1
- package/dist/esm/common/resources/init.js +17 -9
- package/dist/esm/common/resources/utils.d.ts +0 -9
- package/dist/esm/common/resources/utils.d.ts.map +1 -1
- package/dist/esm/common/resources/utils.js +0 -24
- package/dist/esm/common/resources/utils.test.js +1 -30
- package/dist/esm/common/schema/aggregate.d.ts +6 -5
- package/dist/esm/common/schema/aggregate.d.ts.map +1 -1
- package/dist/esm/common/schema/aggregate.js +4 -4
- package/dist/esm/common/schema/aggregate.test.js +21 -22
- package/dist/esm/common/schema/collection.d.ts +11 -10
- package/dist/esm/common/schema/collection.d.ts.map +1 -1
- package/dist/esm/common/schema/collection.js +4 -4
- package/dist/esm/common/schema/collection.test.js +66 -48
- package/dist/esm/common/schema/dates.d.ts +27 -26
- package/dist/esm/common/schema/dates.d.ts.map +1 -1
- package/dist/esm/common/schema/dates.js +17 -11
- package/dist/esm/common/schema/dates.test.js +24 -13
- package/dist/esm/common/schema/id.d.ts +2 -1
- package/dist/esm/common/schema/id.d.ts.map +1 -1
- package/dist/esm/common/schema/id.js +2 -2
- package/dist/esm/common/schema/id.test.js +70 -38
- package/dist/esm/common/schema/jwt.d.ts +27 -14
- package/dist/esm/common/schema/jwt.d.ts.map +1 -1
- package/dist/esm/common/schema/jwt.js +14 -2
- package/dist/esm/common/schema/jwt.test.js +25 -19
- package/dist/esm/common/schema/metadata.d.ts +24 -41
- package/dist/esm/common/schema/metadata.d.ts.map +1 -1
- package/dist/esm/common/schema/metadata.js +38 -37
- package/dist/esm/common/schema/metadata.test.js +36 -37
- package/dist/esm/common/schema/pagination.d.ts +6 -5
- package/dist/esm/common/schema/pagination.d.ts.map +1 -1
- package/dist/esm/common/schema/pagination.js +4 -4
- package/dist/esm/common/schema/pagination.test.js +19 -20
- package/dist/esm/common/schema/schema.d.ts +4 -4
- package/dist/esm/common/schema/schema.d.ts.map +1 -1
- package/dist/esm/common/schema/schema.js +6 -5
- package/dist/esm/common/schema/schema.test.js +9 -15
- package/dist/esm/common/schema/sets.d.ts +3 -2
- package/dist/esm/common/schema/sets.d.ts.map +1 -1
- package/dist/esm/common/schema/sets.js +9 -6
- package/dist/esm/common/schema/sets.test.js +53 -44
- package/dist/esm/customer/organization/schema.d.ts +44 -46
- package/dist/esm/customer/organization/schema.d.ts.map +1 -1
- package/dist/esm/customer/organization/schema.js +26 -20
- package/dist/esm/customer/schema.d.ts +7 -6
- package/dist/esm/customer/schema.d.ts.map +1 -1
- package/dist/esm/customer/schema.js +9 -3
- package/dist/esm/customer/users/resources.d.ts.map +1 -1
- package/dist/esm/customer/users/resources.js +6 -6
- package/dist/esm/customer/users/schema.d.ts +140 -139
- package/dist/esm/customer/users/schema.d.ts.map +1 -1
- package/dist/esm/customer/users/schema.js +58 -46
- package/dist/esm/customer/users/schema.test.js +22 -35
- package/dist/esm/customer/users/utils.d.ts +3 -2
- package/dist/esm/customer/users/utils.d.ts.map +1 -1
- package/dist/esm/customer/users/utils.test.js +1 -1
- package/dist/esm/identity/schema.d.ts +5 -1
- package/dist/esm/identity/schema.d.ts.map +1 -1
- package/dist/esm/identity/schema.js +5 -2
- package/dist/esm/identity/schema.test.js +21 -16
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.d.ts +31 -28
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.d.ts.map +1 -1
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.js +56 -37
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.test.js +44 -45
- package/dist/esm/oauth/authorize/schema/grants/implicit.d.ts +16 -10
- package/dist/esm/oauth/authorize/schema/grants/implicit.d.ts.map +1 -1
- package/dist/esm/oauth/authorize/schema/grants/implicit.js +19 -10
- package/dist/esm/oauth/authorize/schema/schema.d.ts +44 -36
- package/dist/esm/oauth/authorize/schema/schema.d.ts.map +1 -1
- package/dist/esm/oauth/common/schema.d.ts +21 -7
- package/dist/esm/oauth/common/schema.d.ts.map +1 -1
- package/dist/esm/oauth/common/schema.js +20 -7
- package/dist/esm/oauth/common/schema.test.js +25 -26
- package/dist/esm/oauth/token/schema/grants/authorization-code.d.ts +12 -9
- package/dist/esm/oauth/token/schema/grants/authorization-code.d.ts.map +1 -1
- package/dist/esm/oauth/token/schema/grants/authorization-code.js +11 -10
- package/dist/esm/oauth/token/schema/grants/client-credentials.d.ts +20 -15
- package/dist/esm/oauth/token/schema/grants/client-credentials.d.ts.map +1 -1
- package/dist/esm/oauth/token/schema/grants/client-credentials.js +13 -8
- package/dist/esm/oauth/token/schema/grants/refresh-token.d.ts +11 -8
- package/dist/esm/oauth/token/schema/grants/refresh-token.d.ts.map +1 -1
- package/dist/esm/oauth/token/schema/grants/refresh-token.js +6 -6
- package/dist/esm/oauth/token/schema/schema.d.ts +28 -21
- package/dist/esm/oauth/token/schema/schema.d.ts.map +1 -1
- package/dist/esm/oauth/token/schema/schema.test.js +42 -28
- package/dist/esm/workspace/authorization/schema.d.ts +44 -27
- package/dist/esm/workspace/authorization/schema.d.ts.map +1 -1
- package/dist/esm/workspace/authorization/schema.js +16 -11
- package/dist/esm/workspace/branding/schema.d.ts +30 -37
- package/dist/esm/workspace/branding/schema.d.ts.map +1 -1
- package/dist/esm/workspace/branding/schema.js +20 -15
- package/dist/esm/workspace/membership/schema.d.ts +21 -20
- package/dist/esm/workspace/membership/schema.d.ts.map +1 -1
- package/dist/esm/workspace/membership/schema.js +6 -6
- package/dist/esm/workspace/registration/schema.d.ts +26 -27
- package/dist/esm/workspace/registration/schema.d.ts.map +1 -1
- package/dist/esm/workspace/registration/schema.js +13 -11
- package/dist/esm/workspace/settings/schema.d.ts +12 -19
- package/dist/esm/workspace/settings/schema.d.ts.map +1 -1
- package/dist/esm/workspace/settings/schema.js +7 -6
- package/dist/esm/workspace/settings/schema.test.js +18 -19
- package/dist/esm/workspace/tenant/schema.d.ts +55 -57
- package/dist/esm/workspace/tenant/schema.d.ts.map +1 -1
- package/dist/esm/workspace/tenant/schema.js +17 -12
- package/dist/esm/workspace/user/notifications/schema.d.ts +50 -56
- package/dist/esm/workspace/user/notifications/schema.d.ts.map +1 -1
- package/dist/esm/workspace/user/notifications/schema.js +26 -23
- package/dist/esm/workspace/user/preferences/schema.d.ts +18 -25
- package/dist/esm/workspace/user/preferences/schema.d.ts.map +1 -1
- package/dist/esm/workspace/user/preferences/schema.js +16 -11
- package/package.json +3 -3
- package/src/action/schema/base.test.ts.bak +152 -0
- package/src/action/schema/operations/set-password.test.ts.bak +197 -0
- package/src/action/schema/operations/sign-up-verification.test.ts.bak +163 -0
- package/src/action/schema/operations/sign-up.test.ts.bak +203 -0
- package/src/action/schema/operations/user-attribute-verification.test.ts.bak +148 -0
- package/src/action/schema/schema.test.ts.bak +218 -0
- package/src/activity/schema/base.test.ts.bak +291 -0
- package/src/activity/schema/schema.test.ts.bak +392 -0
- package/src/activity/schema/types/authentication.test.ts.bak +337 -0
- package/src/activity/schema/types/authorization.test.ts.bak +379 -0
- package/src/activity/schema/types/note.test.ts.bak +367 -0
- package/src/activity/schema/types/operation.test.ts.bak +379 -0
- package/src/activity/schema/types/unknown.test.ts.bak +304 -0
- package/src/app/authorization/schema.test.ts.bak +412 -0
- package/src/app/oidc/schema.test.ts.bak +117 -0
- package/src/app/registration/schema.test.ts.bak +308 -0
- package/src/app/schema.test.ts.bak +221 -0
- package/src/association/schema.test.ts.bak +148 -0
- package/src/authentication/factors/schema.test.ts.bak +174 -0
- package/src/authentication/settings/schema.test.ts.bak +91 -0
- package/src/authentication/strategies/schema/types/email.test.ts.bak +252 -0
- package/src/authorization/permissions/schema.test.ts.bak +267 -0
- package/src/authorization/roles/schema.test.ts.bak +283 -0
- package/src/common/schema/aggregate.test.ts.bak +89 -0
- package/src/common/schema/collection.test.ts.bak +116 -0
- package/src/common/schema/dates.test.ts.bak +49 -0
- package/src/common/schema/id.test.ts.bak +149 -0
- package/src/common/schema/jwt.test.ts.bak +61 -0
- package/src/common/schema/metadata.test.ts.bak +141 -0
- package/src/common/schema/pagination.test.ts.bak +80 -0
- package/src/common/schema/schema.test.ts.bak +41 -0
- package/src/common/schema/sets.test.ts.bak +108 -0
- package/src/customer/users/schema.test.ts.bak +138 -0
- package/src/identity/schema.test.ts.bak +48 -0
- package/src/oauth/token/schema/schema.test.ts.bak +142 -0
- package/src/workspace/settings/schema.test.ts.bak +88 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { CollectionSchema, PaginationCollectionSchema } from './collection.js';
|
|
4
|
+
|
|
5
|
+
describe('Common Schema - Collection', () => {
|
|
6
|
+
describe('CollectionSchema', () => {
|
|
7
|
+
test('should accept valid collection with string items', () => {
|
|
8
|
+
const StringCollectionSchema = CollectionSchema('string');
|
|
9
|
+
const result = StringCollectionSchema({
|
|
10
|
+
items: ['item1', 'item2', 'item3'],
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
14
|
+
expect(result).toEqual({
|
|
15
|
+
items: ['item1', 'item2', 'item3'],
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('should accept valid collection with number items', () => {
|
|
20
|
+
const NumberCollectionSchema = CollectionSchema('number');
|
|
21
|
+
const result = NumberCollectionSchema({
|
|
22
|
+
items: [1, 2, 3],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
26
|
+
expect(result).toEqual({
|
|
27
|
+
items: [1, 2, 3],
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('should accept empty collection', () => {
|
|
32
|
+
const StringCollectionSchema = CollectionSchema('string');
|
|
33
|
+
const result = StringCollectionSchema({
|
|
34
|
+
items: [],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
38
|
+
expect(result).toEqual({
|
|
39
|
+
items: [],
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('should reject invalid items type', () => {
|
|
44
|
+
const StringCollectionSchema = CollectionSchema('string');
|
|
45
|
+
const result = StringCollectionSchema({
|
|
46
|
+
items: 'not-an-array',
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('PaginationCollectionSchema', () => {
|
|
54
|
+
test('should accept valid paginated collection', () => {
|
|
55
|
+
const StringPaginationCollectionSchema =
|
|
56
|
+
PaginationCollectionSchema('string');
|
|
57
|
+
const result = StringPaginationCollectionSchema({
|
|
58
|
+
items: ['item1', 'item2'],
|
|
59
|
+
pagination: {
|
|
60
|
+
pageSize: '10',
|
|
61
|
+
nextToken: 'token123',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
66
|
+
expect(result).toEqual({
|
|
67
|
+
items: ['item1', 'item2'],
|
|
68
|
+
pagination: {
|
|
69
|
+
pageSize: '10',
|
|
70
|
+
nextToken: 'token123',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('should accept collection without pagination', () => {
|
|
76
|
+
const StringPaginationCollectionSchema =
|
|
77
|
+
PaginationCollectionSchema('string');
|
|
78
|
+
const result = StringPaginationCollectionSchema({
|
|
79
|
+
items: ['item1', 'item2'],
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
83
|
+
expect(result).toEqual({
|
|
84
|
+
items: ['item1', 'item2'],
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('should accept collection with empty pagination', () => {
|
|
89
|
+
const StringPaginationCollectionSchema =
|
|
90
|
+
PaginationCollectionSchema('string');
|
|
91
|
+
const result = StringPaginationCollectionSchema({
|
|
92
|
+
items: ['item1'],
|
|
93
|
+
pagination: {},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
97
|
+
expect(result).toEqual({
|
|
98
|
+
items: ['item1'],
|
|
99
|
+
pagination: {},
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('should reject invalid pagination', () => {
|
|
104
|
+
const StringPaginationCollectionSchema =
|
|
105
|
+
PaginationCollectionSchema('string');
|
|
106
|
+
const result = StringPaginationCollectionSchema({
|
|
107
|
+
items: ['item1'],
|
|
108
|
+
pagination: {
|
|
109
|
+
pageSize: true,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { RequiredDatePayloadSchema, RequiredDateSchema } from './dates.js';
|
|
4
|
+
|
|
5
|
+
describe('Common - Dates', () => {
|
|
6
|
+
describe('Date Schema', () => {
|
|
7
|
+
test('should accept an iso string', async () => {
|
|
8
|
+
const result = RequiredDateSchema(
|
|
9
|
+
new Date().toISOString()
|
|
10
|
+
) as typeof RequiredDateSchema.inferOut;
|
|
11
|
+
|
|
12
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
13
|
+
expect(result).toBeInstanceOf(Date);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('should accept a Date object', async () => {
|
|
17
|
+
const result = RequiredDateSchema(
|
|
18
|
+
new Date()
|
|
19
|
+
) as typeof RequiredDateSchema.inferOut;
|
|
20
|
+
|
|
21
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
22
|
+
expect(result).toBeInstanceOf(Date);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('Payload Schema', () => {
|
|
27
|
+
test('should parse a Date to an ISO string', async () => {
|
|
28
|
+
const iso = new Date().toISOString();
|
|
29
|
+
|
|
30
|
+
const result = RequiredDatePayloadSchema(
|
|
31
|
+
new Date(iso)
|
|
32
|
+
) as typeof RequiredDatePayloadSchema.inferOut;
|
|
33
|
+
|
|
34
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
35
|
+
expect(result).to.equal(iso);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('should parse an ISO to an ISO string', async () => {
|
|
39
|
+
const iso = new Date().toISOString();
|
|
40
|
+
|
|
41
|
+
const result = RequiredDatePayloadSchema(
|
|
42
|
+
iso
|
|
43
|
+
) as typeof RequiredDatePayloadSchema.inferOut;
|
|
44
|
+
|
|
45
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
46
|
+
expect(result).to.equal(iso);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { KSUIDSchema } from './id.js';
|
|
4
|
+
|
|
5
|
+
describe('Common Schema - ID', () => {
|
|
6
|
+
describe('KSUIDSchema', () => {
|
|
7
|
+
test('should accept valid KSUID with correct prefix', () => {
|
|
8
|
+
const schema = KSUIDSchema('usr');
|
|
9
|
+
const validId = 'usr_123456789012345678901234567';
|
|
10
|
+
|
|
11
|
+
const result = schema(validId);
|
|
12
|
+
expect(result).toBe(validId);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('should accept KSUID with different prefixes', () => {
|
|
16
|
+
const userSchema = KSUIDSchema('usr');
|
|
17
|
+
const appSchema = KSUIDSchema('app');
|
|
18
|
+
const activitySchema = KSUIDSchema('act');
|
|
19
|
+
|
|
20
|
+
const userId = 'usr_abcdefghijklmnopqrstuvwxy12';
|
|
21
|
+
const appId = 'app_1234567890ABCDEFGHIJKLMNOP1';
|
|
22
|
+
const activityId = 'act_abcDEF123456789012345678901';
|
|
23
|
+
|
|
24
|
+
expect(userSchema(userId)).toBe(userId);
|
|
25
|
+
expect(appSchema(appId)).toBe(appId);
|
|
26
|
+
expect(activitySchema(activityId)).toBe(activityId);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('should accept KSUID with mixed alphanumeric characters', () => {
|
|
30
|
+
const schema = KSUIDSchema('test');
|
|
31
|
+
const mixedId = 'test_1a2B3c4D5e6F7g8H9i0JkLmNoPq';
|
|
32
|
+
|
|
33
|
+
const result = schema(mixedId);
|
|
34
|
+
expect(result).toBe(mixedId);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('should reject KSUID with wrong prefix', () => {
|
|
38
|
+
const schema = KSUIDSchema('usr');
|
|
39
|
+
const wrongPrefixId = 'app_123456789012345678901234567';
|
|
40
|
+
|
|
41
|
+
const result = schema(wrongPrefixId);
|
|
42
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('should reject KSUID with missing prefix', () => {
|
|
46
|
+
const schema = KSUIDSchema('usr');
|
|
47
|
+
const noPrefixId = '123456789012345678901234567';
|
|
48
|
+
|
|
49
|
+
const result = schema(noPrefixId);
|
|
50
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('should reject KSUID with missing underscore', () => {
|
|
54
|
+
const schema = KSUIDSchema('usr');
|
|
55
|
+
const noUnderscoreId = 'usr123456789012345678901234567';
|
|
56
|
+
|
|
57
|
+
const result = schema(noUnderscoreId);
|
|
58
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('should reject KSUID with incorrect suffix length (too short)', () => {
|
|
62
|
+
const schema = KSUIDSchema('usr');
|
|
63
|
+
const shortId = 'usr_12345678901234567890123456';
|
|
64
|
+
|
|
65
|
+
const result = schema(shortId);
|
|
66
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('should reject KSUID with incorrect suffix length (too long)', () => {
|
|
70
|
+
const schema = KSUIDSchema('usr');
|
|
71
|
+
const longId = 'usr_1234567890123456789012345678';
|
|
72
|
+
|
|
73
|
+
const result = schema(longId);
|
|
74
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('should reject KSUID with invalid characters in suffix', () => {
|
|
78
|
+
const schema = KSUIDSchema('usr');
|
|
79
|
+
const invalidCharsId = 'usr_123456789012345678901234_*';
|
|
80
|
+
|
|
81
|
+
const result = schema(invalidCharsId);
|
|
82
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('should reject KSUID with special characters in suffix', () => {
|
|
86
|
+
const schema = KSUIDSchema('usr');
|
|
87
|
+
const specialCharsId = 'usr_12345678901234567890123456@';
|
|
88
|
+
|
|
89
|
+
const result = schema(specialCharsId);
|
|
90
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('should reject KSUID with spaces', () => {
|
|
94
|
+
const schema = KSUIDSchema('usr');
|
|
95
|
+
const spaceId = 'usr_1234567890123456789012345 7';
|
|
96
|
+
|
|
97
|
+
const result = schema(spaceId);
|
|
98
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('should reject empty string', () => {
|
|
102
|
+
const schema = KSUIDSchema('usr');
|
|
103
|
+
|
|
104
|
+
const result = schema('');
|
|
105
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('should reject non-string values', () => {
|
|
109
|
+
const schema = KSUIDSchema('usr');
|
|
110
|
+
|
|
111
|
+
expect(schema(123)).toBeInstanceOf(type.errors);
|
|
112
|
+
expect(schema(null)).toBeInstanceOf(type.errors);
|
|
113
|
+
expect(schema(undefined)).toBeInstanceOf(type.errors);
|
|
114
|
+
expect(schema({})).toBeInstanceOf(type.errors);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('should work with complex prefixes', () => {
|
|
118
|
+
const complexSchema = KSUIDSchema('app_config');
|
|
119
|
+
const validComplexId = 'app_config_123456789012345678901234567';
|
|
120
|
+
|
|
121
|
+
const result = complexSchema(validComplexId);
|
|
122
|
+
expect(result).toBe(validComplexId);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('should work with single character prefix', () => {
|
|
126
|
+
const singleCharSchema = KSUIDSchema('a');
|
|
127
|
+
const validSingleCharId = 'a_123456789012345678901234567';
|
|
128
|
+
|
|
129
|
+
const result = singleCharSchema(validSingleCharId);
|
|
130
|
+
expect(result).toBe(validSingleCharId);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('should create different schemas for different prefixes', () => {
|
|
134
|
+
const userSchema = KSUIDSchema('usr');
|
|
135
|
+
const orgSchema = KSUIDSchema('org');
|
|
136
|
+
|
|
137
|
+
const userId = 'usr_123456789012345678901234567';
|
|
138
|
+
const orgId = 'org_123456789012345678901234567';
|
|
139
|
+
|
|
140
|
+
// User schema should accept user ID but reject org ID
|
|
141
|
+
expect(userSchema(userId)).toBe(userId);
|
|
142
|
+
expect(userSchema(orgId)).toBeInstanceOf(type.errors);
|
|
143
|
+
|
|
144
|
+
// Org schema should accept org ID but reject user ID
|
|
145
|
+
expect(orgSchema(orgId)).toBe(orgId);
|
|
146
|
+
expect(orgSchema(userId)).toBeInstanceOf(type.errors);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { Algorithm, AlgorithmSchema } from './jwt.js';
|
|
4
|
+
|
|
5
|
+
describe('Common Schema - JWT', () => {
|
|
6
|
+
describe('Algorithm constants', () => {
|
|
7
|
+
test('should have correct algorithm values', () => {
|
|
8
|
+
expect(Algorithm.DEFAULT).toBe('RS256');
|
|
9
|
+
expect(Algorithm.HS256).toBe('HS256');
|
|
10
|
+
expect(Algorithm.HS384).toBe('HS384');
|
|
11
|
+
expect(Algorithm.HS512).toBe('HS512');
|
|
12
|
+
expect(Algorithm.RS256).toBe('RS256');
|
|
13
|
+
expect(Algorithm.RS384).toBe('RS384');
|
|
14
|
+
expect(Algorithm.RS512).toBe('RS512');
|
|
15
|
+
expect(Algorithm.ES256).toBe('ES256');
|
|
16
|
+
expect(Algorithm.ES384).toBe('ES384');
|
|
17
|
+
expect(Algorithm.ES512).toBe('ES512');
|
|
18
|
+
expect(Algorithm.PS256).toBe('PS256');
|
|
19
|
+
expect(Algorithm.PS384).toBe('PS384');
|
|
20
|
+
expect(Algorithm.PS512).toBe('PS512');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe('AlgorithmSchema', () => {
|
|
25
|
+
test('should accept valid HMAC algorithms', () => {
|
|
26
|
+
expect(AlgorithmSchema('HS256')).not.toBeInstanceOf(type.errors);
|
|
27
|
+
expect(AlgorithmSchema('HS384')).not.toBeInstanceOf(type.errors);
|
|
28
|
+
expect(AlgorithmSchema('HS512')).not.toBeInstanceOf(type.errors);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('should accept valid RSA algorithms', () => {
|
|
32
|
+
expect(AlgorithmSchema('RS256')).not.toBeInstanceOf(type.errors);
|
|
33
|
+
expect(AlgorithmSchema('RS384')).not.toBeInstanceOf(type.errors);
|
|
34
|
+
expect(AlgorithmSchema('RS512')).not.toBeInstanceOf(type.errors);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('should accept valid ECDSA algorithms', () => {
|
|
38
|
+
expect(AlgorithmSchema('ES256')).not.toBeInstanceOf(type.errors);
|
|
39
|
+
expect(AlgorithmSchema('ES384')).not.toBeInstanceOf(type.errors);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('should accept valid PSS algorithms', () => {
|
|
43
|
+
expect(AlgorithmSchema('PS256')).not.toBeInstanceOf(type.errors);
|
|
44
|
+
expect(AlgorithmSchema('PS384')).not.toBeInstanceOf(type.errors);
|
|
45
|
+
expect(AlgorithmSchema('PS512')).not.toBeInstanceOf(type.errors);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('should reject invalid algorithms', () => {
|
|
49
|
+
expect(AlgorithmSchema('INVALID')).toBeInstanceOf(type.errors);
|
|
50
|
+
expect(AlgorithmSchema('HS128')).toBeInstanceOf(type.errors);
|
|
51
|
+
expect(AlgorithmSchema('RS128')).toBeInstanceOf(type.errors);
|
|
52
|
+
expect(AlgorithmSchema('')).toBeInstanceOf(type.errors);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('should reject non-string values', () => {
|
|
56
|
+
expect(AlgorithmSchema(123)).toBeInstanceOf(type.errors);
|
|
57
|
+
expect(AlgorithmSchema(null)).toBeInstanceOf(type.errors);
|
|
58
|
+
expect(AlgorithmSchema(undefined)).toBeInstanceOf(type.errors);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import {
|
|
4
|
+
MetadataMapPropertySchema,
|
|
5
|
+
MetadataPayloadPropertySchema,
|
|
6
|
+
UpsertMetadataPayloadSchema,
|
|
7
|
+
} from './metadata.js';
|
|
8
|
+
|
|
9
|
+
describe('Common - Metadata', () => {
|
|
10
|
+
describe('Map Property Schema', () => {
|
|
11
|
+
test('should parse a record to a map', async () => {
|
|
12
|
+
const result = MetadataMapPropertySchema({
|
|
13
|
+
metadata: { foo: 'bar' },
|
|
14
|
+
}) as typeof MetadataMapPropertySchema.inferOut;
|
|
15
|
+
|
|
16
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
17
|
+
expect(result?.metadata).toBeInstanceOf(Map);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('should parse undefined property to a map', async () => {
|
|
21
|
+
const result = MetadataMapPropertySchema({
|
|
22
|
+
metadata: undefined,
|
|
23
|
+
}) as typeof MetadataMapPropertySchema.inferOut;
|
|
24
|
+
|
|
25
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
26
|
+
expect(result?.metadata).toBeInstanceOf(Map);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('should parse undefined to a map', async () => {
|
|
30
|
+
const result = MetadataMapPropertySchema(
|
|
31
|
+
{}
|
|
32
|
+
) as typeof MetadataMapPropertySchema.inferOut;
|
|
33
|
+
|
|
34
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
35
|
+
expect(result?.metadata).toBeInstanceOf(Map);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('should parse map to a map', async () => {
|
|
39
|
+
const result = MetadataMapPropertySchema({
|
|
40
|
+
metadata: new Map([['foo', 'bar']]),
|
|
41
|
+
}) as typeof MetadataMapPropertySchema.inferOut;
|
|
42
|
+
|
|
43
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
44
|
+
expect(result?.metadata).toBeInstanceOf(Map);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('should parse null to a map', async () => {
|
|
48
|
+
const result = MetadataMapPropertySchema({
|
|
49
|
+
metadata: null,
|
|
50
|
+
}) as typeof MetadataMapPropertySchema.inferOut;
|
|
51
|
+
|
|
52
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
53
|
+
expect(result?.metadata).toBeInstanceOf(Map);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('Payload', () => {
|
|
58
|
+
test('should parse map to record', async () => {
|
|
59
|
+
const result = MetadataPayloadPropertySchema({
|
|
60
|
+
metadata: new Map<string, string | number>([
|
|
61
|
+
['foo', 'bar'],
|
|
62
|
+
['baz', 0],
|
|
63
|
+
]),
|
|
64
|
+
}) as typeof MetadataPayloadPropertySchema.inferOut;
|
|
65
|
+
|
|
66
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
67
|
+
expect(result?.metadata?.foo).to.equal('bar');
|
|
68
|
+
expect(result?.metadata?.baz).to.equal(0);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('should return undefined if map is empty', async () => {
|
|
72
|
+
const result = MetadataPayloadPropertySchema({
|
|
73
|
+
metadata: new Map(),
|
|
74
|
+
}) as typeof MetadataPayloadPropertySchema.inferOut;
|
|
75
|
+
|
|
76
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
77
|
+
expect(result?.metadata).is.undefined;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('Upsert Metadata Payload Schema', () => {
|
|
82
|
+
test('should handle incoming record', async () => {
|
|
83
|
+
const result = UpsertMetadataPayloadSchema({
|
|
84
|
+
foo: 'bar',
|
|
85
|
+
bar: 'baz',
|
|
86
|
+
}) as typeof UpsertMetadataPayloadSchema.inferOut;
|
|
87
|
+
|
|
88
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
89
|
+
expect(result?.foo).to.equal('bar');
|
|
90
|
+
expect(result?.bar).to.equal('baz');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('should handle incoming map', async () => {
|
|
94
|
+
const result = UpsertMetadataPayloadSchema(
|
|
95
|
+
new Map([
|
|
96
|
+
['foo', 'bar'],
|
|
97
|
+
['bar', 'baz'],
|
|
98
|
+
])
|
|
99
|
+
) as typeof UpsertMetadataPayloadSchema.inferOut;
|
|
100
|
+
|
|
101
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
102
|
+
expect(result?.foo).to.equal('bar');
|
|
103
|
+
expect(result?.bar).to.equal('baz');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('should only allow 10 items', async () => {
|
|
107
|
+
const result = UpsertMetadataPayloadSchema(
|
|
108
|
+
new Map([
|
|
109
|
+
['1', '1'],
|
|
110
|
+
['2', '2'],
|
|
111
|
+
['3', '3'],
|
|
112
|
+
['4', '4'],
|
|
113
|
+
['5', '5'],
|
|
114
|
+
['6', '6'],
|
|
115
|
+
['7', '7'],
|
|
116
|
+
['8', '8'],
|
|
117
|
+
['9', '9'],
|
|
118
|
+
['10', '10'],
|
|
119
|
+
['11', '11'],
|
|
120
|
+
])
|
|
121
|
+
) as typeof UpsertMetadataPayloadSchema.inferOut;
|
|
122
|
+
|
|
123
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe('Map Property Schema', () => {
|
|
128
|
+
test('should parse map to record', async () => {
|
|
129
|
+
const result = MetadataMapPropertySchema({
|
|
130
|
+
metadata: {
|
|
131
|
+
foo: 'bar',
|
|
132
|
+
bar: 'baz',
|
|
133
|
+
},
|
|
134
|
+
}) as typeof MetadataMapPropertySchema.inferOut;
|
|
135
|
+
|
|
136
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
137
|
+
expect(result?.metadata?.get('foo')).to.equal('bar');
|
|
138
|
+
expect(result?.metadata?.get('bar')).to.equal('baz');
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { PaginationSchema } from './pagination.js';
|
|
4
|
+
|
|
5
|
+
describe('Common Schema - Pagination', () => {
|
|
6
|
+
describe('PaginationSchema', () => {
|
|
7
|
+
test('should accept valid pagination with pageSize as string', () => {
|
|
8
|
+
const result = PaginationSchema({
|
|
9
|
+
pageSize: '10',
|
|
10
|
+
nextToken: 'token123',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
14
|
+
expect(result).toEqual({
|
|
15
|
+
pageSize: '10',
|
|
16
|
+
nextToken: 'token123',
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('should accept valid pagination with pageSize as number', () => {
|
|
21
|
+
const result = PaginationSchema({
|
|
22
|
+
pageSize: 20,
|
|
23
|
+
nextToken: 'token456',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
27
|
+
expect(result).toEqual({
|
|
28
|
+
pageSize: 20,
|
|
29
|
+
nextToken: 'token456',
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('should accept pagination with only pageSize', () => {
|
|
34
|
+
const result = PaginationSchema({
|
|
35
|
+
pageSize: '15',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
39
|
+
expect(result).toEqual({
|
|
40
|
+
pageSize: '15',
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('should accept pagination with only nextToken', () => {
|
|
45
|
+
const result = PaginationSchema({
|
|
46
|
+
nextToken: 'token789',
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
50
|
+
expect(result).toEqual({
|
|
51
|
+
nextToken: 'token789',
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('should accept empty pagination object', () => {
|
|
56
|
+
const result = PaginationSchema({});
|
|
57
|
+
|
|
58
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
59
|
+
expect(result).toEqual({});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('should reject invalid pageSize type', () => {
|
|
63
|
+
const result = PaginationSchema({
|
|
64
|
+
pageSize: true,
|
|
65
|
+
nextToken: 'token123',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('should reject invalid nextToken type', () => {
|
|
72
|
+
const result = PaginationSchema({
|
|
73
|
+
pageSize: '10',
|
|
74
|
+
nextToken: 123,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { optionallyNullishToUndefined } from './schema.js';
|
|
4
|
+
|
|
5
|
+
describe('Common Schema', () => {
|
|
6
|
+
describe('optionallyNullishToUndefined', () => {
|
|
7
|
+
test('should parse null string successfully', async () => {
|
|
8
|
+
const Schema = type({
|
|
9
|
+
foo: optionallyNullishToUndefined(type('string')),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const result = Schema.assert({
|
|
13
|
+
foo: null,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (result instanceof type.errors) {
|
|
17
|
+
console.log(result.summary);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
21
|
+
expect(result.foo).toBeUndefined();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('should parse undefined string successfully', async () => {
|
|
25
|
+
const Schema = type({
|
|
26
|
+
foo: optionallyNullishToUndefined(type('string')),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const result = Schema.assert({
|
|
30
|
+
foo: undefined,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (result instanceof type.errors) {
|
|
34
|
+
console.log(result.summary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
38
|
+
expect(result.foo).toBeUndefined();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|