@go-mondo/identity-sdk 0.0.2-beta.8 → 0.0.2-beta.9
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 +8 -0
- package/dist/cjs/action/schema/base.d.ts.map +1 -1
- package/dist/cjs/action/schema/base.js +3 -1
- package/dist/cjs/action/schema/base.test.d.ts +2 -0
- package/dist/cjs/action/schema/base.test.d.ts.map +1 -0
- package/dist/cjs/action/schema/base.test.js +122 -0
- package/dist/cjs/action/schema/operations/set-password.js +1 -1
- package/dist/cjs/action/schema/operations/set-password.test.d.ts +2 -0
- package/dist/cjs/action/schema/operations/set-password.test.d.ts.map +1 -0
- package/dist/cjs/action/schema/operations/set-password.test.js +167 -0
- package/dist/cjs/action/schema/operations/sign-up-verification.js +1 -1
- package/dist/cjs/action/schema/operations/sign-up-verification.test.d.ts +2 -0
- package/dist/cjs/action/schema/operations/sign-up-verification.test.d.ts.map +1 -0
- package/dist/cjs/action/schema/operations/sign-up-verification.test.js +141 -0
- package/dist/cjs/action/schema/operations/sign-up.test.d.ts +2 -0
- package/dist/cjs/action/schema/operations/sign-up.test.d.ts.map +1 -0
- package/dist/cjs/action/schema/operations/sign-up.test.js +174 -0
- package/dist/cjs/action/schema/operations/user-attribute-verification.js +1 -1
- package/dist/cjs/action/schema/operations/user-attribute-verification.test.d.ts +2 -0
- package/dist/cjs/action/schema/operations/user-attribute-verification.test.d.ts.map +1 -0
- package/dist/cjs/action/schema/operations/user-attribute-verification.test.js +129 -0
- package/dist/cjs/action/schema/schema.test.d.ts +2 -0
- package/dist/cjs/action/schema/schema.test.d.ts.map +1 -0
- package/dist/cjs/action/schema/schema.test.js +191 -0
- package/dist/cjs/action/schema/utils.d.ts +7 -0
- package/dist/cjs/action/schema/utils.d.ts.map +1 -0
- package/dist/cjs/action/schema/utils.js +16 -0
- package/dist/cjs/action/schema/utils.test.d.ts +2 -0
- package/dist/cjs/action/schema/utils.test.d.ts.map +1 -0
- package/dist/cjs/action/schema/utils.test.js +26 -0
- package/dist/cjs/activity/resources.test.d.ts +2 -0
- package/dist/cjs/activity/resources.test.d.ts.map +1 -0
- package/dist/cjs/activity/resources.test.js +224 -0
- package/dist/cjs/activity/schema/base.d.ts +1 -1
- package/dist/cjs/activity/schema/base.d.ts.map +1 -1
- package/dist/cjs/activity/schema/base.js +5 -4
- package/dist/cjs/activity/schema/base.test.d.ts +2 -0
- package/dist/cjs/activity/schema/base.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/base.test.js +239 -0
- package/dist/cjs/activity/schema/schema.d.ts +5 -5
- package/dist/cjs/activity/schema/schema.test.d.ts +2 -0
- package/dist/cjs/activity/schema/schema.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/schema.test.js +344 -0
- package/dist/cjs/activity/schema/types/authentication.d.ts +1 -1
- package/dist/cjs/activity/schema/types/authentication.js +1 -1
- package/dist/cjs/activity/schema/types/authentication.test.d.ts +2 -0
- package/dist/cjs/activity/schema/types/authentication.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/types/authentication.test.js +303 -0
- package/dist/cjs/activity/schema/types/authorization.d.ts +1 -1
- package/dist/cjs/activity/schema/types/authorization.js +1 -1
- package/dist/cjs/activity/schema/types/authorization.test.d.ts +2 -0
- package/dist/cjs/activity/schema/types/authorization.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/types/authorization.test.js +341 -0
- package/dist/cjs/activity/schema/types/note.d.ts +1 -1
- package/dist/cjs/activity/schema/types/note.test.d.ts +2 -0
- package/dist/cjs/activity/schema/types/note.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/types/note.test.js +319 -0
- package/dist/cjs/activity/schema/types/operation.d.ts +1 -1
- package/dist/cjs/activity/schema/types/operation.test.d.ts +2 -0
- package/dist/cjs/activity/schema/types/operation.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/types/operation.test.js +344 -0
- package/dist/cjs/activity/schema/types/unknown.d.ts +1 -1
- package/dist/cjs/activity/schema/types/unknown.test.d.ts +2 -0
- package/dist/cjs/activity/schema/types/unknown.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/types/unknown.test.js +275 -0
- package/dist/cjs/activity/schema/utils.test.d.ts +2 -0
- package/dist/cjs/activity/schema/utils.test.d.ts.map +1 -0
- package/dist/cjs/activity/schema/utils.test.js +26 -0
- package/dist/cjs/app/authorization/schema.d.ts +6 -6
- package/dist/cjs/app/authorization/schema.d.ts.map +1 -1
- package/dist/cjs/app/authorization/schema.js +39 -26
- package/dist/cjs/app/authorization/schema.test.d.ts +2 -0
- package/dist/cjs/app/authorization/schema.test.d.ts.map +1 -0
- package/dist/cjs/app/authorization/schema.test.js +353 -0
- package/dist/cjs/app/oauth/schema.d.ts +1 -1
- package/dist/cjs/app/oauth/schema.d.ts.map +1 -1
- package/dist/cjs/app/oauth/schema.js +2 -1
- package/dist/cjs/app/oauth/schema.test.d.ts +2 -0
- package/dist/cjs/app/oauth/schema.test.d.ts.map +1 -0
- package/dist/cjs/app/oauth/schema.test.js +173 -0
- package/dist/cjs/app/oidc/schema.d.ts +2 -2
- package/dist/cjs/app/oidc/schema.d.ts.map +1 -1
- package/dist/cjs/app/oidc/schema.js +1 -1
- package/dist/cjs/app/oidc/schema.test.d.ts +2 -0
- package/dist/cjs/app/oidc/schema.test.d.ts.map +1 -0
- package/dist/cjs/app/oidc/schema.test.js +95 -0
- package/dist/cjs/app/registration/resources.test.d.ts +2 -0
- package/dist/cjs/app/registration/resources.test.d.ts.map +1 -0
- package/dist/cjs/app/registration/resources.test.js +295 -0
- package/dist/cjs/app/registration/schema.d.ts +1 -1
- package/dist/cjs/app/registration/schema.test.d.ts +2 -0
- package/dist/cjs/app/registration/schema.test.d.ts.map +1 -0
- package/dist/cjs/app/registration/schema.test.js +262 -0
- package/dist/cjs/app/resources.test.d.ts +2 -0
- package/dist/cjs/app/resources.test.d.ts.map +1 -0
- package/dist/cjs/app/resources.test.js +288 -0
- package/dist/cjs/app/saml/schema.d.ts +3 -3
- package/dist/cjs/app/saml/schema.d.ts.map +1 -1
- package/dist/cjs/app/saml/schema.js +2 -2
- package/dist/cjs/app/schema.d.ts +5 -1
- package/dist/cjs/app/schema.d.ts.map +1 -1
- package/dist/cjs/app/schema.js +7 -2
- package/dist/cjs/app/schema.test.d.ts +2 -0
- package/dist/cjs/app/schema.test.d.ts.map +1 -0
- package/dist/cjs/app/schema.test.js +184 -0
- package/dist/cjs/app/utils.test.d.ts +2 -0
- package/dist/cjs/app/utils.test.d.ts.map +1 -0
- package/dist/cjs/app/utils.test.js +42 -0
- package/dist/cjs/association/schema.d.ts +23 -23
- package/dist/cjs/association/schema.js +3 -3
- package/dist/cjs/association/schema.test.d.ts +2 -0
- package/dist/cjs/association/schema.test.d.ts.map +1 -0
- package/dist/cjs/association/schema.test.js +121 -0
- package/dist/cjs/authentication/factors/schema.test.js +19 -18
- package/dist/cjs/authentication/providers/schema.js +1 -1
- package/dist/cjs/authentication/sessions/schema.d.ts +5 -5
- package/dist/cjs/authentication/sessions/schema.d.ts.map +1 -1
- package/dist/cjs/authentication/sessions/schema.js +4 -2
- package/dist/cjs/authentication/settings/schema.d.ts +1 -1
- package/dist/cjs/authentication/settings/schema.js +1 -1
- package/dist/cjs/authentication/settings/schema.test.d.ts +2 -0
- package/dist/cjs/authentication/settings/schema.test.d.ts.map +1 -0
- package/dist/cjs/authentication/settings/schema.test.js +73 -0
- package/dist/cjs/authentication/strategies/schema/base.d.ts +1 -1
- package/dist/cjs/authentication/strategies/schema/base.d.ts.map +1 -1
- package/dist/cjs/authentication/strategies/schema/base.js +3 -1
- package/dist/cjs/authentication/strategies/schema/schema.d.ts +3 -3
- package/dist/cjs/authentication/strategies/schema/types/email.d.ts +1 -1
- package/dist/cjs/authentication/strategies/schema/types/email.test.d.ts +2 -0
- package/dist/cjs/authentication/strategies/schema/types/email.test.d.ts.map +1 -0
- package/dist/cjs/authentication/strategies/schema/types/email.test.js +205 -0
- package/dist/cjs/authentication/strategies/schema/types/password.d.ts +1 -1
- package/dist/cjs/authentication/strategies/schema/types/totp.d.ts +1 -1
- package/dist/cjs/authentication/utils.d.ts +13 -0
- package/dist/cjs/authentication/utils.d.ts.map +1 -0
- package/dist/cjs/authentication/utils.js +25 -0
- package/dist/cjs/authentication/utils.test.d.ts +2 -0
- package/dist/cjs/authentication/utils.test.d.ts.map +1 -0
- package/dist/cjs/authentication/utils.test.js +142 -0
- package/dist/cjs/authorization/index.d.ts +1 -1
- package/dist/cjs/authorization/index.d.ts.map +1 -1
- package/dist/cjs/authorization/index.js +1 -1
- package/dist/cjs/authorization/permissions/schema.d.ts +1 -2
- package/dist/cjs/authorization/permissions/schema.d.ts.map +1 -1
- package/dist/cjs/authorization/permissions/schema.js +9 -10
- package/dist/cjs/authorization/permissions/schema.test.d.ts +2 -0
- package/dist/cjs/authorization/permissions/schema.test.d.ts.map +1 -0
- package/dist/cjs/authorization/permissions/schema.test.js +217 -0
- package/dist/cjs/authorization/roles/schema.d.ts +3 -3
- package/dist/cjs/authorization/roles/schema.d.ts.map +1 -1
- package/dist/cjs/authorization/roles/schema.js +10 -10
- package/dist/cjs/authorization/roles/schema.test.d.ts +2 -0
- package/dist/cjs/authorization/roles/schema.test.d.ts.map +1 -0
- package/dist/cjs/authorization/roles/schema.test.js +236 -0
- package/dist/cjs/authorization/schema.d.ts +17 -0
- package/dist/cjs/authorization/schema.d.ts.map +1 -0
- package/dist/cjs/authorization/{utils.js → schema.js} +7 -1
- package/dist/cjs/authorization/schema.test.d.ts +2 -0
- package/dist/cjs/authorization/schema.test.d.ts.map +1 -0
- package/dist/cjs/authorization/schema.test.js +42 -0
- package/dist/cjs/common/errors/http.test.d.ts +2 -0
- package/dist/cjs/common/errors/http.test.d.ts.map +1 -0
- package/dist/cjs/common/errors/http.test.js +71 -0
- package/dist/cjs/common/errors/validation.test.d.ts +2 -0
- package/dist/cjs/common/errors/validation.test.d.ts.map +1 -0
- package/dist/cjs/common/errors/validation.test.js +92 -0
- package/dist/cjs/common/resources/init.d.ts +2 -2
- package/dist/cjs/common/resources/init.d.ts.map +1 -1
- package/dist/cjs/common/resources/init.js +1 -1
- package/dist/cjs/common/resources/init.test.d.ts +2 -0
- package/dist/cjs/common/resources/init.test.d.ts.map +1 -0
- package/dist/cjs/common/resources/init.test.js +233 -0
- package/dist/cjs/common/resources/operations.test.d.ts +2 -0
- package/dist/cjs/common/resources/operations.test.d.ts.map +1 -0
- package/dist/cjs/common/resources/operations.test.js +356 -0
- package/dist/cjs/common/resources/utils.d.ts +1 -1
- package/dist/cjs/common/resources/utils.d.ts.map +1 -1
- package/dist/cjs/common/resources/utils.test.d.ts +2 -0
- package/dist/cjs/common/resources/utils.test.d.ts.map +1 -0
- package/dist/cjs/common/resources/utils.test.js +163 -0
- package/dist/cjs/common/schema/aggregate.test.d.ts +2 -0
- package/dist/cjs/common/schema/aggregate.test.d.ts.map +1 -0
- package/dist/cjs/common/schema/aggregate.test.js +75 -0
- package/dist/cjs/common/schema/collection.d.ts +2 -2
- package/dist/cjs/common/schema/collection.test.d.ts +2 -0
- package/dist/cjs/common/schema/collection.test.d.ts.map +1 -0
- package/dist/cjs/common/schema/collection.test.js +98 -0
- package/dist/cjs/common/schema/id.d.ts +2 -0
- package/dist/cjs/common/schema/id.d.ts.map +1 -0
- package/dist/cjs/common/schema/id.js +6 -0
- package/dist/cjs/common/schema/id.test.d.ts +2 -0
- package/dist/cjs/common/schema/id.test.d.ts.map +1 -0
- package/dist/cjs/common/schema/id.test.js +116 -0
- package/dist/cjs/common/schema/jwt.test.d.ts +2 -0
- package/dist/cjs/common/schema/jwt.test.d.ts.map +1 -0
- package/dist/cjs/common/schema/jwt.test.js +56 -0
- package/dist/cjs/common/schema/metadata.d.ts +9 -3
- package/dist/cjs/common/schema/metadata.d.ts.map +1 -1
- package/dist/cjs/common/schema/metadata.js +27 -8
- package/dist/cjs/common/schema/metadata.test.js +49 -0
- package/dist/cjs/common/schema/pagination.d.ts +2 -2
- package/dist/cjs/common/schema/pagination.js +2 -2
- package/dist/cjs/common/schema/pagination.test.d.ts +2 -0
- package/dist/cjs/common/schema/pagination.test.d.ts.map +1 -0
- package/dist/cjs/common/schema/pagination.test.js +68 -0
- package/dist/cjs/common/schema/sets.test.d.ts +2 -0
- package/dist/cjs/common/schema/sets.test.d.ts.map +1 -0
- package/dist/cjs/common/schema/sets.test.js +84 -0
- package/dist/cjs/common/schema/url.test.d.ts +2 -0
- package/dist/cjs/common/schema/url.test.d.ts.map +1 -0
- package/dist/cjs/common/schema/url.test.js +74 -0
- package/dist/cjs/customer/index.d.ts +2 -1
- package/dist/cjs/customer/index.d.ts.map +1 -1
- package/dist/cjs/customer/index.js +2 -1
- package/dist/cjs/customer/{schema/organization.d.ts → organization/schema.d.ts} +4 -3
- package/dist/cjs/customer/organization/schema.d.ts.map +1 -0
- package/dist/cjs/customer/{schema/organization.js → organization/schema.js} +9 -7
- package/dist/cjs/customer/schema.d.ts +17 -0
- package/dist/cjs/customer/schema.d.ts.map +1 -0
- package/dist/cjs/customer/{schema/utils.js → schema.js} +7 -1
- package/dist/cjs/customer/schema.test.d.ts +2 -0
- package/dist/cjs/customer/schema.test.d.ts.map +1 -0
- package/dist/cjs/customer/schema.test.js +42 -0
- package/dist/cjs/customer/users/schema.d.ts +4 -3
- package/dist/cjs/customer/users/schema.d.ts.map +1 -1
- package/dist/cjs/customer/users/schema.js +29 -26
- package/dist/cjs/customer/users/schema.test.js +13 -12
- package/dist/cjs/customer/users/utils.test.d.ts +2 -0
- package/dist/cjs/customer/users/utils.test.d.ts.map +1 -0
- package/dist/cjs/customer/users/utils.test.js +145 -0
- package/dist/cjs/identity/schema.test.d.ts +2 -0
- package/dist/cjs/identity/schema.test.d.ts.map +1 -0
- package/dist/cjs/identity/schema.test.js +40 -0
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.d.ts.map +1 -1
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.js +22 -3
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.test.d.ts +2 -0
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.test.d.ts.map +1 -0
- package/dist/cjs/oauth/authorize/schema/grants/authorization-code.test.js +334 -0
- package/dist/cjs/oauth/common/schema.test.d.ts +2 -0
- package/dist/cjs/oauth/common/schema.test.d.ts.map +1 -0
- package/dist/cjs/oauth/common/schema.test.js +290 -0
- package/dist/cjs/oauth/token/schema/schema.test.d.ts +2 -0
- package/dist/cjs/oauth/token/schema/schema.test.d.ts.map +1 -0
- package/dist/cjs/oauth/token/schema/schema.test.js +122 -0
- package/dist/cjs/workspace/settings/schema.test.d.ts +2 -0
- package/dist/cjs/workspace/settings/schema.test.d.ts.map +1 -0
- package/dist/cjs/workspace/settings/schema.test.js +73 -0
- package/dist/cjs/workspace/tenant/schema.d.ts +1 -0
- package/dist/cjs/workspace/tenant/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/tenant/schema.js +8 -7
- package/dist/cjs/workspace/user/notifications/schema.d.ts.map +1 -1
- package/dist/cjs/workspace/user/notifications/schema.js +3 -2
- package/dist/cjs/workspace/user/preferences/schema.js +2 -2
- package/dist/cjs/workspace/utils.d.ts +0 -3
- package/dist/cjs/workspace/utils.d.ts.map +1 -1
- package/dist/cjs/workspace/utils.js +0 -3
- package/dist/cjs/workspace/utils.test.d.ts +2 -0
- package/dist/cjs/workspace/utils.test.d.ts.map +1 -0
- package/dist/cjs/workspace/utils.test.js +63 -0
- package/dist/esm/action/schema/base.d.ts.map +1 -1
- package/dist/esm/action/schema/base.js +3 -1
- package/dist/esm/action/schema/base.test.d.ts +2 -0
- package/dist/esm/action/schema/base.test.d.ts.map +1 -0
- package/dist/esm/action/schema/base.test.js +120 -0
- package/dist/esm/action/schema/operations/set-password.js +1 -1
- package/dist/esm/action/schema/operations/set-password.test.d.ts +2 -0
- package/dist/esm/action/schema/operations/set-password.test.d.ts.map +1 -0
- package/dist/esm/action/schema/operations/set-password.test.js +165 -0
- package/dist/esm/action/schema/operations/sign-up-verification.js +1 -1
- package/dist/esm/action/schema/operations/sign-up-verification.test.d.ts +2 -0
- package/dist/esm/action/schema/operations/sign-up-verification.test.d.ts.map +1 -0
- package/dist/esm/action/schema/operations/sign-up-verification.test.js +139 -0
- package/dist/esm/action/schema/operations/sign-up.test.d.ts +2 -0
- package/dist/esm/action/schema/operations/sign-up.test.d.ts.map +1 -0
- package/dist/esm/action/schema/operations/sign-up.test.js +172 -0
- package/dist/esm/action/schema/operations/user-attribute-verification.js +1 -1
- package/dist/esm/action/schema/operations/user-attribute-verification.test.d.ts +2 -0
- package/dist/esm/action/schema/operations/user-attribute-verification.test.d.ts.map +1 -0
- package/dist/esm/action/schema/operations/user-attribute-verification.test.js +127 -0
- package/dist/esm/action/schema/schema.test.d.ts +2 -0
- package/dist/esm/action/schema/schema.test.d.ts.map +1 -0
- package/dist/esm/action/schema/schema.test.js +189 -0
- package/dist/esm/action/schema/utils.d.ts +7 -0
- package/dist/esm/action/schema/utils.d.ts.map +1 -0
- package/dist/esm/action/schema/utils.js +9 -0
- package/dist/esm/action/schema/utils.test.d.ts +2 -0
- package/dist/esm/action/schema/utils.test.d.ts.map +1 -0
- package/dist/esm/action/schema/utils.test.js +24 -0
- package/dist/esm/activity/resources.test.d.ts +2 -0
- package/dist/esm/activity/resources.test.d.ts.map +1 -0
- package/dist/esm/activity/resources.test.js +189 -0
- package/dist/esm/activity/schema/base.d.ts +1 -1
- package/dist/esm/activity/schema/base.d.ts.map +1 -1
- package/dist/esm/activity/schema/base.js +7 -6
- package/dist/esm/activity/schema/base.test.d.ts +2 -0
- package/dist/esm/activity/schema/base.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/base.test.js +237 -0
- package/dist/esm/activity/schema/schema.d.ts +5 -5
- package/dist/esm/activity/schema/schema.test.d.ts +2 -0
- package/dist/esm/activity/schema/schema.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/schema.test.js +342 -0
- package/dist/esm/activity/schema/types/authentication.d.ts +1 -1
- package/dist/esm/activity/schema/types/authentication.js +1 -1
- package/dist/esm/activity/schema/types/authentication.test.d.ts +2 -0
- package/dist/esm/activity/schema/types/authentication.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/types/authentication.test.js +301 -0
- package/dist/esm/activity/schema/types/authorization.d.ts +1 -1
- package/dist/esm/activity/schema/types/authorization.js +1 -1
- package/dist/esm/activity/schema/types/authorization.test.d.ts +2 -0
- package/dist/esm/activity/schema/types/authorization.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/types/authorization.test.js +339 -0
- package/dist/esm/activity/schema/types/note.d.ts +1 -1
- package/dist/esm/activity/schema/types/note.test.d.ts +2 -0
- package/dist/esm/activity/schema/types/note.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/types/note.test.js +317 -0
- package/dist/esm/activity/schema/types/operation.d.ts +1 -1
- package/dist/esm/activity/schema/types/operation.test.d.ts +2 -0
- package/dist/esm/activity/schema/types/operation.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/types/operation.test.js +342 -0
- package/dist/esm/activity/schema/types/unknown.d.ts +1 -1
- package/dist/esm/activity/schema/types/unknown.test.d.ts +2 -0
- package/dist/esm/activity/schema/types/unknown.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/types/unknown.test.js +273 -0
- package/dist/esm/activity/schema/utils.test.d.ts +2 -0
- package/dist/esm/activity/schema/utils.test.d.ts.map +1 -0
- package/dist/esm/activity/schema/utils.test.js +24 -0
- package/dist/esm/app/authorization/schema.d.ts +6 -6
- package/dist/esm/app/authorization/schema.d.ts.map +1 -1
- package/dist/esm/app/authorization/schema.js +40 -27
- package/dist/esm/app/authorization/schema.test.d.ts +2 -0
- package/dist/esm/app/authorization/schema.test.d.ts.map +1 -0
- package/dist/esm/app/authorization/schema.test.js +351 -0
- package/dist/esm/app/oauth/schema.d.ts +1 -1
- package/dist/esm/app/oauth/schema.d.ts.map +1 -1
- package/dist/esm/app/oauth/schema.js +3 -2
- package/dist/esm/app/oauth/schema.test.d.ts +2 -0
- package/dist/esm/app/oauth/schema.test.d.ts.map +1 -0
- package/dist/esm/app/oauth/schema.test.js +171 -0
- package/dist/esm/app/oidc/schema.d.ts +2 -2
- package/dist/esm/app/oidc/schema.d.ts.map +1 -1
- package/dist/esm/app/oidc/schema.js +2 -2
- package/dist/esm/app/oidc/schema.test.d.ts +2 -0
- package/dist/esm/app/oidc/schema.test.d.ts.map +1 -0
- package/dist/esm/app/oidc/schema.test.js +93 -0
- package/dist/esm/app/registration/resources.test.d.ts +2 -0
- package/dist/esm/app/registration/resources.test.d.ts.map +1 -0
- package/dist/esm/app/registration/resources.test.js +260 -0
- package/dist/esm/app/registration/schema.d.ts +1 -1
- package/dist/esm/app/registration/schema.test.d.ts +2 -0
- package/dist/esm/app/registration/schema.test.d.ts.map +1 -0
- package/dist/esm/app/registration/schema.test.js +260 -0
- package/dist/esm/app/resources.test.d.ts +2 -0
- package/dist/esm/app/resources.test.d.ts.map +1 -0
- package/dist/esm/app/resources.test.js +253 -0
- package/dist/esm/app/saml/schema.d.ts +3 -3
- package/dist/esm/app/saml/schema.d.ts.map +1 -1
- package/dist/esm/app/saml/schema.js +3 -3
- package/dist/esm/app/schema.d.ts +5 -1
- package/dist/esm/app/schema.d.ts.map +1 -1
- package/dist/esm/app/schema.js +7 -2
- package/dist/esm/app/schema.test.d.ts +2 -0
- package/dist/esm/app/schema.test.d.ts.map +1 -0
- package/dist/esm/app/schema.test.js +182 -0
- package/dist/esm/app/utils.test.d.ts +2 -0
- package/dist/esm/app/utils.test.d.ts.map +1 -0
- package/dist/esm/app/utils.test.js +40 -0
- package/dist/esm/association/schema.d.ts +23 -23
- package/dist/esm/association/schema.js +1 -1
- package/dist/esm/association/schema.test.d.ts +2 -0
- package/dist/esm/association/schema.test.d.ts.map +1 -0
- package/dist/esm/association/schema.test.js +119 -0
- package/dist/esm/authentication/factors/schema.test.js +19 -18
- package/dist/esm/authentication/providers/schema.js +1 -1
- package/dist/esm/authentication/sessions/schema.d.ts +5 -5
- package/dist/esm/authentication/sessions/schema.d.ts.map +1 -1
- package/dist/esm/authentication/sessions/schema.js +4 -2
- package/dist/esm/authentication/settings/schema.d.ts +1 -1
- package/dist/esm/authentication/settings/schema.js +2 -2
- package/dist/esm/authentication/settings/schema.test.d.ts +2 -0
- package/dist/esm/authentication/settings/schema.test.d.ts.map +1 -0
- package/dist/esm/authentication/settings/schema.test.js +71 -0
- package/dist/esm/authentication/strategies/schema/base.d.ts +1 -1
- package/dist/esm/authentication/strategies/schema/base.d.ts.map +1 -1
- package/dist/esm/authentication/strategies/schema/base.js +3 -1
- package/dist/esm/authentication/strategies/schema/schema.d.ts +3 -3
- package/dist/esm/authentication/strategies/schema/types/email.d.ts +1 -1
- package/dist/esm/authentication/strategies/schema/types/email.test.d.ts +2 -0
- package/dist/esm/authentication/strategies/schema/types/email.test.d.ts.map +1 -0
- package/dist/esm/authentication/strategies/schema/types/email.test.js +203 -0
- package/dist/esm/authentication/strategies/schema/types/password.d.ts +1 -1
- package/dist/esm/authentication/strategies/schema/types/totp.d.ts +1 -1
- package/dist/esm/authentication/utils.d.ts +13 -0
- package/dist/esm/authentication/utils.d.ts.map +1 -0
- package/dist/esm/authentication/utils.js +17 -0
- package/dist/esm/authentication/utils.test.d.ts +2 -0
- package/dist/esm/authentication/utils.test.d.ts.map +1 -0
- package/dist/esm/authentication/utils.test.js +140 -0
- package/dist/esm/authorization/index.d.ts +1 -1
- package/dist/esm/authorization/index.d.ts.map +1 -1
- package/dist/esm/authorization/index.js +1 -1
- package/dist/esm/authorization/permissions/schema.d.ts +1 -2
- package/dist/esm/authorization/permissions/schema.d.ts.map +1 -1
- package/dist/esm/authorization/permissions/schema.js +7 -8
- package/dist/esm/authorization/permissions/schema.test.d.ts +2 -0
- package/dist/esm/authorization/permissions/schema.test.d.ts.map +1 -0
- package/dist/esm/authorization/permissions/schema.test.js +215 -0
- package/dist/esm/authorization/roles/schema.d.ts +3 -3
- package/dist/esm/authorization/roles/schema.d.ts.map +1 -1
- package/dist/esm/authorization/roles/schema.js +9 -9
- package/dist/esm/authorization/roles/schema.test.d.ts +2 -0
- package/dist/esm/authorization/roles/schema.test.d.ts.map +1 -0
- package/dist/esm/authorization/roles/schema.test.js +234 -0
- package/dist/esm/authorization/schema.d.ts +17 -0
- package/dist/esm/authorization/schema.d.ts.map +1 -0
- package/dist/esm/authorization/schema.js +21 -0
- package/dist/esm/authorization/schema.test.d.ts +2 -0
- package/dist/esm/authorization/schema.test.d.ts.map +1 -0
- package/dist/esm/authorization/schema.test.js +40 -0
- package/dist/esm/common/errors/http.test.d.ts +2 -0
- package/dist/esm/common/errors/http.test.d.ts.map +1 -0
- package/dist/esm/common/errors/http.test.js +69 -0
- package/dist/esm/common/errors/validation.test.d.ts +2 -0
- package/dist/esm/common/errors/validation.test.d.ts.map +1 -0
- package/dist/esm/common/errors/validation.test.js +90 -0
- package/dist/esm/common/resources/init.d.ts +2 -2
- package/dist/esm/common/resources/init.d.ts.map +1 -1
- package/dist/esm/common/resources/init.js +1 -1
- package/dist/esm/common/resources/init.test.d.ts +2 -0
- package/dist/esm/common/resources/init.test.d.ts.map +1 -0
- package/dist/esm/common/resources/init.test.js +231 -0
- package/dist/esm/common/resources/operations.test.d.ts +2 -0
- package/dist/esm/common/resources/operations.test.d.ts.map +1 -0
- package/dist/esm/common/resources/operations.test.js +354 -0
- package/dist/esm/common/resources/utils.d.ts +1 -1
- package/dist/esm/common/resources/utils.d.ts.map +1 -1
- package/dist/esm/common/resources/utils.test.d.ts +2 -0
- package/dist/esm/common/resources/utils.test.d.ts.map +1 -0
- package/dist/esm/common/resources/utils.test.js +161 -0
- package/dist/esm/common/schema/aggregate.test.d.ts +2 -0
- package/dist/esm/common/schema/aggregate.test.d.ts.map +1 -0
- package/dist/esm/common/schema/aggregate.test.js +73 -0
- package/dist/esm/common/schema/collection.d.ts +2 -2
- package/dist/esm/common/schema/collection.test.d.ts +2 -0
- package/dist/esm/common/schema/collection.test.d.ts.map +1 -0
- package/dist/esm/common/schema/collection.test.js +96 -0
- package/dist/esm/common/schema/id.d.ts +2 -0
- package/dist/esm/common/schema/id.d.ts.map +1 -0
- package/dist/esm/common/schema/id.js +2 -0
- package/dist/esm/common/schema/id.test.d.ts +2 -0
- package/dist/esm/common/schema/id.test.d.ts.map +1 -0
- package/dist/esm/common/schema/id.test.js +114 -0
- package/dist/esm/common/schema/jwt.test.d.ts +2 -0
- package/dist/esm/common/schema/jwt.test.d.ts.map +1 -0
- package/dist/esm/common/schema/jwt.test.js +54 -0
- package/dist/esm/common/schema/metadata.d.ts +9 -3
- package/dist/esm/common/schema/metadata.d.ts.map +1 -1
- package/dist/esm/common/schema/metadata.js +24 -6
- package/dist/esm/common/schema/metadata.test.js +50 -1
- package/dist/esm/common/schema/pagination.d.ts +2 -2
- package/dist/esm/common/schema/pagination.js +2 -2
- package/dist/esm/common/schema/pagination.test.d.ts +2 -0
- package/dist/esm/common/schema/pagination.test.d.ts.map +1 -0
- package/dist/esm/common/schema/pagination.test.js +66 -0
- package/dist/esm/common/schema/sets.test.d.ts +2 -0
- package/dist/esm/common/schema/sets.test.d.ts.map +1 -0
- package/dist/esm/common/schema/sets.test.js +82 -0
- package/dist/esm/common/schema/url.test.d.ts +2 -0
- package/dist/esm/common/schema/url.test.d.ts.map +1 -0
- package/dist/esm/common/schema/url.test.js +72 -0
- package/dist/esm/customer/index.d.ts +2 -1
- package/dist/esm/customer/index.d.ts.map +1 -1
- package/dist/esm/customer/index.js +2 -1
- package/dist/esm/customer/{schema/organization.d.ts → organization/schema.d.ts} +4 -3
- package/dist/esm/customer/organization/schema.d.ts.map +1 -0
- package/dist/esm/customer/{schema/organization.js → organization/schema.js} +7 -5
- package/dist/esm/customer/schema.d.ts +17 -0
- package/dist/esm/customer/schema.d.ts.map +1 -0
- package/dist/esm/customer/schema.js +21 -0
- package/dist/esm/customer/schema.test.d.ts +2 -0
- package/dist/esm/customer/schema.test.d.ts.map +1 -0
- package/dist/esm/customer/schema.test.js +40 -0
- package/dist/esm/customer/users/schema.d.ts +4 -3
- package/dist/esm/customer/users/schema.d.ts.map +1 -1
- package/dist/esm/customer/users/schema.js +9 -6
- package/dist/esm/customer/users/schema.test.js +6 -5
- package/dist/esm/customer/users/utils.test.d.ts +2 -0
- package/dist/esm/customer/users/utils.test.d.ts.map +1 -0
- package/dist/esm/customer/users/utils.test.js +143 -0
- package/dist/esm/identity/schema.test.d.ts +2 -0
- package/dist/esm/identity/schema.test.d.ts.map +1 -0
- package/dist/esm/identity/schema.test.js +38 -0
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.d.ts.map +1 -1
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.js +22 -3
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.test.d.ts +2 -0
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.test.d.ts.map +1 -0
- package/dist/esm/oauth/authorize/schema/grants/authorization-code.test.js +332 -0
- package/dist/esm/oauth/common/schema.test.d.ts +2 -0
- package/dist/esm/oauth/common/schema.test.d.ts.map +1 -0
- package/dist/esm/oauth/common/schema.test.js +288 -0
- package/dist/esm/oauth/token/schema/schema.test.d.ts +2 -0
- package/dist/esm/oauth/token/schema/schema.test.d.ts.map +1 -0
- package/dist/esm/oauth/token/schema/schema.test.js +120 -0
- package/dist/esm/workspace/settings/schema.test.d.ts +2 -0
- package/dist/esm/workspace/settings/schema.test.d.ts.map +1 -0
- package/dist/esm/workspace/settings/schema.test.js +71 -0
- package/dist/esm/workspace/tenant/schema.d.ts +1 -0
- package/dist/esm/workspace/tenant/schema.d.ts.map +1 -1
- package/dist/esm/workspace/tenant/schema.js +4 -3
- package/dist/esm/workspace/user/notifications/schema.d.ts.map +1 -1
- package/dist/esm/workspace/user/notifications/schema.js +4 -3
- package/dist/esm/workspace/user/preferences/schema.js +3 -3
- package/dist/esm/workspace/utils.d.ts +0 -3
- package/dist/esm/workspace/utils.d.ts.map +1 -1
- package/dist/esm/workspace/utils.js +0 -3
- package/dist/esm/workspace/utils.test.d.ts +2 -0
- package/dist/esm/workspace/utils.test.d.ts.map +1 -0
- package/dist/esm/workspace/utils.test.js +61 -0
- package/package.json +1 -1
- package/dist/cjs/authorization/utils.d.ts +0 -11
- package/dist/cjs/authorization/utils.d.ts.map +0 -1
- package/dist/cjs/customer/schema/organization.d.ts.map +0 -1
- package/dist/cjs/customer/schema/schema.d.ts +0 -4
- package/dist/cjs/customer/schema/schema.d.ts.map +0 -1
- package/dist/cjs/customer/schema/schema.js +0 -19
- package/dist/cjs/customer/schema/utils.d.ts +0 -11
- package/dist/cjs/customer/schema/utils.d.ts.map +0 -1
- package/dist/esm/authorization/utils.d.ts +0 -11
- package/dist/esm/authorization/utils.d.ts.map +0 -1
- package/dist/esm/authorization/utils.js +0 -15
- package/dist/esm/customer/schema/organization.d.ts.map +0 -1
- package/dist/esm/customer/schema/schema.d.ts +0 -4
- package/dist/esm/customer/schema/schema.d.ts.map +0 -1
- package/dist/esm/customer/schema/schema.js +0 -3
- package/dist/esm/customer/schema/utils.d.ts +0 -11
- package/dist/esm/customer/schema/utils.d.ts.map +0 -1
- package/dist/esm/customer/schema/utils.js +0 -15
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { appendSearchParams } from './url.js';
|
|
3
|
+
describe('Common Schema - URL', () => {
|
|
4
|
+
describe('appendSearchParams', () => {
|
|
5
|
+
test('should append search params from Map to path', () => {
|
|
6
|
+
const params = new Map([
|
|
7
|
+
['key1', 'value1'],
|
|
8
|
+
['key2', 'value2'],
|
|
9
|
+
]);
|
|
10
|
+
const result = appendSearchParams('/api/test', params);
|
|
11
|
+
expect(result).toBe('/api/test?key1=value1&key2=value2');
|
|
12
|
+
});
|
|
13
|
+
test('should append search params from URLSearchParams to path', () => {
|
|
14
|
+
const params = new URLSearchParams();
|
|
15
|
+
params.set('foo', 'bar');
|
|
16
|
+
params.set('baz', 'qux');
|
|
17
|
+
const result = appendSearchParams('/api/endpoint', params);
|
|
18
|
+
expect(result).toBe('/api/endpoint?foo=bar&baz=qux');
|
|
19
|
+
});
|
|
20
|
+
test('should handle empty params', () => {
|
|
21
|
+
const params = new Map();
|
|
22
|
+
const result = appendSearchParams('/api/test', params);
|
|
23
|
+
expect(result).toBe('/api/test');
|
|
24
|
+
});
|
|
25
|
+
test('should skip undefined values', () => {
|
|
26
|
+
const params = new Map([
|
|
27
|
+
['key1', 'value1'],
|
|
28
|
+
['key2', undefined],
|
|
29
|
+
['key3', 'value3'],
|
|
30
|
+
]);
|
|
31
|
+
const result = appendSearchParams('/api/test', params);
|
|
32
|
+
expect(result).toBe('/api/test?key1=value1&key3=value3');
|
|
33
|
+
});
|
|
34
|
+
test('should skip null values', () => {
|
|
35
|
+
const params = new Map([
|
|
36
|
+
['key1', 'value1'],
|
|
37
|
+
['key2', null],
|
|
38
|
+
['key3', 'value3'],
|
|
39
|
+
]);
|
|
40
|
+
const result = appendSearchParams('/api/test', params);
|
|
41
|
+
expect(result).toBe('/api/test?key1=value1&key3=value3');
|
|
42
|
+
});
|
|
43
|
+
test('should skip empty string values', () => {
|
|
44
|
+
const params = new Map([
|
|
45
|
+
['key1', 'value1'],
|
|
46
|
+
['key2', ''],
|
|
47
|
+
['key3', 'value3'],
|
|
48
|
+
]);
|
|
49
|
+
const result = appendSearchParams('/api/test', params);
|
|
50
|
+
expect(result).toBe('/api/test?key1=value1&key3=value3');
|
|
51
|
+
});
|
|
52
|
+
test('should handle path without leading slash', () => {
|
|
53
|
+
const params = new Map([['param', 'value']]);
|
|
54
|
+
const result = appendSearchParams('api/test', params);
|
|
55
|
+
expect(result).toBe('api/test?param=value');
|
|
56
|
+
});
|
|
57
|
+
test('should handle single parameter', () => {
|
|
58
|
+
const params = new Map([['single', 'value']]);
|
|
59
|
+
const result = appendSearchParams('/path', params);
|
|
60
|
+
expect(result).toBe('/path?single=value');
|
|
61
|
+
});
|
|
62
|
+
test('should handle all falsy values', () => {
|
|
63
|
+
const params = new Map([
|
|
64
|
+
['key1', undefined],
|
|
65
|
+
['key2', null],
|
|
66
|
+
['key3', ''],
|
|
67
|
+
]);
|
|
68
|
+
const result = appendSearchParams('/api/test', params);
|
|
69
|
+
expect(result).toBe('/api/test');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/customer/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/customer/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC"}
|
|
@@ -3,8 +3,6 @@ export declare const OrganizationStatus: {
|
|
|
3
3
|
readonly SUSPENDED: "suspended";
|
|
4
4
|
};
|
|
5
5
|
export type AnyOrganizationStatus = (typeof OrganizationStatus)[keyof typeof OrganizationStatus];
|
|
6
|
-
export declare const OrganizationIdSchema: import("arktype/internal/methods/string.ts").StringType<string, {}>;
|
|
7
|
-
export type OrganizationId = typeof OrganizationIdSchema.inferOut;
|
|
8
6
|
export declare const OrganizationIdPropertySchema: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
9
7
|
id: string;
|
|
10
8
|
}, {}>;
|
|
@@ -45,10 +43,13 @@ export declare const UpdateOrganizationPayloadSchema: import("arktype/internal/m
|
|
|
45
43
|
} | null>) | undefined;
|
|
46
44
|
}, {}>;
|
|
47
45
|
export type UpdateOrganizationPayload = typeof UpdateOrganizationPayloadSchema.inferOut;
|
|
46
|
+
/**
|
|
47
|
+
* Association
|
|
48
|
+
*/
|
|
48
49
|
export declare const OrganizationAssociationReferenceSchema: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
49
50
|
id: string;
|
|
50
51
|
name: string;
|
|
51
52
|
model: "Organization";
|
|
52
53
|
}, {}>;
|
|
53
54
|
export type OrganizationAssociationReference = typeof OrganizationAssociationReferenceSchema.inferOut;
|
|
54
|
-
//# sourceMappingURL=
|
|
55
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/customer/organization/schema.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AACX,MAAM,MAAM,qBAAqB,GAC/B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D,eAAO,MAAM,4BAA4B;;MAEvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAChC,OAAO,4BAA4B,CAAC,QAAQ,CAAC;AAS/C,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;MASD,CAAC;AACtC,MAAM,MAAM,mBAAmB,GAAG,OAAO,yBAAyB,CAAC,QAAQ,CAAC;AAE5E,eAAO,MAAM,+BAA+B;;;;;;;;;MAID,CAAC;AAC5C,MAAM,MAAM,yBAAyB,GACnC,OAAO,+BAA+B,CAAC,QAAQ,CAAC;AAElD,eAAO,MAAM,+BAA+B;;;;;;;;MAGD,CAAC;AAC5C,MAAM,MAAM,yBAAyB,GACnC,OAAO,+BAA+B,CAAC,QAAQ,CAAC;AAElD;;GAEG;AAEH,eAAO,MAAM,sCAAsC;;;;MAMhD,CAAC;AACJ,MAAM,MAAM,gCAAgC,GAC1C,OAAO,sCAAsC,CAAC,QAAQ,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { type } from 'arktype';
|
|
2
2
|
import { OptionalDatePayloadSchema, RequiredDatePayloadSchema, } from '../../common/index.js';
|
|
3
|
-
import { MetadataPayloadPropertySchema,
|
|
4
|
-
import { generateOrganizationId } from '
|
|
3
|
+
import { MetadataPayloadPropertySchema, UpsertMetadataPropertyPayloadSchema, } from '../../common/schema/metadata.js';
|
|
4
|
+
import { OrganizationIdSchema, generateOrganizationId } from '../schema.js';
|
|
5
5
|
export const OrganizationStatus = {
|
|
6
6
|
ACTIVE: 'active',
|
|
7
7
|
SUSPENDED: 'suspended',
|
|
8
8
|
};
|
|
9
|
-
export const OrganizationIdSchema = type.string;
|
|
10
9
|
export const OrganizationIdPropertySchema = type({
|
|
11
10
|
id: OrganizationIdSchema,
|
|
12
11
|
});
|
|
@@ -26,11 +25,14 @@ export const InsertOrganizationPayloadSchema = type({
|
|
|
26
25
|
id: OrganizationIdSchema.default(() => generateOrganizationId()),
|
|
27
26
|
status: StatusSchema.optional(),
|
|
28
27
|
name: OrganizationNameSchema,
|
|
29
|
-
}).and(
|
|
28
|
+
}).and(UpsertMetadataPropertyPayloadSchema);
|
|
30
29
|
export const UpdateOrganizationPayloadSchema = type({
|
|
31
30
|
status: StatusSchema.or(type.null).optional(),
|
|
32
31
|
name: OrganizationNameSchema.or(type.null).optional(),
|
|
33
|
-
}).and(
|
|
32
|
+
}).and(UpsertMetadataPropertyPayloadSchema);
|
|
33
|
+
/**
|
|
34
|
+
* Association
|
|
35
|
+
*/
|
|
34
36
|
export const OrganizationAssociationReferenceSchema = OrganizationIdPropertySchema.and(type({
|
|
35
37
|
name: type.string,
|
|
36
38
|
model: "'Organization'",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const Model: {
|
|
2
|
+
readonly Organization: {
|
|
3
|
+
readonly UIDPrefix: "org";
|
|
4
|
+
};
|
|
5
|
+
readonly User: {
|
|
6
|
+
readonly UIDPrefix: "usr";
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function generateUserId(): string;
|
|
10
|
+
export declare function generateOrganizationId(): string;
|
|
11
|
+
export declare const UserIdSchema: import("arktype/internal/methods/string.ts").StringType<string, {}>;
|
|
12
|
+
export type UserId = typeof UserIdSchema.inferOut;
|
|
13
|
+
export declare const UserIdAssociationsSchema: import("arktype").BaseType<string[] | undefined, {}>;
|
|
14
|
+
export declare const OrganizationIdSchema: import("arktype/internal/methods/string.ts").StringType<string, {}>;
|
|
15
|
+
export type OrganizationId = typeof OrganizationIdSchema.inferOut;
|
|
16
|
+
export declare const OrganizationIdAssociationsSchema: import("arktype").BaseType<string[] | undefined, {}>;
|
|
17
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/customer/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK;;;;;;;CAOR,CAAC;AAEX,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,sBAAsB,WAErC;AAED,eAAO,MAAM,YAAY,qEAAoC,CAAC;AAC9D,MAAM,MAAM,MAAM,GAAG,OAAO,YAAY,CAAC,QAAQ,CAAC;AAElD,eAAO,MAAM,wBAAwB,sDAEpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,qEAA4C,CAAC;AAC9E,MAAM,MAAM,cAAc,GAAG,OAAO,oBAAoB,CAAC,QAAQ,CAAC;AAElE,eAAO,MAAM,gCAAgC,sDAE5C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import KSUID from 'ksuid';
|
|
3
|
+
import { KSUIDSchema } from '../common/schema/id.js';
|
|
4
|
+
export const Model = {
|
|
5
|
+
Organization: {
|
|
6
|
+
UIDPrefix: 'org',
|
|
7
|
+
},
|
|
8
|
+
User: {
|
|
9
|
+
UIDPrefix: 'usr',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export function generateUserId() {
|
|
13
|
+
return `${Model.User.UIDPrefix}_${KSUID.randomSync().string}`;
|
|
14
|
+
}
|
|
15
|
+
export function generateOrganizationId() {
|
|
16
|
+
return `${Model.Organization.UIDPrefix}_${KSUID.randomSync().string}`;
|
|
17
|
+
}
|
|
18
|
+
export const UserIdSchema = KSUIDSchema(Model.User.UIDPrefix);
|
|
19
|
+
export const UserIdAssociationsSchema = type('undefined').or(UserIdSchema.array());
|
|
20
|
+
export const OrganizationIdSchema = KSUIDSchema(Model.Organization.UIDPrefix);
|
|
21
|
+
export const OrganizationIdAssociationsSchema = type('undefined').or(OrganizationIdSchema.array());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../src/customer/schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { Model, generateOrganizationId, generateUserId } from './schema.js';
|
|
3
|
+
describe('Customer Schema - Utils', () => {
|
|
4
|
+
describe('Model constants', () => {
|
|
5
|
+
test('should have correct UID prefixes', () => {
|
|
6
|
+
expect(Model.Organization.UIDPrefix).toBe('org');
|
|
7
|
+
expect(Model.User.UIDPrefix).toBe('usr');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
describe('generateUserId', () => {
|
|
11
|
+
test('should generate ID with correct prefix', () => {
|
|
12
|
+
const id = generateUserId();
|
|
13
|
+
expect(id).toMatch(/^usr_[A-Za-z0-9]+$/);
|
|
14
|
+
});
|
|
15
|
+
test('should generate unique IDs', () => {
|
|
16
|
+
const id1 = generateUserId();
|
|
17
|
+
const id2 = generateUserId();
|
|
18
|
+
expect(id1).not.toBe(id2);
|
|
19
|
+
});
|
|
20
|
+
test('should generate IDs with correct length', () => {
|
|
21
|
+
const id = generateUserId();
|
|
22
|
+
expect(id.length).toBeGreaterThan(4); // prefix + underscore + KSUID
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('generateOrganizationId', () => {
|
|
26
|
+
test('should generate ID with correct prefix', () => {
|
|
27
|
+
const id = generateOrganizationId();
|
|
28
|
+
expect(id).toMatch(/^org_[A-Za-z0-9]+$/);
|
|
29
|
+
});
|
|
30
|
+
test('should generate unique IDs', () => {
|
|
31
|
+
const id1 = generateOrganizationId();
|
|
32
|
+
const id2 = generateOrganizationId();
|
|
33
|
+
expect(id1).not.toBe(id2);
|
|
34
|
+
});
|
|
35
|
+
test('should generate IDs with correct length', () => {
|
|
36
|
+
const id = generateOrganizationId();
|
|
37
|
+
expect(id.length).toBeGreaterThan(4); // prefix + underscore + KSUID
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -23,8 +23,6 @@ export declare const UpdateUserNamePropertiesSchema: import("arktype/internal/me
|
|
|
23
23
|
honorificPrefix?: string | null | undefined;
|
|
24
24
|
honorificSuffix?: string | null | undefined;
|
|
25
25
|
}, {}>;
|
|
26
|
-
export declare const UserIdSchema: import("arktype/internal/methods/string.ts").StringType<string, {}>;
|
|
27
|
-
export type UserId = typeof UserIdSchema.inferOut;
|
|
28
26
|
export declare const UserIdPropertySchema: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
29
27
|
id: string;
|
|
30
28
|
}, {}>;
|
|
@@ -66,7 +64,7 @@ export declare const UserSchema: import("arktype/internal/methods/object.ts").Ob
|
|
|
66
64
|
lastLogin?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
67
65
|
deletedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
68
66
|
deactivatedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
69
|
-
metadata: (In: import("arktype/internal/attributes.ts").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean
|
|
67
|
+
metadata: (In: import("arktype/internal/attributes.ts").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean>>;
|
|
70
68
|
}, {}>;
|
|
71
69
|
export type UserProperties = typeof UserSchema.inferIn;
|
|
72
70
|
export type User = typeof UserSchema.inferOut;
|
|
@@ -133,6 +131,9 @@ export declare const UpdateUserPayloadSchema: import("arktype/internal/methods/o
|
|
|
133
131
|
}, {}>;
|
|
134
132
|
export type UpdateUserInput = typeof UpdateUserPayloadSchema.inferIn;
|
|
135
133
|
export type UpdateUserPayload = typeof UpdateUserPayloadSchema.inferOut;
|
|
134
|
+
/**
|
|
135
|
+
* Association
|
|
136
|
+
*/
|
|
136
137
|
export declare const UserAssociationReferenceSchema: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
137
138
|
id: string;
|
|
138
139
|
givenName?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/customer/users/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/customer/users/schema.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,eAAO,MAAM,UAAU;;;;CAIb,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAQzE,eAAO,MAAM,wBAAwB;;;;;;MAMnC,CAAC;AAGH,eAAO,MAAM,8BAA8B;;;;;;MAMzC,CAAC;AAGH,eAAO,MAAM,oBAAoB;;MAE/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,oBAAoB,CAAC,QAAQ,CAAC;AAElE,eAAO,MAAM,mBAAmB,qEAAuB,CAAC;AACxD,eAAO,MAAM,yBAAyB,qEAAiB,CAAC;AAExD,eAAO,MAAM,oCAAoC;;;;;MAK/C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;MAGvC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;MAEjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,sBAAsB,CAAC,QAAQ,CAAC;AAStE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;MAMU,CAAC;AAClC,MAAM,MAAM,cAAc,GAAG,OAAO,UAAU,CAAC,OAAO,CAAC;AACvD,MAAM,MAAM,IAAI,GAAG,OAAO,UAAU,CAAC,QAAQ,CAAC;AAE9C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;MAMO,CAAC;AACtC,MAAM,MAAM,WAAW,GAAG,OAAO,iBAAiB,CAAC,QAAQ,CAAC;AAE5D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;MAMO,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,uBAAuB,CAAC,OAAO,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;MAIO,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,uBAAuB,CAAC,OAAO,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE;;GAEG;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;MAS1C,CAAC;AACF,MAAM,MAAM,wBAAwB,GAClC,OAAO,8BAA8B,CAAC,QAAQ,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type } from 'arktype';
|
|
2
|
+
import { RoleIdAssociationsSchema } from '../../authorization/schema.js';
|
|
2
3
|
import { AggregateSchema } from '../../common/schema/aggregate.js';
|
|
3
4
|
import { OptionalDatePayloadSchema, OptionalDateSchema, RequiredDatePayloadSchema, RequiredDateSchema, } from '../../common/schema/dates.js';
|
|
4
|
-
import { MetadataMapPropertySchema, MetadataPayloadPropertySchema,
|
|
5
|
+
import { MetadataMapPropertySchema, MetadataPayloadPropertySchema, UpsertMetadataPropertyPayloadSchema, } from '../../common/schema/metadata.js';
|
|
5
6
|
import { optionallyNullish, optionallyNullishToUndefined, optionallyUndefined, } from '../../common/schema/schema.js';
|
|
7
|
+
import { UserIdSchema } from '../schema.js';
|
|
6
8
|
export const VerifiableAttribute = {
|
|
7
9
|
EMAIL: 'email',
|
|
8
10
|
PHONE_NUMBER: 'phoneNumber',
|
|
@@ -29,7 +31,6 @@ export const UpdateUserNamePropertiesSchema = type({
|
|
|
29
31
|
honorificSuffix: optionallyNullish(type('string')),
|
|
30
32
|
});
|
|
31
33
|
// type UpsertUserNameProperties = typeof UpdateUserNamePropertiesSchema.inferOut;
|
|
32
|
-
export const UserIdSchema = type.string;
|
|
33
34
|
export const UserIdPropertySchema = type({
|
|
34
35
|
id: UserIdSchema,
|
|
35
36
|
});
|
|
@@ -45,9 +46,8 @@ export const EmailOrPhonePropertiesSchema = type({
|
|
|
45
46
|
email: optionallyNullishToUndefined(RequiredEmailSchema),
|
|
46
47
|
phoneNumber: optionallyNullishToUndefined(RequiredPhoneNumberSchema),
|
|
47
48
|
});
|
|
48
|
-
const UserRoleAssociationSchema = type('string[] | undefined');
|
|
49
49
|
export const UserAssociationsSchema = type({
|
|
50
|
-
roles:
|
|
50
|
+
roles: RoleIdAssociationsSchema.optional(),
|
|
51
51
|
});
|
|
52
52
|
const BaseSchema = UserIdPropertySchema.and(UserNamePropertiesSchema)
|
|
53
53
|
.and(VerifiedEmailOrPhonePropertiesSchema)
|
|
@@ -75,12 +75,15 @@ export const InsertUserPayloadSchema = type({
|
|
|
75
75
|
.and(UserNamePropertiesSchema)
|
|
76
76
|
.and(VerifiedEmailOrPhonePropertiesSchema)
|
|
77
77
|
.and(UserAssociationsSchema)
|
|
78
|
-
.and(
|
|
78
|
+
.and(UpsertMetadataPropertyPayloadSchema);
|
|
79
79
|
export const UpdateUserPayloadSchema = type({
|
|
80
80
|
suspended: type.boolean.optional(),
|
|
81
81
|
})
|
|
82
82
|
.and(UpdateUserNamePropertiesSchema)
|
|
83
|
-
.and(
|
|
83
|
+
.and(UpsertMetadataPropertyPayloadSchema);
|
|
84
|
+
/**
|
|
85
|
+
* Association
|
|
86
|
+
*/
|
|
84
87
|
export const UserAssociationReferenceSchema = UserIdPropertySchema.and(UserNamePropertiesSchema).and(EmailOrPhonePropertiesSchema.and(type({
|
|
85
88
|
status: UserStatusSchema.default('unverified'),
|
|
86
89
|
model: "'User'",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type } from 'arktype';
|
|
2
2
|
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { generateUserId } from '../schema.js';
|
|
3
4
|
import { InsertUserPayloadSchema, UserPayloadSchema, UserStatus, } from './schema.js';
|
|
4
5
|
describe('Customer - User', () => {
|
|
5
6
|
describe('User Payload', () => {
|
|
6
7
|
test('should parse attributes successfully', async () => {
|
|
7
8
|
const item = {
|
|
8
9
|
foo: 'bar',
|
|
9
|
-
id:
|
|
10
|
+
id: generateUserId(),
|
|
10
11
|
phoneNumber: '123',
|
|
11
12
|
status: UserStatus.ACTIVE,
|
|
12
13
|
createdAt: new Date(),
|
|
@@ -24,7 +25,7 @@ describe('Customer - User', () => {
|
|
|
24
25
|
test('should parse attributes successfully', async () => {
|
|
25
26
|
const item = {
|
|
26
27
|
foo: 'bar',
|
|
27
|
-
id:
|
|
28
|
+
id: generateUserId(),
|
|
28
29
|
familyName: 'Foo',
|
|
29
30
|
phoneNumber: '123',
|
|
30
31
|
};
|
|
@@ -39,7 +40,7 @@ describe('Customer - User', () => {
|
|
|
39
40
|
test('should serialize successfully', async () => {
|
|
40
41
|
const item = {
|
|
41
42
|
foo: 'bar',
|
|
42
|
-
id:
|
|
43
|
+
id: generateUserId(),
|
|
43
44
|
phoneNumber: '123',
|
|
44
45
|
metadata: new Map(),
|
|
45
46
|
// status: UserStatus.ACTIVE,
|
|
@@ -55,7 +56,7 @@ describe('Customer - User', () => {
|
|
|
55
56
|
});
|
|
56
57
|
test('should serialize nulls successfully', async () => {
|
|
57
58
|
const payload = {
|
|
58
|
-
id:
|
|
59
|
+
id: generateUserId(),
|
|
59
60
|
status: 'unverified',
|
|
60
61
|
givenName: null,
|
|
61
62
|
middleName: null,
|
|
@@ -77,7 +78,7 @@ describe('Customer - User', () => {
|
|
|
77
78
|
});
|
|
78
79
|
test('should serialize nulls successfully', async () => {
|
|
79
80
|
const payload = {
|
|
80
|
-
id:
|
|
81
|
+
id: generateUserId(),
|
|
81
82
|
status: 'unverified',
|
|
82
83
|
givenName: null,
|
|
83
84
|
middleName: null,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../../src/customer/users/utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { getInitials, buildName, buildProperName, buildReference, } from './utils.js';
|
|
3
|
+
describe('Customer Users - Utils', () => {
|
|
4
|
+
describe('getInitials', () => {
|
|
5
|
+
test('should return initials for single name', () => {
|
|
6
|
+
expect(getInitials('John')).toBe('J');
|
|
7
|
+
});
|
|
8
|
+
test('should return initials for full name', () => {
|
|
9
|
+
expect(getInitials('John Doe')).toBe('JD');
|
|
10
|
+
});
|
|
11
|
+
test('should return initials for multiple names', () => {
|
|
12
|
+
expect(getInitials('John Michael Doe')).toBe('JMD');
|
|
13
|
+
});
|
|
14
|
+
test('should handle names with extra spaces', () => {
|
|
15
|
+
expect(getInitials('John Doe')).toBe('JD');
|
|
16
|
+
expect(getInitials(' John Doe ')).toBe('JD');
|
|
17
|
+
});
|
|
18
|
+
test('should return undefined for empty string', () => {
|
|
19
|
+
expect(getInitials('')).toBeUndefined();
|
|
20
|
+
});
|
|
21
|
+
test('should return undefined for undefined input', () => {
|
|
22
|
+
expect(getInitials(undefined)).toBeUndefined();
|
|
23
|
+
});
|
|
24
|
+
test('should handle single character names', () => {
|
|
25
|
+
expect(getInitials('A B C')).toBe('ABC');
|
|
26
|
+
});
|
|
27
|
+
test('should filter out empty parts', () => {
|
|
28
|
+
expect(getInitials('John Doe')).toBe('JD');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('buildName', () => {
|
|
32
|
+
test('should build name from givenName and familyName', () => {
|
|
33
|
+
const item = { givenName: 'John', familyName: 'Doe' };
|
|
34
|
+
expect(buildName(item)).toBe('John Doe');
|
|
35
|
+
});
|
|
36
|
+
test('should handle only givenName', () => {
|
|
37
|
+
const item = { givenName: 'John' };
|
|
38
|
+
expect(buildName(item)).toBe('John');
|
|
39
|
+
});
|
|
40
|
+
test('should handle only familyName', () => {
|
|
41
|
+
const item = { familyName: 'Doe' };
|
|
42
|
+
expect(buildName(item)).toBe('Doe');
|
|
43
|
+
});
|
|
44
|
+
test('should return empty string for empty object', () => {
|
|
45
|
+
expect(buildName({})).toBe('');
|
|
46
|
+
});
|
|
47
|
+
test('should return empty string for undefined', () => {
|
|
48
|
+
expect(buildName(undefined)).toBe('');
|
|
49
|
+
});
|
|
50
|
+
test('should filter out empty strings', () => {
|
|
51
|
+
const item = { givenName: 'John', familyName: '' };
|
|
52
|
+
expect(buildName(item)).toBe('John');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe('buildProperName', () => {
|
|
56
|
+
test('should build proper name with all components', () => {
|
|
57
|
+
const item = {
|
|
58
|
+
honorificPrefix: 'Dr.',
|
|
59
|
+
givenName: 'John',
|
|
60
|
+
middleName: 'Michael',
|
|
61
|
+
familyName: 'Doe',
|
|
62
|
+
honorificSuffix: 'Jr.',
|
|
63
|
+
};
|
|
64
|
+
expect(buildProperName(item, true)).toBe('Dr. John Michael Doe Jr.');
|
|
65
|
+
});
|
|
66
|
+
test('should exclude middle name by default', () => {
|
|
67
|
+
const item = {
|
|
68
|
+
honorificPrefix: 'Dr.',
|
|
69
|
+
givenName: 'John',
|
|
70
|
+
middleName: 'Michael',
|
|
71
|
+
familyName: 'Doe',
|
|
72
|
+
honorificSuffix: 'Jr.',
|
|
73
|
+
};
|
|
74
|
+
expect(buildProperName(item)).toBe('Dr. John Doe Jr.');
|
|
75
|
+
});
|
|
76
|
+
test('should handle missing components', () => {
|
|
77
|
+
const item = {
|
|
78
|
+
givenName: 'John',
|
|
79
|
+
familyName: 'Doe',
|
|
80
|
+
};
|
|
81
|
+
expect(buildProperName(item)).toBe('John Doe');
|
|
82
|
+
});
|
|
83
|
+
test('should handle only prefix and suffix', () => {
|
|
84
|
+
const item = {
|
|
85
|
+
honorificPrefix: 'Dr.',
|
|
86
|
+
honorificSuffix: 'PhD',
|
|
87
|
+
};
|
|
88
|
+
expect(buildProperName(item)).toBe('Dr. PhD');
|
|
89
|
+
});
|
|
90
|
+
test('should return empty string for empty object', () => {
|
|
91
|
+
expect(buildProperName({})).toBe('');
|
|
92
|
+
});
|
|
93
|
+
test('should return empty string for undefined', () => {
|
|
94
|
+
expect(buildProperName(undefined)).toBe('');
|
|
95
|
+
});
|
|
96
|
+
test('should include middle name when explicitly requested', () => {
|
|
97
|
+
const item = {
|
|
98
|
+
givenName: 'John',
|
|
99
|
+
middleName: 'Michael',
|
|
100
|
+
familyName: 'Doe',
|
|
101
|
+
};
|
|
102
|
+
expect(buildProperName(item, true)).toBe('John Michael Doe');
|
|
103
|
+
expect(buildProperName(item, false)).toBe('John Doe');
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe('buildReference', () => {
|
|
107
|
+
test('should prioritize name over email', () => {
|
|
108
|
+
const item = {
|
|
109
|
+
givenName: 'John',
|
|
110
|
+
familyName: 'Doe',
|
|
111
|
+
email: 'john@example.com',
|
|
112
|
+
};
|
|
113
|
+
expect(buildReference(item)).toBe('John Doe');
|
|
114
|
+
});
|
|
115
|
+
test('should fallback to email when no name', () => {
|
|
116
|
+
const item = {
|
|
117
|
+
email: 'john@example.com',
|
|
118
|
+
};
|
|
119
|
+
expect(buildReference(item)).toBe('john@example.com');
|
|
120
|
+
});
|
|
121
|
+
test('should return empty string when no name or email', () => {
|
|
122
|
+
const item = {};
|
|
123
|
+
expect(buildReference(item)).toBe('');
|
|
124
|
+
});
|
|
125
|
+
test('should return empty string for undefined', () => {
|
|
126
|
+
expect(buildReference(undefined)).toBe('');
|
|
127
|
+
});
|
|
128
|
+
test('should use partial name if available', () => {
|
|
129
|
+
const item = {
|
|
130
|
+
givenName: 'John',
|
|
131
|
+
email: 'john@example.com',
|
|
132
|
+
};
|
|
133
|
+
expect(buildReference(item)).toBe('John');
|
|
134
|
+
});
|
|
135
|
+
test('should prefer family name over email if no given name', () => {
|
|
136
|
+
const item = {
|
|
137
|
+
familyName: 'Doe',
|
|
138
|
+
email: 'john@example.com',
|
|
139
|
+
};
|
|
140
|
+
expect(buildReference(item)).toBe('Doe');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../src/identity/schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { IdentityIdentifier, IdentityIdentifierSchema } from './schema.js';
|
|
4
|
+
describe('Identity - Schema', () => {
|
|
5
|
+
describe('IdentityIdentifier constants', () => {
|
|
6
|
+
test('should have correct identifier values', () => {
|
|
7
|
+
expect(IdentityIdentifier.EMAIL).toBe('email');
|
|
8
|
+
expect(IdentityIdentifier.PHONE_NUMBER).toBe('phoneNumber');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
describe('IdentityIdentifierSchema', () => {
|
|
12
|
+
test('should accept valid email identifier', () => {
|
|
13
|
+
const result = IdentityIdentifierSchema('email');
|
|
14
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
15
|
+
expect(result).toBe('email');
|
|
16
|
+
});
|
|
17
|
+
test('should accept valid phone number identifier', () => {
|
|
18
|
+
const result = IdentityIdentifierSchema('phoneNumber');
|
|
19
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
20
|
+
expect(result).toBe('phoneNumber');
|
|
21
|
+
});
|
|
22
|
+
test('should reject invalid identifiers', () => {
|
|
23
|
+
expect(IdentityIdentifierSchema('username')).toBeInstanceOf(type.errors);
|
|
24
|
+
expect(IdentityIdentifierSchema('invalid')).toBeInstanceOf(type.errors);
|
|
25
|
+
expect(IdentityIdentifierSchema('')).toBeInstanceOf(type.errors);
|
|
26
|
+
});
|
|
27
|
+
test('should reject non-string values', () => {
|
|
28
|
+
expect(IdentityIdentifierSchema(123)).toBeInstanceOf(type.errors);
|
|
29
|
+
expect(IdentityIdentifierSchema(null)).toBeInstanceOf(type.errors);
|
|
30
|
+
expect(IdentityIdentifierSchema(undefined)).toBeInstanceOf(type.errors);
|
|
31
|
+
});
|
|
32
|
+
test('should be case sensitive', () => {
|
|
33
|
+
expect(IdentityIdentifierSchema('Email')).toBeInstanceOf(type.errors);
|
|
34
|
+
expect(IdentityIdentifierSchema('PHONE_NUMBER')).toBeInstanceOf(type.errors);
|
|
35
|
+
expect(IdentityIdentifierSchema('phonenumber')).toBeInstanceOf(type.errors);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-code.d.ts","sourceRoot":"","sources":["../../../../../../src/oauth/authorize/schema/grants/authorization-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authorization-code.d.ts","sourceRoot":"","sources":["../../../../../../src/oauth/authorize/schema/grants/authorization-code.ts"],"names":[],"mappings":"AA8DA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;MAEd,CAAC;AACvB,MAAM,MAAM,wBAAwB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC"}
|
|
@@ -9,9 +9,28 @@ const ResponseTypeSchema = type.enumerated(ResponseType.CODE);
|
|
|
9
9
|
const PKCESchema = type({
|
|
10
10
|
code_challenge_method: CodeChallengeMethodSchema.optional(),
|
|
11
11
|
code_challenge: type('string').optional(),
|
|
12
|
-
})
|
|
12
|
+
})
|
|
13
|
+
.or({
|
|
13
14
|
code_challenge_method: CodeChallengeMethodSchema,
|
|
14
|
-
code_challenge: type('string'),
|
|
15
|
+
code_challenge: type('string').moreThanLength(0),
|
|
16
|
+
})
|
|
17
|
+
.narrow((data, ctx) => {
|
|
18
|
+
if ((data.code_challenge_method && data.code_challenge) ||
|
|
19
|
+
(!data.code_challenge_method && !data.code_challenge)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (data.code_challenge_method && !data.code_challenge) {
|
|
23
|
+
return ctx.reject({
|
|
24
|
+
expected: 'is required',
|
|
25
|
+
actual: '',
|
|
26
|
+
path: ['code_challenge'],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return ctx.reject({
|
|
30
|
+
expected: 'is required',
|
|
31
|
+
actual: '',
|
|
32
|
+
path: ['code_challenge_method'],
|
|
33
|
+
});
|
|
15
34
|
});
|
|
16
35
|
const OAuthSchema = type({
|
|
17
36
|
response_type: ResponseTypeSchema,
|
|
@@ -24,7 +43,7 @@ const OIDCSchema = type({
|
|
|
24
43
|
nonce: type('string').optional(),
|
|
25
44
|
display: AuthorizationDisplaySchema.optional(),
|
|
26
45
|
prompt: AuthorizationPromptSchema.optional(),
|
|
27
|
-
max_age: type(
|
|
46
|
+
max_age: type.keywords.number.integer.atLeast(0).optional(),
|
|
28
47
|
});
|
|
29
48
|
export const AuthorizationCodeSchema = OAuthSchema.and(OIDCSchema)
|
|
30
49
|
.and(PKCESchema)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-code.test.d.ts","sourceRoot":"","sources":["../../../../../../src/oauth/authorize/schema/grants/authorization-code.test.ts"],"names":[],"mappings":""}
|