@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,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const utils_js_1 = require("./utils.js");
|
|
5
|
+
(0, vitest_1.describe)('Authentication Utils', () => {
|
|
6
|
+
(0, vitest_1.describe)('Model constants', () => {
|
|
7
|
+
(0, vitest_1.test)('should have correct Strategy model properties', () => {
|
|
8
|
+
(0, vitest_1.expect)(utils_js_1.Model.Strategy.UIDPrefix).toBe('stg');
|
|
9
|
+
(0, vitest_1.expect)(utils_js_1.Model.Strategy.TYPE).toBe('Strategy');
|
|
10
|
+
});
|
|
11
|
+
(0, vitest_1.test)('should have correct Session model properties', () => {
|
|
12
|
+
(0, vitest_1.expect)(utils_js_1.Model.Session.UIDPrefix).toBe('ssn');
|
|
13
|
+
(0, vitest_1.expect)(utils_js_1.Model.Session.TYPE).toBe('Session');
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.test)('should be readonly (const assertion)', () => {
|
|
16
|
+
// Test that the Model object is properly typed as const
|
|
17
|
+
(0, vitest_1.expect)(typeof utils_js_1.Model).toBe('object');
|
|
18
|
+
(0, vitest_1.expect)(Object.isFrozen(utils_js_1.Model)).toBe(false); // const assertion doesn't freeze at runtime
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
(0, vitest_1.describe)('generateStrategyId', () => {
|
|
22
|
+
(0, vitest_1.test)('should generate ID with correct prefix', () => {
|
|
23
|
+
const id = (0, utils_js_1.generateStrategyId)();
|
|
24
|
+
(0, vitest_1.expect)(id).toMatch(/^stg_/);
|
|
25
|
+
});
|
|
26
|
+
(0, vitest_1.test)('should generate ID with correct format', () => {
|
|
27
|
+
const id = (0, utils_js_1.generateStrategyId)();
|
|
28
|
+
// Should match: prefix + underscore + KSUID (27 characters)
|
|
29
|
+
(0, vitest_1.expect)(id).toMatch(/^stg_[A-Za-z0-9]{27}$/);
|
|
30
|
+
});
|
|
31
|
+
(0, vitest_1.test)('should generate unique IDs on multiple calls', () => {
|
|
32
|
+
const id1 = (0, utils_js_1.generateStrategyId)();
|
|
33
|
+
const id2 = (0, utils_js_1.generateStrategyId)();
|
|
34
|
+
const id3 = (0, utils_js_1.generateStrategyId)();
|
|
35
|
+
(0, vitest_1.expect)(id1).not.toBe(id2);
|
|
36
|
+
(0, vitest_1.expect)(id2).not.toBe(id3);
|
|
37
|
+
(0, vitest_1.expect)(id1).not.toBe(id3);
|
|
38
|
+
});
|
|
39
|
+
(0, vitest_1.test)('should generate IDs with correct total length', () => {
|
|
40
|
+
const id = (0, utils_js_1.generateStrategyId)();
|
|
41
|
+
// prefix (3) + underscore (1) + KSUID (27) = 31 characters
|
|
42
|
+
(0, vitest_1.expect)(id.length).toBe(31);
|
|
43
|
+
});
|
|
44
|
+
(0, vitest_1.test)('should generate IDs that start with strategy prefix', () => {
|
|
45
|
+
const ids = Array.from({ length: 10 }, () => (0, utils_js_1.generateStrategyId)());
|
|
46
|
+
for (const id of ids) {
|
|
47
|
+
(0, vitest_1.expect)(id.startsWith('stg_')).toBe(true);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.test)('should generate KSUID-compatible format', () => {
|
|
51
|
+
const id = (0, utils_js_1.generateStrategyId)();
|
|
52
|
+
const ksuidPart = id.substring(4); // Remove 'stg_'
|
|
53
|
+
// KSUID should be 27 characters of base62
|
|
54
|
+
(0, vitest_1.expect)(ksuidPart.length).toBe(27);
|
|
55
|
+
(0, vitest_1.expect)(ksuidPart).toMatch(/^[A-Za-z0-9]{27}$/);
|
|
56
|
+
});
|
|
57
|
+
(0, vitest_1.test)('should be deterministic in format but random in content', () => {
|
|
58
|
+
const ids = Array.from({ length: 100 }, () => (0, utils_js_1.generateStrategyId)());
|
|
59
|
+
// All should have same format
|
|
60
|
+
for (const id of ids) {
|
|
61
|
+
(0, vitest_1.expect)(id).toMatch(/^stg_[A-Za-z0-9]{27}$/);
|
|
62
|
+
}
|
|
63
|
+
// All should be unique
|
|
64
|
+
const uniqueIds = new Set(ids);
|
|
65
|
+
(0, vitest_1.expect)(uniqueIds.size).toBe(100);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
(0, vitest_1.describe)('generateSessionId', () => {
|
|
69
|
+
(0, vitest_1.test)('should generate ID with correct prefix', () => {
|
|
70
|
+
const id = (0, utils_js_1.generateSessionId)();
|
|
71
|
+
(0, vitest_1.expect)(id).toMatch(/^ssn_/);
|
|
72
|
+
});
|
|
73
|
+
(0, vitest_1.test)('should generate ID with correct format', () => {
|
|
74
|
+
const id = (0, utils_js_1.generateSessionId)();
|
|
75
|
+
// Should match: prefix + underscore + KSUID (27 characters)
|
|
76
|
+
(0, vitest_1.expect)(id).toMatch(/^ssn_[A-Za-z0-9]{27}$/);
|
|
77
|
+
});
|
|
78
|
+
(0, vitest_1.test)('should generate unique IDs on multiple calls', () => {
|
|
79
|
+
const id1 = (0, utils_js_1.generateSessionId)();
|
|
80
|
+
const id2 = (0, utils_js_1.generateSessionId)();
|
|
81
|
+
const id3 = (0, utils_js_1.generateSessionId)();
|
|
82
|
+
(0, vitest_1.expect)(id1).not.toBe(id2);
|
|
83
|
+
(0, vitest_1.expect)(id2).not.toBe(id3);
|
|
84
|
+
(0, vitest_1.expect)(id1).not.toBe(id3);
|
|
85
|
+
});
|
|
86
|
+
(0, vitest_1.test)('should generate IDs with correct total length', () => {
|
|
87
|
+
const id = (0, utils_js_1.generateSessionId)();
|
|
88
|
+
// prefix (3) + underscore (1) + KSUID (27) = 31 characters
|
|
89
|
+
(0, vitest_1.expect)(id.length).toBe(31);
|
|
90
|
+
});
|
|
91
|
+
(0, vitest_1.test)('should generate IDs that start with session prefix', () => {
|
|
92
|
+
const ids = Array.from({ length: 10 }, () => (0, utils_js_1.generateSessionId)());
|
|
93
|
+
for (const id of ids) {
|
|
94
|
+
(0, vitest_1.expect)(id.startsWith('ssn_')).toBe(true);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
(0, vitest_1.test)('should generate KSUID-compatible format', () => {
|
|
98
|
+
const id = (0, utils_js_1.generateSessionId)();
|
|
99
|
+
const ksuidPart = id.substring(4); // Remove 'ssn_'
|
|
100
|
+
// KSUID should be 27 characters of base62
|
|
101
|
+
(0, vitest_1.expect)(ksuidPart.length).toBe(27);
|
|
102
|
+
(0, vitest_1.expect)(ksuidPart).toMatch(/^[A-Za-z0-9]{27}$/);
|
|
103
|
+
});
|
|
104
|
+
(0, vitest_1.test)('should be deterministic in format but random in content', () => {
|
|
105
|
+
const ids = Array.from({ length: 100 }, () => (0, utils_js_1.generateSessionId)());
|
|
106
|
+
// All should have same format
|
|
107
|
+
for (const id of ids) {
|
|
108
|
+
(0, vitest_1.expect)(id).toMatch(/^ssn_[A-Za-z0-9]{27}$/);
|
|
109
|
+
}
|
|
110
|
+
// All should be unique
|
|
111
|
+
const uniqueIds = new Set(ids);
|
|
112
|
+
(0, vitest_1.expect)(uniqueIds.size).toBe(100);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
(0, vitest_1.describe)('ID generation comparison', () => {
|
|
116
|
+
(0, vitest_1.test)('should generate different formats for strategy vs session', () => {
|
|
117
|
+
const strategyId = (0, utils_js_1.generateStrategyId)();
|
|
118
|
+
const sessionId = (0, utils_js_1.generateSessionId)();
|
|
119
|
+
(0, vitest_1.expect)(strategyId.startsWith('stg_')).toBe(true);
|
|
120
|
+
(0, vitest_1.expect)(sessionId.startsWith('ssn_')).toBe(true);
|
|
121
|
+
(0, vitest_1.expect)(strategyId).not.toBe(sessionId);
|
|
122
|
+
});
|
|
123
|
+
(0, vitest_1.test)('should maintain format consistency across generators', () => {
|
|
124
|
+
const strategyIds = Array.from({ length: 10 }, () => (0, utils_js_1.generateStrategyId)());
|
|
125
|
+
const sessionIds = Array.from({ length: 10 }, () => (0, utils_js_1.generateSessionId)());
|
|
126
|
+
// All strategy IDs should have same prefix
|
|
127
|
+
for (const id of strategyIds) {
|
|
128
|
+
(0, vitest_1.expect)(id.startsWith('stg_')).toBe(true);
|
|
129
|
+
(0, vitest_1.expect)(id.length).toBe(31);
|
|
130
|
+
}
|
|
131
|
+
// All session IDs should have same prefix
|
|
132
|
+
for (const id of sessionIds) {
|
|
133
|
+
(0, vitest_1.expect)(id.startsWith('ssn_')).toBe(true);
|
|
134
|
+
(0, vitest_1.expect)(id.length).toBe(31);
|
|
135
|
+
}
|
|
136
|
+
// No overlap between the two sets
|
|
137
|
+
const allIds = [...strategyIds, ...sessionIds];
|
|
138
|
+
const uniqueIds = new Set(allIds);
|
|
139
|
+
(0, vitest_1.expect)(uniqueIds.size).toBe(20);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authorization/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AAGxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAElC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authorization/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AAGxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAElC,cAAc,aAAa,CAAC"}
|
|
@@ -20,4 +20,4 @@ __exportStar(require("./permissions/schema.js"), exports);
|
|
|
20
20
|
// Roles
|
|
21
21
|
__exportStar(require("./roles/resources.js"), exports);
|
|
22
22
|
__exportStar(require("./roles/schema.js"), exports);
|
|
23
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./schema.js"), exports);
|
|
@@ -3,7 +3,6 @@ export declare const PermissionStatus: {
|
|
|
3
3
|
readonly DISABLED: "disabled";
|
|
4
4
|
};
|
|
5
5
|
export type AnyPermissionStatus = (typeof PermissionStatus)[keyof typeof PermissionStatus];
|
|
6
|
-
export declare const PermissionIdSchema: import("arktype/out/methods/string.js").StringType<string, {}>;
|
|
7
6
|
export declare const PermissionIdPropertySchema: import("arktype/out/methods/object.js").ObjectType<{
|
|
8
7
|
id: string;
|
|
9
8
|
}, {}>;
|
|
@@ -30,7 +29,7 @@ export declare const PermissionSchema: import("arktype/out/methods/object.js").O
|
|
|
30
29
|
} | undefined;
|
|
31
30
|
deletedAt?: Date | ((In: string) => import("arktype/out/attributes.js").To<Date>) | undefined;
|
|
32
31
|
deactivatedAt?: Date | ((In: string) => import("arktype/out/attributes.js").To<Date>) | undefined;
|
|
33
|
-
metadata: (In: import("arktype/out/attributes.js").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean
|
|
32
|
+
metadata: (In: import("arktype/out/attributes.js").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean>>;
|
|
34
33
|
}, {}>;
|
|
35
34
|
export type PermissionProperties = typeof PermissionSchema.inferIn;
|
|
36
35
|
export type Permission = typeof PermissionSchema.inferOut;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/authorization/permissions/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/authorization/permissions/schema.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D,eAAO,MAAM,0BAA0B;;MAErC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,0BAA0B,CAAC,QAAQ,CAAC;AAO9E,eAAO,MAAM,4BAA4B;;;MAGvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAChC,OAAO,4BAA4B,CAAC,QAAQ,CAAC;AAQ/C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;MAOI,CAAC;AAClC,MAAM,MAAM,oBAAoB,GAAG,OAAO,gBAAgB,CAAC,OAAO,CAAC;AACnE,MAAM,MAAM,UAAU,GAAG,OAAO,gBAAgB,CAAC,QAAQ,CAAC;AAE1D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;MAOC,CAAC;AACtC,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;MAOC,CAAC;AAC5C,MAAM,MAAM,qBAAqB,GAC/B,OAAO,6BAA6B,CAAC,OAAO,CAAC;AAC/C,MAAM,MAAM,uBAAuB,GACjC,OAAO,6BAA6B,CAAC,QAAQ,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;MAIC,CAAC;AAC5C,MAAM,MAAM,qBAAqB,GAC/B,OAAO,6BAA6B,CAAC,OAAO,CAAC;AAC/C,MAAM,MAAM,uBAAuB,GACjC,OAAO,6BAA6B,CAAC,QAAQ,CAAC;AAEhD;;GAEG;AAEH,eAAO,MAAM,oCAAoC;;;;;MAK7C,CAAC;AACL,MAAM,MAAM,8BAA8B,GACxC,OAAO,oCAAoC,CAAC,QAAQ,CAAC"}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PermissionAssociationReferenceSchema = exports.UpdatePermissionPayloadSchema = exports.InsertPermissionPayloadSchema = exports.PermissionPayloadSchema = exports.PermissionSchema = exports.PermissionAssociationsSchema = exports.PermissionIdPropertySchema = exports.
|
|
3
|
+
exports.PermissionAssociationReferenceSchema = exports.UpdatePermissionPayloadSchema = exports.InsertPermissionPayloadSchema = exports.PermissionPayloadSchema = exports.PermissionSchema = exports.PermissionAssociationsSchema = exports.PermissionIdPropertySchema = exports.PermissionStatus = void 0;
|
|
4
4
|
const arktype_1 = require("arktype");
|
|
5
|
+
const schema_js_1 = require("../../app/schema.js");
|
|
5
6
|
const index_js_1 = require("../../common/index.js");
|
|
6
7
|
const aggregate_js_1 = require("../../common/schema/aggregate.js");
|
|
7
8
|
const metadata_js_1 = require("../../common/schema/metadata.js");
|
|
8
|
-
const
|
|
9
|
+
const schema_js_2 = require("../schema.js");
|
|
9
10
|
exports.PermissionStatus = {
|
|
10
11
|
ENABLED: 'enabled',
|
|
11
12
|
DISABLED: 'disabled',
|
|
12
13
|
};
|
|
13
|
-
exports.PermissionIdSchema = arktype_1.type.string;
|
|
14
14
|
exports.PermissionIdPropertySchema = (0, arktype_1.type)({
|
|
15
|
-
id:
|
|
15
|
+
id: schema_js_2.PermissionIdSchema,
|
|
16
16
|
});
|
|
17
17
|
const PermissionStatusSchema = arktype_1.type.enumerated(exports.PermissionStatus.ENABLED, exports.PermissionStatus.DISABLED);
|
|
18
|
-
const AssociationSchema = (0, arktype_1.type)('string[] | undefined');
|
|
19
18
|
exports.PermissionAssociationsSchema = (0, arktype_1.type)({
|
|
20
|
-
apps:
|
|
21
|
-
roles:
|
|
19
|
+
apps: schema_js_1.AppIdAssociationsSchema.optional(),
|
|
20
|
+
roles: schema_js_2.RoleIdAssociationsSchema.optional(),
|
|
22
21
|
});
|
|
23
22
|
const BaseSchema = exports.PermissionIdPropertySchema.and({
|
|
24
23
|
name: (0, arktype_1.type)('string'),
|
|
@@ -45,13 +44,13 @@ exports.PermissionPayloadSchema = BaseSchema.and({
|
|
|
45
44
|
* Insert
|
|
46
45
|
*/
|
|
47
46
|
exports.InsertPermissionPayloadSchema = (0, arktype_1.type)({
|
|
48
|
-
id:
|
|
47
|
+
id: schema_js_2.PermissionIdSchema.default(() => (0, schema_js_2.generatePermissionId)()),
|
|
49
48
|
name: (0, arktype_1.type)('string'),
|
|
50
49
|
status: PermissionStatusSchema.default(exports.PermissionStatus.ENABLED),
|
|
51
50
|
description: (0, arktype_1.type)('string').optional(),
|
|
52
51
|
})
|
|
53
52
|
.and(exports.PermissionAssociationsSchema)
|
|
54
|
-
.and(metadata_js_1.
|
|
53
|
+
.and(metadata_js_1.UpsertMetadataPropertyPayloadSchema);
|
|
55
54
|
/**
|
|
56
55
|
* Update
|
|
57
56
|
*/
|
|
@@ -59,7 +58,7 @@ exports.UpdatePermissionPayloadSchema = (0, arktype_1.type)({
|
|
|
59
58
|
name: (0, arktype_1.type)('string').optional(),
|
|
60
59
|
status: PermissionStatusSchema.optional(),
|
|
61
60
|
description: (0, arktype_1.type)('string').optional(),
|
|
62
|
-
}).and(metadata_js_1.
|
|
61
|
+
}).and(metadata_js_1.UpsertMetadataPropertyPayloadSchema);
|
|
63
62
|
/**
|
|
64
63
|
* Association
|
|
65
64
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../../src/authorization/permissions/schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const arktype_1 = require("arktype");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const utils_js_1 = require("../../app/utils.js");
|
|
6
|
+
const schema_js_1 = require("../schema.js");
|
|
7
|
+
const schema_js_2 = require("./schema.js");
|
|
8
|
+
(0, vitest_1.describe)('Authorization Permissions - Schema', () => {
|
|
9
|
+
(0, vitest_1.describe)('PermissionStatus constants', () => {
|
|
10
|
+
(0, vitest_1.test)('should have correct status values', () => {
|
|
11
|
+
(0, vitest_1.expect)(schema_js_2.PermissionStatus.ENABLED).toBe('enabled');
|
|
12
|
+
(0, vitest_1.expect)(schema_js_2.PermissionStatus.DISABLED).toBe('disabled');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.describe)('PermissionIdSchema', () => {
|
|
16
|
+
(0, vitest_1.test)('should accept valid string ID', () => {
|
|
17
|
+
const result = (0, schema_js_1.PermissionIdSchema)((0, schema_js_1.generatePermissionId)());
|
|
18
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
19
|
+
});
|
|
20
|
+
(0, vitest_1.test)('should reject non-string values', () => {
|
|
21
|
+
(0, vitest_1.expect)((0, schema_js_1.PermissionIdSchema)(123)).toBeInstanceOf(arktype_1.type.errors);
|
|
22
|
+
(0, vitest_1.expect)((0, schema_js_1.PermissionIdSchema)(null)).toBeInstanceOf(arktype_1.type.errors);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
(0, vitest_1.describe)('PermissionIdPropertySchema', () => {
|
|
26
|
+
(0, vitest_1.test)('should accept valid id property', () => {
|
|
27
|
+
const payload = { id: (0, schema_js_1.generatePermissionId)() };
|
|
28
|
+
const result = (0, schema_js_2.PermissionIdPropertySchema)(payload);
|
|
29
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
30
|
+
(0, vitest_1.expect)(result).toEqual({ id: payload.id });
|
|
31
|
+
});
|
|
32
|
+
(0, vitest_1.test)('should reject missing id', () => {
|
|
33
|
+
const result = (0, schema_js_2.PermissionIdPropertySchema)({});
|
|
34
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
(0, vitest_1.describe)('PermissionAssociationsSchema', () => {
|
|
38
|
+
const payload = {
|
|
39
|
+
apps: [(0, utils_js_1.generateAppId)(), (0, utils_js_1.generateAppId)()],
|
|
40
|
+
roles: [(0, schema_js_1.generateRoleId)(), (0, schema_js_1.generateRoleId)()],
|
|
41
|
+
};
|
|
42
|
+
(0, vitest_1.test)('should accept valid associations', () => {
|
|
43
|
+
const result = (0, schema_js_2.PermissionAssociationsSchema)(payload);
|
|
44
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
45
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
46
|
+
apps: payload.apps,
|
|
47
|
+
roles: payload.roles,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.test)('should accept optional associations', () => {
|
|
51
|
+
const result = (0, schema_js_2.PermissionAssociationsSchema)({});
|
|
52
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
53
|
+
(0, vitest_1.expect)(result).toEqual({});
|
|
54
|
+
});
|
|
55
|
+
(0, vitest_1.test)('should accept undefined associations', () => {
|
|
56
|
+
const result = (0, schema_js_2.PermissionAssociationsSchema)({
|
|
57
|
+
apps: undefined,
|
|
58
|
+
roles: [(0, schema_js_1.generateRoleId)()],
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
61
|
+
});
|
|
62
|
+
(0, vitest_1.test)('should reject non-array associations', () => {
|
|
63
|
+
const result = (0, schema_js_2.PermissionAssociationsSchema)({
|
|
64
|
+
apps: 'not-an-array',
|
|
65
|
+
});
|
|
66
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
(0, vitest_1.describe)('PermissionSchema', () => {
|
|
70
|
+
(0, vitest_1.test)('should accept complete permission object', () => {
|
|
71
|
+
const permission = {
|
|
72
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
73
|
+
name: 'read:users',
|
|
74
|
+
status: 'enabled',
|
|
75
|
+
description: 'Read user data',
|
|
76
|
+
apps: { ids: [(0, utils_js_1.generateAppId)()], count: 1 },
|
|
77
|
+
roles: { ids: [(0, schema_js_1.generateRoleId)()], count: 1 },
|
|
78
|
+
createdAt: new Date(),
|
|
79
|
+
updatedAt: new Date(),
|
|
80
|
+
metadata: { key: 'value' },
|
|
81
|
+
};
|
|
82
|
+
const result = (0, schema_js_2.PermissionSchema)(permission);
|
|
83
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
84
|
+
});
|
|
85
|
+
(0, vitest_1.test)('should accept minimal permission object', () => {
|
|
86
|
+
const permission = {
|
|
87
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
88
|
+
name: 'read:users',
|
|
89
|
+
status: 'enabled',
|
|
90
|
+
createdAt: new Date(),
|
|
91
|
+
updatedAt: new Date(),
|
|
92
|
+
metadata: {},
|
|
93
|
+
};
|
|
94
|
+
const result = (0, schema_js_2.PermissionSchema)(permission);
|
|
95
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
96
|
+
});
|
|
97
|
+
(0, vitest_1.test)('should reject invalid status', () => {
|
|
98
|
+
const permission = {
|
|
99
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
100
|
+
name: 'read:users',
|
|
101
|
+
status: 'invalid',
|
|
102
|
+
createdAt: new Date(),
|
|
103
|
+
updatedAt: new Date(),
|
|
104
|
+
metadata: {},
|
|
105
|
+
};
|
|
106
|
+
const result = (0, schema_js_2.PermissionSchema)(permission);
|
|
107
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
108
|
+
});
|
|
109
|
+
(0, vitest_1.test)('should reject missing required fields', () => {
|
|
110
|
+
const permission = {
|
|
111
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
112
|
+
name: 'read:users',
|
|
113
|
+
};
|
|
114
|
+
const result = (0, schema_js_2.PermissionSchema)(permission);
|
|
115
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
(0, vitest_1.describe)('InsertPermissionPayloadSchema', () => {
|
|
119
|
+
(0, vitest_1.test)('should accept complete insert payload', () => {
|
|
120
|
+
const payload = {
|
|
121
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
122
|
+
name: 'read:users',
|
|
123
|
+
status: 'enabled',
|
|
124
|
+
description: 'Read user data',
|
|
125
|
+
apps: [(0, utils_js_1.generateAppId)()],
|
|
126
|
+
roles: [(0, schema_js_1.generateRoleId)()],
|
|
127
|
+
metadata: { key: 'value' },
|
|
128
|
+
};
|
|
129
|
+
const result = (0, schema_js_2.InsertPermissionPayloadSchema)(payload);
|
|
130
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
131
|
+
});
|
|
132
|
+
(0, vitest_1.test)('should accept minimal insert payload', () => {
|
|
133
|
+
const payload = {
|
|
134
|
+
name: 'read:users',
|
|
135
|
+
};
|
|
136
|
+
const result = (0, schema_js_2.InsertPermissionPayloadSchema)(payload);
|
|
137
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
138
|
+
(0, vitest_1.expect)(result.status).toBe('enabled'); // default value
|
|
139
|
+
});
|
|
140
|
+
(0, vitest_1.test)('should generate default ID when not provided', () => {
|
|
141
|
+
const payload = { name: 'read:users' };
|
|
142
|
+
const result = (0, schema_js_2.InsertPermissionPayloadSchema)(payload);
|
|
143
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
144
|
+
(0, vitest_1.expect)(result.id).toMatch(/^per_/);
|
|
145
|
+
});
|
|
146
|
+
(0, vitest_1.test)('should reject missing name', () => {
|
|
147
|
+
const result = (0, schema_js_2.InsertPermissionPayloadSchema)({});
|
|
148
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
(0, vitest_1.describe)('UpdatePermissionPayloadSchema', () => {
|
|
152
|
+
(0, vitest_1.test)('should accept all optional fields', () => {
|
|
153
|
+
const payload = {
|
|
154
|
+
name: 'updated:permission',
|
|
155
|
+
status: 'disabled',
|
|
156
|
+
description: 'Updated description',
|
|
157
|
+
metadata: { updated: true },
|
|
158
|
+
};
|
|
159
|
+
const result = (0, schema_js_2.UpdatePermissionPayloadSchema)(payload);
|
|
160
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
161
|
+
(0, vitest_1.expect)(result).toEqual(payload);
|
|
162
|
+
});
|
|
163
|
+
(0, vitest_1.test)('should accept empty update payload', () => {
|
|
164
|
+
const result = (0, schema_js_2.UpdatePermissionPayloadSchema)({});
|
|
165
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
166
|
+
(0, vitest_1.expect)(result).toEqual({});
|
|
167
|
+
});
|
|
168
|
+
(0, vitest_1.test)('should accept partial updates', () => {
|
|
169
|
+
const payload = { name: 'new:name' };
|
|
170
|
+
const result = (0, schema_js_2.UpdatePermissionPayloadSchema)(payload);
|
|
171
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
172
|
+
(0, vitest_1.expect)(result).toEqual(payload);
|
|
173
|
+
});
|
|
174
|
+
(0, vitest_1.test)('should reject invalid status', () => {
|
|
175
|
+
const payload = { status: 'invalid-status' };
|
|
176
|
+
const result = (0, schema_js_2.UpdatePermissionPayloadSchema)(payload);
|
|
177
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
(0, vitest_1.describe)('PermissionAssociationReferenceSchema', () => {
|
|
181
|
+
(0, vitest_1.test)('should accept complete association reference', () => {
|
|
182
|
+
const reference = {
|
|
183
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
184
|
+
name: 'read:users',
|
|
185
|
+
status: 'enabled',
|
|
186
|
+
model: 'Permission',
|
|
187
|
+
};
|
|
188
|
+
const result = (0, schema_js_2.PermissionAssociationReferenceSchema)(reference);
|
|
189
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
190
|
+
(0, vitest_1.expect)(result).toEqual(reference);
|
|
191
|
+
});
|
|
192
|
+
(0, vitest_1.test)('should use default status when not provided', () => {
|
|
193
|
+
const reference = {
|
|
194
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
195
|
+
name: 'read:users',
|
|
196
|
+
model: 'Permission',
|
|
197
|
+
};
|
|
198
|
+
const result = (0, schema_js_2.PermissionAssociationReferenceSchema)(reference);
|
|
199
|
+
(0, vitest_1.expect)(result).not.toBeInstanceOf(arktype_1.type.errors);
|
|
200
|
+
(0, vitest_1.expect)(result.status).toBe('disabled'); // default value
|
|
201
|
+
});
|
|
202
|
+
(0, vitest_1.test)('should reject missing required fields', () => {
|
|
203
|
+
const reference = { id: (0, schema_js_1.generatePermissionId)() };
|
|
204
|
+
const result = (0, schema_js_2.PermissionAssociationReferenceSchema)(reference);
|
|
205
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
206
|
+
});
|
|
207
|
+
(0, vitest_1.test)('should reject invalid model value', () => {
|
|
208
|
+
const reference = {
|
|
209
|
+
id: (0, schema_js_1.generatePermissionId)(),
|
|
210
|
+
name: 'read:users',
|
|
211
|
+
model: 'InvalidModel',
|
|
212
|
+
};
|
|
213
|
+
const result = (0, schema_js_2.PermissionAssociationReferenceSchema)(reference);
|
|
214
|
+
(0, vitest_1.expect)(result).toBeInstanceOf(arktype_1.type.errors);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
});
|
|
@@ -34,7 +34,7 @@ export declare const RoleSchema: import("arktype/out/methods/object.js").ObjectT
|
|
|
34
34
|
updatedAt: Date | ((In: string) => import("arktype/out/attributes.js").To<Date>);
|
|
35
35
|
deletedAt?: Date | ((In: string) => import("arktype/out/attributes.js").To<Date>) | undefined;
|
|
36
36
|
deactivatedAt?: Date | ((In: string) => import("arktype/out/attributes.js").To<Date>) | undefined;
|
|
37
|
-
metadata: (In: import("arktype/out/attributes.js").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean
|
|
37
|
+
metadata: (In: import("arktype/out/attributes.js").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean>>;
|
|
38
38
|
}, {}>;
|
|
39
39
|
export type RoleProperties = typeof RoleSchema.inferIn;
|
|
40
40
|
export type Role = typeof RoleSchema.inferOut;
|
|
@@ -81,7 +81,7 @@ export declare const InsertRolePayloadSchema: import("arktype/out/methods/object
|
|
|
81
81
|
[x: string]: string | number | boolean;
|
|
82
82
|
} | Map<string, string | number | boolean> | null | undefined) => import("arktype").Out<{
|
|
83
83
|
[x: string]: string | number | boolean;
|
|
84
|
-
} |
|
|
84
|
+
} | null>) | undefined;
|
|
85
85
|
}, {}>;
|
|
86
86
|
export type InsertRoleInput = typeof InsertRolePayloadSchema.inferIn;
|
|
87
87
|
export type InsertRolePayload = typeof InsertRolePayloadSchema.inferOut;
|
|
@@ -96,7 +96,7 @@ export declare const UpdateRolePayloadSchema: import("arktype/out/methods/object
|
|
|
96
96
|
[x: string]: string | number | boolean;
|
|
97
97
|
} | Map<string, string | number | boolean> | null | undefined) => import("arktype").Out<{
|
|
98
98
|
[x: string]: string | number | boolean;
|
|
99
|
-
} |
|
|
99
|
+
} | null>) | undefined;
|
|
100
100
|
}, {}>;
|
|
101
101
|
export type UpdateRoleInput = typeof UpdateRolePayloadSchema.inferIn;
|
|
102
102
|
export type UpdateRolePayload = typeof UpdateRolePayloadSchema.inferOut;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/schema.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEzE,eAAO,MAAM,oBAAoB;;MAE/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,oBAAoB,CAAC,QAAQ,CAAC;AAIlE,eAAO,MAAM,sBAAsB;;;;MAIjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,sBAAsB,CAAC,QAAQ,CAAC;AAWtE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;MAOU,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;;;;;;;;;;;;;;;;;;;;;;;;;;MAOO,CAAC;AACtC,MAAM,MAAM,WAAW,GAAG,OAAO,iBAAiB,CAAC,QAAQ,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;MAOO,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,uBAAuB,CAAC,OAAO,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE;;GAEG;AACH,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;AACH,eAAO,MAAM,8BAA8B;;;;;MAIzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAClC,OAAO,8BAA8B,CAAC,QAAQ,CAAC"}
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RoleAssociationReferenceSchema = exports.UpdateRolePayloadSchema = exports.InsertRolePayloadSchema = exports.RolePayloadSchema = exports.RoleSchema = exports.RoleAssociationsSchema = exports.RoleIdPropertySchema = exports.RoleStatus = void 0;
|
|
4
4
|
const arktype_1 = require("arktype");
|
|
5
|
+
const schema_js_1 = require("../../app/schema.js");
|
|
5
6
|
const index_js_1 = require("../../common/index.js");
|
|
6
7
|
const aggregate_js_1 = require("../../common/schema/aggregate.js");
|
|
7
8
|
const metadata_js_1 = require("../../common/schema/metadata.js");
|
|
8
|
-
const
|
|
9
|
+
const schema_js_2 = require("../../customer/schema.js");
|
|
10
|
+
const schema_js_3 = require("../schema.js");
|
|
9
11
|
exports.RoleStatus = {
|
|
10
12
|
ENABLED: 'enabled',
|
|
11
13
|
DISABLED: 'disabled',
|
|
12
14
|
};
|
|
13
|
-
const RoleIdSchema = arktype_1.type.string;
|
|
14
15
|
exports.RoleIdPropertySchema = (0, arktype_1.type)({
|
|
15
|
-
id: RoleIdSchema,
|
|
16
|
+
id: schema_js_3.RoleIdSchema,
|
|
16
17
|
});
|
|
17
18
|
const StatusSchema = arktype_1.type.enumerated(exports.RoleStatus.ENABLED, exports.RoleStatus.DISABLED);
|
|
18
|
-
const AssociationSchema = (0, arktype_1.type)('string[] | undefined');
|
|
19
19
|
exports.RoleAssociationsSchema = (0, arktype_1.type)({
|
|
20
|
-
apps:
|
|
21
|
-
permissions:
|
|
22
|
-
users:
|
|
20
|
+
apps: schema_js_1.AppIdAssociationsSchema.optional(),
|
|
21
|
+
permissions: schema_js_3.PermissionIdAssociationsSchema.optional(),
|
|
22
|
+
users: schema_js_2.UserIdAssociationsSchema.optional(),
|
|
23
23
|
});
|
|
24
24
|
const BaseSchema = exports.RoleIdPropertySchema.and({
|
|
25
25
|
name: (0, arktype_1.type)('string'),
|
|
@@ -49,13 +49,13 @@ exports.RolePayloadSchema = BaseSchema.and({
|
|
|
49
49
|
* Insert
|
|
50
50
|
*/
|
|
51
51
|
exports.InsertRolePayloadSchema = (0, arktype_1.type)({
|
|
52
|
-
id: RoleIdSchema.default(() => (0,
|
|
52
|
+
id: schema_js_3.RoleIdSchema.default(() => (0, schema_js_3.generateRoleId)()),
|
|
53
53
|
name: (0, arktype_1.type)('string'),
|
|
54
54
|
status: StatusSchema.default(exports.RoleStatus.ENABLED),
|
|
55
55
|
description: (0, arktype_1.type)('string').optional(),
|
|
56
56
|
})
|
|
57
57
|
.and(exports.RoleAssociationsSchema)
|
|
58
|
-
.and(metadata_js_1.
|
|
58
|
+
.and(metadata_js_1.UpsertMetadataPropertyPayloadSchema);
|
|
59
59
|
/**
|
|
60
60
|
* Update
|
|
61
61
|
*/
|
|
@@ -63,7 +63,7 @@ exports.UpdateRolePayloadSchema = (0, arktype_1.type)({
|
|
|
63
63
|
name: (0, arktype_1.type)('string').optional(),
|
|
64
64
|
status: StatusSchema.optional(),
|
|
65
65
|
description: (0, arktype_1.type)('string').optional(),
|
|
66
|
-
}).and(metadata_js_1.
|
|
66
|
+
}).and(metadata_js_1.UpsertMetadataPropertyPayloadSchema);
|
|
67
67
|
/**
|
|
68
68
|
* Association
|
|
69
69
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/schema.test.ts"],"names":[],"mappings":""}
|