@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,69 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { HttpError } from './http.js';
|
|
3
|
+
describe('Common Errors - HTTP', () => {
|
|
4
|
+
describe('HttpError', () => {
|
|
5
|
+
test('should create error with default message and status', () => {
|
|
6
|
+
const error = new HttpError();
|
|
7
|
+
expect(error.message).toBe('An unknown error occurred. Please try the operation again.');
|
|
8
|
+
expect(error.statusCode).toBe(500);
|
|
9
|
+
expect(error.type).toBe('Unknown');
|
|
10
|
+
expect(error.trace).toBeUndefined();
|
|
11
|
+
expect(error.body).toBeUndefined();
|
|
12
|
+
});
|
|
13
|
+
test('should create error with custom message', () => {
|
|
14
|
+
const error = new HttpError('Custom error message');
|
|
15
|
+
expect(error.message).toBe('Custom error message');
|
|
16
|
+
expect(error.statusCode).toBe(500);
|
|
17
|
+
expect(error.type).toBe('Unknown');
|
|
18
|
+
});
|
|
19
|
+
test('should create error with custom options', () => {
|
|
20
|
+
const options = {
|
|
21
|
+
statusCode: 404,
|
|
22
|
+
type: 'NotFound',
|
|
23
|
+
trace: 'trace-123',
|
|
24
|
+
body: { resource: 'user' },
|
|
25
|
+
};
|
|
26
|
+
const error = new HttpError('Resource not found', options);
|
|
27
|
+
expect(error.message).toBe('Resource not found');
|
|
28
|
+
expect(error.statusCode).toBe(404);
|
|
29
|
+
expect(error.type).toBe('NotFound');
|
|
30
|
+
expect(error.trace).toBeUndefined(); // trace is not assigned in constructor
|
|
31
|
+
expect(error.body).toBeUndefined(); // body is not assigned in constructor
|
|
32
|
+
});
|
|
33
|
+
test('should handle partial options', () => {
|
|
34
|
+
const error = new HttpError('Test error', { statusCode: 400 });
|
|
35
|
+
expect(error.message).toBe('Test error');
|
|
36
|
+
expect(error.statusCode).toBe(400);
|
|
37
|
+
expect(error.type).toBe('Unknown');
|
|
38
|
+
expect(error.trace).toBeUndefined();
|
|
39
|
+
expect(error.body).toBeUndefined();
|
|
40
|
+
});
|
|
41
|
+
test('should be instance of Error', () => {
|
|
42
|
+
const error = new HttpError();
|
|
43
|
+
expect(error).toBeInstanceOf(Error);
|
|
44
|
+
expect(error).toBeInstanceOf(HttpError);
|
|
45
|
+
});
|
|
46
|
+
describe('isAuthorizationError', () => {
|
|
47
|
+
test('should return true for 401 status', () => {
|
|
48
|
+
const error = new HttpError('Unauthorized', { statusCode: 401 });
|
|
49
|
+
expect(error.isAuthorizationError).toBe(true);
|
|
50
|
+
});
|
|
51
|
+
test('should return true for 403 status', () => {
|
|
52
|
+
const error = new HttpError('Forbidden', { statusCode: 403 });
|
|
53
|
+
expect(error.isAuthorizationError).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
test('should return false for other status codes', () => {
|
|
56
|
+
const error400 = new HttpError('Bad Request', { statusCode: 400 });
|
|
57
|
+
const error404 = new HttpError('Not Found', { statusCode: 404 });
|
|
58
|
+
const error500 = new HttpError('Internal Error', { statusCode: 500 });
|
|
59
|
+
expect(error400.isAuthorizationError).toBe(false);
|
|
60
|
+
expect(error404.isAuthorizationError).toBe(false);
|
|
61
|
+
expect(error500.isAuthorizationError).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
test('should return false for default status code', () => {
|
|
64
|
+
const error = new HttpError();
|
|
65
|
+
expect(error.isAuthorizationError).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.test.d.ts","sourceRoot":"","sources":["../../../../src/common/errors/validation.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { HttpError } from './http.js';
|
|
3
|
+
import { ValidationError } from './validation.js';
|
|
4
|
+
describe('Common Errors - Validation', () => {
|
|
5
|
+
describe('ValidationError', () => {
|
|
6
|
+
test('should create validation error with fields', () => {
|
|
7
|
+
const fields = {
|
|
8
|
+
email: 'Invalid email format',
|
|
9
|
+
name: 'Name is required',
|
|
10
|
+
};
|
|
11
|
+
const options = {
|
|
12
|
+
statusCode: 400,
|
|
13
|
+
type: 'ValidationError',
|
|
14
|
+
fields,
|
|
15
|
+
};
|
|
16
|
+
const error = new ValidationError('Validation failed', options);
|
|
17
|
+
expect(error.message).toBe('Validation failed');
|
|
18
|
+
expect(error.statusCode).toBe(400);
|
|
19
|
+
expect(error.type).toBe('ValidationError');
|
|
20
|
+
expect(error.fields).toEqual(fields);
|
|
21
|
+
});
|
|
22
|
+
test('should inherit from HttpError', () => {
|
|
23
|
+
const fields = { field: 'error' };
|
|
24
|
+
const error = new ValidationError('Test', { fields });
|
|
25
|
+
expect(error).toBeInstanceOf(Error);
|
|
26
|
+
expect(error).toBeInstanceOf(HttpError);
|
|
27
|
+
expect(error).toBeInstanceOf(ValidationError);
|
|
28
|
+
});
|
|
29
|
+
test('should use default HTTP error properties when not specified', () => {
|
|
30
|
+
const fields = { field: 'error' };
|
|
31
|
+
const error = new ValidationError('Test validation error', { fields });
|
|
32
|
+
expect(error.message).toBe('Test validation error');
|
|
33
|
+
expect(error.statusCode).toBe(500); // HttpError default
|
|
34
|
+
expect(error.type).toBe('Unknown'); // HttpError default
|
|
35
|
+
expect(error.fields).toEqual(fields);
|
|
36
|
+
});
|
|
37
|
+
test('should handle all HttpError options plus fields', () => {
|
|
38
|
+
const options = {
|
|
39
|
+
statusCode: 422,
|
|
40
|
+
type: 'UnprocessableEntity',
|
|
41
|
+
trace: 'validation-trace-456',
|
|
42
|
+
body: { request: 'data' },
|
|
43
|
+
fields: { username: 'Username already exists' },
|
|
44
|
+
};
|
|
45
|
+
const error = new ValidationError('Unprocessable entity', options);
|
|
46
|
+
expect(error.message).toBe('Unprocessable entity');
|
|
47
|
+
expect(error.statusCode).toBe(422);
|
|
48
|
+
expect(error.type).toBe('UnprocessableEntity');
|
|
49
|
+
expect(error.trace).toBeUndefined(); // trace is not assigned in HttpError constructor
|
|
50
|
+
expect(error.body).toBeUndefined(); // body is not assigned in HttpError constructor
|
|
51
|
+
expect(error.fields).toEqual({ username: 'Username already exists' });
|
|
52
|
+
});
|
|
53
|
+
test('should inherit isAuthorizationError from HttpError', () => {
|
|
54
|
+
const fields = { field: 'error' };
|
|
55
|
+
const error401 = new ValidationError('Unauthorized', {
|
|
56
|
+
statusCode: 401,
|
|
57
|
+
fields,
|
|
58
|
+
});
|
|
59
|
+
const error403 = new ValidationError('Forbidden', {
|
|
60
|
+
statusCode: 403,
|
|
61
|
+
fields,
|
|
62
|
+
});
|
|
63
|
+
const error400 = new ValidationError('Bad Request', {
|
|
64
|
+
statusCode: 400,
|
|
65
|
+
fields,
|
|
66
|
+
});
|
|
67
|
+
expect(error401.isAuthorizationError).toBe(true);
|
|
68
|
+
expect(error403.isAuthorizationError).toBe(true);
|
|
69
|
+
expect(error400.isAuthorizationError).toBe(false);
|
|
70
|
+
});
|
|
71
|
+
test('should handle empty fields object', () => {
|
|
72
|
+
const error = new ValidationError('No field errors', { fields: {} });
|
|
73
|
+
expect(error.fields).toEqual({});
|
|
74
|
+
expect(error.message).toBe('No field errors');
|
|
75
|
+
});
|
|
76
|
+
test('should handle multiple field errors', () => {
|
|
77
|
+
const fields = {
|
|
78
|
+
email: 'Email is invalid',
|
|
79
|
+
password: 'Password too short',
|
|
80
|
+
confirmPassword: 'Passwords do not match',
|
|
81
|
+
age: 'Must be 18 or older',
|
|
82
|
+
};
|
|
83
|
+
const error = new ValidationError('Multiple validation errors', {
|
|
84
|
+
fields,
|
|
85
|
+
});
|
|
86
|
+
expect(error.fields).toEqual(fields);
|
|
87
|
+
expect(Object.keys(error.fields)).toHaveLength(4);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -2,8 +2,8 @@ declare const ConfigSchema: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
2
2
|
host: (In: import("arktype/internal/attributes.ts").Default<string, "https://manage-api.mondoidentity.com">) => import("arktype/internal/attributes.ts").To<URL>;
|
|
3
3
|
accessToken: string;
|
|
4
4
|
}, {}>;
|
|
5
|
-
type ConfigProps = typeof ConfigSchema.inferIn;
|
|
6
|
-
type Config = typeof ConfigSchema.inferOut;
|
|
5
|
+
export type ConfigProps = typeof ConfigSchema.inferIn;
|
|
6
|
+
export type Config = typeof ConfigSchema.inferOut;
|
|
7
7
|
export declare class MondoIdentity {
|
|
8
8
|
readonly config: Config;
|
|
9
9
|
constructor(config: ConfigProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/resources/init.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,YAAY;;;MAA0B,CAAC;AAE7C,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/resources/init.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,YAAY;;;MAA0B,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,OAAO,CAAC;AACtD,MAAM,MAAM,MAAM,GAAG,OAAO,YAAY,CAAC,QAAQ,CAAC;AAElD,qBAAa,aAAa;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEL,MAAM,EAAE,WAAW;IAItC;;OAEG;IACH,IAAW,UAAU,IAAI,CAAC,OAAO,EAAE,WAAW,KAAK,WAAW,CAU7D;CAuBF"}
|
|
@@ -3,7 +3,7 @@ const BaseConfigSchema = type({
|
|
|
3
3
|
host: type('string.url.parse').default('https://manage-api.mondoidentity.com'),
|
|
4
4
|
});
|
|
5
5
|
const AccessTokenConfigSchema = BaseConfigSchema.and({
|
|
6
|
-
accessToken: type('string'),
|
|
6
|
+
accessToken: type('string').moreThanLength(0),
|
|
7
7
|
});
|
|
8
8
|
const ConfigSchema = AccessTokenConfigSchema;
|
|
9
9
|
export class MondoIdentity {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.test.d.ts","sourceRoot":"","sources":["../../../../src/common/resources/init.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { MondoIdentity } from './init.js';
|
|
3
|
+
describe('Common Resources - Init', () => {
|
|
4
|
+
describe('MondoIdentity class', () => {
|
|
5
|
+
describe('constructor', () => {
|
|
6
|
+
test('should initialize with valid config including access token', () => {
|
|
7
|
+
const config = {
|
|
8
|
+
accessToken: 'test-access-token',
|
|
9
|
+
host: 'https://api.example.com',
|
|
10
|
+
};
|
|
11
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
12
|
+
expect(mondoIdentity.config.accessToken).toBe('test-access-token');
|
|
13
|
+
expect(mondoIdentity.config.host.toString()).toBe(`${config.host}/`);
|
|
14
|
+
});
|
|
15
|
+
test('should use default host when not provided', () => {
|
|
16
|
+
const config = {
|
|
17
|
+
accessToken: 'test-access-token',
|
|
18
|
+
};
|
|
19
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
20
|
+
expect(mondoIdentity.config.accessToken).toBe('test-access-token');
|
|
21
|
+
expect(mondoIdentity.config.host.toString()).toBe('https://manage-api.mondoidentity.com/');
|
|
22
|
+
});
|
|
23
|
+
test('should parse URL host correctly', () => {
|
|
24
|
+
const config = {
|
|
25
|
+
accessToken: 'test-token',
|
|
26
|
+
host: 'https://custom-api.domain.com:8080/path',
|
|
27
|
+
};
|
|
28
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
29
|
+
expect(mondoIdentity.config.host.toString()).toBe(config.host);
|
|
30
|
+
});
|
|
31
|
+
test('should throw error when access token is missing', () => {
|
|
32
|
+
const config = {
|
|
33
|
+
host: 'https://api.example.com',
|
|
34
|
+
};
|
|
35
|
+
expect(() => new MondoIdentity(config)).toThrow('Invalid configuration');
|
|
36
|
+
});
|
|
37
|
+
test('should throw error when access token is empty', () => {
|
|
38
|
+
const config = {
|
|
39
|
+
accessToken: '',
|
|
40
|
+
host: 'https://api.example.com',
|
|
41
|
+
};
|
|
42
|
+
expect(() => new MondoIdentity(config)).toThrow('Invalid configuration');
|
|
43
|
+
});
|
|
44
|
+
test('should throw error when host is invalid URL', () => {
|
|
45
|
+
const config = {
|
|
46
|
+
accessToken: 'test-token',
|
|
47
|
+
host: 'not-a-valid-url',
|
|
48
|
+
};
|
|
49
|
+
expect(() => new MondoIdentity(config)).toThrow('Invalid configuration');
|
|
50
|
+
});
|
|
51
|
+
test('should throw error when host is not a string', () => {
|
|
52
|
+
const config = {
|
|
53
|
+
accessToken: 'test-token',
|
|
54
|
+
host: 123,
|
|
55
|
+
};
|
|
56
|
+
expect(() => new MondoIdentity(config)).toThrow('Invalid configuration');
|
|
57
|
+
});
|
|
58
|
+
test('should throw error when access token is not a string', () => {
|
|
59
|
+
const config = {
|
|
60
|
+
accessToken: 123,
|
|
61
|
+
host: 'https://api.example.com',
|
|
62
|
+
};
|
|
63
|
+
expect(() => new MondoIdentity(config)).toThrow('Invalid configuration');
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('config property', () => {
|
|
67
|
+
test('should be readonly', () => {
|
|
68
|
+
const config = {
|
|
69
|
+
accessToken: 'test-token',
|
|
70
|
+
host: 'https://api.example.com',
|
|
71
|
+
};
|
|
72
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
73
|
+
// Config should be accessible
|
|
74
|
+
expect(mondoIdentity.config).toBeDefined();
|
|
75
|
+
expect(mondoIdentity.config.accessToken).toBe('test-token');
|
|
76
|
+
});
|
|
77
|
+
test('should preserve original config values', () => {
|
|
78
|
+
const config = {
|
|
79
|
+
accessToken: 'my-secret-token',
|
|
80
|
+
host: 'https://staging-api.mondoidentity.com',
|
|
81
|
+
};
|
|
82
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
83
|
+
expect(mondoIdentity.config.accessToken).toBe('my-secret-token');
|
|
84
|
+
expect(mondoIdentity.config.host).instanceOf(URL);
|
|
85
|
+
expect(mondoIdentity.config.host.toString()).toBe(`${config.host}/`);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
describe('authorizer property', () => {
|
|
89
|
+
test('should return function that adds authorization header when access token is provided', () => {
|
|
90
|
+
const config = {
|
|
91
|
+
accessToken: 'bearer-token-123',
|
|
92
|
+
};
|
|
93
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
94
|
+
const authorizer = mondoIdentity.authorizer;
|
|
95
|
+
expect(typeof authorizer).toBe('function');
|
|
96
|
+
const mockRequest = {
|
|
97
|
+
method: 'GET',
|
|
98
|
+
headers: {},
|
|
99
|
+
};
|
|
100
|
+
const authorizedRequest = authorizer(mockRequest);
|
|
101
|
+
expect(authorizedRequest.headers).toBeInstanceOf(Headers);
|
|
102
|
+
const headers = authorizedRequest.headers;
|
|
103
|
+
expect(headers.get('authorization')).toBe('bearer-token-123');
|
|
104
|
+
});
|
|
105
|
+
test('should preserve existing headers when adding authorization', () => {
|
|
106
|
+
const config = {
|
|
107
|
+
accessToken: 'test-token',
|
|
108
|
+
};
|
|
109
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
110
|
+
const authorizer = mondoIdentity.authorizer;
|
|
111
|
+
const mockRequest = {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
headers: {
|
|
114
|
+
'content-type': 'application/json',
|
|
115
|
+
'user-agent': 'test-client',
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const authorizedRequest = authorizer(mockRequest);
|
|
119
|
+
const headers = authorizedRequest.headers;
|
|
120
|
+
expect(headers.get('authorization')).toBe('test-token');
|
|
121
|
+
expect(headers.get('content-type')).toBe('application/json');
|
|
122
|
+
expect(headers.get('user-agent')).toBe('test-client');
|
|
123
|
+
});
|
|
124
|
+
test('should handle Headers object as input', () => {
|
|
125
|
+
const config = {
|
|
126
|
+
accessToken: 'header-token',
|
|
127
|
+
};
|
|
128
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
129
|
+
const authorizer = mondoIdentity.authorizer;
|
|
130
|
+
const existingHeaders = new Headers({
|
|
131
|
+
accept: 'application/json',
|
|
132
|
+
});
|
|
133
|
+
const mockRequest = {
|
|
134
|
+
method: 'GET',
|
|
135
|
+
headers: existingHeaders,
|
|
136
|
+
};
|
|
137
|
+
const authorizedRequest = authorizer(mockRequest);
|
|
138
|
+
const headers = authorizedRequest.headers;
|
|
139
|
+
expect(headers.get('authorization')).toBe('header-token');
|
|
140
|
+
expect(headers.get('accept')).toBe('application/json');
|
|
141
|
+
});
|
|
142
|
+
test('should handle undefined headers', () => {
|
|
143
|
+
const config = {
|
|
144
|
+
accessToken: 'undefined-headers-token',
|
|
145
|
+
};
|
|
146
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
147
|
+
const authorizer = mondoIdentity.authorizer;
|
|
148
|
+
const mockRequest = {
|
|
149
|
+
method: 'GET',
|
|
150
|
+
// headers intentionally undefined
|
|
151
|
+
};
|
|
152
|
+
const authorizedRequest = authorizer(mockRequest);
|
|
153
|
+
const headers = authorizedRequest.headers;
|
|
154
|
+
expect(headers.get('authorization')).toBe('undefined-headers-token');
|
|
155
|
+
});
|
|
156
|
+
test('should return same request reference with modified headers', () => {
|
|
157
|
+
const config = {
|
|
158
|
+
accessToken: 'reference-token',
|
|
159
|
+
};
|
|
160
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
161
|
+
const authorizer = mondoIdentity.authorizer;
|
|
162
|
+
const mockRequest = {
|
|
163
|
+
method: 'PUT',
|
|
164
|
+
body: 'test-body',
|
|
165
|
+
};
|
|
166
|
+
const authorizedRequest = authorizer(mockRequest);
|
|
167
|
+
// Should be the same object reference
|
|
168
|
+
expect(authorizedRequest).toBe(mockRequest);
|
|
169
|
+
expect(authorizedRequest.method).toBe('PUT');
|
|
170
|
+
expect(authorizedRequest.body).toBe('test-body');
|
|
171
|
+
});
|
|
172
|
+
test('should be a getter that returns consistent function', () => {
|
|
173
|
+
const config = {
|
|
174
|
+
accessToken: 'consistent-token',
|
|
175
|
+
};
|
|
176
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
177
|
+
// Getting authorizer multiple times should return the same function behavior
|
|
178
|
+
const authorizer1 = mondoIdentity.authorizer;
|
|
179
|
+
const authorizer2 = mondoIdentity.authorizer;
|
|
180
|
+
const mockRequest1 = { method: 'GET' };
|
|
181
|
+
const mockRequest2 = { method: 'POST' };
|
|
182
|
+
const result1 = authorizer1(mockRequest1);
|
|
183
|
+
const result2 = authorizer2(mockRequest2);
|
|
184
|
+
const headers1 = result1.headers;
|
|
185
|
+
const headers2 = result2.headers;
|
|
186
|
+
expect(headers1.get('authorization')).toBe('consistent-token');
|
|
187
|
+
expect(headers2.get('authorization')).toBe('consistent-token');
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
describe('integration tests', () => {
|
|
191
|
+
test('should work with real-world configuration', () => {
|
|
192
|
+
const config = {
|
|
193
|
+
accessToken: 'prod_12345abcdef67890',
|
|
194
|
+
host: 'https://api.mondoidentity.com/v1',
|
|
195
|
+
};
|
|
196
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
197
|
+
const authorizer = mondoIdentity.authorizer;
|
|
198
|
+
// Test configuration
|
|
199
|
+
expect(mondoIdentity.config.accessToken).toBe('prod_12345abcdef67890');
|
|
200
|
+
expect(mondoIdentity.config.host).instanceOf(URL);
|
|
201
|
+
expect(mondoIdentity.config.host.toString()).toBe(config.host);
|
|
202
|
+
// Test authorization
|
|
203
|
+
const apiRequest = {
|
|
204
|
+
method: 'GET',
|
|
205
|
+
headers: {
|
|
206
|
+
accept: 'application/json',
|
|
207
|
+
'user-agent': 'mondo-identity-sdk/1.0.0',
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
const authorizedRequest = authorizer(apiRequest);
|
|
211
|
+
const headers = authorizedRequest.headers;
|
|
212
|
+
expect(headers.get('authorization')).toBe('prod_12345abcdef67890');
|
|
213
|
+
expect(headers.get('accept')).toBe('application/json');
|
|
214
|
+
expect(headers.get('user-agent')).toBe('mondo-identity-sdk/1.0.0');
|
|
215
|
+
});
|
|
216
|
+
test('should handle edge cases gracefully', () => {
|
|
217
|
+
const config = {
|
|
218
|
+
accessToken: 'edge-case-token-with-special-chars!@#$%^&*()',
|
|
219
|
+
host: 'https://localhost:3000',
|
|
220
|
+
};
|
|
221
|
+
const mondoIdentity = new MondoIdentity(config);
|
|
222
|
+
expect(() => {
|
|
223
|
+
const authorizer = mondoIdentity.authorizer;
|
|
224
|
+
const request = authorizer({ method: 'OPTIONS' });
|
|
225
|
+
const headers = request.headers;
|
|
226
|
+
headers.get('authorization');
|
|
227
|
+
}).not.toThrow();
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.test.d.ts","sourceRoot":"","sources":["../../../../src/common/resources/operations.test.ts"],"names":[],"mappings":""}
|