@appsemble/utils 0.29.10 → 0.30.1
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/README.md +3 -3
- package/api/components/parameters/$own.d.ts +2 -0
- package/api/components/parameters/$own.js +7 -0
- package/api/components/parameters/appMemberId.d.ts +2 -0
- package/api/components/parameters/appMemberId.js +8 -0
- package/api/components/parameters/groupId.d.ts +2 -0
- package/api/components/parameters/groupId.js +8 -0
- package/api/components/parameters/groupMemberId.d.ts +2 -0
- package/api/components/parameters/groupMemberId.js +8 -0
- package/api/components/parameters/index.d.ts +17 -13
- package/api/components/parameters/index.js +17 -13
- package/api/components/parameters/organizationId.d.ts +9 -2
- package/api/components/parameters/organizationId.js +1 -1
- package/api/components/parameters/roles.js +12 -6
- package/api/components/parameters/seed.d.ts +2 -0
- package/api/components/parameters/seed.js +9 -0
- package/api/components/parameters/selectedGroupId.d.ts +2 -0
- package/api/components/parameters/selectedGroupId.js +7 -0
- package/api/components/parameters/serviceSecretId.d.ts +2 -0
- package/api/components/parameters/{appServiceId.js → serviceSecretId.js} +3 -3
- package/api/components/requestBodies/oauth2Consent.js +1 -5
- package/api/components/requestBodies/user.js +1 -1
- package/api/components/schemas/ActionDefinition.js +14 -11
- package/api/components/schemas/AppAccount.js +7 -24
- package/api/components/schemas/AppDefinition.js +3 -15
- package/api/components/schemas/AppMember.d.ts +2 -0
- package/api/components/schemas/AppMember.js +26 -0
- package/api/components/schemas/AppMemberCurrentPatchActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberCurrentPatchActionDefinition.js +30 -0
- package/api/components/schemas/AppMemberDeleteActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberDeleteActionDefinition.js +20 -0
- package/api/components/schemas/AppMemberInfo.d.ts +2 -0
- package/api/components/schemas/AppMemberInfo.js +48 -0
- package/api/components/schemas/AppMemberInviteActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberInviteActionDefinition.js +24 -0
- package/api/components/schemas/AppMemberLoginActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberLoginActionDefinition.js +24 -0
- package/api/components/schemas/AppMemberLogoutActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberLogoutActionDefinition.js +14 -0
- package/api/components/schemas/AppMemberPropertiesPatchActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberPropertiesPatchActionDefinition.js +26 -0
- package/api/components/schemas/AppMemberPropertyDefinition.d.ts +2 -0
- package/api/components/schemas/{UserPropertyDefinition.js → AppMemberPropertyDefinition.js} +5 -5
- package/api/components/schemas/AppMemberQueryActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberQueryActionDefinition.js +20 -0
- package/api/components/schemas/AppMemberRegisterActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberRegisterActionDefinition.js +43 -0
- package/api/components/schemas/AppMemberRoleUpdateActionDefinition.d.ts +1 -0
- package/api/components/schemas/AppMemberRoleUpdateActionDefinition.js +27 -0
- package/api/components/schemas/AppMembersDefinition.d.ts +2 -0
- package/api/components/schemas/AppMembersDefinition.js +17 -0
- package/api/components/schemas/GroupMember.d.ts +2 -0
- package/api/components/schemas/GroupMember.js +19 -0
- package/api/components/schemas/GroupMemberDeleteActionDefinition.d.ts +1 -0
- package/api/components/schemas/{TeamMembersActionDefinition.js → GroupMemberDeleteActionDefinition.js} +5 -5
- package/api/components/schemas/GroupMemberInviteActionDefinition.d.ts +1 -0
- package/api/components/schemas/{TeamInviteActionDefinition.js → GroupMemberInviteActionDefinition.js} +5 -6
- package/api/components/schemas/GroupMemberQueryActionDefinition.d.ts +1 -0
- package/api/components/schemas/GroupMemberQueryActionDefinition.js +18 -0
- package/api/components/schemas/GroupMemberRoleUpdateActionDefinition.d.ts +1 -0
- package/api/components/schemas/GroupMemberRoleUpdateActionDefinition.js +22 -0
- package/api/components/schemas/GroupQueryActionDefinition.d.ts +1 -0
- package/api/components/schemas/{UserLogoutActionDefinition.js → GroupQueryActionDefinition.js} +4 -4
- package/api/components/schemas/OrganizationMember.js +2 -2
- package/api/components/schemas/ResourceCountActionDefinition.js +4 -0
- package/api/components/schemas/ResourceCreateActionDefinition.js +1 -1
- package/api/components/schemas/ResourceDefinition.js +0 -22
- package/api/components/schemas/ResourceQueryActionDefinition.js +4 -0
- package/api/components/schemas/SecurityDefaultDefinition.js +1 -1
- package/api/components/schemas/SecurityDefinition.js +2 -6
- package/api/components/schemas/SecurityGuestDefinition.d.ts +2 -0
- package/api/components/schemas/SecurityGuestDefinition.js +26 -0
- package/api/components/schemas/SecurityRoleDefinition.js +7 -0
- package/api/components/schemas/User.js +2 -22
- package/api/components/schemas/UserInfo.d.ts +2 -0
- package/api/components/schemas/UserInfo.js +42 -0
- package/api/components/schemas/index.d.ts +22 -15
- package/api/components/schemas/index.js +22 -15
- package/api/components/securitySchemes/app.js +6 -6
- package/api/components/securitySchemes/cli.js +3 -3
- package/api/paths/app-collections/appCollectionId/apps/appId/pinned.d.ts +2 -0
- package/api/paths/app-collections/appCollectionId/apps/appId/pinned.js +70 -0
- package/api/paths/app-collections/appCollectionId/apps/appId.d.ts +2 -0
- package/api/paths/app-collections/appCollectionId/apps/appId.js +34 -0
- package/api/paths/app-collections/appCollectionId/apps.d.ts +2 -0
- package/api/paths/app-collections/appCollectionId/apps.js +93 -0
- package/api/paths/app-collections/appCollectionId/expert/profileImage.d.ts +2 -0
- package/api/paths/app-collections/appCollectionId/expert/profileImage.js +31 -0
- package/api/paths/app-collections/appCollectionId/headerImage.d.ts +2 -0
- package/api/paths/app-collections/appCollectionId/headerImage.js +31 -0
- package/api/paths/app-collections/appCollectionId.d.ts +2 -0
- package/api/paths/app-collections/appCollectionId.js +102 -0
- package/api/paths/app-invites/token/respond.d.ts +2 -0
- package/api/paths/app-invites/token/respond.js +51 -0
- package/api/paths/app-invites/token.d.ts +2 -0
- package/api/paths/app-invites/token.js +23 -0
- package/api/paths/app-members/appMemberId/picture.d.ts +2 -0
- package/api/paths/app-members/appMemberId/picture.js +30 -0
- package/api/paths/app-members/appMemberId/properties.d.ts +2 -0
- package/api/paths/app-members/appMemberId/properties.js +48 -0
- package/api/paths/app-members/appMemberId/role.d.ts +2 -0
- package/api/paths/app-members/appMemberId/role.js +46 -0
- package/api/paths/app-members/appMemberId.d.ts +2 -0
- package/api/paths/app-members/appMemberId.js +24 -0
- package/api/paths/appCollections.d.ts +1 -1
- package/api/paths/appCollections.js +12 -454
- package/api/paths/appTemplates.d.ts +2 -0
- package/api/paths/appTemplates.js +94 -0
- package/api/paths/apps/appId/actions/path.d.ts +2 -0
- package/api/paths/{action.js → apps/appId/actions/path.js} +18 -20
- package/api/paths/apps/appId/assets/assetId.d.ts +2 -0
- package/api/paths/apps/appId/assets/assetId.js +38 -0
- package/api/paths/apps/appId/assets/count.d.ts +2 -0
- package/api/paths/apps/appId/assets/count.js +22 -0
- package/api/paths/apps/appId/assets.d.ts +2 -0
- package/api/paths/apps/appId/assets.js +96 -0
- package/api/paths/apps/appId/auth/email/login.d.ts +2 -0
- package/api/paths/apps/appId/auth/email/login.js +10 -0
- package/api/paths/apps/appId/auth/email/register.d.ts +2 -0
- package/api/paths/apps/appId/auth/email/register.js +52 -0
- package/api/paths/apps/appId/auth/email/requestResetPassword.d.ts +2 -0
- package/api/paths/apps/appId/auth/email/requestResetPassword.js +31 -0
- package/api/paths/apps/appId/auth/email/resendVerification.d.ts +2 -0
- package/api/paths/apps/appId/auth/email/resendVerification.js +32 -0
- package/api/paths/apps/appId/auth/email/resetPassword.d.ts +2 -0
- package/api/paths/apps/appId/auth/email/resetPassword.js +34 -0
- package/api/paths/apps/appId/auth/email/verify.d.ts +2 -0
- package/api/paths/apps/appId/auth/email/verify.js +31 -0
- package/api/paths/apps/appId/broadcast.d.ts +2 -0
- package/api/paths/apps/appId/broadcast.js +36 -0
- package/api/paths/apps/appId/demo-groups.d.ts +2 -0
- package/api/paths/apps/appId/demo-groups.js +29 -0
- package/api/paths/apps/appId/demo-members.d.ts +2 -0
- package/api/paths/apps/appId/demo-members.js +27 -0
- package/api/paths/apps/appId/email.d.ts +2 -0
- package/api/paths/apps/appId/email.js +48 -0
- package/api/paths/apps/appId/export.d.ts +2 -0
- package/api/paths/apps/appId/export.js +41 -0
- package/api/paths/apps/appId/groups.d.ts +2 -0
- package/api/paths/apps/appId/groups.js +79 -0
- package/api/paths/apps/appId/icon.d.ts +2 -0
- package/api/paths/apps/appId/icon.js +31 -0
- package/api/paths/apps/appId/invites.d.ts +2 -0
- package/api/paths/apps/appId/invites.js +79 -0
- package/api/paths/apps/appId/lock.d.ts +2 -0
- package/api/paths/apps/appId/lock.js +35 -0
- package/api/paths/apps/appId/maskableIcon.d.ts +2 -0
- package/api/paths/apps/appId/maskableIcon.js +15 -0
- package/api/paths/apps/appId/members/current/groups.d.ts +2 -0
- package/api/paths/apps/appId/members/current/groups.js +30 -0
- package/api/paths/apps/appId/members/current/link.d.ts +2 -0
- package/api/paths/apps/appId/members/current/link.js +41 -0
- package/api/paths/apps/appId/members/current.d.ts +2 -0
- package/api/paths/apps/appId/members/current.js +111 -0
- package/api/paths/apps/appId/members.d.ts +2 -0
- package/api/paths/apps/appId/members.js +29 -0
- package/api/paths/apps/appId/messages/language.d.ts +2 -0
- package/api/paths/apps/appId/messages/language.js +47 -0
- package/api/paths/apps/appId/messages.d.ts +2 -0
- package/api/paths/apps/appId/messages.js +72 -0
- package/api/paths/apps/appId/quotas/emails.d.ts +2 -0
- package/api/paths/apps/appId/quotas/emails.js +36 -0
- package/api/paths/apps/appId/ratings.d.ts +2 -0
- package/api/paths/apps/appId/ratings.js +58 -0
- package/api/paths/apps/appId/readmes/readmeId.d.ts +2 -0
- package/api/paths/apps/appId/readmes/readmeId.js +17 -0
- package/api/paths/apps/appId/reseed.d.ts +2 -0
- package/api/paths/apps/appId/reseed.js +12 -0
- package/api/paths/apps/appId/resources/resourceType/count.d.ts +2 -0
- package/api/paths/apps/appId/resources/resourceType/count.js +30 -0
- package/api/paths/apps/appId/resources/resourceType/resourceId/subscriptions.d.ts +2 -0
- package/api/paths/apps/appId/resources/resourceType/resourceId/subscriptions.js +31 -0
- package/api/paths/apps/appId/resources/resourceType/resourceId.d.ts +2 -0
- package/api/paths/apps/appId/resources/resourceType/resourceId.js +74 -0
- package/api/paths/apps/appId/resources/resourceType/subscriptions.d.ts +2 -0
- package/api/paths/apps/appId/resources/resourceType/subscriptions.js +26 -0
- package/api/paths/apps/appId/resources/resourceType.d.ts +2 -0
- package/api/paths/apps/appId/resources/resourceType.js +171 -0
- package/api/paths/apps/appId/resources/versions.d.ts +2 -0
- package/api/paths/apps/appId/resources/versions.js +29 -0
- package/api/paths/apps/appId/resources.d.ts +2 -0
- package/api/paths/apps/appId/resources.js +15 -0
- package/api/paths/apps/appId/saml/secretId/acs.d.ts +2 -0
- package/api/paths/apps/appId/saml/secretId/acs.js +35 -0
- package/api/paths/apps/appId/saml/secretId/authn.d.ts +2 -0
- package/api/paths/apps/appId/saml/secretId/authn.js +37 -0
- package/api/paths/apps/appId/saml/secretId/metadata.d.ts +2 -0
- package/api/paths/apps/appId/saml/secretId/metadata.js +21 -0
- package/api/paths/apps/appId/scim/resource-types/resourceTypeId.d.ts +2 -0
- package/api/paths/apps/appId/scim/resource-types/resourceTypeId.js +25 -0
- package/api/paths/apps/appId/scim/resource-types.d.ts +2 -0
- package/api/paths/apps/appId/scim/resource-types.js +22 -0
- package/api/paths/apps/appId/scim/schemas/schemaId.d.ts +2 -0
- package/api/paths/apps/appId/scim/schemas/schemaId.js +24 -0
- package/api/paths/apps/appId/scim/schemas.d.ts +2 -0
- package/api/paths/apps/appId/scim/schemas.js +21 -0
- package/api/paths/apps/appId/scim/service-provider-config.d.ts +2 -0
- package/api/paths/apps/appId/scim/service-provider-config.js +22 -0
- package/api/paths/apps/appId/scim/users/userId.d.ts +2 -0
- package/api/paths/apps/appId/scim/users/userId.js +92 -0
- package/api/paths/apps/appId/scim/users.d.ts +2 -0
- package/api/paths/apps/appId/scim/users.js +58 -0
- package/api/paths/apps/appId/screenshots/screenshotId.d.ts +2 -0
- package/api/paths/apps/appId/screenshots/screenshotId.js +28 -0
- package/api/paths/apps/appId/screenshots.d.ts +2 -0
- package/api/paths/apps/appId/screenshots.js +55 -0
- package/api/paths/apps/appId/secrets/oauth2/secretId/verify.d.ts +2 -0
- package/api/paths/apps/appId/secrets/oauth2/secretId/verify.js +47 -0
- package/api/paths/apps/appId/secrets/oauth2/secretId.d.ts +2 -0
- package/api/paths/apps/appId/secrets/oauth2/secretId.js +60 -0
- package/api/paths/apps/appId/secrets/oauth2.d.ts +2 -0
- package/api/paths/apps/appId/secrets/oauth2.js +54 -0
- package/api/paths/apps/appId/secrets/saml/secretId.d.ts +2 -0
- package/api/paths/apps/appId/secrets/saml/secretId.js +39 -0
- package/api/paths/apps/appId/secrets/saml.d.ts +2 -0
- package/api/paths/apps/appId/secrets/saml.js +54 -0
- package/api/paths/apps/appId/secrets/scim.d.ts +2 -0
- package/api/paths/apps/appId/secrets/scim.js +43 -0
- package/api/paths/apps/appId/secrets/service/secretId.d.ts +2 -0
- package/api/paths/apps/appId/secrets/service/secretId.js +39 -0
- package/api/paths/apps/appId/secrets/service.d.ts +2 -0
- package/api/paths/apps/appId/secrets/service.js +54 -0
- package/api/paths/apps/appId/secrets/ssl.d.ts +2 -0
- package/api/paths/apps/appId/secrets/ssl.js +37 -0
- package/api/paths/apps/appId/snapshots/snapshotId.d.ts +2 -0
- package/api/paths/apps/appId/snapshots/snapshotId.js +47 -0
- package/api/paths/apps/appId/snapshots.d.ts +2 -0
- package/api/paths/apps/appId/snapshots.js +40 -0
- package/api/paths/apps/appId/style/block/organizationId/blockId.d.ts +2 -0
- package/api/paths/apps/appId/style/block/organizationId/blockId.js +53 -0
- package/api/paths/apps/appId/style/core.d.ts +2 -0
- package/api/paths/apps/appId/style/core.js +17 -0
- package/api/paths/apps/appId/style/shared.d.ts +2 -0
- package/api/paths/apps/appId/style/shared.js +17 -0
- package/api/paths/apps/appId/subscriptions.d.ts +2 -0
- package/api/paths/apps/appId/subscriptions.js +91 -0
- package/api/paths/apps/appId/variables/variableId.d.ts +2 -0
- package/api/paths/apps/appId/variables/variableId.js +39 -0
- package/api/paths/apps/appId/variables.d.ts +2 -0
- package/api/paths/apps/appId/variables.js +53 -0
- package/api/paths/apps/appId.d.ts +2 -0
- package/api/paths/apps/appId.js +175 -0
- package/api/paths/apps.d.ts +1 -1
- package/api/paths/apps.js +95 -1518
- package/api/paths/auth/email/login.d.ts +2 -0
- package/api/paths/auth/email/login.js +10 -0
- package/api/paths/auth/email/register.d.ts +2 -0
- package/api/paths/auth/email/register.js +45 -0
- package/api/paths/auth/email/requestResetPassword.d.ts +2 -0
- package/api/paths/auth/email/requestResetPassword.js +30 -0
- package/api/paths/auth/email/resendVerification.d.ts +2 -0
- package/api/paths/auth/email/resendVerification.js +31 -0
- package/api/paths/auth/email/resetPassword.d.ts +2 -0
- package/api/paths/auth/email/resetPassword.js +33 -0
- package/api/paths/auth/email/verify.d.ts +2 -0
- package/api/paths/auth/email/verify.js +30 -0
- package/api/paths/auth/oauth2/authorizations/connect.d.ts +2 -0
- package/api/paths/auth/oauth2/authorizations/connect.js +45 -0
- package/api/paths/auth/oauth2/authorizations/register.d.ts +2 -0
- package/api/paths/auth/oauth2/authorizations/register.js +32 -0
- package/api/paths/auth/refreshToken.d.ts +2 -0
- package/api/paths/auth/refreshToken.js +26 -0
- package/api/paths/blocks/organizationId/blockId/versions/list.d.ts +2 -0
- package/api/paths/blocks/organizationId/blockId/versions/list.js +27 -0
- package/api/paths/blocks/organizationId/blockId/versions/version/asset.d.ts +2 -0
- package/api/paths/blocks/organizationId/blockId/versions/version/asset.js +24 -0
- package/api/paths/blocks/organizationId/blockId/versions/version/icon.d.ts +2 -0
- package/api/paths/blocks/organizationId/blockId/versions/version/icon.js +18 -0
- package/api/paths/blocks/organizationId/blockId/versions/version/messages/language.d.ts +2 -0
- package/api/paths/blocks/organizationId/blockId/versions/version/messages/language.js +37 -0
- package/api/paths/blocks/organizationId/blockId/versions/version.d.ts +2 -0
- package/api/paths/blocks/organizationId/blockId/versions/version.js +29 -0
- package/api/paths/blocks/organizationId/blockId/versions.d.ts +2 -0
- package/api/paths/blocks/organizationId/blockId/versions.js +27 -0
- package/api/paths/blocks/organizationId/blockId.d.ts +2 -0
- package/api/paths/blocks/organizationId/blockId.js +18 -0
- package/api/paths/blocks/versions/blockVersion.js +21 -0
- package/api/paths/blocks.d.ts +1 -1
- package/api/paths/blocks.js +29 -204
- package/api/paths/containerLogs.d.ts +1 -1
- package/api/paths/containerLogs.js +28 -30
- package/api/paths/group-invites/token/respond.d.ts +2 -0
- package/api/paths/group-invites/token/respond.js +42 -0
- package/api/paths/group-invites/token.d.ts +2 -0
- package/api/paths/group-invites/token.js +23 -0
- package/api/paths/group-members/groupMemberId/role.d.ts +2 -0
- package/api/paths/group-members/groupMemberId/role.js +40 -0
- package/api/paths/group-members/groupMemberId.d.ts +2 -0
- package/api/paths/group-members/groupMemberId.js +34 -0
- package/api/paths/groups/groupId/invites.d.ts +2 -0
- package/api/paths/groups/groupId/invites.js +87 -0
- package/api/paths/groups/groupId/members.d.ts +2 -0
- package/api/paths/groups/groupId/members.js +34 -0
- package/api/paths/groups/groupId.d.ts +2 -0
- package/api/paths/groups/groupId.js +86 -0
- package/api/paths/health.d.ts +1 -1
- package/api/paths/health.js +12 -66
- package/api/paths/index.d.ts +145 -136
- package/api/paths/index.js +294 -58
- package/api/paths/messages/language.d.ts +2 -0
- package/api/paths/messages/language.js +21 -0
- package/api/paths/messages.d.ts +2 -0
- package/api/paths/messages.js +26 -0
- package/api/paths/organization-invites/token/respond.d.ts +2 -0
- package/api/paths/organization-invites/token/respond.js +42 -0
- package/api/paths/organization-invites/token.d.ts +2 -0
- package/api/paths/organization-invites/token.js +23 -0
- package/api/paths/organizations/organizationId/appCollections.d.ts +2 -0
- package/api/paths/organizations/organizationId/appCollections.js +76 -0
- package/api/paths/organizations/organizationId/apps/import.d.ts +2 -0
- package/api/paths/organizations/organizationId/apps/import.js +26 -0
- package/api/paths/organizations/organizationId/apps.d.ts +2 -0
- package/api/paths/organizations/organizationId/apps.js +33 -0
- package/api/paths/organizations/organizationId/blocks.d.ts +2 -0
- package/api/paths/organizations/organizationId/blocks.js +25 -0
- package/api/paths/organizations/organizationId/icon.d.ts +2 -0
- package/api/paths/organizations/organizationId/icon.js +14 -0
- package/api/paths/organizations/organizationId/invites/resend.d.ts +2 -0
- package/api/paths/organizations/organizationId/invites/resend.js +32 -0
- package/api/paths/organizations/organizationId/invites.d.ts +2 -0
- package/api/paths/organizations/organizationId/invites.js +108 -0
- package/api/paths/organizations/organizationId/members/memberId/role.d.ts +2 -0
- package/api/paths/organizations/organizationId/members/memberId/role.js +50 -0
- package/api/paths/organizations/organizationId/members/memberId.d.ts +2 -0
- package/api/paths/organizations/organizationId/members/memberId.js +25 -0
- package/api/paths/organizations/organizationId/members.d.ts +2 -0
- package/api/paths/organizations/organizationId/members.js +25 -0
- package/api/paths/organizations/organizationId.d.ts +2 -0
- package/api/paths/organizations/organizationId.js +67 -0
- package/api/paths/organizations.d.ts +1 -1
- package/api/paths/organizations.js +46 -452
- package/api/paths/ssl.d.ts +2 -0
- package/api/paths/ssl.js +31 -0
- package/api/paths/timezones.d.ts +2 -0
- package/api/paths/timezones.js +23 -0
- package/api/paths/trainingBlocks/trainingBlockId.d.ts +2 -0
- package/api/paths/trainingBlocks/trainingBlockId.js +41 -0
- package/api/paths/trainings/trainingId/blocks.d.ts +2 -0
- package/api/paths/trainings/trainingId/blocks.js +51 -0
- package/api/paths/trainings/trainingId/users/current.d.ts +2 -0
- package/api/paths/trainings/trainingId/users/current.js +62 -0
- package/api/paths/trainings/trainingId/users.d.ts +2 -0
- package/api/paths/trainings/trainingId/users.js +25 -0
- package/api/paths/trainings/trainingId.d.ts +2 -0
- package/api/paths/trainings/trainingId.js +85 -0
- package/api/paths/trainings.d.ts +1 -1
- package/api/paths/trainings.js +26 -287
- package/api/paths/users/current/apps/accounts.d.ts +2 -0
- package/api/paths/users/current/apps/accounts.js +24 -0
- package/api/paths/users/current/apps/appId/account.d.ts +2 -0
- package/api/paths/users/current/apps/appId/account.js +65 -0
- package/api/paths/users/current/apps.d.ts +2 -0
- package/api/paths/users/current/apps.js +32 -0
- package/api/paths/users/current/auth/oauth2/apps/appId/consent/agree.d.ts +2 -0
- package/api/paths/users/current/auth/oauth2/apps/appId/consent/agree.js +12 -0
- package/api/paths/users/current/auth/oauth2/apps/appId/consent/verify.d.ts +2 -0
- package/api/paths/users/current/auth/oauth2/apps/appId/consent/verify.js +12 -0
- package/api/paths/users/current/auth/oauth2/authorizations.d.ts +2 -0
- package/api/paths/users/current/auth/oauth2/authorizations.js +43 -0
- package/api/paths/users/current/auth/oauth2/clientCredentials/clientId.d.ts +2 -0
- package/api/paths/users/current/auth/oauth2/clientCredentials/clientId.js +23 -0
- package/api/paths/users/current/auth/oauth2/clientCredentials.d.ts +2 -0
- package/api/paths/users/current/auth/oauth2/clientCredentials.js +53 -0
- package/api/paths/users/current/emails.d.ts +2 -0
- package/api/paths/users/current/emails.js +73 -0
- package/api/paths/users/current/organizations.d.ts +2 -0
- package/api/paths/users/current/organizations.js +29 -0
- package/api/paths/users/current/unsubscribe.d.ts +2 -0
- package/api/paths/users/current/unsubscribe.js +29 -0
- package/api/paths/users/current.d.ts +2 -0
- package/api/paths/users/current.js +43 -0
- package/api/paths/users/subscribed.d.ts +2 -0
- package/api/paths/users/subscribed.js +12 -0
- package/api/tags/index.d.ts +2 -1
- package/api/tags/index.js +170 -8
- package/appMembers.d.ts +1 -0
- package/appMembers.js +9 -0
- package/authorization.d.ts +12 -0
- package/authorization.js +171 -0
- package/constants/index.d.ts +0 -2
- package/constants/index.js +0 -2
- package/constants/scopes.d.ts +1 -1
- package/constants/scopes.js +2 -2
- package/examples.js +13 -14
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +2 -2
- package/reference-schemas/remappers/data.js +23 -38
- package/remap.d.ts +3 -7
- package/remap.js +1 -2
- package/remap.test.js +8 -9
- package/validation.js +396 -83
- package/validation.test.js +1039 -230
- package/api/components/parameters/$team.d.ts +0 -2
- package/api/components/parameters/$team.js +0 -8
- package/api/components/parameters/appServiceId.d.ts +0 -2
- package/api/components/parameters/memberEmail.d.ts +0 -2
- package/api/components/parameters/memberEmail.js +0 -8
- package/api/components/schemas/TeamInviteActionDefinition.d.ts +0 -1
- package/api/components/schemas/TeamJoinActionDefinition.d.ts +0 -1
- package/api/components/schemas/TeamJoinActionDefinition.js +0 -14
- package/api/components/schemas/TeamListActionDefinition.d.ts +0 -1
- package/api/components/schemas/TeamListActionDefinition.js +0 -14
- package/api/components/schemas/TeamMembersActionDefinition.d.ts +0 -1
- package/api/components/schemas/TeamsDefinition.d.ts +0 -2
- package/api/components/schemas/TeamsDefinition.js +0 -28
- package/api/components/schemas/UserCreateActionDefinition.d.ts +0 -1
- package/api/components/schemas/UserCreateActionDefinition.js +0 -33
- package/api/components/schemas/UserLoginActionDefinition.d.ts +0 -1
- package/api/components/schemas/UserLoginActionDefinition.js +0 -22
- package/api/components/schemas/UserLogoutActionDefinition.d.ts +0 -1
- package/api/components/schemas/UserPropertyDefinition.d.ts +0 -2
- package/api/components/schemas/UserQueryActionDefinition.d.ts +0 -1
- package/api/components/schemas/UserQueryActionDefinition.js +0 -20
- package/api/components/schemas/UserRegisterActionDefinition.d.ts +0 -1
- package/api/components/schemas/UserRegisterActionDefinition.js +0 -37
- package/api/components/schemas/UserRemoveActionDefinition.d.ts +0 -1
- package/api/components/schemas/UserRemoveActionDefinition.js +0 -20
- package/api/components/schemas/UserUpdateActionDefinition.d.ts +0 -1
- package/api/components/schemas/UserUpdateActionDefinition.js +0 -36
- package/api/components/schemas/UsersDefinition.d.ts +0 -2
- package/api/components/schemas/UsersDefinition.js +0 -17
- package/api/paths/appMessages.d.ts +0 -2
- package/api/paths/appMessages.js +0 -120
- package/api/paths/appOAuth2Secrets.d.ts +0 -2
- package/api/paths/appOAuth2Secrets.js +0 -161
- package/api/paths/appQuotas.d.ts +0 -2
- package/api/paths/appQuotas.js +0 -38
- package/api/paths/appSSLSecrets.d.ts +0 -2
- package/api/paths/appSSLSecrets.js +0 -39
- package/api/paths/appSamlSecrets.d.ts +0 -2
- package/api/paths/appSamlSecrets.js +0 -94
- package/api/paths/appScimEndpoints.d.ts +0 -2
- package/api/paths/appScimEndpoints.js +0 -260
- package/api/paths/appScimSecrets.d.ts +0 -2
- package/api/paths/appScimSecrets.js +0 -45
- package/api/paths/appServiceSecrets.d.ts +0 -2
- package/api/paths/appServiceSecrets.js +0 -94
- package/api/paths/appVariables.d.ts +0 -2
- package/api/paths/appVariables.js +0 -93
- package/api/paths/appsembleMessages.d.ts +0 -2
- package/api/paths/appsembleMessages.js +0 -48
- package/api/paths/assets.d.ts +0 -2
- package/api/paths/assets.js +0 -213
- package/api/paths/emails.d.ts +0 -2
- package/api/paths/emails.js +0 -167
- package/api/paths/invite.d.ts +0 -2
- package/api/paths/invite.js +0 -25
- package/api/paths/oauth2ClientCredentials.d.ts +0 -2
- package/api/paths/oauth2ClientCredentials.js +0 -77
- package/api/paths/oauth2Login.d.ts +0 -2
- package/api/paths/oauth2Login.js +0 -119
- package/api/paths/oauth2Provider.d.ts +0 -2
- package/api/paths/oauth2Provider.js +0 -75
- package/api/paths/resourceHistory.d.ts +0 -2
- package/api/paths/resourceHistory.js +0 -31
- package/api/paths/resources.d.ts +0 -2
- package/api/paths/resources.js +0 -395
- package/api/paths/saml.d.ts +0 -2
- package/api/paths/saml.js +0 -126
- package/api/paths/templates.d.ts +0 -2
- package/api/paths/templates.js +0 -96
- package/api/paths/user.d.ts +0 -2
- package/api/paths/user.js +0 -649
- package/api/tags/app.d.ts +0 -2
- package/api/tags/app.js +0 -5
- package/api/tags/appMember.d.ts +0 -2
- package/api/tags/appMember.js +0 -5
- package/api/tags/asset.d.ts +0 -2
- package/api/tags/asset.js +0 -5
- package/api/tags/auth.d.ts +0 -2
- package/api/tags/auth.js +0 -5
- package/api/tags/language.d.ts +0 -2
- package/api/tags/language.js +0 -5
- package/api/tags/organization.d.ts +0 -2
- package/api/tags/organization.js +0 -5
- package/api/tags/resource.d.ts +0 -2
- package/api/tags/resource.js +0 -5
- package/api/tags/template.d.ts +0 -2
- package/api/tags/template.js +0 -5
- package/api/tags/user.d.ts +0 -2
- package/api/tags/user.js +0 -5
- package/appSecurity.d.ts +0 -9
- package/appSecurity.js +0 -41
- package/appSecurity.test.d.ts +0 -1
- package/appSecurity.test.js +0 -114
- package/checkAppRole.d.ts +0 -11
- package/checkAppRole.js +0 -34
- package/constants/Permission.d.ts +0 -114
- package/constants/Permission.js +0 -116
- package/constants/roles.d.ts +0 -16
- package/constants/roles.js +0 -58
- /package/api/paths/{action.d.ts → blocks/versions/blockVersion.d.ts} +0 -0
package/validation.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { PredefinedAppRole, predefinedAppRolePermissions, } from '@appsemble/types';
|
|
1
2
|
import cronParser from 'cron-parser';
|
|
2
3
|
import { ValidationError, Validator } from 'jsonschema';
|
|
3
4
|
import languageTags from 'language-tags';
|
|
4
5
|
import { getAppBlocks, normalizeBlockName } from './blockUtils.js';
|
|
5
6
|
import { has } from './has.js';
|
|
6
|
-
import { findPageByName, normalize, partialNormalized } from './index.js';
|
|
7
|
+
import { findPageByName, getAppInheritedRoles, getAppPossibleGuestPermissions, getAppPossiblePermissions, getAppRolePermissions, normalize, partialNormalized, } from './index.js';
|
|
7
8
|
import { iterApp } from './iterApp.js';
|
|
8
9
|
import { serverActions } from './serverActions.js';
|
|
10
|
+
const allResourcePermissionPattern = /^\$resource:all:(get|query|create|delete|patch|update)$/;
|
|
11
|
+
const resourcePermissionPattern = /^\$resource:[^:]+:(get|query|create|delete|patch|update)$/;
|
|
12
|
+
const allOwnResourcePermissionPattern = /^\$resource:all:own:(get|query|delete|patch|update)$/;
|
|
13
|
+
const ownResourcePermissionPattern = /^\$resource:[^:]+:own:(get|query|delete|patch|update)$/;
|
|
14
|
+
const allResourceViewPermissionPattern = /^\$resource:all:(get|query):[^:]+$/;
|
|
15
|
+
const resourceViewPermissionPattern = /^\$resource:[^:]+:(get|query):[^:]+$/;
|
|
9
16
|
/**
|
|
10
17
|
* Check whether or not the given link represents a link related to the Appsemble core.
|
|
11
18
|
*
|
|
@@ -65,18 +72,18 @@ function validateUniquePageNames(definition, report) {
|
|
|
65
72
|
}
|
|
66
73
|
checkPages(definition.pages);
|
|
67
74
|
}
|
|
68
|
-
function
|
|
75
|
+
function validateMembersSchema(definition, report) {
|
|
69
76
|
var _a;
|
|
70
|
-
if (!definition.
|
|
77
|
+
if (!definition.members) {
|
|
71
78
|
return;
|
|
72
79
|
}
|
|
73
|
-
for (const [propertyName, propertyDefinition] of Object.entries(definition.
|
|
80
|
+
for (const [propertyName, propertyDefinition] of Object.entries(definition.members.properties)) {
|
|
74
81
|
// Handled by schema validation
|
|
75
82
|
if (!(propertyDefinition === null || propertyDefinition === void 0 ? void 0 : propertyDefinition.schema)) {
|
|
76
83
|
continue;
|
|
77
84
|
}
|
|
78
85
|
const { schema } = propertyDefinition;
|
|
79
|
-
const prefix = ['
|
|
86
|
+
const prefix = ['members', 'properties', propertyName, 'schema'];
|
|
80
87
|
validateJSONSchema(schema, prefix, report);
|
|
81
88
|
if (!('type' in schema) && !('enum' in schema)) {
|
|
82
89
|
report(schema, 'must define type or enum', prefix);
|
|
@@ -86,7 +93,7 @@ function validateUsersSchema(definition, report) {
|
|
|
86
93
|
const resourceDefinition = (_a = definition.resources) === null || _a === void 0 ? void 0 : _a[resourceName];
|
|
87
94
|
if (!resourceDefinition) {
|
|
88
95
|
report(resourceName, 'refers to a resource that doesn’t exist', [
|
|
89
|
-
'
|
|
96
|
+
'members',
|
|
90
97
|
'properties',
|
|
91
98
|
propertyName,
|
|
92
99
|
'reference',
|
|
@@ -342,12 +349,275 @@ function validateBlocks(definition, blockVersions, report) {
|
|
|
342
349
|
},
|
|
343
350
|
});
|
|
344
351
|
}
|
|
352
|
+
function validatePermissions(appDefinition, permissions, inheritedPermissions, possiblePermissions, report, path) {
|
|
353
|
+
var _a, _b, _c, _d;
|
|
354
|
+
const checked = [];
|
|
355
|
+
for (const [index, permission] of permissions.entries()) {
|
|
356
|
+
if (checked.includes(permission)) {
|
|
357
|
+
report(appDefinition, 'duplicate permission declaration', [...path, 'permissions', index]);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (!possiblePermissions.includes(permission)) {
|
|
361
|
+
if (resourcePermissionPattern.test(permission) ||
|
|
362
|
+
ownResourcePermissionPattern.test(permission)) {
|
|
363
|
+
const [, resourceName] = permission.split(':');
|
|
364
|
+
if (resourceName && resourceName !== 'all' && !((_a = appDefinition.resources) === null || _a === void 0 ? void 0 : _a[resourceName])) {
|
|
365
|
+
report(appDefinition, `resource ${resourceName} does not exist in the app's resources definition`, [...path, 'permissions', index]);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (resourceViewPermissionPattern.test(permission)) {
|
|
370
|
+
const [, resourceName, , resourceView] = permission.split(':');
|
|
371
|
+
if (resourceName === 'all') {
|
|
372
|
+
for (const [rName, resourceDefinition] of Object.entries(appDefinition.resources)) {
|
|
373
|
+
if (!((_b = resourceDefinition.views) === null || _b === void 0 ? void 0 : _b[resourceView])) {
|
|
374
|
+
report(appDefinition, `resource ${rName} is missing a definition for the ${resourceView} view`, [...path, 'permissions', index]);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
if (!((_d = (_c = appDefinition.resources[resourceName]) === null || _c === void 0 ? void 0 : _c.views) === null || _d === void 0 ? void 0 : _d[resourceView])) {
|
|
381
|
+
report(appDefinition, `resource ${resourceName} is missing a definition for the ${resourceView} view`, [...path, 'permissions', index]);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
report(appDefinition, 'invalid permission', [...path, 'permissions', index]);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
if (inheritedPermissions.includes(permission)) {
|
|
390
|
+
report(appDefinition, 'permission is already inherited from another role', [
|
|
391
|
+
...path,
|
|
392
|
+
'permissions',
|
|
393
|
+
index,
|
|
394
|
+
]);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const otherPermissions = permissions.filter((p) => p !== permission);
|
|
398
|
+
if (resourcePermissionPattern.test(permission)) {
|
|
399
|
+
const [, , resourceAction] = permission.split(':');
|
|
400
|
+
if (otherPermissions.some((p) => {
|
|
401
|
+
if (allResourcePermissionPattern.test(p)) {
|
|
402
|
+
const [, , otherResourceAction] = p.split(':');
|
|
403
|
+
return otherResourceAction === resourceAction;
|
|
404
|
+
}
|
|
405
|
+
return false;
|
|
406
|
+
})) {
|
|
407
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all is already declared`, [...path, 'permissions', index]);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (inheritedPermissions.some((p) => {
|
|
411
|
+
if (allResourcePermissionPattern.test(p)) {
|
|
412
|
+
const [, , otherResourceAction] = p.split(':');
|
|
413
|
+
return otherResourceAction === resourceAction;
|
|
414
|
+
}
|
|
415
|
+
return false;
|
|
416
|
+
})) {
|
|
417
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all is already inherited from another role`, [...path, 'permissions', index]);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (ownResourcePermissionPattern.test(permission)) {
|
|
422
|
+
const [, resourceName, , resourceAction] = permission.split(':');
|
|
423
|
+
if (otherPermissions.some((p) => {
|
|
424
|
+
if (resourcePermissionPattern.test(p)) {
|
|
425
|
+
const [, otherResourceName, otherResourceAction] = p.split(':');
|
|
426
|
+
return (resourceName !== 'all' &&
|
|
427
|
+
otherResourceName === resourceName &&
|
|
428
|
+
otherResourceAction === resourceAction);
|
|
429
|
+
}
|
|
430
|
+
return false;
|
|
431
|
+
})) {
|
|
432
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action on resource ${resourceName} is already declared`, [...path, 'permissions', index]);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
if (otherPermissions.some((p) => {
|
|
436
|
+
if (allOwnResourcePermissionPattern.test(p)) {
|
|
437
|
+
const [, , , otherResourceAction] = p.split(':');
|
|
438
|
+
return otherResourceAction === resourceAction;
|
|
439
|
+
}
|
|
440
|
+
return false;
|
|
441
|
+
})) {
|
|
442
|
+
report(appDefinition, `redundant permission. An own permission for the ${resourceAction} resource action with scope all is already declared`, [...path, 'permissions', index]);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
if (otherPermissions.some((p) => {
|
|
446
|
+
if (allResourcePermissionPattern.test(p)) {
|
|
447
|
+
const [, , otherResourceAction] = p.split(':');
|
|
448
|
+
return otherResourceAction === resourceAction;
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
})) {
|
|
452
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all is already declared`, [...path, 'permissions', index]);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (inheritedPermissions.some((p) => {
|
|
456
|
+
if (resourcePermissionPattern.test(p)) {
|
|
457
|
+
const [, otherResourceName, otherResourceAction] = p.split(':');
|
|
458
|
+
return (resourceName !== 'all' &&
|
|
459
|
+
otherResourceName === resourceName &&
|
|
460
|
+
otherResourceAction === resourceAction);
|
|
461
|
+
}
|
|
462
|
+
return false;
|
|
463
|
+
})) {
|
|
464
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action on resource ${resourceName} is already inherited from another role`, [...path, 'permissions', index]);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (inheritedPermissions.some((p) => {
|
|
468
|
+
if (allOwnResourcePermissionPattern.test(p)) {
|
|
469
|
+
const [, , , otherResourceAction] = p.split(':');
|
|
470
|
+
return otherResourceAction === resourceAction;
|
|
471
|
+
}
|
|
472
|
+
return false;
|
|
473
|
+
})) {
|
|
474
|
+
report(appDefinition, `redundant permission. An own permission for the ${resourceAction} resource action with scope all is already inherited from another role`, [...path, 'permissions', index]);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (inheritedPermissions.some((p) => {
|
|
478
|
+
if (allResourcePermissionPattern.test(p)) {
|
|
479
|
+
const [, , otherResourceAction] = p.split(':');
|
|
480
|
+
return otherResourceAction === resourceAction;
|
|
481
|
+
}
|
|
482
|
+
return false;
|
|
483
|
+
})) {
|
|
484
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all is already inherited from another role`, [...path, 'permissions', index]);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (resourceViewPermissionPattern.test(permission)) {
|
|
489
|
+
const [, resourceName, resourceAction, resourceView] = permission.split(':');
|
|
490
|
+
// $resource:type:query:public, $resource:type:query:private
|
|
491
|
+
if (otherPermissions.some((p) => {
|
|
492
|
+
if (resourceViewPermissionPattern.test(p)) {
|
|
493
|
+
const [, otherResourceName, otherResourceAction] = p.split(':');
|
|
494
|
+
return (otherResourceName !== 'all' &&
|
|
495
|
+
otherResourceName === resourceName &&
|
|
496
|
+
otherResourceAction === resourceAction);
|
|
497
|
+
}
|
|
498
|
+
return false;
|
|
499
|
+
})) {
|
|
500
|
+
report(appDefinition, `a view permission for the ${resourceAction} action on resource ${resourceName} is already declared`, [...path, 'permissions', index]);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
// $resource:type:query:public, $resource:all:query:private
|
|
504
|
+
if (otherPermissions.some((p) => {
|
|
505
|
+
if (allResourceViewPermissionPattern.test(p)) {
|
|
506
|
+
const [, , otherResourceAction, otherResourceView] = p.split(':');
|
|
507
|
+
return otherResourceAction === resourceAction && otherResourceView !== resourceView;
|
|
508
|
+
}
|
|
509
|
+
return false;
|
|
510
|
+
})) {
|
|
511
|
+
report(appDefinition, `a view permission for the ${resourceAction} action with scope all is already declared`, [...path, 'permissions', index]);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
// $resource:type:query:public, $resource:type:query
|
|
515
|
+
if (otherPermissions.some((p) => {
|
|
516
|
+
if (resourcePermissionPattern.test(p)) {
|
|
517
|
+
const [, otherResourceName, otherResourceAction] = p.split(':');
|
|
518
|
+
return otherResourceName === resourceName && otherResourceAction === resourceAction;
|
|
519
|
+
}
|
|
520
|
+
return false;
|
|
521
|
+
})) {
|
|
522
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} action on resource ${resourceName} without a specific view is already declared`, [...path, 'permissions', index]);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
// $resource:type:query:public, $resource:all:query
|
|
526
|
+
if (otherPermissions.some((p) => {
|
|
527
|
+
if (resourcePermissionPattern.test(p)) {
|
|
528
|
+
const [, otherResourceName, otherResourceAction] = p.split(':');
|
|
529
|
+
return otherResourceName === 'all' && otherResourceAction === resourceAction;
|
|
530
|
+
}
|
|
531
|
+
return false;
|
|
532
|
+
})) {
|
|
533
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all without a specific view is already declared`, [...path, 'permissions', index]);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
// $resource:type:query:public, $resource:all:query:public
|
|
537
|
+
if (otherPermissions.some((p) => {
|
|
538
|
+
if (allResourceViewPermissionPattern.test(p)) {
|
|
539
|
+
const [, otherResourceName, otherResourceAction, otherResourceView] = p.split(':');
|
|
540
|
+
return (otherResourceName === 'all' &&
|
|
541
|
+
otherResourceAction === resourceAction &&
|
|
542
|
+
otherResourceView === resourceView);
|
|
543
|
+
}
|
|
544
|
+
return false;
|
|
545
|
+
})) {
|
|
546
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all for this view is already declared`, [...path, 'permissions', index]);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
// $resource:type:query:private
|
|
550
|
+
// $resource:type:query:public
|
|
551
|
+
if (inheritedPermissions.some((p) => {
|
|
552
|
+
if (resourceViewPermissionPattern.test(p)) {
|
|
553
|
+
const [, otherResourceName, otherResourceAction] = p.split(':');
|
|
554
|
+
return (otherResourceName !== 'all' &&
|
|
555
|
+
otherResourceName === resourceName &&
|
|
556
|
+
otherResourceAction === resourceAction);
|
|
557
|
+
}
|
|
558
|
+
return false;
|
|
559
|
+
})) {
|
|
560
|
+
report(appDefinition, `a view permission for the ${resourceAction} action on resource ${resourceName} is already inherited from another role`, [...path, 'permissions', index]);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
// $resource:all:query:private
|
|
564
|
+
// $resource:type:query:public
|
|
565
|
+
if (inheritedPermissions.some((p) => {
|
|
566
|
+
if (allResourceViewPermissionPattern.test(p)) {
|
|
567
|
+
const [, , otherResourceAction, otherResourceView] = p.split(':');
|
|
568
|
+
return otherResourceAction === resourceAction && otherResourceView !== resourceView;
|
|
569
|
+
}
|
|
570
|
+
return false;
|
|
571
|
+
})) {
|
|
572
|
+
report(appDefinition, `a view permission for the ${resourceAction} action with scope all is already inherited from another role`, [...path, 'permissions', index]);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
// $resource:type:query
|
|
576
|
+
// $resource:type:query:public
|
|
577
|
+
if (inheritedPermissions.some((p) => {
|
|
578
|
+
if (resourcePermissionPattern.test(p)) {
|
|
579
|
+
const [, otherResourceName, otherResourceAction] = p.split(':');
|
|
580
|
+
return otherResourceName === resourceName && otherResourceAction === resourceAction;
|
|
581
|
+
}
|
|
582
|
+
return false;
|
|
583
|
+
})) {
|
|
584
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} action on resource ${resourceName} without a specific view is already inherited from another role`, [...path, 'permissions', index]);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
// $resource:all:query
|
|
588
|
+
// $resource:type:query:public
|
|
589
|
+
if (inheritedPermissions.some((p) => {
|
|
590
|
+
if (allResourcePermissionPattern.test(p)) {
|
|
591
|
+
const [, , otherResourceAction] = p.split(':');
|
|
592
|
+
return otherResourceAction === resourceAction;
|
|
593
|
+
}
|
|
594
|
+
return false;
|
|
595
|
+
})) {
|
|
596
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all without a specific view is already inherited from another role`, [...path, 'permissions', index]);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
// $resource:all:query:public
|
|
600
|
+
// $resource:type:query:public
|
|
601
|
+
if (inheritedPermissions.some((p) => {
|
|
602
|
+
if (allResourceViewPermissionPattern.test(p)) {
|
|
603
|
+
const [, , otherResourceAction, otherResourceView] = p.split(':');
|
|
604
|
+
return otherResourceAction === resourceAction && otherResourceView === resourceView;
|
|
605
|
+
}
|
|
606
|
+
return false;
|
|
607
|
+
})) {
|
|
608
|
+
report(appDefinition, `redundant permission. A permission for the ${resourceAction} resource action with scope all for this view is already inherited from another role`, [...path, 'permissions', index]);
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
checked.push(permission);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
345
615
|
function checkCyclicRoleInheritance(roles, name, report) {
|
|
346
|
-
let
|
|
616
|
+
let lastChecked;
|
|
347
617
|
const stack = [];
|
|
348
618
|
const checkRoleRecursively = (role) => {
|
|
349
619
|
var _a, _b;
|
|
350
|
-
|
|
620
|
+
lastChecked = role;
|
|
351
621
|
if (stack.includes(role)) {
|
|
352
622
|
return true;
|
|
353
623
|
}
|
|
@@ -355,8 +625,8 @@ function checkCyclicRoleInheritance(roles, name, report) {
|
|
|
355
625
|
return (_b = (_a = roles[role]) === null || _a === void 0 ? void 0 : _a.inherits) === null || _b === void 0 ? void 0 : _b.some(checkRoleRecursively);
|
|
356
626
|
};
|
|
357
627
|
const duplicate = checkRoleRecursively(name);
|
|
358
|
-
if (duplicate &&
|
|
359
|
-
report(roles[name], '
|
|
628
|
+
if (duplicate && lastChecked === name) {
|
|
629
|
+
report(roles[name], 'cyclically inherits itself', ['security', 'roles', name]);
|
|
360
630
|
}
|
|
361
631
|
}
|
|
362
632
|
/**
|
|
@@ -367,59 +637,92 @@ function checkCyclicRoleInheritance(roles, name, report) {
|
|
|
367
637
|
*/
|
|
368
638
|
function validateSecurity(definition, report) {
|
|
369
639
|
const { notifications, security } = definition;
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
if (
|
|
373
|
-
report(notifications, 'only works if security is defined', ['notifications']);
|
|
374
|
-
}
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
const checkRoleExists = (name, path, allow = defaultAllow) => {
|
|
378
|
-
if (!has(security.roles, name) && !allow.includes(name)) {
|
|
640
|
+
const predefinedRoles = Object.keys(PredefinedAppRole);
|
|
641
|
+
const checkRoleExists = (name, path, roles = predefinedRoles) => {
|
|
642
|
+
if (!has(security.roles, name) && !roles.includes(name)) {
|
|
379
643
|
report(name, 'does not exist in this app’s roles', path);
|
|
380
644
|
return false;
|
|
381
645
|
}
|
|
382
646
|
return true;
|
|
383
647
|
};
|
|
384
|
-
const checkRoles = (object, path
|
|
648
|
+
const checkRoles = (object, path) => {
|
|
385
649
|
if (!(object === null || object === void 0 ? void 0 : object.roles)) {
|
|
386
650
|
return;
|
|
387
651
|
}
|
|
388
652
|
for (const [index, role] of object.roles.entries()) {
|
|
389
|
-
checkRoleExists(role, [...path, 'roles', index],
|
|
653
|
+
checkRoleExists(role, [...path, 'roles', index], ['$guest', ...predefinedRoles]);
|
|
390
654
|
}
|
|
391
655
|
};
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
for (const [resourceName, resource] of Object.entries(definition.resources)) {
|
|
396
|
-
checkRoles(resource, ['resources', resourceName], [...defaultAllow, '$author']);
|
|
397
|
-
checkRoles(resource.count, ['resources', resourceName, 'count'], [...defaultAllow, '$author']);
|
|
398
|
-
checkRoles(resource.create, ['resources', resourceName, 'create']);
|
|
399
|
-
checkRoles(resource.delete, ['resources', resourceName, 'delete'], [...defaultAllow, '$author']);
|
|
400
|
-
checkRoles(resource.get, ['resources', resourceName, 'get'], [...defaultAllow, '$author']);
|
|
401
|
-
checkRoles(resource.query, ['resources', resourceName, 'query'], [...defaultAllow, '$author']);
|
|
402
|
-
checkRoles(resource.update, ['resources', resourceName, 'update'], [...defaultAllow, '$author']);
|
|
403
|
-
if (resource.views) {
|
|
404
|
-
for (const [viewName, view] of Object.entries(resource.views)) {
|
|
405
|
-
checkRoles(view, ['resources', resourceName, 'views', viewName], [...defaultAllow, '$author']);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
656
|
+
if (!security) {
|
|
657
|
+
if (notifications === 'login') {
|
|
658
|
+
report(notifications, 'only works if security is defined', ['notifications']);
|
|
408
659
|
}
|
|
660
|
+
return;
|
|
409
661
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
662
|
+
if ((!security.default || !security.roles) && !security.guest) {
|
|
663
|
+
report(definition, 'invalid security definition. Must define either guest or roles and default', ['security']);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
if (security.guest) {
|
|
667
|
+
if (security.guest.inherits && security.guest.inherits.length && !security.roles) {
|
|
668
|
+
report(definition, 'guest can not inherit roles if the roles property is not defined', [
|
|
669
|
+
'security',
|
|
670
|
+
'guest',
|
|
671
|
+
'inherits',
|
|
672
|
+
]);
|
|
673
|
+
return;
|
|
414
674
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
675
|
+
const inheritedPermissions = getAppRolePermissions(security, security.guest.inherits || []);
|
|
676
|
+
const possibleGuestPermissions = getAppPossibleGuestPermissions(definition);
|
|
677
|
+
if (inheritedPermissions.some((ip) => !possibleGuestPermissions.includes(ip))) {
|
|
678
|
+
report(definition, 'invalid security definition. Guest cannot inherit roles that contain own resource permissions', ['security', 'guest', 'inherits']);
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (security.guest.permissions) {
|
|
682
|
+
validatePermissions(definition, security.guest.permissions, inheritedPermissions, possibleGuestPermissions, report, ['security', 'guest']);
|
|
418
683
|
}
|
|
419
|
-
|
|
420
|
-
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
checkRoleExists(security.default.role, ['security', 'default', 'role']);
|
|
687
|
+
}
|
|
688
|
+
if (security.roles) {
|
|
689
|
+
const possibleAppPermissions = getAppPossiblePermissions(definition);
|
|
690
|
+
for (const [name, role] of Object.entries(security.roles)) {
|
|
691
|
+
if (predefinedRoles.includes(name)) {
|
|
692
|
+
report(definition, `not allowed to overwrite role ${name}`, ['security', 'roles', name]);
|
|
693
|
+
}
|
|
694
|
+
const inheritedPermissions = [];
|
|
695
|
+
if (role === null || role === void 0 ? void 0 : role.inherits) {
|
|
696
|
+
let found = false;
|
|
697
|
+
for (const [index, inherited] of (role.inherits || []).entries()) {
|
|
698
|
+
found || (found = checkRoleExists(inherited, ['security', 'roles', name, 'inherits', index]));
|
|
699
|
+
}
|
|
700
|
+
if (found) {
|
|
701
|
+
checkCyclicRoleInheritance(security.roles, name, report);
|
|
702
|
+
}
|
|
703
|
+
const inheritedRoles = getAppInheritedRoles(security, [name]).filter((r) => r !== name);
|
|
704
|
+
for (const inheritedRole of inheritedRoles) {
|
|
705
|
+
const roleDefinition = security.roles[inheritedRole];
|
|
706
|
+
if (roleDefinition) {
|
|
707
|
+
const rolePermissions = roleDefinition.permissions;
|
|
708
|
+
if (rolePermissions) {
|
|
709
|
+
inheritedPermissions.push(...rolePermissions);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
const predefinedRolePermissions = predefinedAppRolePermissions[inheritedRole];
|
|
714
|
+
if (predefinedRolePermissions) {
|
|
715
|
+
inheritedPermissions.push(...predefinedRolePermissions);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
if (role.permissions) {
|
|
721
|
+
validatePermissions(definition, role.permissions, inheritedPermissions, possibleAppPermissions, report, ['security', 'roles', name]);
|
|
722
|
+
}
|
|
421
723
|
}
|
|
422
724
|
}
|
|
725
|
+
iterApp(definition, { onBlock: checkRoles, onPage: checkRoles });
|
|
423
726
|
}
|
|
424
727
|
/**
|
|
425
728
|
* Validates the hooks in resource definition to ensure its properties are valid.
|
|
@@ -522,21 +825,21 @@ function validateActions(definition, report) {
|
|
|
522
825
|
const urlRegex = new RegExp(`^${partialNormalized.source}:`);
|
|
523
826
|
iterApp(definition, {
|
|
524
827
|
onAction(action, path) {
|
|
525
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
828
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
526
829
|
if (path[0] === 'cron' && !serverActions.has(action.type)) {
|
|
527
830
|
report(action.type, 'action type is not supported for cron jobs', [...path, 'type']);
|
|
528
831
|
return;
|
|
529
832
|
}
|
|
530
|
-
if (action.type.startsWith('
|
|
531
|
-
report(action.type, 'refers to
|
|
833
|
+
if (action.type.startsWith('app.member.') && !definition.security) {
|
|
834
|
+
report(action.type, 'refers to an app member action but the app doesn’t have a security definition', [...path, 'type']);
|
|
532
835
|
return;
|
|
533
836
|
}
|
|
534
|
-
if (['
|
|
837
|
+
if (['app.member.register', 'app.member.properties.patch', 'app.member.current.patch'].includes(action.type) &&
|
|
535
838
|
Object.values((_a = action.properties) !== null && _a !== void 0 ? _a : {})[0] &&
|
|
536
|
-
((_b = definition.
|
|
839
|
+
((_b = definition.members) === null || _b === void 0 ? void 0 : _b.properties)) {
|
|
537
840
|
for (const propertyName of Object.keys(Object.values((_c = action.properties) !== null && _c !== void 0 ? _c : {})[0])) {
|
|
538
|
-
if (!((_d = definition.
|
|
539
|
-
report(action.type, 'contains a property that doesn’t exist in
|
|
841
|
+
if (!((_d = definition.members) === null || _d === void 0 ? void 0 : _d.properties[propertyName])) {
|
|
842
|
+
report(action.type, 'contains a property that doesn’t exist in app member properties', [
|
|
540
843
|
...path,
|
|
541
844
|
'properties',
|
|
542
845
|
]);
|
|
@@ -547,58 +850,68 @@ function validateActions(definition, report) {
|
|
|
547
850
|
// All of the actions starting with `resource.` contain a property called `resource`.
|
|
548
851
|
const { resource: resourceName, view } = action;
|
|
549
852
|
const resource = (_e = definition.resources) === null || _e === void 0 ? void 0 : _e[resourceName];
|
|
853
|
+
const [, resourceAction] = action.type.split('.');
|
|
550
854
|
if (!resource) {
|
|
551
855
|
report(action.type, 'refers to a resource that doesn’t exist', [...path, 'resource']);
|
|
552
856
|
return;
|
|
553
857
|
}
|
|
554
858
|
if (!action.type.startsWith('resource.subscription.')) {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
if (!roles) {
|
|
558
|
-
report(action.type, 'refers to a resource action that is currently set to private', [
|
|
559
|
-
...path,
|
|
560
|
-
'resource',
|
|
561
|
-
]);
|
|
859
|
+
if (!definition.security) {
|
|
860
|
+
report(action.type, 'missing security definition', [...path, 'resource']);
|
|
562
861
|
return;
|
|
563
862
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
863
|
+
const allPermissions = ((_f = definition.security.guest) === null || _f === void 0 ? void 0 : _f.permissions) || [];
|
|
864
|
+
if (definition.security.roles) {
|
|
865
|
+
const allRolePermissions = getAppRolePermissions(definition.security, Object.keys(definition.security.roles));
|
|
866
|
+
allPermissions.push(...allRolePermissions);
|
|
567
867
|
}
|
|
568
|
-
if ((
|
|
569
|
-
if (
|
|
570
|
-
|
|
571
|
-
return
|
|
868
|
+
if (!allPermissions.some((permission) => {
|
|
869
|
+
if (resourcePermissionPattern.test(permission)) {
|
|
870
|
+
const [, permissionResourceName, permissionResourceAction] = permission.split(':');
|
|
871
|
+
return (['all', resourceName].includes(permissionResourceName) &&
|
|
872
|
+
(permissionResourceAction === resourceAction ||
|
|
873
|
+
(resourceAction === 'count' && permissionResourceAction === 'query')));
|
|
572
874
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
]);
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
if (viewRoles && !viewRoles.length && !definition.security) {
|
|
582
|
-
report(action.type, 'refers to a resource action that is accessible when logged in, but the app has no security definitions', [...path, 'view']);
|
|
583
|
-
return;
|
|
875
|
+
if (ownResourcePermissionPattern.test(permission)) {
|
|
876
|
+
const [, permissionResourceName, , permissionResourceAction] = permission.split(':');
|
|
877
|
+
return (['all', resourceName].includes(permissionResourceName) &&
|
|
878
|
+
(permissionResourceAction === resourceAction ||
|
|
879
|
+
(resourceAction === 'count' && permissionResourceAction === 'query')));
|
|
584
880
|
}
|
|
881
|
+
return false;
|
|
882
|
+
})) {
|
|
883
|
+
report(action.type, 'there is no-one in the app, who has permissions to use this action', [...path, 'resource']);
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
if (view &&
|
|
887
|
+
!allPermissions.some((permission) => {
|
|
888
|
+
if (resourceViewPermissionPattern.test(permission)) {
|
|
889
|
+
const [, permissionResourceName, permissionResourceAction, permissionResourceView] = permission.split(':');
|
|
890
|
+
return (['all', resourceName].includes(permissionResourceName) &&
|
|
891
|
+
permissionResourceAction === resourceAction &&
|
|
892
|
+
(!permissionResourceView || permissionResourceView === view));
|
|
893
|
+
}
|
|
894
|
+
return false;
|
|
895
|
+
})) {
|
|
896
|
+
report(action.type, 'there is no-one in the app, who has permissions to use this action', [...path, 'resource']);
|
|
897
|
+
return;
|
|
585
898
|
}
|
|
586
899
|
}
|
|
587
900
|
}
|
|
588
901
|
if (action.type.startsWith('flow.')) {
|
|
589
|
-
const page = (
|
|
902
|
+
const page = (_g = definition.pages) === null || _g === void 0 ? void 0 : _g[Number(path[1])];
|
|
590
903
|
if (page.type !== 'flow' && page.type !== 'loop') {
|
|
591
904
|
report(action.type, 'flow actions can only be used on pages with the type ‘flow’ or ‘loop’', [...path, 'type']);
|
|
592
905
|
return;
|
|
593
906
|
}
|
|
594
|
-
if (action.type === 'flow.cancel' && !((
|
|
907
|
+
if (action.type === 'flow.cancel' && !((_h = page.actions) === null || _h === void 0 ? void 0 : _h.onFlowCancel)) {
|
|
595
908
|
report(action.type, 'was defined but ‘onFlowCancel’ page action wasn’t defined', [
|
|
596
909
|
...path,
|
|
597
910
|
'type',
|
|
598
911
|
]);
|
|
599
912
|
return;
|
|
600
913
|
}
|
|
601
|
-
if (action.type === 'flow.finish' && !((
|
|
914
|
+
if (action.type === 'flow.finish' && !((_j = page.actions) === null || _j === void 0 ? void 0 : _j.onFlowFinish)) {
|
|
602
915
|
report(action.type, 'was defined but ‘onFlowFinish’ page action wasn’t defined', [
|
|
603
916
|
...path,
|
|
604
917
|
'type',
|
|
@@ -612,7 +925,7 @@ function validateActions(definition, report) {
|
|
|
612
925
|
if (page.type === 'flow' &&
|
|
613
926
|
action.type === 'flow.next' &&
|
|
614
927
|
Number(path[3]) === page.steps.length - 1 &&
|
|
615
|
-
!((
|
|
928
|
+
!((_k = page.actions) === null || _k === void 0 ? void 0 : _k.onFlowFinish)) {
|
|
616
929
|
report(action.type, 'was defined on the last step but ‘onFlowFinish’ page action wasn’t defined', [...path, 'type']);
|
|
617
930
|
return;
|
|
618
931
|
}
|
|
@@ -858,7 +1171,7 @@ export async function validateAppDefinition(definition, getBlockVersions, contro
|
|
|
858
1171
|
validateHooks(definition, report);
|
|
859
1172
|
validateLanguage(definition, report);
|
|
860
1173
|
validateResourceReferences(definition, report);
|
|
861
|
-
|
|
1174
|
+
validateMembersSchema(definition, report);
|
|
862
1175
|
validateResourceSchemas(definition, report);
|
|
863
1176
|
validateSecurity(definition, report);
|
|
864
1177
|
validateBlocks(definition, blockVersionMap, report);
|