@contember/engine-vimeo-plugin 2.1.0-alpha.3 → 2.1.0-alpha.35

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.
Files changed (52) hide show
  1. package/package.json +13 -8
  2. package/dist/development/index.cjs +0 -25
  3. package/dist/development/index.cjs.map +0 -1
  4. package/dist/development/index.js +0 -26
  5. package/dist/development/index.js.map +0 -1
  6. package/dist/development/src/Config.cjs +0 -25
  7. package/dist/development/src/Config.cjs.map +0 -1
  8. package/dist/development/src/Config.js +0 -8
  9. package/dist/development/src/Config.js.map +0 -1
  10. package/dist/development/src/VimeoConfigProcessor.cjs +0 -44
  11. package/dist/development/src/VimeoConfigProcessor.cjs.map +0 -1
  12. package/dist/development/src/VimeoConfigProcessor.js +0 -27
  13. package/dist/development/src/VimeoConfigProcessor.js.map +0 -1
  14. package/dist/development/src/VimeoSchemaContributor.cjs +0 -90
  15. package/dist/development/src/VimeoSchemaContributor.cjs.map +0 -1
  16. package/dist/development/src/VimeoSchemaContributor.js +0 -90
  17. package/dist/development/src/VimeoSchemaContributor.js.map +0 -1
  18. package/dist/development/src/VimeoService.cjs +0 -50
  19. package/dist/development/src/VimeoService.cjs.map +0 -1
  20. package/dist/development/src/VimeoService.js +0 -50
  21. package/dist/development/src/VimeoService.js.map +0 -1
  22. package/dist/production/index.cjs +0 -25
  23. package/dist/production/index.cjs.map +0 -1
  24. package/dist/production/index.js +0 -26
  25. package/dist/production/index.js.map +0 -1
  26. package/dist/production/src/Config.cjs +0 -25
  27. package/dist/production/src/Config.cjs.map +0 -1
  28. package/dist/production/src/Config.js +0 -8
  29. package/dist/production/src/Config.js.map +0 -1
  30. package/dist/production/src/VimeoConfigProcessor.cjs +0 -44
  31. package/dist/production/src/VimeoConfigProcessor.cjs.map +0 -1
  32. package/dist/production/src/VimeoConfigProcessor.js +0 -27
  33. package/dist/production/src/VimeoConfigProcessor.js.map +0 -1
  34. package/dist/production/src/VimeoSchemaContributor.cjs +0 -90
  35. package/dist/production/src/VimeoSchemaContributor.cjs.map +0 -1
  36. package/dist/production/src/VimeoSchemaContributor.js +0 -90
  37. package/dist/production/src/VimeoSchemaContributor.js.map +0 -1
  38. package/dist/production/src/VimeoService.cjs +0 -50
  39. package/dist/production/src/VimeoService.cjs.map +0 -1
  40. package/dist/production/src/VimeoService.js +0 -50
  41. package/dist/production/src/VimeoService.js.map +0 -1
  42. package/dist/types/Config.d.ts +0 -9
  43. package/dist/types/Config.d.ts.map +0 -1
  44. package/dist/types/VimeoConfigProcessor.d.ts +0 -8
  45. package/dist/types/VimeoConfigProcessor.d.ts.map +0 -1
  46. package/dist/types/VimeoSchemaContributor.d.ts +0 -11
  47. package/dist/types/VimeoSchemaContributor.d.ts.map +0 -1
  48. package/dist/types/VimeoService.d.ts +0 -21
  49. package/dist/types/VimeoService.d.ts.map +0 -1
  50. package/dist/types/index.d.ts +0 -12
  51. package/dist/types/index.d.ts.map +0 -1
  52. package/dist/types/tsconfig.tsbuildinfo +0 -1
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.1.0-alpha.3",
4
+ "version": "2.1.0-alpha.35",
5
5
  "main": "./dist/production/index.js",
6
6
  "typings": "./dist/types/index.d.ts",
7
7
  "exports": {
@@ -23,16 +23,21 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@contember/engine-plugins": "2.1.0-alpha.3",
27
- "@contember/typesafe": "2.1.0-alpha.3"
26
+ "@contember/engine-plugins": "workspace:*",
27
+ "@contember/typesafe": "workspace:*"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/node": "^20.17.22",
31
- "graphql": "^16.9.0"
30
+ "@types/node": "catalog:",
31
+ "graphql": "catalog:"
32
32
  },
33
33
  "peerDependencies": {
34
- "graphql": ">= 14.6.0",
35
- "pg": "^8.9.0"
34
+ "graphql": "catalog:",
35
+ "pg": "catalog:"
36
36
  },
37
- "type": "module"
37
+ "type": "module",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/contember/contember.git",
41
+ "directory": "packages/engine-vimeo-plugin"
42
+ }
38
43
  }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const VimeoConfigProcessor = require("./src/VimeoConfigProcessor.cjs");
