@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,253 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
2
|
+
import { AppResources } from './resources.js';
|
|
3
|
+
describe('App Resources', () => {
|
|
4
|
+
let mockInstance;
|
|
5
|
+
let appResources;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
vi.clearAllMocks();
|
|
8
|
+
// Mock MondoIdentity instance
|
|
9
|
+
mockInstance = {
|
|
10
|
+
config: {
|
|
11
|
+
host: 'https://api.example.com',
|
|
12
|
+
accessToken: 'test-token',
|
|
13
|
+
},
|
|
14
|
+
authorizer: vi.fn((req) => req),
|
|
15
|
+
};
|
|
16
|
+
appResources = new AppResources(mockInstance);
|
|
17
|
+
});
|
|
18
|
+
describe('AppResources class', () => {
|
|
19
|
+
test('should initialize with MondoIdentity instance', () => {
|
|
20
|
+
expect(appResources).toBeInstanceOf(AppResources);
|
|
21
|
+
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
|
22
|
+
expect(appResources['instance']).toBe(mockInstance);
|
|
23
|
+
});
|
|
24
|
+
describe('buildPath static method', () => {
|
|
25
|
+
test('should build path without ID', () => {
|
|
26
|
+
const path = AppResources.buildPath();
|
|
27
|
+
expect(path).toBe('/v1/apps');
|
|
28
|
+
});
|
|
29
|
+
test('should build path with app ID', () => {
|
|
30
|
+
const path = AppResources.buildPath('app_123');
|
|
31
|
+
expect(path).toBe('/v1/apps/app_123');
|
|
32
|
+
});
|
|
33
|
+
test('should return existing path if ID already starts with /v1/apps', () => {
|
|
34
|
+
const existingPath = '/v1/apps/app_456/custom/path';
|
|
35
|
+
const path = AppResources.buildPath(existingPath);
|
|
36
|
+
expect(path).toBe(existingPath);
|
|
37
|
+
});
|
|
38
|
+
test('should handle empty ID', () => {
|
|
39
|
+
const path = AppResources.buildPath('');
|
|
40
|
+
expect(path).toBe('/v1/apps');
|
|
41
|
+
});
|
|
42
|
+
test('should handle undefined ID', () => {
|
|
43
|
+
const path = AppResources.buildPath(undefined);
|
|
44
|
+
expect(path).toBe('/v1/apps');
|
|
45
|
+
});
|
|
46
|
+
test('should filter out falsy values correctly', () => {
|
|
47
|
+
const path = AppResources.buildPath('app_789');
|
|
48
|
+
expect(path).toBe('/v1/apps/app_789');
|
|
49
|
+
});
|
|
50
|
+
test('should handle various app ID patterns', () => {
|
|
51
|
+
const testCases = [
|
|
52
|
+
{ input: 'app_12345', expected: '/v1/apps/app_12345' },
|
|
53
|
+
{ input: 'app_production', expected: '/v1/apps/app_production' },
|
|
54
|
+
{ input: 'app_test_env', expected: '/v1/apps/app_test_env' },
|
|
55
|
+
{ input: '/v1/apps/existing', expected: '/v1/apps/existing' },
|
|
56
|
+
{ input: '/v1/apps/nested/path', expected: '/v1/apps/nested/path' },
|
|
57
|
+
];
|
|
58
|
+
for (const { input, expected } of testCases) {
|
|
59
|
+
expect(AppResources.buildPath(input)).toBe(expected);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('method signatures', () => {
|
|
64
|
+
test('should have listItems method', () => {
|
|
65
|
+
expect(typeof appResources.listItems).toBe('function');
|
|
66
|
+
expect(appResources.listItems.length).toBe(1); // optional pagination parameter
|
|
67
|
+
});
|
|
68
|
+
test('should have getItem method', () => {
|
|
69
|
+
expect(typeof appResources.getItem).toBe('function');
|
|
70
|
+
expect(appResources.getItem.length).toBe(1); // id parameter
|
|
71
|
+
});
|
|
72
|
+
test('should have insertItem method', () => {
|
|
73
|
+
expect(typeof appResources.insertItem).toBe('function');
|
|
74
|
+
expect(appResources.insertItem.length).toBe(1); // item parameter
|
|
75
|
+
});
|
|
76
|
+
test('should have updateItem method', () => {
|
|
77
|
+
expect(typeof appResources.updateItem).toBe('function');
|
|
78
|
+
expect(appResources.updateItem.length).toBe(2); // id and item parameters
|
|
79
|
+
});
|
|
80
|
+
test('should have deleteItem method', () => {
|
|
81
|
+
expect(typeof appResources.deleteItem).toBe('function');
|
|
82
|
+
expect(appResources.deleteItem.length).toBe(1); // id parameter
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe('PATH constant', () => {
|
|
87
|
+
test('should export correct PATH constant', async () => {
|
|
88
|
+
const { PATH } = await import('./resources.js');
|
|
89
|
+
expect(PATH).toBe('/v1/apps');
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
describe('URL building scenarios', () => {
|
|
93
|
+
test('should create proper URL structure for different app types', () => {
|
|
94
|
+
const scenarios = [
|
|
95
|
+
{ appId: 'app_web_frontend', expected: '/v1/apps/app_web_frontend' },
|
|
96
|
+
{ appId: 'app_mobile_ios', expected: '/v1/apps/app_mobile_ios' },
|
|
97
|
+
{ appId: 'app_api_gateway', expected: '/v1/apps/app_api_gateway' },
|
|
98
|
+
{
|
|
99
|
+
appId: 'app_background_worker',
|
|
100
|
+
expected: '/v1/apps/app_background_worker',
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
for (const { appId, expected } of scenarios) {
|
|
104
|
+
const result = AppResources.buildPath(appId);
|
|
105
|
+
expect(result).toBe(expected);
|
|
106
|
+
expect(result).toMatch(/^\/v1\/apps\//);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
test('should handle edge cases in path building', () => {
|
|
110
|
+
// Test with already formatted paths
|
|
111
|
+
expect(AppResources.buildPath('/v1/apps/already/formatted')).toBe('/v1/apps/already/formatted');
|
|
112
|
+
// Test with empty string
|
|
113
|
+
expect(AppResources.buildPath('')).toBe('/v1/apps');
|
|
114
|
+
// Test with undefined
|
|
115
|
+
expect(AppResources.buildPath(undefined)).toBe('/v1/apps');
|
|
116
|
+
// Test with null
|
|
117
|
+
expect(AppResources.buildPath(null)).toBe('/v1/apps');
|
|
118
|
+
// Test with single character
|
|
119
|
+
expect(AppResources.buildPath('a')).toBe('/v1/apps/a');
|
|
120
|
+
});
|
|
121
|
+
test('should create valid URL paths for various app environments', () => {
|
|
122
|
+
const environments = [
|
|
123
|
+
'app_development',
|
|
124
|
+
'app_staging',
|
|
125
|
+
'app_production',
|
|
126
|
+
'app_testing',
|
|
127
|
+
'app_sandbox',
|
|
128
|
+
];
|
|
129
|
+
for (const env of environments) {
|
|
130
|
+
const path = AppResources.buildPath(env);
|
|
131
|
+
expect(path).toBe(`/v1/apps/${env}`);
|
|
132
|
+
expect(path).toMatch(/^\/v1\/apps\/app_[a-z]+$/);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('Integration with MondoIdentity instance', () => {
|
|
137
|
+
test('should store MondoIdentity instance internally', () => {
|
|
138
|
+
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
|
139
|
+
const internalInstance = appResources['instance'];
|
|
140
|
+
expect(internalInstance).toBe(mockInstance);
|
|
141
|
+
expect(internalInstance.config.host).toBe('https://api.example.com');
|
|
142
|
+
expect(internalInstance.config.accessToken).toBe('test-token');
|
|
143
|
+
});
|
|
144
|
+
test('should maintain reference to authorizer function', () => {
|
|
145
|
+
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
|
146
|
+
const internalInstance = appResources['instance'];
|
|
147
|
+
expect(typeof internalInstance.authorizer).toBe('function');
|
|
148
|
+
expect(internalInstance.authorizer).toBe(mockInstance.authorizer);
|
|
149
|
+
});
|
|
150
|
+
test('should work with different MondoIdentity configurations', () => {
|
|
151
|
+
const customInstance = {
|
|
152
|
+
config: {
|
|
153
|
+
host: 'https://custom-apps.api.com',
|
|
154
|
+
accessToken: 'custom-app-token',
|
|
155
|
+
},
|
|
156
|
+
authorizer: vi.fn(),
|
|
157
|
+
};
|
|
158
|
+
const customResources = new AppResources(customInstance);
|
|
159
|
+
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
|
160
|
+
expect(customResources['instance']).toBe(customInstance);
|
|
161
|
+
// biome-ignore lint/complexity/useLiteralKeys: <explanation>
|
|
162
|
+
expect(customResources['instance'].config.host).toBe('https://custom-apps.api.com');
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
describe('Class structure and inheritance', () => {
|
|
166
|
+
test('should have proper class structure', () => {
|
|
167
|
+
expect(AppResources).toBeDefined();
|
|
168
|
+
expect(typeof AppResources).toBe('function');
|
|
169
|
+
expect(AppResources.prototype.constructor).toBe(AppResources);
|
|
170
|
+
});
|
|
171
|
+
test('should have static buildPath method', () => {
|
|
172
|
+
expect(typeof AppResources.buildPath).toBe('function');
|
|
173
|
+
expect(AppResources.buildPath).toBeDefined();
|
|
174
|
+
});
|
|
175
|
+
test('should have all CRUD instance methods', () => {
|
|
176
|
+
const methods = [
|
|
177
|
+
'listItems',
|
|
178
|
+
'getItem',
|
|
179
|
+
'insertItem',
|
|
180
|
+
'updateItem',
|
|
181
|
+
'deleteItem',
|
|
182
|
+
];
|
|
183
|
+
for (const methodName of methods) {
|
|
184
|
+
expect(typeof appResources[methodName]).toBe('function');
|
|
185
|
+
expect(appResources[methodName]).toBeDefined();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
test('should maintain method binding', () => {
|
|
189
|
+
const { listItems, getItem, insertItem, updateItem, deleteItem } = appResources;
|
|
190
|
+
expect(typeof listItems).toBe('function');
|
|
191
|
+
expect(typeof getItem).toBe('function');
|
|
192
|
+
expect(typeof insertItem).toBe('function');
|
|
193
|
+
expect(typeof updateItem).toBe('function');
|
|
194
|
+
expect(typeof deleteItem).toBe('function');
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
describe('CRUD operation method signatures', () => {
|
|
198
|
+
test('should have correct parameter counts for each method', () => {
|
|
199
|
+
// listItems(pagination?: Pagination)
|
|
200
|
+
expect(appResources.listItems.length).toBe(1);
|
|
201
|
+
// getItem(id: string)
|
|
202
|
+
expect(appResources.getItem.length).toBe(1);
|
|
203
|
+
// insertItem(item: InsertAppInput)
|
|
204
|
+
expect(appResources.insertItem.length).toBe(1);
|
|
205
|
+
// updateItem(id: string, item: UpdateAppInput)
|
|
206
|
+
expect(appResources.updateItem.length).toBe(2);
|
|
207
|
+
// deleteItem(id: string)
|
|
208
|
+
expect(appResources.deleteItem.length).toBe(1);
|
|
209
|
+
});
|
|
210
|
+
test('should support full CRUD workflow pattern', () => {
|
|
211
|
+
// This test verifies the class provides a complete CRUD interface
|
|
212
|
+
// without actually calling the methods (which would require complex mocking)
|
|
213
|
+
const crudMethods = {
|
|
214
|
+
create: 'insertItem',
|
|
215
|
+
read: ['listItems', 'getItem'],
|
|
216
|
+
update: 'updateItem',
|
|
217
|
+
delete: 'deleteItem',
|
|
218
|
+
};
|
|
219
|
+
// Create operation
|
|
220
|
+
expect(appResources).toHaveProperty(crudMethods.create);
|
|
221
|
+
// Read operations
|
|
222
|
+
for (const method of crudMethods.read) {
|
|
223
|
+
expect(appResources).toHaveProperty(method);
|
|
224
|
+
}
|
|
225
|
+
// Update operation
|
|
226
|
+
expect(appResources).toHaveProperty(crudMethods.update);
|
|
227
|
+
// Delete operation
|
|
228
|
+
expect(appResources).toHaveProperty(crudMethods.delete);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
describe('Path filtering and validation', () => {
|
|
232
|
+
test('should properly filter out falsy values in path construction', () => {
|
|
233
|
+
const falsyValues = [null, undefined, ''];
|
|
234
|
+
for (const value of falsyValues) {
|
|
235
|
+
const path = AppResources.buildPath(value);
|
|
236
|
+
expect(path).toBe('/v1/apps');
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
test('should handle complex app ID formats', () => {
|
|
240
|
+
const complexIds = [
|
|
241
|
+
'app_complex-name_123',
|
|
242
|
+
'app_with.dots',
|
|
243
|
+
'app_with_multiple_underscores',
|
|
244
|
+
'app-with-dashes',
|
|
245
|
+
'app123numbers',
|
|
246
|
+
];
|
|
247
|
+
for (const id of complexIds) {
|
|
248
|
+
const path = AppResources.buildPath(id);
|
|
249
|
+
expect(path).toBe(`/v1/apps/${id}`);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
});
|
|
@@ -2,7 +2,7 @@ export declare const SAMLSchema: import("arktype/internal/methods/object.ts").Ob
|
|
|
2
2
|
updatedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
3
3
|
deletedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
4
4
|
deactivatedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
5
|
-
metadata: (In: import("arktype/internal/attributes.ts").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean
|
|
5
|
+
metadata: (In: import("arktype/internal/attributes.ts").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean>>;
|
|
6
6
|
}, {}>;
|
|
7
7
|
export type SAMLProperties = typeof SAMLSchema.inferIn;
|
|
8
8
|
export type SAML = typeof SAMLSchema.inferOut;
|
|
@@ -22,7 +22,7 @@ export declare const InsertSAMLPayloadSchema: import("arktype").BaseType<{
|
|
|
22
22
|
[x: string]: string | number | boolean;
|
|
23
23
|
} | Map<string, string | number | boolean> | null | undefined) => import("arktype").Out<{
|
|
24
24
|
[x: string]: string | number | boolean;
|
|
25
|
-
} |
|
|
25
|
+
} | null>) | undefined;
|
|
26
26
|
} | undefined, {}>;
|
|
27
27
|
export type InsertSAMLInput = typeof InsertSAMLPayloadSchema.inferIn;
|
|
28
28
|
export type InsertSAMLPayload = typeof InsertSAMLPayloadSchema.inferOut;
|
|
@@ -31,7 +31,7 @@ export declare const UpdateSAMLPayloadSchema: import("arktype/internal/methods/o
|
|
|
31
31
|
[x: string]: string | number | boolean;
|
|
32
32
|
} | Map<string, string | number | boolean> | null | undefined) => import("arktype").Out<{
|
|
33
33
|
[x: string]: string | number | boolean;
|
|
34
|
-
} |
|
|
34
|
+
} | null>) | undefined;
|
|
35
35
|
}, {}>;
|
|
36
36
|
export type UpdateSAMLInput = typeof InsertSAMLPayloadSchema.inferIn;
|
|
37
37
|
export type UpdateSAMLPayload = typeof InsertSAMLPayloadSchema.inferOut;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/app/saml/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/app/saml/schema.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU;;;;;MAIU,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;;;;;;;;;MAIO,CAAC;AACtC,MAAM,MAAM,WAAW,GAAG,OAAO,iBAAiB,CAAC,QAAQ,CAAC;AAE5D,eAAO,MAAM,uBAAuB;;;;;;kBACiB,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,OAAO,uBAAuB,CAAC,OAAO,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC;AAExE,eAAO,MAAM,uBAAuB;;;;;;MAAsC,CAAC;AAC3E,MAAM,MAAM,eAAe,GAAG,OAAO,uBAAuB,CAAC,OAAO,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,QAAQ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type } from 'arktype';
|
|
2
2
|
import { OptionalDatePayloadSchema, OptionalDateSchema, } from '../../common/schema/dates.js';
|
|
3
|
-
import { MetadataMapPropertySchema, MetadataPayloadPropertySchema, } from '../../common/schema/metadata.js';
|
|
3
|
+
import { MetadataMapPropertySchema, MetadataPayloadPropertySchema, UpsertMetadataPropertyPayloadSchema, } from '../../common/schema/metadata.js';
|
|
4
4
|
export const SAMLSchema = type({
|
|
5
5
|
'updatedAt?': OptionalDateSchema,
|
|
6
6
|
'deletedAt?': OptionalDateSchema,
|
|
@@ -11,5 +11,5 @@ export const SAMLPayloadSchema = type({
|
|
|
11
11
|
'deletedAt?': OptionalDatePayloadSchema,
|
|
12
12
|
'deactivatedAt?': OptionalDatePayloadSchema,
|
|
13
13
|
}).and(MetadataPayloadPropertySchema);
|
|
14
|
-
export const InsertSAMLPayloadSchema =
|
|
15
|
-
export const UpdateSAMLPayloadSchema =
|
|
14
|
+
export const InsertSAMLPayloadSchema = UpsertMetadataPropertyPayloadSchema.or('undefined');
|
|
15
|
+
export const UpdateSAMLPayloadSchema = UpsertMetadataPropertyPayloadSchema;
|
package/dist/esm/app/schema.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const AppSchema: import("arktype/internal/methods/object.ts").Obj
|
|
|
18
18
|
updatedAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
|
|
19
19
|
deletedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
20
20
|
deactivatedAt?: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>) | undefined;
|
|
21
|
-
metadata: (In: import("arktype/internal/attributes.ts").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean
|
|
21
|
+
metadata: (In: import("arktype/internal/attributes.ts").Default<unknown, Map<string, string | number | boolean>>) => import("arktype").Out<Map<string, string | number | boolean>>;
|
|
22
22
|
}, {}>;
|
|
23
23
|
export type AppProperties = typeof AppSchema.inferIn;
|
|
24
24
|
export type App = typeof AppSchema.inferOut;
|
|
@@ -63,6 +63,10 @@ export declare const UpdateAppPayloadSchema: import("arktype/internal/methods/ob
|
|
|
63
63
|
}, {}>;
|
|
64
64
|
export type UpdateAppInput = typeof UpdateAppPayloadSchema.inferIn;
|
|
65
65
|
export type UpdateAppPayload = typeof UpdateAppPayloadSchema.inferOut;
|
|
66
|
+
/**
|
|
67
|
+
* Association
|
|
68
|
+
*/
|
|
69
|
+
export declare const AppIdAssociationsSchema: import("arktype").BaseType<string[] | undefined, {}>;
|
|
66
70
|
export declare const AppAssociationReferenceSchema: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
67
71
|
id: string;
|
|
68
72
|
status: import("arktype/internal/attributes.ts").Default<"enabled" | "disabled", "disabled">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/app/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/app/schema.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,SAAS;;;CAGZ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEtE,eAAO,MAAM,WAAW,qEAAmC,CAAC;AAC5D,MAAM,MAAM,KAAK,GAAG,OAAO,WAAW,CAAC,QAAQ,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;MAE9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,mBAAmB,CAAC,QAAQ,CAAC;AAUhE,eAAO,MAAM,SAAS;;;;;;;;;;MAKW,CAAC;AAClC,MAAM,MAAM,aAAa,GAAG,OAAO,SAAS,CAAC,OAAO,CAAC;AACrD,MAAM,MAAM,GAAG,GAAG,OAAO,SAAS,CAAC,QAAQ,CAAC;AAE5C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;MAOQ,CAAC;AACtC,MAAM,MAAM,UAAU,GAAG,OAAO,gBAAgB,CAAC,QAAQ,CAAC;AAE1D,eAAO,MAAM,sBAAsB;;;;;;;;;;MAKE,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG,OAAO,sBAAsB,CAAC,OAAO,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,OAAO,sBAAsB,CAAC,QAAQ,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;;;;MAIE,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG,OAAO,sBAAsB,CAAC,OAAO,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,OAAO,sBAAsB,CAAC,QAAQ,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,uBAAuB,sDAEnC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;MAMzC,CAAC;AACF,MAAM,MAAM,uBAAuB,GACjC,OAAO,6BAA6B,CAAC,QAAQ,CAAC"}
|
package/dist/esm/app/schema.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type } from 'arktype';
|
|
2
2
|
import { OptionalDatePayloadSchema, OptionalDateSchema, RequiredDatePayloadSchema, RequiredDateSchema, } from '../common/index.js';
|
|
3
|
+
import { KSUIDSchema } from '../common/schema/id.js';
|
|
3
4
|
import { MetadataMapPropertySchema, MetadataPayloadPropertySchema, } from '../common/schema/metadata.js';
|
|
4
|
-
import { generateAppId } from './utils.js';
|
|
5
|
+
import { Model, generateAppId } from './utils.js';
|
|
5
6
|
export const AppStatus = {
|
|
6
7
|
ENABLED: 'enabled',
|
|
7
8
|
DISABLED: 'disabled',
|
|
8
9
|
};
|
|
9
|
-
export const AppIdSchema =
|
|
10
|
+
export const AppIdSchema = KSUIDSchema(Model.App.UIDPrefix);
|
|
10
11
|
export const AppIdPropertySchema = type({
|
|
11
12
|
id: AppIdSchema,
|
|
12
13
|
});
|
|
@@ -41,6 +42,10 @@ export const UpdateAppPayloadSchema = type({
|
|
|
41
42
|
label: type('string').or(type.null).optional(),
|
|
42
43
|
description: type('string').or(type.null).optional(),
|
|
43
44
|
}).and(MetadataPayloadPropertySchema);
|
|
45
|
+
/**
|
|
46
|
+
* Association
|
|
47
|
+
*/
|
|
48
|
+
export const AppIdAssociationsSchema = type('undefined').or(AppIdSchema.array());
|
|
44
49
|
export const AppAssociationReferenceSchema = AppIdPropertySchema.and(type({
|
|
45
50
|
status: StatusSchema.default('disabled'),
|
|
46
51
|
label: type('string'),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../src/app/schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
3
|
+
import { AppAssociationReferenceSchema, AppIdPropertySchema, AppIdSchema, AppSchema, AppStatus, UpdateAppPayloadSchema, } from './schema.js';
|
|
4
|
+
import { generateAppId } from './utils.js';
|
|
5
|
+
describe('App - Schema', () => {
|
|
6
|
+
describe('AppStatus constants', () => {
|
|
7
|
+
test('should have correct status values', () => {
|
|
8
|
+
expect(AppStatus.ENABLED).toBe('enabled');
|
|
9
|
+
expect(AppStatus.DISABLED).toBe('disabled');
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe('AppIdSchema', () => {
|
|
13
|
+
test('should accept valid app ID', () => {
|
|
14
|
+
const id = generateAppId();
|
|
15
|
+
const result = AppIdSchema(id);
|
|
16
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
17
|
+
expect(result).toBe(id);
|
|
18
|
+
});
|
|
19
|
+
test('should reject invalid app ID format', () => {
|
|
20
|
+
expect(AppIdSchema('invalid_id')).toBeInstanceOf(type.errors);
|
|
21
|
+
expect(AppIdSchema('wrong_prefix_123')).toBeInstanceOf(type.errors);
|
|
22
|
+
});
|
|
23
|
+
test('should reject non-string values', () => {
|
|
24
|
+
expect(AppIdSchema(123)).toBeInstanceOf(type.errors);
|
|
25
|
+
expect(AppIdSchema(null)).toBeInstanceOf(type.errors);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('AppIdPropertySchema', () => {
|
|
29
|
+
test('should accept valid id property', () => {
|
|
30
|
+
const payload = { id: generateAppId() };
|
|
31
|
+
const result = AppIdPropertySchema(payload);
|
|
32
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
33
|
+
expect(result).toEqual(payload);
|
|
34
|
+
});
|
|
35
|
+
test('should reject missing id', () => {
|
|
36
|
+
const result = AppIdPropertySchema({});
|
|
37
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
38
|
+
});
|
|
39
|
+
test('should reject invalid id format', () => {
|
|
40
|
+
const result = AppIdPropertySchema({ id: 'invalid_id' });
|
|
41
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('AppSchema', () => {
|
|
45
|
+
test('should accept complete app object', () => {
|
|
46
|
+
const app = {
|
|
47
|
+
id: generateAppId(),
|
|
48
|
+
status: 'enabled',
|
|
49
|
+
label: 'My Application',
|
|
50
|
+
description: 'Application description',
|
|
51
|
+
createdAt: new Date(),
|
|
52
|
+
updatedAt: new Date(),
|
|
53
|
+
metadata: { key: 'value' },
|
|
54
|
+
};
|
|
55
|
+
const result = AppSchema(app);
|
|
56
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
57
|
+
});
|
|
58
|
+
test('should accept minimal app object', () => {
|
|
59
|
+
const app = {
|
|
60
|
+
id: generateAppId(),
|
|
61
|
+
status: 'enabled',
|
|
62
|
+
label: 'Simple App',
|
|
63
|
+
createdAt: new Date(),
|
|
64
|
+
updatedAt: new Date(),
|
|
65
|
+
metadata: {},
|
|
66
|
+
};
|
|
67
|
+
const result = AppSchema(app);
|
|
68
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
69
|
+
});
|
|
70
|
+
test('should accept app with optional dates', () => {
|
|
71
|
+
const app = {
|
|
72
|
+
id: generateAppId(),
|
|
73
|
+
status: 'disabled',
|
|
74
|
+
label: 'Disabled App',
|
|
75
|
+
description: 'This app is disabled',
|
|
76
|
+
createdAt: new Date(),
|
|
77
|
+
updatedAt: new Date(),
|
|
78
|
+
deletedAt: new Date(),
|
|
79
|
+
deactivatedAt: new Date(),
|
|
80
|
+
metadata: {},
|
|
81
|
+
};
|
|
82
|
+
const result = AppSchema(app);
|
|
83
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
84
|
+
});
|
|
85
|
+
test('should reject invalid status', () => {
|
|
86
|
+
const app = {
|
|
87
|
+
id: generateAppId(),
|
|
88
|
+
status: 'invalid-status',
|
|
89
|
+
label: 'My App',
|
|
90
|
+
createdAt: new Date(),
|
|
91
|
+
updatedAt: new Date(),
|
|
92
|
+
metadata: {},
|
|
93
|
+
};
|
|
94
|
+
const result = AppSchema(app);
|
|
95
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
96
|
+
});
|
|
97
|
+
test('should reject missing required fields', () => {
|
|
98
|
+
const app = {
|
|
99
|
+
id: generateAppId(),
|
|
100
|
+
status: 'enabled',
|
|
101
|
+
// missing label, createdAt, updatedAt, metadata
|
|
102
|
+
};
|
|
103
|
+
const result = AppSchema(app);
|
|
104
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe('UpdateAppPayloadSchema', () => {
|
|
108
|
+
test('should accept all optional fields', () => {
|
|
109
|
+
const payload = {
|
|
110
|
+
status: 'disabled',
|
|
111
|
+
label: 'Updated App',
|
|
112
|
+
description: 'Updated description',
|
|
113
|
+
metadata: { updated: true },
|
|
114
|
+
};
|
|
115
|
+
const result = UpdateAppPayloadSchema(payload);
|
|
116
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
117
|
+
expect(result).toEqual(payload);
|
|
118
|
+
});
|
|
119
|
+
test('should accept empty update payload', () => {
|
|
120
|
+
const result = UpdateAppPayloadSchema({});
|
|
121
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
122
|
+
expect(result).toEqual({});
|
|
123
|
+
});
|
|
124
|
+
test('should accept partial updates', () => {
|
|
125
|
+
const payload = { label: 'New Label' };
|
|
126
|
+
const result = UpdateAppPayloadSchema(payload);
|
|
127
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
128
|
+
expect(result).toEqual(payload);
|
|
129
|
+
});
|
|
130
|
+
test('should accept null values for nullable fields', () => {
|
|
131
|
+
const payload = {
|
|
132
|
+
label: null,
|
|
133
|
+
description: null,
|
|
134
|
+
};
|
|
135
|
+
const result = UpdateAppPayloadSchema(payload);
|
|
136
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
137
|
+
expect(result).toEqual(payload);
|
|
138
|
+
});
|
|
139
|
+
test('should reject invalid status', () => {
|
|
140
|
+
const payload = { status: 'invalid-status' };
|
|
141
|
+
const result = UpdateAppPayloadSchema(payload);
|
|
142
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
describe('AppAssociationReferenceSchema', () => {
|
|
146
|
+
test('should accept complete association reference', () => {
|
|
147
|
+
const reference = {
|
|
148
|
+
id: generateAppId(),
|
|
149
|
+
status: 'enabled',
|
|
150
|
+
label: 'Associated App',
|
|
151
|
+
model: 'App',
|
|
152
|
+
};
|
|
153
|
+
const result = AppAssociationReferenceSchema(reference);
|
|
154
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
155
|
+
expect(result).toEqual(reference);
|
|
156
|
+
});
|
|
157
|
+
test('should use default status when not provided', () => {
|
|
158
|
+
const reference = {
|
|
159
|
+
id: generateAppId(),
|
|
160
|
+
label: 'Test App',
|
|
161
|
+
model: 'App',
|
|
162
|
+
};
|
|
163
|
+
const result = AppAssociationReferenceSchema(reference);
|
|
164
|
+
expect(result).not.toBeInstanceOf(type.errors);
|
|
165
|
+
expect(result.status).toBe('disabled'); // default value
|
|
166
|
+
});
|
|
167
|
+
test('should reject missing required fields', () => {
|
|
168
|
+
const reference = { id: generateAppId() };
|
|
169
|
+
const result = AppAssociationReferenceSchema(reference);
|
|
170
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
171
|
+
});
|
|
172
|
+
test('should reject invalid model value', () => {
|
|
173
|
+
const reference = {
|
|
174
|
+
id: generateAppId(),
|
|
175
|
+
label: 'Test App',
|
|
176
|
+
model: 'InvalidModel',
|
|
177
|
+
};
|
|
178
|
+
const result = AppAssociationReferenceSchema(reference);
|
|
179
|
+
expect(result).toBeInstanceOf(type.errors);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../src/app/utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { Model, generateAppId, generateOAuthId } from './utils.js';
|
|
3
|
+
describe('App - Utils', () => {
|
|
4
|
+
describe('Model constants', () => {
|
|
5
|
+
test('should have correct UID prefixes', () => {
|
|
6
|
+
expect(Model.App.UIDPrefix).toBe('app');
|
|
7
|
+
expect(Model.OAuth.UIDPrefix).toBe('aoa');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
describe('generateAppId', () => {
|
|
11
|
+
test('should generate ID with correct prefix', () => {
|
|
12
|
+
const id = generateAppId();
|
|
13
|
+
expect(id).toMatch(/^app_[A-Za-z0-9]+$/);
|
|
14
|
+
});
|
|
15
|
+
test('should generate unique IDs', () => {
|
|
16
|
+
const id1 = generateAppId();
|
|
17
|
+
const id2 = generateAppId();
|
|
18
|
+
expect(id1).not.toBe(id2);
|
|
19
|
+
});
|
|
20
|
+
test('should generate IDs with correct length', () => {
|
|
21
|
+
const id = generateAppId();
|
|
22
|
+
expect(id.length).toBeGreaterThan(4); // prefix + underscore + KSUID
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('generateOAuthId', () => {
|
|
26
|
+
test('should generate ID with correct prefix', () => {
|
|
27
|
+
const id = generateOAuthId();
|
|
28
|
+
expect(id).toMatch(/^aoa_[A-Za-z0-9]+$/);
|
|
29
|
+
});
|
|
30
|
+
test('should generate unique IDs', () => {
|
|
31
|
+
const id1 = generateOAuthId();
|
|
32
|
+
const id2 = generateOAuthId();
|
|
33
|
+
expect(id1).not.toBe(id2);
|
|
34
|
+
});
|
|
35
|
+
test('should generate IDs with correct length', () => {
|
|
36
|
+
const id = generateOAuthId();
|
|
37
|
+
expect(id.length).toBeGreaterThan(4); // prefix + underscore + KSUID
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|