@contember/engine-vimeo-plugin 2.2.0-alpha.1 → 2.2.0-alpha.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contember/engine-vimeo-plugin",
3
3
  "license": "Apache-2.0",
4
- "version": "2.2.0-alpha.1",
4
+ "version": "2.2.0-alpha.11",
5
5
  "main": "./dist/production/index.js",
6
6
  "typings": "./dist/types/index.d.ts",
7
7
  "exports": {
@@ -23,8 +23,8 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@contember/engine-plugins": "2.1.0-beta.2",
27
- "@contember/typesafe": "2.1.0-beta.2"
26
+ "@contember/engine-plugins": "2.2.0-alpha.11",
27
+ "@contember/typesafe": "2.2.0-alpha.11"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^24.12.0",
@@ -22,20 +22,12 @@ export class VimeoSchemaContributor implements GraphQLSchemaContributor {
22
22
  private readonly vimeoServiceFactory: VimeoServiceFactory,
23
23
  ) {}
24
24
 
25
- getCacheKey?(context: GraphQLSchemaContributorContext): string {
26
- return context.project.vimeo ? 'yes' : 'no'
25
+ getCacheKey(context: GraphQLSchemaContributorContext): string {
26
+ return this.isUploadAllowed(context) ? 'yes' : 'no'
27
27
  }
28
28
 
29
29
  createSchema(context: GraphQLSchemaContributorContext): GraphQLSchemaConfig | undefined {
30
- if (!context.project.vimeo) {
31
- return undefined
32
- }
33
-
34
- if (
35
- !context.identity.projectRoles.find(
36
- role => (context.schema.acl.roles[role]?.vimeo as VimeoAcl | undefined)?.upload,
37
- )
38
- ) {
30
+ if (!this.isUploadAllowed(context)) {
39
31
  return undefined
40
32
  }
41
33
 
@@ -59,6 +51,10 @@ export class VimeoSchemaContributor implements GraphQLSchemaContributor {
59
51
  }
60
52
  }
61
53
 
54
+ private isUploadAllowed({ project, schema, identity }: GraphQLSchemaContributorContext): boolean {
55
+ return !!project.vimeo && identity.projectRoles.some(role => (schema.acl.roles[role]?.vimeo as VimeoAcl | undefined)?.upload)
56
+ }
57
+
62
58
  private createMutation(): GraphQLFieldConfig<any, any, any> {
63
59
  return {
64
60
  type: new GraphQLNonNull(