4
- const VimeoSchemaContributor = require("./src/VimeoSchemaContributor.cjs");
5
- const VimeoService = require("./src/VimeoService.cjs");
6
- var __defProp = Object.defineProperty;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
9
- class VimeoPlugin {
10
- constructor() {
11
- __publicField(this, "name", "contember/vimeo");
12
- }
13
- getConfigProcessor() {
14
- return new VimeoConfigProcessor.VimeoConfigProcessor();
15
- }
16
- getSchemaContributor() {
17
- const vimeoServiceFactory = new VimeoService.VimeoServiceFactory();
18
- return new VimeoSchemaContributor.VimeoSchemaContributor(vimeoServiceFactory);
19
- }
20
- }
21
- exports.VimeoSchemaContributor = VimeoSchemaContributor.VimeoSchemaContributor;
22
- exports.VimeoService = VimeoService.VimeoService;
23
- exports.VimeoServiceFactory = VimeoService.VimeoServiceFactory;
24
- exports.default = VimeoPlugin;
25
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../packages/engine-vimeo-plugin/src/index.ts"],"sourcesContent":["import { Plugin, SchemaContributorArgs } from '@contember/engine-plugins'\nimport { VimeoConfigProcessor } from './VimeoConfigProcessor'\nimport { VimeoSchemaContributor } from './VimeoSchemaContributor'\nimport { VimeoServiceFactory } from './VimeoService'\nimport { ProjectVimeoConfig } from './Config'\n\nexport * from './VimeoSchemaContributor'\nexport * from './VimeoService'\n\nexport default class VimeoPlugin implements Plugin<ProjectVimeoConfig> {\n\tname = 'contember/vimeo'\n\n\tgetConfigProcessor() {\n\t\treturn new VimeoConfigProcessor()\n\t}\n\n\tgetSchemaContributor() {\n\t\tconst vimeoServiceFactory = new VimeoServiceFactory()\n\t\treturn new VimeoSchemaContributor(vimeoServiceFactory)\n\t}\n}\n"],"names":["VimeoConfigProcessor","VimeoServiceFactory","VimeoSchemaContributor"],"mappings":";;;;;;;;AASA,MAAqB,YAAkD;AAAA,EAAvE,cAAA;AACQ,kBAAA,MAAA,QAAA,iBAAA;AAAA,EAAA;AAAA,EAEP,qBAAqB;AACpB,WAAO,IAAIA,qBAAAA,qBAAqB;AAAA,EAAA;AAAA,EAGjC,uBAAuB;AAChB,UAAA,sBAAsB,IAAIC,iCAAoB;AAC7C,WAAA,IAAIC,8CAAuB,mBAAmB;AAAA,EAAA;AAEvD;;;;;"}
@@ -1,26 +0,0 @@
1
- import { VimeoConfigProcessor } from "./src/VimeoConfigProcessor.js";
2
- import { VimeoSchemaContributor } from "./src/VimeoSchemaContributor.js";
3
- import { VimeoServiceFactory } from "./src/VimeoService.js";
4
- import { VimeoService } from "./src/VimeoService.js";
5
- var __defProp = Object.defineProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
8
- class VimeoPlugin {
9
- constructor() {
10
- __publicField(this, "name", "contember/vimeo");
11
- }
12
- getConfigProcessor() {
13
- return new VimeoConfigProcessor();
14
- }
15
- getSchemaContributor() {
16
- const vimeoServiceFactory = new VimeoServiceFactory();
17
- return new VimeoSchemaContributor(vimeoServiceFactory);
18
- }
19
- }
20
- export {
21
- VimeoSchemaContributor,
22
- VimeoService,
23
- VimeoServiceFactory,
24
- VimeoPlugin as default
25
- };
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../packages/engine-vimeo-plugin/src/index.ts"],"sourcesContent":["import { Plugin, SchemaContributorArgs } from '@contember/engine-plugins'\nimport { VimeoConfigProcessor } from './VimeoConfigProcessor'\nimport { VimeoSchemaContributor } from './VimeoSchemaContributor'\nimport { VimeoServiceFactory } from './VimeoService'\nimport { ProjectVimeoConfig } from './Config'\n\nexport * from './VimeoSchemaContributor'\nexport * from './VimeoService'\n\nexport default class VimeoPlugin implements Plugin<ProjectVimeoConfig> {\n\tname = 'contember/vimeo'\n\n\tgetConfigProcessor() {\n\t\treturn new VimeoConfigProcessor()\n\t}\n\n\tgetSchemaContributor() {\n\t\tconst vimeoServiceFactory = new VimeoServiceFactory()\n\t\treturn new VimeoSchemaContributor(vimeoServiceFactory)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AASA,MAAqB,YAAkD;AAAA,EAAvE,cAAA;AACQ,kBAAA,MAAA,QAAA,iBAAA;AAAA,EAAA;AAAA,EAEP,qBAAqB;AACpB,WAAO,IAAI,qBAAqB;AAAA,EAAA;AAAA,EAGjC,uBAAuB;AAChB,UAAA,sBAAsB,IAAI,oBAAoB;AAC7C,WAAA,IAAI,uBAAuB,mBAAmB;AAAA,EAAA;AAEvD;"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Typesafe = require("@contember/typesafe");
4
- function _interopNamespaceDefault(e) {
5
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
- if (e) {
7
- for (const k in e) {
8
- if (k !== "default") {
9
- const d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: () => e[k]
13
- });
14
- }
15
- }
16
- }
17
- n.default = e;
18
- return Object.freeze(n);
19
- }
20
- const Typesafe__namespace = /* @__PURE__ */ _interopNamespaceDefault(Typesafe);
21
- const vimeoConfigSchema = Typesafe__namespace.object({
22
- token: Typesafe__namespace.string
23
- });
24
- exports.vimeoConfigSchema = vimeoConfigSchema;
25
- //# sourceMappingURL=Config.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.cjs","sources":["../../../../packages/engine-vimeo-plugin/src/Config.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\n\nexport const vimeoConfigSchema = Typesafe.object({\n\ttoken: Typesafe.string,\n})\n\nexport type VimeoConfig = ReturnType<typeof vimeoConfigSchema>\n\nexport type ProjectVimeoConfig = { vimeo?: VimeoConfig | undefined }\n"],"names":["Typesafe"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEa,MAAA,oBAAoBA,oBAAS,OAAO;AAAA,EAChD,OAAOA,oBAAS;AACjB,CAAC;;"}
@@ -1,8 +0,0 @@
1
- import * as Typesafe from "@contember/typesafe";
2
- const vimeoConfigSchema = Typesafe.object({
3
- token: Typesafe.string
4
- });
5
- export {
6
- vimeoConfigSchema
7
- };
8
- //# sourceMappingURL=Config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.js","sources":["../../../../packages/engine-vimeo-plugin/src/Config.ts"],"sourcesContent":["import * as Typesafe from '@contember/typesafe'\n\nexport const vimeoConfigSchema = Typesafe.object({\n\ttoken: Typesafe.string,\n})\n\nexport type VimeoConfig = ReturnType<typeof vimeoConfigSchema>\n\nexport type ProjectVimeoConfig = { vimeo?: VimeoConfig | undefined }\n"],"names":[],"mappings":";AAEa,MAAA,oBAAoB,SAAS,OAAO;AAAA,EAChD,OAAO,SAAS;AACjB,CAAC;"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Typesafe = require("@contember/typesafe");
4
- const Config = require("./Config.cjs");
5
- function _interopNamespaceDefault(e) {
6
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e) {
8
- for (const k in e) {
9
- if (k !== "default") {
10
- const d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: () => e[k]
14
- });
15
- }
16
- }
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
20
- }
21
- const Typesafe__namespace = /* @__PURE__ */ _interopNamespaceDefault(Typesafe);
22
- class VimeoConfigProcessor {
23
- getProjectConfigSchema(slug) {
24
- return Typesafe__namespace.union(
25
- (input, path = []) => Typesafe__namespace.valueAt(input, ["vimeo", "token"]) === void 0 ? {} : Typesafe__namespace.fail(path),
26
- Typesafe__namespace.object({
27
- vimeo: Config.vimeoConfigSchema
28
- })
29
- );
30
- }
31
- prepareConfigTemplate(template, { env }) {
32
- return {
33
- ...template,
34
- projectDefaults: {
35
- ...template.projectDefaults,
36
- vimeo: {
37
- token: `%?project.secret.vimeo.token||project.env.VIMEO_TOKEN%`
38
- }
39
- }
40
- };
41
- }
42
- }
43
- exports.VimeoConfigProcessor = VimeoConfigProcessor;
44
- //# sourceMappingURL=VimeoConfigProcessor.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VimeoConfigProcessor.cjs","sources":["../../../../packages/engine-vimeo-plugin/src/VimeoConfigProcessor.ts"],"sourcesContent":["import { ConfigProcessor, ConfigTemplate, ConfigTemplateContext } from '@contember/engine-plugins'\nimport * as Typesafe from '@contember/typesafe'\nimport { ProjectVimeoConfig, vimeoConfigSchema } from './Config'\n\nexport class VimeoConfigProcessor implements ConfigProcessor<ProjectVimeoConfig> {\n\tgetProjectConfigSchema?(slug: string): Typesafe.Type<ProjectVimeoConfig> {\n\t\treturn Typesafe.union(\n\t\t\t(input, path = []) => Typesafe.valueAt(input, ['vimeo', 'token']) === undefined ? {} : Typesafe.fail(path),\n\t\t\tTypesafe.object({\n\t\t\t\tvimeo: vimeoConfigSchema,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprepareConfigTemplate(template: ConfigTemplate, { env }: ConfigTemplateContext) {\n\t\treturn {\n\t\t\t...template,\n\t\t\tprojectDefaults: {\n\t\t\t\t...template.projectDefaults,\n\t\t\t\tvimeo: {\n\t\t\t\t\ttoken: `%?project.secret.vimeo.token||project.env.VIMEO_TOKEN%`,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n}\n"],"names":["Typesafe","vimeoConfigSchema"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIO,MAAM,qBAAoE;AAAA,EAChF,uBAAwB,MAAiD;AACxE,WAAOA,oBAAS;AAAA,MACf,CAAC,OAAO,OAAO,CAAA,MAAOA,oBAAS,QAAQ,OAAO,CAAC,SAAS,OAAO,CAAC,MAAM,SAAY,CAAK,IAAAA,oBAAS,KAAK,IAAI;AAAA,MACzGA,oBAAS,OAAO;AAAA,QACf,OAAOC,OAAAA;AAAAA,MACP,CAAA;AAAA,IACF;AAAA,EAAA;AAAA,EAGD,sBAAsB,UAA0B,EAAE,OAA8B;AACxE,WAAA;AAAA,MACN,GAAG;AAAA,MACH,iBAAiB;AAAA,QAChB,GAAG,SAAS;AAAA,QACZ,OAAO;AAAA,UACN,OAAO;AAAA,QAAA;AAAA,MACR;AAAA,IAEF;AAAA,EAAA;AAEF;;"}
@@ -1,27 +0,0 @@
1
- import * as Typesafe from "@contember/typesafe";
2
- import { vimeoConfigSchema } from "./Config.js";
3
- class VimeoConfigProcessor {
4
- getProjectConfigSchema(slug) {
5
- return Typesafe.union(
6
- (input, path = []) => Typesafe.valueAt(input, ["vimeo", "token"]) === void 0 ? {} : Typesafe.fail(path),
7
- Typesafe.object({
8
- vimeo: vimeoConfigSchema
9
- })
10
- );
11
- }
12
- prepareConfigTemplate(template, { env }) {
13
- return {
14
- ...template,
15
- projectDefaults: {
16
- ...template.projectDefaults,
17
- vimeo: {
18
- token: `%?project.secret.vimeo.token||project.env.VIMEO_TOKEN%`
19
- }
20
- }
21
- };
22
- }
23
- }
24
- export {
25
- VimeoConfigProcessor
26
- };
27
- //# sourceMappingURL=VimeoConfigProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VimeoConfigProcessor.js","sources":["../../../../packages/engine-vimeo-plugin/src/VimeoConfigProcessor.ts"],"sourcesContent":["import { ConfigProcessor, ConfigTemplate, ConfigTemplateContext } from '@contember/engine-plugins'\nimport * as Typesafe from '@contember/typesafe'\nimport { ProjectVimeoConfig, vimeoConfigSchema } from './Config'\n\nexport class VimeoConfigProcessor implements ConfigProcessor<ProjectVimeoConfig> {\n\tgetProjectConfigSchema?(slug: string): Typesafe.Type<ProjectVimeoConfig> {\n\t\treturn Typesafe.union(\n\t\t\t(input, path = []) => Typesafe.valueAt(input, ['vimeo', 'token']) === undefined ? {} : Typesafe.fail(path),\n\t\t\tTypesafe.object({\n\t\t\t\tvimeo: vimeoConfigSchema,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprepareConfigTemplate(template: ConfigTemplate, { env }: ConfigTemplateContext) {\n\t\treturn {\n\t\t\t...template,\n\t\t\tprojectDefaults: {\n\t\t\t\t...template.projectDefaults,\n\t\t\t\tvimeo: {\n\t\t\t\t\ttoken: `%?project.secret.vimeo.token||project.env.VIMEO_TOKEN%`,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,qBAAoE;AAAA,EAChF,uBAAwB,MAAiD;AACxE,WAAO,SAAS;AAAA,MACf,CAAC,OAAO,OAAO,CAAA,MAAO,SAAS,QAAQ,OAAO,CAAC,SAAS,OAAO,CAAC,MAAM,SAAY,CAAK,IAAA,SAAS,KAAK,IAAI;AAAA,MACzG,SAAS,OAAO;AAAA,QACf,OAAO;AAAA,MACP,CAAA;AAAA,IACF;AAAA,EAAA;AAAA,EAGD,sBAAsB,UAA0B,EAAE,OAA8B;AACxE,WAAA;AAAA,MACN,GAAG;AAAA,MACH,iBAAiB;AAAA,QAChB,GAAG,SAAS;AAAA,QACZ,OAAO;AAAA,UACN,OAAO;AAAA,QAAA;AAAA,MACR;AAAA,IAEF;AAAA,EAAA;AAEF;"}
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const graphql = require("graphql");
4
- class VimeoSchemaContributor {
5
- constructor(vimeoServiceFactory) {
6
- this.vimeoServiceFactory = vimeoServiceFactory;
7
- }
8
- getCacheKey(context) {
9
- return context.project.vimeo ? "yes" : "no";
10
- }
11
- createSchema(context) {
12
- if (!context.project.vimeo) {
13
- return void 0;
14
- }
15
- if (!context.identity.projectRoles.find(
16
- (role) => context.schema.acl.roles[role]?.vimeo?.upload
17
- )) {
18
- return void 0;
19
- }
20
- const uploadMutation = this.createMutation();
21
- const mutation = {
22
- generateVimeoUploadUrl: uploadMutation
23
- };
24
- return {
25
- mutation: new graphql.GraphQLObjectType({
26
- name: "Mutation",
27
- fields: () => mutation
28
- }),
29
- query: new graphql.GraphQLObjectType({
30
- name: "Query",
31
- fields: () => ({
32
- vimeoDummyQuery: {
33
- type: graphql.GraphQLString
34
- }
35
- })
36
- })
37
- };
38
- }
39
- createMutation() {
40
- return {
41
- type: new graphql.GraphQLNonNull(
42
- new graphql.GraphQLObjectType({
43
- name: "VimeoUploadResponse",
44
- fields: {
45
- ok: { type: new graphql.GraphQLNonNull(graphql.GraphQLBoolean) },
46
- errors: {
47
- type: new graphql.GraphQLNonNull(
48
- new graphql.GraphQLList(
49
- new graphql.GraphQLNonNull(
50
- new graphql.GraphQLObjectType({
51
- name: "VimeoUploadError",
52
- fields: {
53
- endUserMessage: { type: graphql.GraphQLString },
54
- developerMessage: { type: graphql.GraphQLString },
55
- code: { type: graphql.GraphQLInt }
56
- }
57
- })
58
- )
59
- )
60
- )
61
- },
62
- result: {
63
- type: new graphql.GraphQLObjectType({
64
- name: "VimeoUploadResult",
65
- fields: {
66
- uploadUrl: { type: new graphql.GraphQLNonNull(graphql.GraphQLString) },
67
- vimeoId: { type: new graphql.GraphQLNonNull(graphql.GraphQLString) }
68
- }
69
- })
70
- }
71
- }
72
- })
73
- ),
74
- args: {
75
- size: {
76
- type: new graphql.GraphQLNonNull(graphql.GraphQLInt)
77
- }
78
- },
79
- resolve: async (parent, args, ctx) => {
80
- if (!ctx.project.vimeo) {
81
- throw new graphql.GraphQLError("Vimeo is not configured for this project");
82
- }
83
- const vimeoService = this.vimeoServiceFactory.create(ctx.project.vimeo);
84
- return await vimeoService.getUploadUrl(args.size);
85
- }
86
- };
87
- }
88
- }
89
- exports.VimeoSchemaContributor = VimeoSchemaContributor;
90
- //# sourceMappingURL=VimeoSchemaContributor.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VimeoSchemaContributor.cjs","sources":["../../../../packages/engine-vimeo-plugin/src/VimeoSchemaContributor.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLError,\n\tGraphQLFieldConfig,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLSchemaConfig,\n\tGraphQLString,\n} from 'graphql'\nimport { VimeoServiceFactory } from './VimeoService'\nimport { ProjectVimeoConfig } from './Config'\nimport { GraphQLSchemaContributor, GraphQLSchemaContributorContext } from '@contember/engine-plugins'\n\ninterface VimeoAcl {\n\tupload?: boolean\n}\n\nexport class VimeoSchemaContributor implements GraphQLSchemaContributor {\n\tconstructor(\n\t\tprivate readonly vimeoServiceFactory: VimeoServiceFactory,\n\t) {}\n\n\tgetCacheKey?(context: GraphQLSchemaContributorContext): string {\n\t\treturn context.project.vimeo ? 'yes' : 'no'\n\t}\n\n\tcreateSchema(context: GraphQLSchemaContributorContext): GraphQLSchemaConfig | undefined {\n\t\tif (!context.project.vimeo) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (\n\t\t\t!context.identity.projectRoles.find(\n\t\t\t\trole => (context.schema.acl.roles[role]?.vimeo as VimeoAcl | undefined)?.upload,\n\t\t\t)\n\t\t) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst uploadMutation = this.createMutation()\n\t\tconst mutation = {\n\t\t\tgenerateVimeoUploadUrl: uploadMutation as GraphQLFieldConfig<any, any, any>,\n\t\t}\n\t\treturn {\n\t\t\tmutation: new GraphQLObjectType({\n\t\t\t\tname: 'Mutation',\n\t\t\t\tfields: () => mutation,\n\t\t\t}),\n\t\t\tquery: new GraphQLObjectType({\n\t\t\t\tname: 'Query',\n\t\t\t\tfields: () => ({\n\t\t\t\t\tvimeoDummyQuery: {\n\t\t\t\t\t\ttype: GraphQLString,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t}),\n\t\t}\n\t}\n\n\tprivate createMutation(): GraphQLFieldConfig<any, any, any> {\n\t\treturn {\n\t\t\ttype: new GraphQLNonNull(\n\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\tname: 'VimeoUploadResponse',\n\t\t\t\t\tfields: {\n\t\t\t\t\t\tok: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\t\t\t\t\terrors: {\n\t\t\t\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\t\t\t\tnew GraphQLList(\n\t\t\t\t\t\t\t\t\tnew GraphQLNonNull(\n\t\t\t\t\t\t\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\t\t\t\t\t\t\tname: 'VimeoUploadError',\n\t\t\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\t\t\tendUserMessage: { type: GraphQLString },\n\t\t\t\t\t\t\t\t\t\t\t\tdeveloperMessage: { type: GraphQLString },\n\t\t\t\t\t\t\t\t\t\t\t\tcode: { type: GraphQLInt },\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\ttype: new GraphQLObjectType({\n\t\t\t\t\t\t\t\tname: 'VimeoUploadResult',\n\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\tuploadUrl: { type: new GraphQLNonNull(GraphQLString) },\n\t\t\t\t\t\t\t\t\tvimeoId: { type: new GraphQLNonNull(GraphQLString) },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t\targs: {\n\t\t\t\tsize: {\n\t\t\t\t\ttype: new GraphQLNonNull(GraphQLInt),\n\t\t\t\t},\n\t\t\t},\n\t\t\tresolve: async (parent: any, args: { size: number }, ctx: { project: ProjectVimeoConfig }) => {\n\t\t\t\tif (!ctx.project.vimeo) {\n\t\t\t\t\tthrow new GraphQLError('Vimeo is not configured for this project')\n\t\t\t\t}\n\t\t\t\tconst vimeoService = this.vimeoServiceFactory.create(ctx.project.vimeo)\n\t\t\t\treturn await vimeoService.getUploadUrl(args.size)\n\t\t\t},\n\t\t}\n\t}\n}\n"],"names":["GraphQLObjectType","GraphQLString","GraphQLNonNull","GraphQLBoolean","GraphQLList","GraphQLInt","GraphQLError"],"mappings":";;;AAmBO,MAAM,uBAA2D;AAAA,EACvE,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAAA,EAAA;AAAA,EAGlB,YAAa,SAAkD;AACvD,WAAA,QAAQ,QAAQ,QAAQ,QAAQ;AAAA,EAAA;AAAA,EAGxC,aAAa,SAA2E;AACnF,QAAA,CAAC,QAAQ,QAAQ,OAAO;AACpB,aAAA;AAAA,IAAA;AAIP,QAAA,CAAC,QAAQ,SAAS,aAAa;AAAA,MAC9B,UAAS,QAAQ,OAAO,IAAI,MAAM,IAAI,GAAG,OAAgC;AAAA,IAAA,GAEzE;AACM,aAAA;AAAA,IAAA;AAGF,UAAA,iBAAiB,KAAK,eAAe;AAC3C,UAAM,WAAW;AAAA,MAChB,wBAAwB;AAAA,IACzB;AACO,WAAA;AAAA,MACN,UAAU,IAAIA,QAAAA,kBAAkB;AAAA,QAC/B,MAAM;AAAA,QACN,QAAQ,MAAM;AAAA,MAAA,CACd;AAAA,MACD,OAAO,IAAIA,QAAAA,kBAAkB;AAAA,QAC5B,MAAM;AAAA,QACN,QAAQ,OAAO;AAAA,UACd,iBAAiB;AAAA,YAChB,MAAMC,QAAAA;AAAAA,UAAA;AAAA,QAER;AAAA,MACA,CAAA;AAAA,IACF;AAAA,EAAA;AAAA,EAGO,iBAAoD;AACpD,WAAA;AAAA,MACN,MAAM,IAAIC,QAAA;AAAA,QACT,IAAIF,0BAAkB;AAAA,UACrB,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,IAAI,EAAE,MAAM,IAAIE,QAAA,eAAeC,QAAc,cAAA,EAAE;AAAA,YAC/C,QAAQ;AAAA,cACP,MAAM,IAAID,QAAA;AAAA,gBACT,IAAIE,QAAA;AAAA,kBACH,IAAIF,QAAA;AAAA,oBACH,IAAIF,0BAAkB;AAAA,sBACrB,MAAM;AAAA,sBACN,QAAQ;AAAA,wBACP,gBAAgB,EAAE,MAAMC,sBAAc;AAAA,wBACtC,kBAAkB,EAAE,MAAMA,sBAAc;AAAA,wBACxC,MAAM,EAAE,MAAMI,QAAW,WAAA;AAAA,sBAAA;AAAA,oBAE1B,CAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,cACD;AAAA,YAEF;AAAA,YACA,QAAQ;AAAA,cACP,MAAM,IAAIL,QAAAA,kBAAkB;AAAA,gBAC3B,MAAM;AAAA,gBACN,QAAQ;AAAA,kBACP,WAAW,EAAE,MAAM,IAAIE,QAAA,eAAeD,QAAa,aAAA,EAAE;AAAA,kBACrD,SAAS,EAAE,MAAM,IAAIC,QAAAA,eAAeD,QAAAA,aAAa,EAAE;AAAA,gBAAA;AAAA,cAEpD,CAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAED,CAAA;AAAA,MACF;AAAA,MACA,MAAM;AAAA,QACL,MAAM;AAAA,UACL,MAAM,IAAIC,QAAAA,eAAeG,QAAU,UAAA;AAAA,QAAA;AAAA,MAErC;AAAA,MACA,SAAS,OAAO,QAAa,MAAwB,QAAyC;AACzF,YAAA,CAAC,IAAI,QAAQ,OAAO;AACjB,gBAAA,IAAIC,qBAAa,0CAA0C;AAAA,QAAA;AAElE,cAAM,eAAe,KAAK,oBAAoB,OAAO,IAAI,QAAQ,KAAK;AACtE,eAAO,MAAM,aAAa,aAAa,KAAK,IAAI;AAAA,MAAA;AAAA,IAElD;AAAA,EAAA;AAEF;;"}
@@ -1,90 +0,0 @@
1
- import { GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLBoolean, GraphQLList, GraphQLInt, GraphQLError } from "graphql";
2
- class VimeoSchemaContributor {
3
- constructor(vimeoServiceFactory) {
4
- this.vimeoServiceFactory = vimeoServiceFactory;
5
- }
6
- getCacheKey(context) {
7
- return context.project.vimeo ? "yes" : "no";
8
- }
9
- createSchema(context) {
10
- if (!context.project.vimeo) {
11
- return void 0;
12
- }
13
- if (!context.identity.projectRoles.find(
14
- (role) => context.schema.acl.roles[role]?.vimeo?.upload
15
- )) {
16
- return void 0;
17
- }
18
- const uploadMutation = this.createMutation();
19
- const mutation = {
20
- generateVimeoUploadUrl: uploadMutation
21
- };
22
- return {
23
- mutation: new GraphQLObjectType({
24
- name: "Mutation",
25
- fields: () => mutation
26
- }),
27
- query: new GraphQLObjectType({
28
- name: "Query",
29
- fields: () => ({
30
- vimeoDummyQuery: {
31
- type: GraphQLString
32
- }
33
- })
34
- })
35
- };
36
- }
37
- createMutation() {
38
- return {
39
- type: new GraphQLNonNull(
40
- new GraphQLObjectType({
41
- name: "VimeoUploadResponse",
42
- fields: {
43
- ok: { type: new GraphQLNonNull(GraphQLBoolean) },
44
- errors: {
45
- type: new GraphQLNonNull(
46
- new GraphQLList(
47
- new GraphQLNonNull(
48
- new GraphQLObjectType({
49
- name: "VimeoUploadError",
50
- fields: {
51
- endUserMessage: { type: GraphQLString },
52
- developerMessage: { type: GraphQLString },
53
- code: { type: GraphQLInt }
54
- }
55
- })
56
- )
57
- )
58
- )
59
- },
60
- result: {
61
- type: new GraphQLObjectType({
62
- name: "VimeoUploadResult",
63
- fields: {
64
- uploadUrl: { type: new GraphQLNonNull(GraphQLString) },
65
- vimeoId: { type: new GraphQLNonNull(GraphQLString) }
66
- }
67
- })
68
- }
69
- }
70
- })
71
- ),
72
- args: {
73
- size: {
74
- type: new GraphQLNonNull(GraphQLInt)
75
- }
76
- },
77
- resolve: async (parent, args, ctx) => {
78
- if (!ctx.project.vimeo) {
79
- throw new GraphQLError("Vimeo is not configured for this project");
80
- }
81
- const vimeoService = this.vimeoServiceFactory.create(ctx.project.vimeo);
82
- return await vimeoService.getUploadUrl(args.size);
83
- }
84
- };
85
- }
86
- }
87
- export {
88
- VimeoSchemaContributor
89
- };
90
- //# sourceMappingURL=VimeoSchemaContributor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VimeoSchemaContributor.js","sources":["../../../../packages/engine-vimeo-plugin/src/VimeoSchemaContributor.ts"],"sourcesContent":["import {\n\tGraphQLBoolean,\n\tGraphQLError,\n\tGraphQLFieldConfig,\n\tGraphQLInt,\n\tGraphQLList,\n\tGraphQLNonNull,\n\tGraphQLObjectType,\n\tGraphQLSchemaConfig,\n\tGraphQLString,\n} from 'graphql'\nimport { VimeoServiceFactory } from './VimeoService'\nimport { ProjectVimeoConfig } from './Config'\nimport { GraphQLSchemaContributor, GraphQLSchemaContributorContext } from '@contember/engine-plugins'\n\ninterface VimeoAcl {\n\tupload?: boolean\n}\n\nexport class VimeoSchemaContributor implements GraphQLSchemaContributor {\n\tconstructor(\n\t\tprivate readonly vimeoServiceFactory: VimeoServiceFactory,\n\t) {}\n\n\tgetCacheKey?(context: GraphQLSchemaContributorContext): string {\n\t\treturn context.project.vimeo ? 'yes' : 'no'\n\t}\n\n\tcreateSchema(context: GraphQLSchemaContributorContext): GraphQLSchemaConfig | undefined {\n\t\tif (!context.project.vimeo) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (\n\t\t\t!context.identity.projectRoles.find(\n\t\t\t\trole => (context.schema.acl.roles[role]?.vimeo as VimeoAcl | undefined)?.upload,\n\t\t\t)\n\t\t) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst uploadMutation = this.createMutation()\n\t\tconst mutation = {\n\t\t\tgenerateVimeoUploadUrl: uploadMutation as GraphQLFieldConfig<any, any, any>,\n\t\t}\n\t\treturn {\n\t\t\tmutation: new GraphQLObjectType({\n\t\t\t\tname: 'Mutation',\n\t\t\t\tfields: () => mutation,\n\t\t\t}),\n\t\t\tquery: new GraphQLObjectType({\n\t\t\t\tname: 'Query',\n\t\t\t\tfields: () => ({\n\t\t\t\t\tvimeoDummyQuery: {\n\t\t\t\t\t\ttype: GraphQLString,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t}),\n\t\t}\n\t}\n\n\tprivate createMutation(): GraphQLFieldConfig<any, any, any> {\n\t\treturn {\n\t\t\ttype: new GraphQLNonNull(\n\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\tname: 'VimeoUploadResponse',\n\t\t\t\t\tfields: {\n\t\t\t\t\t\tok: { type: new GraphQLNonNull(GraphQLBoolean) },\n\t\t\t\t\t\terrors: {\n\t\t\t\t\t\t\ttype: new GraphQLNonNull(\n\t\t\t\t\t\t\t\tnew GraphQLList(\n\t\t\t\t\t\t\t\t\tnew GraphQLNonNull(\n\t\t\t\t\t\t\t\t\t\tnew GraphQLObjectType({\n\t\t\t\t\t\t\t\t\t\t\tname: 'VimeoUploadError',\n\t\t\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\t\t\tendUserMessage: { type: GraphQLString },\n\t\t\t\t\t\t\t\t\t\t\t\tdeveloperMessage: { type: GraphQLString },\n\t\t\t\t\t\t\t\t\t\t\t\tcode: { type: GraphQLInt },\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\ttype: new GraphQLObjectType({\n\t\t\t\t\t\t\t\tname: 'VimeoUploadResult',\n\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\tuploadUrl: { type: new GraphQLNonNull(GraphQLString) },\n\t\t\t\t\t\t\t\t\tvimeoId: { type: new GraphQLNonNull(GraphQLString) },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t),\n\t\t\targs: {\n\t\t\t\tsize: {\n\t\t\t\t\ttype: new GraphQLNonNull(GraphQLInt),\n\t\t\t\t},\n\t\t\t},\n\t\t\tresolve: async (parent: any, args: { size: number }, ctx: { project: ProjectVimeoConfig }) => {\n\t\t\t\tif (!ctx.project.vimeo) {\n\t\t\t\t\tthrow new GraphQLError('Vimeo is not configured for this project')\n\t\t\t\t}\n\t\t\t\tconst vimeoService = this.vimeoServiceFactory.create(ctx.project.vimeo)\n\t\t\t\treturn await vimeoService.getUploadUrl(args.size)\n\t\t\t},\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";AAmBO,MAAM,uBAA2D;AAAA,EACvE,YACkB,qBAChB;AADgB,SAAA,sBAAA;AAAA,EAAA;AAAA,EAGlB,YAAa,SAAkD;AACvD,WAAA,QAAQ,QAAQ,QAAQ,QAAQ;AAAA,EAAA;AAAA,EAGxC,aAAa,SAA2E;AACnF,QAAA,CAAC,QAAQ,QAAQ,OAAO;AACpB,aAAA;AAAA,IAAA;AAIP,QAAA,CAAC,QAAQ,SAAS,aAAa;AAAA,MAC9B,UAAS,QAAQ,OAAO,IAAI,MAAM,IAAI,GAAG,OAAgC;AAAA,IAAA,GAEzE;AACM,aAAA;AAAA,IAAA;AAGF,UAAA,iBAAiB,KAAK,eAAe;AAC3C,UAAM,WAAW;AAAA,MAChB,wBAAwB;AAAA,IACzB;AACO,WAAA;AAAA,MACN,UAAU,IAAI,kBAAkB;AAAA,QAC/B,MAAM;AAAA,QACN,QAAQ,MAAM;AAAA,MAAA,CACd;AAAA,MACD,OAAO,IAAI,kBAAkB;AAAA,QAC5B,MAAM;AAAA,QACN,QAAQ,OAAO;AAAA,UACd,iBAAiB;AAAA,YAChB,MAAM;AAAA,UAAA;AAAA,QAER;AAAA,MACA,CAAA;AAAA,IACF;AAAA,EAAA;AAAA,EAGO,iBAAoD;AACpD,WAAA;AAAA,MACN,MAAM,IAAI;AAAA,QACT,IAAI,kBAAkB;AAAA,UACrB,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,IAAI,EAAE,MAAM,IAAI,eAAe,cAAc,EAAE;AAAA,YAC/C,QAAQ;AAAA,cACP,MAAM,IAAI;AAAA,gBACT,IAAI;AAAA,kBACH,IAAI;AAAA,oBACH,IAAI,kBAAkB;AAAA,sBACrB,MAAM;AAAA,sBACN,QAAQ;AAAA,wBACP,gBAAgB,EAAE,MAAM,cAAc;AAAA,wBACtC,kBAAkB,EAAE,MAAM,cAAc;AAAA,wBACxC,MAAM,EAAE,MAAM,WAAW;AAAA,sBAAA;AAAA,oBAE1B,CAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,cACD;AAAA,YAEF;AAAA,YACA,QAAQ;AAAA,cACP,MAAM,IAAI,kBAAkB;AAAA,gBAC3B,MAAM;AAAA,gBACN,QAAQ;AAAA,kBACP,WAAW,EAAE,MAAM,IAAI,eAAe,aAAa,EAAE;AAAA,kBACrD,SAAS,EAAE,MAAM,IAAI,eAAe,aAAa,EAAE;AAAA,gBAAA;AAAA,cAEpD,CAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAED,CAAA;AAAA,MACF;AAAA,MACA,MAAM;AAAA,QACL,MAAM;AAAA,UACL,MAAM,IAAI,eAAe,UAAU;AAAA,QAAA;AAAA,MAErC;AAAA,MACA,SAAS,OAAO,QAAa,MAAwB,QAAyC;AACzF,YAAA,CAAC,IAAI,QAAQ,OAAO;AACjB,gBAAA,IAAI,aAAa,0CAA0C;AAAA,QAAA;AAElE,cAAM,eAAe,KAAK,oBAAoB,OAAO,IAAI,QAAQ,KAAK;AACtE,eAAO,MAAM,aAAa,aAAa,KAAK,IAAI;AAAA,MAAA;AAAA,IAElD;AAAA,EAAA;AAEF;"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- class VimeoService {
4
- constructor(config) {
5
- this.config = config;
6
- }
7
- async getUploadUrl(filesize) {
8
- const authorizationHeader = "Bearer " + this.config.token;
9
- const response = await fetch("https://api.vimeo.com/me/videos?fields=uri,name,upload", {
10
- method: "POST",
11
- headers: {
12
- "Content-Type": "application/json",
13
- "Authorization": authorizationHeader
14
- },
15
- body: JSON.stringify({
16
- upload: {
17
- approach: "tus",
18
- size: filesize
19
- }
20
- })
21
- });
22
- if (response.status !== 200) {
23
- const { error_code, developer_message, error } = await response.json();
24
- return {
25
- ok: false,
26
- errors: [
27
- {
28
- code: error_code,
29
- developerMessage: developer_message,
30
- endUserMessage: error
31
- }
32
- ]
33
- };
34
- }
35
- const data = await response.json();
36
- if (!data.uri.startsWith("/videos/")) {
37
- throw new Error(`Invalid vimeo response with following URI: ${data.uri}`);
38
- }
39
- const vimeoId = data.uri.substring(8);
40
- return { ok: true, errors: [], result: { uploadUrl: data.upload.upload_link, vimeoId } };
41
- }
42
- }
43
- class VimeoServiceFactory {
44
- create(config) {
45
- return new VimeoService(config);
46
- }
47
- }
48
- exports.VimeoService = VimeoService;
49
- exports.VimeoServiceFactory = VimeoServiceFactory;
50
- //# sourceMappingURL=VimeoService.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VimeoService.cjs","sources":["../../../../packages/engine-vimeo-plugin/src/VimeoService.ts"],"sourcesContent":["import { VimeoConfig } from './Config'\n\nexport class VimeoService {\n\tconstructor(public readonly config: VimeoConfig) {}\n\n\tpublic async getUploadUrl(filesize: number): Promise<{\n\t\tok: boolean\n\t\terrors: { code: number; endUserMessage: string; developerMessage: string }[]\n\t\tresult?: { uploadUrl: string; vimeoId: string }\n\t}> {\n\t\tconst authorizationHeader = 'Bearer ' + this.config.token\n\n\t\tconst response = await fetch('https://api.vimeo.com/me/videos?fields=uri,name,upload', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'Authorization': authorizationHeader,\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tupload: {\n\t\t\t\t\tapproach: 'tus',\n\t\t\t\t\tsize: filesize,\n\t\t\t\t},\n\t\t\t}),\n\t\t})\n\t\tif (response.status !== 200) {\n\t\t\tconst { error_code, developer_message, error } = (await response.json()) as any\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: error_code,\n\t\t\t\t\t\tdeveloperMessage: developer_message,\n\t\t\t\t\t\tendUserMessage: error,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t}\n\t\tconst data: any = await response.json()\n\t\tif (!data.uri.startsWith('/videos/')) {\n\t\t\tthrow new Error(`Invalid vimeo response with following URI: ${data.uri}`)\n\t\t}\n\t\tconst vimeoId = data.uri.substring(8)\n\t\treturn { ok: true, errors: [], result: { uploadUrl: data.upload.upload_link, vimeoId } }\n\t}\n}\n\nexport class VimeoServiceFactory {\n\tpublic create(config: VimeoConfig) {\n\t\treturn new VimeoService(config)\n\t}\n}\n"],"names":[],"mappings":";;AAEO,MAAM,aAAa;AAAA,EACzB,YAA4B,QAAqB;AAArB,SAAA,SAAA;AAAA,EAAA;AAAA,EAE5B,MAAa,aAAa,UAIvB;AACI,UAAA,sBAAsB,YAAY,KAAK,OAAO;AAE9C,UAAA,WAAW,MAAM,MAAM,0DAA0D;AAAA,MACtF,QAAQ;AAAA,MACR,SAAS;AAAA,QACR,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU;AAAA,QACpB,QAAQ;AAAA,UACP,UAAU;AAAA,UACV,MAAM;AAAA,QAAA;AAAA,MAEP,CAAA;AAAA,IAAA,CACD;AACG,QAAA,SAAS,WAAW,KAAK;AAC5B,YAAM,EAAE,YAAY,mBAAmB,UAAW,MAAM,SAAS,KAAK;AAC/D,aAAA;AAAA,QACN,IAAI;AAAA,QACJ,QAAQ;AAAA,UACP;AAAA,YACC,MAAM;AAAA,YACN,kBAAkB;AAAA,YAClB,gBAAgB;AAAA,UAAA;AAAA,QACjB;AAAA,MAEF;AAAA,IAAA;AAEK,UAAA,OAAY,MAAM,SAAS,KAAK;AACtC,QAAI,CAAC,KAAK,IAAI,WAAW,UAAU,GAAG;AACrC,YAAM,IAAI,MAAM,8CAA8C,KAAK,GAAG,EAAE;AAAA,IAAA;AAEzE,UAAM,UAAU,KAAK,IAAI,UAAU,CAAC;AACpC,WAAO,EAAE,IAAI,MAAM,QAAQ,CAAA,GAAI,QAAQ,EAAE,WAAW,KAAK,OAAO,aAAa,UAAU;AAAA,EAAA;AAEzF;AAEO,MAAM,oBAAoB;AAAA,EACzB,OAAO,QAAqB;AAC3B,WAAA,IAAI,aAAa,MAAM;AAAA,EAAA;AAEhC;;;"}
@@ -1,50 +0,0 @@
1
- class VimeoService {
2
- constructor(config) {
3
- this.config = config;
4
- }
5
- async getUploadUrl(filesize) {
6
- const authorizationHeader = "Bearer " + this.config.token;
7
- const response = await fetch("https://api.vimeo.com/me/videos?fields=uri,name,upload", {
8
- method: "POST",
9
- headers: {
10
- "Content-Type": "application/json",
11
- "Authorization": authorizationHeader
12
- },
13
- body: JSON.stringify({
14
- upload: {
15
- approach: "tus",
16
- size: filesize
17
- }
18
- })
19
- });
20
- if (response.status !== 200) {
21
- const { error_code, developer_message, error } = await response.json();
22
- return {
23
- ok: false,
24
- errors: [
25
- {
26
- code: error_code,
27
- developerMessage: developer_message,
28
- endUserMessage: error
29
- }
30
- ]
31
- };
32
- }
33
- const data = await response.json();
34
- if (!data.uri.startsWith("/videos/")) {
35
- throw new Error(`Invalid vimeo response with following URI: ${data.uri}`);
36
- }
37
- const vimeoId = data.uri.substring(8);
38
- return { ok: true, errors: [], result: { uploadUrl: data.upload.upload_link, vimeoId } };
39
- }
40
- }
41
- class VimeoServiceFactory {
42
- create(config) {
43
- return new VimeoService(config);
44
- }
45
- }
46
- export {
47
- VimeoService,
48
- VimeoServiceFactory
49
- };
50
- //# sourceMappingURL=VimeoService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VimeoService.js","sources":["../../../../packages/engine-vimeo-plugin/src/VimeoService.ts"],"sourcesContent":["import { VimeoConfig } from './Config'\n\nexport class VimeoService {\n\tconstructor(public readonly config: VimeoConfig) {}\n\n\tpublic async getUploadUrl(filesize: number): Promise<{\n\t\tok: boolean\n\t\terrors: { code: number; endUserMessage: string; developerMessage: string }[]\n\t\tresult?: { uploadUrl: string; vimeoId: string }\n\t}> {\n\t\tconst authorizationHeader = 'Bearer ' + this.config.token\n\n\t\tconst response = await fetch('https://api.vimeo.com/me/videos?fields=uri,name,upload', {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'Authorization': authorizationHeader,\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tupload: {\n\t\t\t\t\tapproach: 'tus',\n\t\t\t\t\tsize: filesize,\n\t\t\t\t},\n\t\t\t}),\n\t\t})\n\t\tif (response.status !== 200) {\n\t\t\tconst { error_code, developer_message, error } = (await response.json()) as any\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: error_code,\n\t\t\t\t\t\tdeveloperMessage: developer_message,\n\t\t\t\t\t\tendUserMessage: error,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t}\n\t\tconst data: any = await response.json()\n\t\tif (!data.uri.startsWith('/videos/')) {\n\t\t\tthrow new Error(`Invalid vimeo response with following URI: ${data.uri}`)\n\t\t}\n\t\tconst vimeoId = data.uri.substring(8)\n\t\treturn { ok: true, errors: [], result: { uploadUrl: data.upload.upload_link, vimeoId } }\n\t}\n}\n\nexport class VimeoServiceFactory {\n\tpublic create(config: VimeoConfig) {\n\t\treturn new VimeoService(config)\n\t}\n}\n"],"names":[],"mappings":"AAEO,MAAM,aAAa;AAAA,EACzB,YAA4B,QAAqB;AAArB,SAAA,SAAA;AAAA,EAAA;AAAA,EAE5B,MAAa,aAAa,UAIvB;AACI,UAAA,sBAAsB,YAAY,KAAK,OAAO;AAE9C,UAAA,WAAW,MAAM,MAAM,0DAA0D;AAAA,MACtF,QAAQ;AAAA,MACR,SAAS;AAAA,QACR,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU;AAAA,QACpB,QAAQ;AAAA,UACP,UAAU;AAAA,UACV,MAAM;AAAA,QAAA;AAAA,MAEP,CAAA;AAAA,IAAA,CACD;AACG,QAAA,SAAS,WAAW,KAAK;AAC5B,YAAM,EAAE,YAAY,mBAAmB,UAAW,MAAM,SAAS,KAAK;AAC/D,aAAA;AAAA,QACN,IAAI;AAAA,QACJ,QAAQ;AAAA,UACP;AAAA,YACC,MAAM;AAAA,YACN,kBAAkB;AAAA,YAClB,gBAAgB;AAAA,UAAA;AAAA,QACjB;AAAA,MAEF;AAAA,IAAA;AAEK,UAAA,OAAY,MAAM,SAAS,KAAK;AACtC,QAAI,CAAC,KAAK,IAAI,WAAW,UAAU,GAAG;AACrC,YAAM,IAAI,MAAM,8CAA8C,KAAK,GAAG,EAAE;AAAA,IAAA;AAEzE,UAAM,UAAU,KAAK,IAAI,UAAU,CAAC;AACpC,WAAO,EAAE,IAAI,MAAM,QAAQ,CAAA,GAAI,QAAQ,EAAE,WAAW,KAAK,OAAO,aAAa,UAAU;AAAA,EAAA;AAEzF;AAEO,MAAM,oBAAoB;AAAA,EACzB,OAAO,QAAqB;AAC3B,WAAA,IAAI,aAAa,MAAM;AAAA,EAAA;AAEhC;"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const VimeoConfigProcessor = require("./src/VimeoConfigProcessor.cjs");
4
- const VimeoSchemaContributor = require("./src/VimeoSchemaContributor.cjs");
5
- const VimeoService = require("./src/VimeoService.cjs");
6
- var __defProp = Object.defineProperty;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
9
- class VimeoPlugin {
10
- constructor() {
11
- __publicField(this, "name", "contember/vimeo");
12
- }
13
- getConfigProcessor() {
14
- return new VimeoConfigProcessor.VimeoConfigProcessor();
15
- }
16
- getSchemaContributor() {
17
- const vimeoServiceFactory = new VimeoService.VimeoServiceFactory();
18
- return new VimeoSchemaContributor.VimeoSchemaContributor(vimeoServiceFactory);
19
- }
20
- }
21
- exports.VimeoSchemaContributor = VimeoSchemaContributor.VimeoSchemaContributor;
22
- exports.VimeoService = VimeoService.VimeoService;
23
- exports.VimeoServiceFactory = VimeoService.VimeoServiceFactory;
24
- exports.default = VimeoPlugin;
25
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../packages/engine-vimeo-plugin/src/index.ts"],"sourcesContent":["import { Plugin, SchemaContributorArgs } from '@contember/engine-plugins'\nimport { VimeoConfigProcessor } from './VimeoConfigProcessor'\nimport { VimeoSchemaContributor } from './VimeoSchemaContributor'\nimport { VimeoServiceFactory } from './VimeoService'\nimport { ProjectVimeoConfig } from './Config'\n\nexport * from './VimeoSchemaContributor'\nexport * from './VimeoService'\n\nexport default class VimeoPlugin implements Plugin<ProjectVimeoConfig> {\n\tname = 'contember/vimeo'\n\n\tgetConfigProcessor() {\n\t\treturn new VimeoConfigProcessor()\n\t}\n\n\tgetSchemaContributor() {\n\t\tconst vimeoServiceFactory = new VimeoServiceFactory()\n\t\treturn new VimeoSchemaContributor(vimeoServiceFactory)\n\t}\n}\n"],"names":["VimeoConfigProcessor","VimeoServiceFactory","VimeoSchemaContributor"],"mappings":";;;;;;;;AASA,MAAqB,YAAkD;AAAA,EAAvE,cAAA;AACQ,kBAAA,MAAA,QAAA,iBAAA;AAAA,EAAA;AAAA,EAEP,qBAAqB;AACpB,WAAO,IAAIA,qBAAAA,qBAAqB;AAAA,EAAA;AAAA,EAGjC,uBAAuB;AAChB,UAAA,sBAAsB,IAAIC,iCAAoB;AAC7C,WAAA,IAAIC,8CAAuB,mBAAmB;AAAA,EAAA;AAEvD;;;;;"}
@@ -1,26 +0,0 @@
1
- import { VimeoConfigProcessor } from "./src/VimeoConfigProcessor.js";
2
- import { VimeoSchemaContributor } from "./src/VimeoSchemaContributor.js";
3
- import { VimeoServiceFactory } from "./src/VimeoService.js";
4
- import { VimeoService } from "./src/VimeoService.js";
5
- var __defProp = Object.defineProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
8
- class VimeoPlugin {
9
- constructor() {
10
- __publicField(this, "name", "contember/vimeo");
11
- }
12
- getConfigProcessor() {
13
- return new VimeoConfigProcessor();
14
- }
15
- getSchemaContributor() {
16
- const vimeoServiceFactory = new VimeoServiceFactory();
17
- return new VimeoSchemaContributor(vimeoServiceFactory);
18
- }
19
- }
20
- export {
21
- VimeoSchemaContributor,
22
- VimeoService,
23
- VimeoServiceFactory,
24
- VimeoPlugin as default
25
- };
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../packages/engine-vimeo-plugin/src/index.ts"],"sourcesContent":["import { Plugin, SchemaContributorArgs } from '@contember/engine-plugins'\nimport { VimeoConfigProcessor } from './VimeoConfigProcessor'\nimport { VimeoSchemaContributor } from './VimeoSchemaContributor'\nimport { VimeoServiceFactory } from './VimeoService'\nimport { ProjectVimeoConfig } from './Config'\n\nexport * from './VimeoSchemaContributor'\nexport * from './VimeoService'\n\nexport default class VimeoPlugin implements Plugin<ProjectVimeoConfig> {\n\tname = 'contember/vimeo'\n\n\tgetConfigProcessor() {\n\t\treturn new VimeoConfigProcessor()\n\t}\n\n\tgetSchemaContributor() {\n\t\tconst vimeoServiceFactory = new VimeoServiceFactory()\n\t\treturn new VimeoSchemaContributor(vimeoServiceFactory)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AASA,MAAqB,YAAkD;AAAA,EAAvE,cAAA;AACQ,kBAAA,MAAA,QAAA,iBAAA;AAAA,EAAA;AAAA,EAEP,qBAAqB;AACpB,WAAO,IAAI,qBAAqB;AAAA,EAAA;AAAA,EAGjC,uBAAuB;AAChB,UAAA,sBAAsB,IAAI,oBAAoB;AAC7C,WAAA,IAAI,uBAAuB,mBAAmB;AAAA,EAAA;AAEvD;"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Typesafe = require("@contember/typesafe");
4
- function _interopNamespaceDefault(e) {
5
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
- if (e) {
7
- for (const k in e) {
8
- if (k !== "default") {
9
- const d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: () => e[k]
13
- });
14
- }
15
- }
16
- }
17
- n.default = e;
18
- return Object.freeze(n);
19
- }
20
- const Typesafe__namespace = /* @__PURE__ */ _interopNamespaceDefault(Typesafe);
21
- const vimeoConfigSchema = Typesafe__namespace.object({
22
- token: Typesafe__namespace.string
23
- });
24
- exports.vimeoConfigSchema = vimeoConfigSchema;
25
- //# sourceMappingURL=Config.cjs.map