@contember/client 1.2.6 → 1.3.0-alpha.3
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/dist/development/content/formatContentApiRelativeUrl.cjs +5 -0
- package/dist/development/content/formatContentApiRelativeUrl.cjs.map +1 -0
- package/dist/development/content/params/whereToFilter.cjs +17 -0
- package/dist/development/content/params/whereToFilter.cjs.map +1 -0
- package/dist/development/content/replaceGraphQlLiteral.cjs +15 -0
- package/dist/development/content/replaceGraphQlLiteral.cjs.map +1 -0
- package/dist/development/content/replaceGraphQlLiteral.js +15 -0
- package/dist/development/content/replaceGraphQlLiteral.js.map +1 -0
- package/dist/development/content/upload/FileUploadError.cjs +10 -0
- package/dist/development/content/upload/FileUploadError.cjs.map +1 -0
- package/dist/development/content/upload/GenerateUploadUrlMutationBuilder.cjs +64 -0
- package/dist/development/content/upload/GenerateUploadUrlMutationBuilder.cjs.map +1 -0
- package/dist/development/content/upload/GenerateUploadUrlMutationBuilder.js +48 -19
- package/dist/development/content/upload/GenerateUploadUrlMutationBuilder.js.map +1 -1
- package/dist/development/content/upload/S3FileUploader.cjs +107 -0
- package/dist/development/content/upload/S3FileUploader.cjs.map +1 -0
- package/dist/development/content/upload/S3FileUploader.js +1 -2
- package/dist/development/content/upload/S3FileUploader.js.map +1 -1
- package/dist/development/graphQlBuilder/GraphQlLiteral.cjs +15 -0
- package/dist/development/graphQlBuilder/GraphQlLiteral.cjs.map +1 -0
- package/dist/development/graphQlBuilder/GraphQlLiteral.js +3 -0
- package/dist/development/graphQlBuilder/GraphQlLiteral.js.map +1 -1
- package/dist/development/graphQlClient/GraphQlClient.cjs +26 -0
- package/dist/development/graphQlClient/GraphQlClient.cjs.map +1 -0
- package/dist/development/graphQlClient/GraphQlClient.js +9 -16
- package/dist/development/graphQlClient/GraphQlClient.js.map +1 -1
- package/dist/development/index.cjs +46 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +5 -26
- package/dist/development/index.js.map +1 -1
- package/dist/development/system/formatSystemApiRelativeUrl.cjs +5 -0
- package/dist/development/system/formatSystemApiRelativeUrl.cjs.map +1 -0
- package/dist/development/tenant/loginMutation.cjs +34 -0
- package/dist/development/tenant/loginMutation.cjs.map +1 -0
- package/dist/development/tenant/tenantApiRelativeUrl.cjs +5 -0
- package/dist/development/tenant/tenantApiRelativeUrl.cjs.map +1 -0
- package/dist/development/tenant/tenantErrorMessages.cjs +18 -0
- package/dist/development/tenant/tenantErrorMessages.cjs.map +1 -0
- package/dist/development/utils/readFileAsArrayBuffer.cjs +15 -0
- package/dist/development/utils/readFileAsArrayBuffer.cjs.map +1 -0
- package/dist/production/content/formatContentApiRelativeUrl.cjs +5 -0
- package/dist/production/content/formatContentApiRelativeUrl.cjs.map +1 -0
- package/dist/production/content/params/whereToFilter.cjs +17 -0
- package/dist/production/content/params/whereToFilter.cjs.map +1 -0
- package/dist/production/content/replaceGraphQlLiteral.cjs +15 -0
- package/dist/production/content/replaceGraphQlLiteral.cjs.map +1 -0
- package/dist/production/content/replaceGraphQlLiteral.js +15 -0
- package/dist/production/content/replaceGraphQlLiteral.js.map +1 -0
- package/dist/production/content/upload/FileUploadError.cjs +10 -0
- package/dist/production/content/upload/FileUploadError.cjs.map +1 -0
- package/dist/production/content/upload/GenerateUploadUrlMutationBuilder.cjs +64 -0
- package/dist/production/content/upload/GenerateUploadUrlMutationBuilder.cjs.map +1 -0
- package/dist/production/content/upload/GenerateUploadUrlMutationBuilder.js +48 -19
- package/dist/production/content/upload/GenerateUploadUrlMutationBuilder.js.map +1 -1
- package/dist/production/content/upload/S3FileUploader.cjs +107 -0
- package/dist/production/content/upload/S3FileUploader.cjs.map +1 -0
- package/dist/production/content/upload/S3FileUploader.js +1 -2
- package/dist/production/content/upload/S3FileUploader.js.map +1 -1
- package/dist/production/graphQlBuilder/GraphQlLiteral.cjs +12 -0
- package/dist/production/graphQlBuilder/GraphQlLiteral.cjs.map +1 -0
- package/dist/production/graphQlBuilder/GraphQlLiteral.js.map +1 -1
- package/dist/production/graphQlClient/GraphQlClient.cjs +26 -0
- package/dist/production/graphQlClient/GraphQlClient.cjs.map +1 -0
- package/dist/production/graphQlClient/GraphQlClient.js +9 -16
- package/dist/production/graphQlClient/GraphQlClient.js.map +1 -1
- package/dist/production/index.cjs +46 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +5 -26
- package/dist/production/index.js.map +1 -1
- package/dist/production/system/formatSystemApiRelativeUrl.cjs +5 -0
- package/dist/production/system/formatSystemApiRelativeUrl.cjs.map +1 -0
- package/dist/production/tenant/loginMutation.cjs +34 -0
- package/dist/production/tenant/loginMutation.cjs.map +1 -0
- package/dist/production/tenant/tenantApiRelativeUrl.cjs +5 -0
- package/dist/production/tenant/tenantApiRelativeUrl.cjs.map +1 -0
- package/dist/production/tenant/tenantErrorMessages.cjs +18 -0
- package/dist/production/tenant/tenantErrorMessages.cjs.map +1 -0
- package/dist/production/utils/readFileAsArrayBuffer.cjs +15 -0
- package/dist/production/utils/readFileAsArrayBuffer.cjs.map +1 -0
- package/dist/types/content/index.d.ts +1 -0
- package/dist/types/content/index.d.ts.map +1 -1
- package/dist/types/content/replaceGraphQlLiteral.d.ts +6 -0
- package/dist/types/content/replaceGraphQlLiteral.d.ts.map +1 -0
- package/dist/types/content/upload/GenerateUploadUrlMutationBuilder.d.ts +8 -4
- package/dist/types/content/upload/GenerateUploadUrlMutationBuilder.d.ts.map +1 -1
- package/dist/types/content/upload/S3FileUploader.d.ts.map +1 -1
- package/dist/types/crudQueryBuilder/index.d.ts +0 -6
- package/dist/types/crudQueryBuilder/index.d.ts.map +1 -1
- package/dist/types/crudQueryBuilder/types.d.ts +2 -43
- package/dist/types/crudQueryBuilder/types.d.ts.map +1 -1
- package/dist/types/graphQlBuilder/GraphQlLiteral.d.ts +3 -0
- package/dist/types/graphQlBuilder/GraphQlLiteral.d.ts.map +1 -1
- package/dist/types/graphQlBuilder/QueryBuilder.d.ts +2 -8
- package/dist/types/graphQlBuilder/QueryBuilder.d.ts.map +1 -1
- package/dist/types/graphQlBuilder/index.d.ts +0 -3
- package/dist/types/graphQlBuilder/index.d.ts.map +1 -1
- package/dist/types/graphQlClient/GraphQlClient.d.ts +10 -12
- package/dist/types/graphQlClient/GraphQlClient.d.ts.map +1 -1
- package/dist/types/graphQlClient/index.d.ts +2 -0
- package/dist/types/graphQlClient/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -29
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -3
- package/src/content/index.ts +1 -1
- package/src/content/replaceGraphQlLiteral.ts +22 -0
- package/src/content/upload/GenerateUploadUrlMutationBuilder.ts +56 -33
- package/src/content/upload/S3FileUploader.ts +1 -2
- package/src/crudQueryBuilder/index.ts +0 -6
- package/src/crudQueryBuilder/types.ts +5 -70
- package/src/graphQlBuilder/GraphQlLiteral.ts +8 -1
- package/src/graphQlBuilder/QueryBuilder.ts +2 -23
- package/src/graphQlBuilder/index.ts +0 -3
- package/src/graphQlClient/GraphQlClient.ts +15 -28
- package/src/graphQlClient/index.ts +7 -0
- package/src/index.ts +5 -31
- package/src/tsconfig.json +12 -1
- package/dist/development/crudQueryBuilder/CrudQueryBuilder.js +0 -104
- package/dist/development/crudQueryBuilder/CrudQueryBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/CrudQueryBuilderError.js +0 -6
- package/dist/development/crudQueryBuilder/CrudQueryBuilderError.js.map +0 -1
- package/dist/development/crudQueryBuilder/ErrorsRelationBuilder.js +0 -15
- package/dist/development/crudQueryBuilder/ErrorsRelationBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/ReadBuilder.js +0 -70
- package/dist/development/crudQueryBuilder/ReadBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/ValidationRelationBuilder.js +0 -18
- package/dist/development/crudQueryBuilder/ValidationRelationBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/WriteBuilder.js +0 -54
- package/dist/development/crudQueryBuilder/WriteBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/WriteDataBuilder.js +0 -110
- package/dist/development/crudQueryBuilder/WriteDataBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/WriteManyRelationBuilder.js +0 -77
- package/dist/development/crudQueryBuilder/WriteManyRelationBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/WriteOneRelationBuilder.js +0 -51
- package/dist/development/crudQueryBuilder/WriteOneRelationBuilder.js.map +0 -1
- package/dist/development/crudQueryBuilder/types.js +0 -40
- package/dist/development/crudQueryBuilder/types.js.map +0 -1
- package/dist/development/graphQlBuilder/GraphQlBuilderError.js +0 -6
- package/dist/development/graphQlBuilder/GraphQlBuilderError.js.map +0 -1
- package/dist/development/graphQlBuilder/ObjectBuilder.js +0 -80
- package/dist/development/graphQlBuilder/ObjectBuilder.js.map +0 -1
- package/dist/development/graphQlBuilder/QueryBuilder.js +0 -22
- package/dist/development/graphQlBuilder/QueryBuilder.js.map +0 -1
- package/dist/development/graphQlBuilder/QueryCompiler.js +0 -101
- package/dist/development/graphQlBuilder/QueryCompiler.js.map +0 -1
- package/dist/development/graphQlBuilder/RootObjectBuilder.js +0 -31
- package/dist/development/graphQlBuilder/RootObjectBuilder.js.map +0 -1
- package/dist/development/utils/isEmptyObject.js +0 -12
- package/dist/development/utils/isEmptyObject.js.map +0 -1
- package/dist/production/crudQueryBuilder/CrudQueryBuilder.js +0 -104
- package/dist/production/crudQueryBuilder/CrudQueryBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/CrudQueryBuilderError.js +0 -6
- package/dist/production/crudQueryBuilder/CrudQueryBuilderError.js.map +0 -1
- package/dist/production/crudQueryBuilder/ErrorsRelationBuilder.js +0 -15
- package/dist/production/crudQueryBuilder/ErrorsRelationBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/ReadBuilder.js +0 -70
- package/dist/production/crudQueryBuilder/ReadBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/ValidationRelationBuilder.js +0 -18
- package/dist/production/crudQueryBuilder/ValidationRelationBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/WriteBuilder.js +0 -54
- package/dist/production/crudQueryBuilder/WriteBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/WriteDataBuilder.js +0 -110
- package/dist/production/crudQueryBuilder/WriteDataBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/WriteManyRelationBuilder.js +0 -77
- package/dist/production/crudQueryBuilder/WriteManyRelationBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/WriteOneRelationBuilder.js +0 -51
- package/dist/production/crudQueryBuilder/WriteOneRelationBuilder.js.map +0 -1
- package/dist/production/crudQueryBuilder/types.js +0 -40
- package/dist/production/crudQueryBuilder/types.js.map +0 -1
- package/dist/production/graphQlBuilder/GraphQlBuilderError.js +0 -6
- package/dist/production/graphQlBuilder/GraphQlBuilderError.js.map +0 -1
- package/dist/production/graphQlBuilder/ObjectBuilder.js +0 -80
- package/dist/production/graphQlBuilder/ObjectBuilder.js.map +0 -1
- package/dist/production/graphQlBuilder/QueryBuilder.js +0 -22
- package/dist/production/graphQlBuilder/QueryBuilder.js.map +0 -1
- package/dist/production/graphQlBuilder/QueryCompiler.js +0 -101
- package/dist/production/graphQlBuilder/QueryCompiler.js.map +0 -1
- package/dist/production/graphQlBuilder/RootObjectBuilder.js +0 -31
- package/dist/production/graphQlBuilder/RootObjectBuilder.js.map +0 -1
- package/dist/production/utils/isEmptyObject.js +0 -12
- package/dist/production/utils/isEmptyObject.js.map +0 -1
- package/dist/types/crudQueryBuilder/CrudQueryBuilder.d.ts +0 -21
- package/dist/types/crudQueryBuilder/CrudQueryBuilder.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/CrudQueryBuilderError.d.ts +0 -3
- package/dist/types/crudQueryBuilder/CrudQueryBuilderError.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/ErrorsRelationBuilder.d.ts +0 -5
- package/dist/types/crudQueryBuilder/ErrorsRelationBuilder.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/ReadBuilder.d.ts +0 -31
- package/dist/types/crudQueryBuilder/ReadBuilder.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/ValidationRelationBuilder.d.ts +0 -5
- package/dist/types/crudQueryBuilder/ValidationRelationBuilder.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/WriteBuilder.d.ts +0 -24
- package/dist/types/crudQueryBuilder/WriteBuilder.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/WriteDataBuilder.d.ts +0 -24
- package/dist/types/crudQueryBuilder/WriteDataBuilder.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/WriteManyRelationBuilder.d.ts +0 -27
- package/dist/types/crudQueryBuilder/WriteManyRelationBuilder.d.ts.map +0 -1
- package/dist/types/crudQueryBuilder/WriteOneRelationBuilder.d.ts +0 -28
- package/dist/types/crudQueryBuilder/WriteOneRelationBuilder.d.ts.map +0 -1
- package/dist/types/graphQlBuilder/GraphQlBuilderError.d.ts +0 -3
- package/dist/types/graphQlBuilder/GraphQlBuilderError.d.ts.map +0 -1
- package/dist/types/graphQlBuilder/ObjectBuilder.d.ts +0 -28
- package/dist/types/graphQlBuilder/ObjectBuilder.d.ts.map +0 -1
- package/dist/types/graphQlBuilder/QueryCompiler.d.ts +0 -13
- package/dist/types/graphQlBuilder/QueryCompiler.d.ts.map +0 -1
- package/dist/types/graphQlBuilder/RootObjectBuilder.d.ts +0 -17
- package/dist/types/graphQlBuilder/RootObjectBuilder.d.ts.map +0 -1
- package/src/crudQueryBuilder/CrudQueryBuilder.ts +0 -168
- package/src/crudQueryBuilder/CrudQueryBuilderError.ts +0 -1
- package/src/crudQueryBuilder/ErrorsRelationBuilder.ts +0 -16
- package/src/crudQueryBuilder/ReadBuilder.ts +0 -106
- package/src/crudQueryBuilder/ValidationRelationBuilder.ts +0 -17
- package/src/crudQueryBuilder/WriteBuilder.ts +0 -79
- package/src/crudQueryBuilder/WriteDataBuilder.ts +0 -153
- package/src/crudQueryBuilder/WriteManyRelationBuilder.ts +0 -141
- package/src/crudQueryBuilder/WriteOneRelationBuilder.ts +0 -101
- package/src/graphQlBuilder/GraphQlBuilderError.ts +0 -1
- package/src/graphQlBuilder/ObjectBuilder.ts +0 -87
- package/src/graphQlBuilder/QueryCompiler.ts +0 -115
- package/src/graphQlBuilder/RootObjectBuilder.ts +0 -36
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const formatContentApiRelativeUrl = (projectSlug, stageSlug) => `/content/${projectSlug}/${stageSlug}`;
|
|
4
|
+
exports.formatContentApiRelativeUrl = formatContentApiRelativeUrl;
|
|
5
|
+
//# sourceMappingURL=formatContentApiRelativeUrl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatContentApiRelativeUrl.cjs","sources":["../../../src/content/formatContentApiRelativeUrl.ts"],"sourcesContent":["export const formatContentApiRelativeUrl = (projectSlug: string, stageSlug: string) =>\n\t`/content/${projectSlug}/${stageSlug}`\n"],"names":[],"mappings":";;AAAO,MAAM,8BAA8B,CAAC,aAAqB,cAChE,YAAY,eAAe;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const GraphQlLiteral = require("../../graphQlBuilder/GraphQlLiteral.cjs");
|
|
4
|
+
const whereToFilter = (by) => {
|
|
5
|
+
const where = {};
|
|
6
|
+
for (const key in by) {
|
|
7
|
+
const value = by[key];
|
|
8
|
+
if (value instanceof GraphQlLiteral.GraphQlLiteral || typeof value === "string" || typeof value === "number") {
|
|
9
|
+
where[key] = { eq: value };
|
|
10
|
+
} else {
|
|
11
|
+
where[key] = whereToFilter(value);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return where;
|
|
15
|
+
};
|
|
16
|
+
exports.whereToFilter = whereToFilter;
|
|
17
|
+
//# sourceMappingURL=whereToFilter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whereToFilter.cjs","sources":["../../../../src/content/params/whereToFilter.ts"],"sourcesContent":["import type { Input, Writable } from '@contember/schema'\nimport { GraphQlLiteral } from '../../graphQlBuilder'\n\nexport const whereToFilter = (\n\tby: Input.UniqueWhere<GraphQlLiteral>,\n): Input.Where<Input.Condition<Input.ColumnValue<GraphQlLiteral>>> => {\n\tconst where: Writable<Input.Where<Input.Condition<Input.ColumnValue<GraphQlLiteral>>>> = {}\n\tfor (const key in by) {\n\t\tconst value = by[key]\n\n\t\tif (value instanceof GraphQlLiteral || typeof value === 'string' || typeof value === 'number') {\n\t\t\twhere[key] = { eq: value }\n\t\t} else {\n\t\t\twhere[key] = whereToFilter(value)\n\t\t}\n\t}\n\n\treturn where\n}\n"],"names":["GraphQlLiteral"],"mappings":";;;AAGa,MAAA,gBAAgB,CAC5B,OACqE;AACrE,QAAM,QAAmF,CAAA;AACzF,aAAW,OAAO,IAAI;AACf,UAAA,QAAQ,GAAG,GAAG;AAEpB,QAAI,iBAAiBA,eAAAA,kBAAkB,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU;AAC9F,YAAM,GAAG,IAAI,EAAE,IAAI,MAAM;AAAA,IAAA,OACnB;AACA,YAAA,GAAG,IAAI,cAAc,KAAK;AAAA,IACjC;AAAA,EACD;AAEO,SAAA;AACR;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const GraphQlLiteral = require("../graphQlBuilder/GraphQlLiteral.cjs");
|
|
4
|
+
const replaceGraphQlLiteral = (input) => {
|
|
5
|
+
if (input instanceof GraphQlLiteral.GraphQlLiteral) {
|
|
6
|
+
return input.value;
|
|
7
|
+
} else if (Array.isArray(input)) {
|
|
8
|
+
return input.map(replaceGraphQlLiteral);
|
|
9
|
+
} else if (typeof input === "object" && input !== null) {
|
|
10
|
+
return Object.fromEntries(Object.entries(input).map(([key, value]) => value !== void 0 ? [key, replaceGraphQlLiteral(value)] : void 0).filter(Boolean));
|
|
11
|
+
}
|
|
12
|
+
return input;
|
|
13
|
+
};
|
|
14
|
+
exports.replaceGraphQlLiteral = replaceGraphQlLiteral;
|
|
15
|
+
//# sourceMappingURL=replaceGraphQlLiteral.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceGraphQlLiteral.cjs","sources":["../../../src/content/replaceGraphQlLiteral.ts"],"sourcesContent":["import { GraphQlLiteral } from '../graphQlBuilder'\n\nexport type ReplaceGraphQlLiteral<T> = T extends GraphQlLiteral<infer Value>\n\t? Value\n\t: T extends string | number | boolean | null\n\t\t? T // Keep primitives as is\n\t\t: T extends {}\n\t\t\t? { [K in keyof T]: ReplaceGraphQlLiteral<T[K]> } // Recursively apply to objects\n\t\t\t: T extends any[]\n\t\t\t\t? ReplaceGraphQlLiteral<T[number]>[] // Recursively apply to array elements\n\t\t\t\t: T;\n\nexport const replaceGraphQlLiteral = <T>(input: T): ReplaceGraphQlLiteral<T> => {\n\tif (input instanceof GraphQlLiteral) {\n\t\treturn input.value as any\n\t} else if (Array.isArray(input)) {\n\t\treturn input.map(replaceGraphQlLiteral) as any\n\t} else if (typeof input === 'object' && input !== null) {\n\t\treturn Object.fromEntries(Object.entries(input).map(([key, value]) => value !== undefined ? [key, replaceGraphQlLiteral(value)] : undefined).filter(Boolean) as any) as any\n\t}\n\treturn input as any\n}\n"],"names":["GraphQlLiteral"],"mappings":";;;AAYa,MAAA,wBAAwB,CAAI,UAAuC;AAC/E,MAAI,iBAAiBA,eAAAA,gBAAgB;AACpC,WAAO,MAAM;AAAA,EACH,WAAA,MAAM,QAAQ,KAAK,GAAG;AACzB,WAAA,MAAM,IAAI,qBAAqB;AAAA,EAC5B,WAAA,OAAO,UAAU,YAAY,UAAU,MAAM;AAChD,WAAA,OAAO,YAAY,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,UAAU,SAAY,CAAC,KAAK,sBAAsB,KAAK,CAAC,IAAI,MAAS,EAAE,OAAO,OAAO,CAAQ;AAAA,EACpK;AACO,SAAA;AACR;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GraphQlLiteral } from "../graphQlBuilder/GraphQlLiteral.js";
|
|
2
|
+
const replaceGraphQlLiteral = (input) => {
|
|
3
|
+
if (input instanceof GraphQlLiteral) {
|
|
4
|
+
return input.value;
|
|
5
|
+
} else if (Array.isArray(input)) {
|
|
6
|
+
return input.map(replaceGraphQlLiteral);
|
|
7
|
+
} else if (typeof input === "object" && input !== null) {
|
|
8
|
+
return Object.fromEntries(Object.entries(input).map(([key, value]) => value !== void 0 ? [key, replaceGraphQlLiteral(value)] : void 0).filter(Boolean));
|
|
9
|
+
}
|
|
10
|
+
return input;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
replaceGraphQlLiteral
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=replaceGraphQlLiteral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceGraphQlLiteral.js","sources":["../../../src/content/replaceGraphQlLiteral.ts"],"sourcesContent":["import { GraphQlLiteral } from '../graphQlBuilder'\n\nexport type ReplaceGraphQlLiteral<T> = T extends GraphQlLiteral<infer Value>\n\t? Value\n\t: T extends string | number | boolean | null\n\t\t? T // Keep primitives as is\n\t\t: T extends {}\n\t\t\t? { [K in keyof T]: ReplaceGraphQlLiteral<T[K]> } // Recursively apply to objects\n\t\t\t: T extends any[]\n\t\t\t\t? ReplaceGraphQlLiteral<T[number]>[] // Recursively apply to array elements\n\t\t\t\t: T;\n\nexport const replaceGraphQlLiteral = <T>(input: T): ReplaceGraphQlLiteral<T> => {\n\tif (input instanceof GraphQlLiteral) {\n\t\treturn input.value as any\n\t} else if (Array.isArray(input)) {\n\t\treturn input.map(replaceGraphQlLiteral) as any\n\t} else if (typeof input === 'object' && input !== null) {\n\t\treturn Object.fromEntries(Object.entries(input).map(([key, value]) => value !== undefined ? [key, replaceGraphQlLiteral(value)] : undefined).filter(Boolean) as any) as any\n\t}\n\treturn input as any\n}\n"],"names":[],"mappings":";AAYa,MAAA,wBAAwB,CAAI,UAAuC;AAC/E,MAAI,iBAAiB,gBAAgB;AACpC,WAAO,MAAM;AAAA,EACH,WAAA,MAAM,QAAQ,KAAK,GAAG;AACzB,WAAA,MAAM,IAAI,qBAAqB;AAAA,EAC5B,WAAA,OAAO,UAAU,YAAY,UAAU,MAAM;AAChD,WAAA,OAAO,YAAY,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,UAAU,SAAY,CAAC,KAAK,sBAAsB,KAAK,CAAC,IAAI,MAAS,EAAE,OAAO,OAAO,CAAQ;AAAA,EACpK;AACO,SAAA;AACR;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class FileUploadError extends Error {
|
|
4
|
+
constructor(options = {}) {
|
|
5
|
+
super(options.developerMessage);
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.FileUploadError = FileUploadError;
|
|
10
|
+
//# sourceMappingURL=FileUploadError.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUploadError.cjs","sources":["../../../../src/content/upload/FileUploadError.ts"],"sourcesContent":["export interface FileUploadErrorOptions {\n\tdeveloperMessage?: string\n\tendUserMessage?: string\n}\n\nexport class FileUploadError extends Error {\n\tpublic constructor(public readonly options: FileUploadErrorOptions = {}) {\n\t\tsuper(options.developerMessage)\n\t}\n}\n"],"names":[],"mappings":";;AAKO,MAAM,wBAAwB,MAAM;AAAA,EACnC,YAA4B,UAAkC,IAAI;AACxE,UAAM,QAAQ,gBAAgB;AADI,SAAA,UAAA;AAAA,EAEnC;AACD;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
|
+
const graphqlBuilder = require("@contember/graphql-builder");
|
|
10
|
+
const index = require("../../index.cjs");
|
|
11
|
+
const replaceGraphQlLiteral = require("../replaceGraphQlLiteral.cjs");
|
|
12
|
+
const _GenerateUploadUrlMutationBuilder = class {
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
static buildQuery(parameters) {
|
|
17
|
+
const selectionItems = [];
|
|
18
|
+
for (const alias in parameters) {
|
|
19
|
+
const fileParameters = parameters[alias];
|
|
20
|
+
if (fileParameters.suffix || fileParameters.fileName || fileParameters.extension) {
|
|
21
|
+
const value = replaceGraphQlLiteral.replaceGraphQlLiteral(fileParameters);
|
|
22
|
+
selectionItems.push(new graphqlBuilder.GraphQlField(alias, "generateUploadUrl", {
|
|
23
|
+
input: {
|
|
24
|
+
value,
|
|
25
|
+
graphQlType: "S3GenerateSignedUploadInput"
|
|
26
|
+
}
|
|
27
|
+
}, _GenerateUploadUrlMutationBuilder.generateUploadUrlFields));
|
|
28
|
+
} else {
|
|
29
|
+
selectionItems.push(new graphqlBuilder.GraphQlField(alias, "generateUploadUrl", {
|
|
30
|
+
contentType: {
|
|
31
|
+
graphQlType: "String",
|
|
32
|
+
value: fileParameters.contentType
|
|
33
|
+
},
|
|
34
|
+
expiration: {
|
|
35
|
+
graphQlType: "Int",
|
|
36
|
+
value: fileParameters.expiration
|
|
37
|
+
},
|
|
38
|
+
prefix: {
|
|
39
|
+
graphQlType: "String",
|
|
40
|
+
value: fileParameters.prefix
|
|
41
|
+
},
|
|
42
|
+
acl: {
|
|
43
|
+
graphQlType: "S3Acl",
|
|
44
|
+
value: fileParameters.acl instanceof index.GraphQlBuilder.GraphqlLiteral ? fileParameters.acl?.value : fileParameters.acl
|
|
45
|
+
}
|
|
46
|
+
}, _GenerateUploadUrlMutationBuilder.generateUploadUrlFields));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const printer = new graphqlBuilder.GraphQlQueryPrinter();
|
|
50
|
+
return printer.printDocument("mutation", selectionItems, {});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
let GenerateUploadUrlMutationBuilder = _GenerateUploadUrlMutationBuilder;
|
|
54
|
+
__publicField(GenerateUploadUrlMutationBuilder, "generateUploadUrlFields", [
|
|
55
|
+
new graphqlBuilder.GraphQlField(null, "url"),
|
|
56
|
+
new graphqlBuilder.GraphQlField(null, "publicUrl"),
|
|
57
|
+
new graphqlBuilder.GraphQlField(null, "method"),
|
|
58
|
+
new graphqlBuilder.GraphQlField(null, "headers", {}, [
|
|
59
|
+
new graphqlBuilder.GraphQlField(null, "key"),
|
|
60
|
+
new graphqlBuilder.GraphQlField(null, "value")
|
|
61
|
+
])
|
|
62
|
+
]);
|
|
63
|
+
exports.GenerateUploadUrlMutationBuilder = GenerateUploadUrlMutationBuilder;
|
|
64
|
+
//# sourceMappingURL=GenerateUploadUrlMutationBuilder.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenerateUploadUrlMutationBuilder.cjs","sources":["../../../../src/content/upload/GenerateUploadUrlMutationBuilder.ts"],"sourcesContent":["import { GraphQlLiteral } from '../../graphQlBuilder'\nimport { GraphQlField, GraphQlPrintResult, GraphQlQueryPrinter, GraphQlSelectionSetItem } from '@contember/graphql-builder'\nimport { GraphQlBuilder } from '../../index'\nimport { replaceGraphQlLiteral } from '../replaceGraphQlLiteral'\n\nclass GenerateUploadUrlMutationBuilder {\n\tprivate static generateUploadUrlFields = [\n\t\tnew GraphQlField(null, 'url'),\n\t\tnew GraphQlField(null, 'publicUrl'),\n\t\tnew GraphQlField(null, 'method'),\n\t\tnew GraphQlField(null, 'headers', {}, [\n\t\t\tnew GraphQlField(null, 'key'),\n\t\t\tnew GraphQlField(null, 'value'),\n\t\t]),\n\t]\n\t/**\n\t * @internal\n\t */\n\tpublic static buildQuery(parameters: GenerateUploadUrlMutationBuilder.MutationParameters): GraphQlPrintResult {\n\t\tconst selectionItems: GraphQlSelectionSetItem[] = []\n\t\tfor (const alias in parameters) {\n\t\t\tconst fileParameters = parameters[alias]\n\t\t\tif (fileParameters.suffix || fileParameters.fileName || fileParameters.extension) {\n\t\t\t\tconst value = replaceGraphQlLiteral(fileParameters)\n\t\t\t\tselectionItems.push(new GraphQlField(alias, 'generateUploadUrl', {\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tgraphQlType: 'S3GenerateSignedUploadInput',\n\t\t\t\t\t},\n\t\t\t\t}, GenerateUploadUrlMutationBuilder.generateUploadUrlFields))\n\t\t\t} else {\n\t\t\t\tselectionItems.push(new GraphQlField(alias, 'generateUploadUrl', {\n\t\t\t\t\tcontentType: {\n\t\t\t\t\t\tgraphQlType: 'String',\n\t\t\t\t\t\tvalue: fileParameters.contentType,\n\t\t\t\t\t},\n\t\t\t\t\texpiration: {\n\t\t\t\t\t\tgraphQlType: 'Int',\n\t\t\t\t\t\tvalue: fileParameters.expiration,\n\t\t\t\t\t},\n\t\t\t\t\tprefix: {\n\t\t\t\t\t\tgraphQlType: 'String',\n\t\t\t\t\t\tvalue: fileParameters.prefix,\n\t\t\t\t\t},\n\t\t\t\t\tacl: {\n\t\t\t\t\t\tgraphQlType: 'S3Acl',\n\t\t\t\t\t\tvalue: fileParameters.acl instanceof GraphQlBuilder.GraphqlLiteral ? fileParameters.acl?.value : fileParameters.acl,\n\t\t\t\t\t},\n\t\t\t\t}, GenerateUploadUrlMutationBuilder.generateUploadUrlFields))\n\t\t\t}\n\t\t}\n\n\t\tconst printer = new GraphQlQueryPrinter()\n\t\treturn printer.printDocument('mutation', selectionItems, {})\n\t}\n}\n\nnamespace GenerateUploadUrlMutationBuilder {\n\texport type Acl =\n\t\t| 'PUBLIC_READ'\n\t\t| 'PRIVATE'\n\t\t| 'NONE'\n\t\t| GraphQlLiteral<'PUBLIC_READ' | 'PRIVATE' | 'NONE'>\n\n\texport type FileParameters = {\n\t\tcontentType: string\n\t\texpiration?: number\n\t\tsize?: number\n\t\tprefix?: string\n\t\textension?: string\n\t\tsuffix?: string\n\t\tfileName?: string\n\t\tacl?: Acl\n\t}\n\n\texport interface MutationParameters {\n\t\t[alias: string]: FileParameters\n\t}\n\n\texport interface ResponseBody {\n\t\turl: string\n\t\tpublicUrl: string\n\t\tmethod: string\n\t\theaders: Array<{\n\t\t\tkey: string\n\t\t\tvalue: string\n\t\t}>\n\t}\n\n\texport interface MutationResponse {\n\t\t[alias: string]: ResponseBody\n\t}\n}\n\nexport { GenerateUploadUrlMutationBuilder }\n"],"names":["replaceGraphQlLiteral","GraphQlField","GraphQlBuilder","GraphQlQueryPrinter"],"mappings":";;;;;;;;;;;AAKA,MAAM,oCAAN,MAAuC;AAAA;AAAA;AAAA;AAAA,EAatC,OAAc,WAAW,YAAqF;AAC7G,UAAM,iBAA4C,CAAA;AAClD,eAAW,SAAS,YAAY;AACzB,YAAA,iBAAiB,WAAW,KAAK;AACvC,UAAI,eAAe,UAAU,eAAe,YAAY,eAAe,WAAW;AAC3E,cAAA,QAAQA,4CAAsB,cAAc;AAClD,uBAAe,KAAK,IAAIC,4BAAa,OAAO,qBAAqB;AAAA,UAChE,OAAO;AAAA,YACN;AAAA,YACA,aAAa;AAAA,UACd;AAAA,QAAA,GACE,kCAAiC,uBAAuB,CAAC;AAAA,MAAA,OACtD;AACN,uBAAe,KAAK,IAAIA,4BAAa,OAAO,qBAAqB;AAAA,UAChE,aAAa;AAAA,YACZ,aAAa;AAAA,YACb,OAAO,eAAe;AAAA,UACvB;AAAA,UACA,YAAY;AAAA,YACX,aAAa;AAAA,YACb,OAAO,eAAe;AAAA,UACvB;AAAA,UACA,QAAQ;AAAA,YACP,aAAa;AAAA,YACb,OAAO,eAAe;AAAA,UACvB;AAAA,UACA,KAAK;AAAA,YACJ,aAAa;AAAA,YACb,OAAO,eAAe,eAAeC,qBAAe,iBAAiB,eAAe,KAAK,QAAQ,eAAe;AAAA,UACjH;AAAA,QAAA,GACE,kCAAiC,uBAAuB,CAAC;AAAA,MAC7D;AAAA,IACD;AAEM,UAAA,UAAU,IAAIC,eAAAA;AACpB,WAAO,QAAQ,cAAc,YAAY,gBAAgB,CAAE,CAAA;AAAA,EAC5D;AACD;AAlDA,IAAM,mCAAN;AACC,cADK,kCACU,2BAA0B;AAAA,EACxC,IAAIF,eAAa,aAAA,MAAM,KAAK;AAAA,EAC5B,IAAIA,eAAa,aAAA,MAAM,WAAW;AAAA,EAClC,IAAIA,eAAa,aAAA,MAAM,QAAQ;AAAA,EAC/B,IAAIA,4BAAa,MAAM,WAAW,IAAI;AAAA,IACrC,IAAIA,eAAa,aAAA,MAAM,KAAK;AAAA,IAC5B,IAAIA,eAAa,aAAA,MAAM,OAAO;AAAA,EAAA,CAC9B;AAAA;;"}
|
|
@@ -4,31 +4,60 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { GraphQlField, GraphQlQueryPrinter } from "@contember/graphql-builder";
|
|
8
|
+
import { GraphQlBuilder } from "../../index.js";
|
|
9
|
+
import { replaceGraphQlLiteral } from "../replaceGraphQlLiteral.js";
|
|
9
10
|
const _GenerateUploadUrlMutationBuilder = class {
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
10
14
|
static buildQuery(parameters) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const selectionItems = [];
|
|
16
|
+
for (const alias in parameters) {
|
|
17
|
+
const fileParameters = parameters[alias];
|
|
18
|
+
if (fileParameters.suffix || fileParameters.fileName || fileParameters.extension) {
|
|
19
|
+
const value = replaceGraphQlLiteral(fileParameters);
|
|
20
|
+
selectionItems.push(new GraphQlField(alias, "generateUploadUrl", {
|
|
21
|
+
input: {
|
|
22
|
+
value,
|
|
23
|
+
graphQlType: "S3GenerateSignedUploadInput"
|
|
24
|
+
}
|
|
25
|
+
}, _GenerateUploadUrlMutationBuilder.generateUploadUrlFields));
|
|
26
|
+
} else {
|
|
27
|
+
selectionItems.push(new GraphQlField(alias, "generateUploadUrl", {
|
|
28
|
+
contentType: {
|
|
29
|
+
graphQlType: "String",
|
|
30
|
+
value: fileParameters.contentType
|
|
31
|
+
},
|
|
32
|
+
expiration: {
|
|
33
|
+
graphQlType: "Int",
|
|
34
|
+
value: fileParameters.expiration
|
|
35
|
+
},
|
|
36
|
+
prefix: {
|
|
37
|
+
graphQlType: "String",
|
|
38
|
+
value: fileParameters.prefix
|
|
39
|
+
},
|
|
40
|
+
acl: {
|
|
41
|
+
graphQlType: "S3Acl",
|
|
42
|
+
value: fileParameters.acl instanceof GraphQlBuilder.GraphqlLiteral ? fileParameters.acl?.value : fileParameters.acl
|
|
43
|
+
}
|
|
44
|
+
}, _GenerateUploadUrlMutationBuilder.generateUploadUrlFields));
|
|
25
45
|
}
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
}
|
|
47
|
+
const printer = new GraphQlQueryPrinter();
|
|
48
|
+
return printer.printDocument("mutation", selectionItems, {});
|
|
28
49
|
}
|
|
29
50
|
};
|
|
30
51
|
let GenerateUploadUrlMutationBuilder = _GenerateUploadUrlMutationBuilder;
|
|
31
|
-
__publicField(GenerateUploadUrlMutationBuilder, "generateUploadUrlFields",
|
|
52
|
+
__publicField(GenerateUploadUrlMutationBuilder, "generateUploadUrlFields", [
|
|
53
|
+
new GraphQlField(null, "url"),
|
|
54
|
+
new GraphQlField(null, "publicUrl"),
|
|
55
|
+
new GraphQlField(null, "method"),
|
|
56
|
+
new GraphQlField(null, "headers", {}, [
|
|
57
|
+
new GraphQlField(null, "key"),
|
|
58
|
+
new GraphQlField(null, "value")
|
|
59
|
+
])
|
|
60
|
+
]);
|
|
32
61
|
export {
|
|
33
62
|
GenerateUploadUrlMutationBuilder
|
|
34
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateUploadUrlMutationBuilder.js","sources":["../../../../src/content/upload/GenerateUploadUrlMutationBuilder.ts"],"sourcesContent":["import { GraphQlLiteral,
|
|
1
|
+
{"version":3,"file":"GenerateUploadUrlMutationBuilder.js","sources":["../../../../src/content/upload/GenerateUploadUrlMutationBuilder.ts"],"sourcesContent":["import { GraphQlLiteral } from '../../graphQlBuilder'\nimport { GraphQlField, GraphQlPrintResult, GraphQlQueryPrinter, GraphQlSelectionSetItem } from '@contember/graphql-builder'\nimport { GraphQlBuilder } from '../../index'\nimport { replaceGraphQlLiteral } from '../replaceGraphQlLiteral'\n\nclass GenerateUploadUrlMutationBuilder {\n\tprivate static generateUploadUrlFields = [\n\t\tnew GraphQlField(null, 'url'),\n\t\tnew GraphQlField(null, 'publicUrl'),\n\t\tnew GraphQlField(null, 'method'),\n\t\tnew GraphQlField(null, 'headers', {}, [\n\t\t\tnew GraphQlField(null, 'key'),\n\t\t\tnew GraphQlField(null, 'value'),\n\t\t]),\n\t]\n\t/**\n\t * @internal\n\t */\n\tpublic static buildQuery(parameters: GenerateUploadUrlMutationBuilder.MutationParameters): GraphQlPrintResult {\n\t\tconst selectionItems: GraphQlSelectionSetItem[] = []\n\t\tfor (const alias in parameters) {\n\t\t\tconst fileParameters = parameters[alias]\n\t\t\tif (fileParameters.suffix || fileParameters.fileName || fileParameters.extension) {\n\t\t\t\tconst value = replaceGraphQlLiteral(fileParameters)\n\t\t\t\tselectionItems.push(new GraphQlField(alias, 'generateUploadUrl', {\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tgraphQlType: 'S3GenerateSignedUploadInput',\n\t\t\t\t\t},\n\t\t\t\t}, GenerateUploadUrlMutationBuilder.generateUploadUrlFields))\n\t\t\t} else {\n\t\t\t\tselectionItems.push(new GraphQlField(alias, 'generateUploadUrl', {\n\t\t\t\t\tcontentType: {\n\t\t\t\t\t\tgraphQlType: 'String',\n\t\t\t\t\t\tvalue: fileParameters.contentType,\n\t\t\t\t\t},\n\t\t\t\t\texpiration: {\n\t\t\t\t\t\tgraphQlType: 'Int',\n\t\t\t\t\t\tvalue: fileParameters.expiration,\n\t\t\t\t\t},\n\t\t\t\t\tprefix: {\n\t\t\t\t\t\tgraphQlType: 'String',\n\t\t\t\t\t\tvalue: fileParameters.prefix,\n\t\t\t\t\t},\n\t\t\t\t\tacl: {\n\t\t\t\t\t\tgraphQlType: 'S3Acl',\n\t\t\t\t\t\tvalue: fileParameters.acl instanceof GraphQlBuilder.GraphqlLiteral ? fileParameters.acl?.value : fileParameters.acl,\n\t\t\t\t\t},\n\t\t\t\t}, GenerateUploadUrlMutationBuilder.generateUploadUrlFields))\n\t\t\t}\n\t\t}\n\n\t\tconst printer = new GraphQlQueryPrinter()\n\t\treturn printer.printDocument('mutation', selectionItems, {})\n\t}\n}\n\nnamespace GenerateUploadUrlMutationBuilder {\n\texport type Acl =\n\t\t| 'PUBLIC_READ'\n\t\t| 'PRIVATE'\n\t\t| 'NONE'\n\t\t| GraphQlLiteral<'PUBLIC_READ' | 'PRIVATE' | 'NONE'>\n\n\texport type FileParameters = {\n\t\tcontentType: string\n\t\texpiration?: number\n\t\tsize?: number\n\t\tprefix?: string\n\t\textension?: string\n\t\tsuffix?: string\n\t\tfileName?: string\n\t\tacl?: Acl\n\t}\n\n\texport interface MutationParameters {\n\t\t[alias: string]: FileParameters\n\t}\n\n\texport interface ResponseBody {\n\t\turl: string\n\t\tpublicUrl: string\n\t\tmethod: string\n\t\theaders: Array<{\n\t\t\tkey: string\n\t\t\tvalue: string\n\t\t}>\n\t}\n\n\texport interface MutationResponse {\n\t\t[alias: string]: ResponseBody\n\t}\n}\n\nexport { GenerateUploadUrlMutationBuilder }\n"],"names":[],"mappings":";;;;;;;;;AAKA,MAAM,oCAAN,MAAuC;AAAA;AAAA;AAAA;AAAA,EAatC,OAAc,WAAW,YAAqF;AAC7G,UAAM,iBAA4C,CAAA;AAClD,eAAW,SAAS,YAAY;AACzB,YAAA,iBAAiB,WAAW,KAAK;AACvC,UAAI,eAAe,UAAU,eAAe,YAAY,eAAe,WAAW;AAC3E,cAAA,QAAQ,sBAAsB,cAAc;AAClD,uBAAe,KAAK,IAAI,aAAa,OAAO,qBAAqB;AAAA,UAChE,OAAO;AAAA,YACN;AAAA,YACA,aAAa;AAAA,UACd;AAAA,QAAA,GACE,kCAAiC,uBAAuB,CAAC;AAAA,MAAA,OACtD;AACN,uBAAe,KAAK,IAAI,aAAa,OAAO,qBAAqB;AAAA,UAChE,aAAa;AAAA,YACZ,aAAa;AAAA,YACb,OAAO,eAAe;AAAA,UACvB;AAAA,UACA,YAAY;AAAA,YACX,aAAa;AAAA,YACb,OAAO,eAAe;AAAA,UACvB;AAAA,UACA,QAAQ;AAAA,YACP,aAAa;AAAA,YACb,OAAO,eAAe;AAAA,UACvB;AAAA,UACA,KAAK;AAAA,YACJ,aAAa;AAAA,YACb,OAAO,eAAe,eAAe,eAAe,iBAAiB,eAAe,KAAK,QAAQ,eAAe;AAAA,UACjH;AAAA,QAAA,GACE,kCAAiC,uBAAuB,CAAC;AAAA,MAC7D;AAAA,IACD;AAEM,UAAA,UAAU,IAAI;AACpB,WAAO,QAAQ,cAAc,YAAY,gBAAgB,CAAE,CAAA;AAAA,EAC5D;AACD;AAlDA,IAAM,mCAAN;AACC,cADK,kCACU,2BAA0B;AAAA,EACxC,IAAI,aAAa,MAAM,KAAK;AAAA,EAC5B,IAAI,aAAa,MAAM,WAAW;AAAA,EAClC,IAAI,aAAa,MAAM,QAAQ;AAAA,EAC/B,IAAI,aAAa,MAAM,WAAW,IAAI;AAAA,IACrC,IAAI,aAAa,MAAM,KAAK;AAAA,IAC5B,IAAI,aAAa,MAAM,OAAO;AAAA,EAAA,CAC9B;AAAA;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
|
+
const pLimit = require("p-limit");
|
|
10
|
+
const FileUploadError = require("./FileUploadError.cjs");
|
|
11
|
+
const GenerateUploadUrlMutationBuilder = require("./GenerateUploadUrlMutationBuilder.cjs");
|
|
12
|
+
const readFileAsArrayBuffer = require("../../utils/readFileAsArrayBuffer.cjs");
|
|
13
|
+
class S3FileUploader {
|
|
14
|
+
constructor(options = {}) {
|
|
15
|
+
__publicField(this, "uploadState");
|
|
16
|
+
__publicField(this, "generateNewAlias", (() => {
|
|
17
|
+
let alias = 1;
|
|
18
|
+
return () => alias++;
|
|
19
|
+
})());
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.uploadState = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
}
|
|
23
|
+
static formatFullAlias(alias) {
|
|
24
|
+
return `file${alias}`;
|
|
25
|
+
}
|
|
26
|
+
async upload(files, options) {
|
|
27
|
+
const parameters = {};
|
|
28
|
+
for (const [file, metadata] of files) {
|
|
29
|
+
if (this.uploadState.has(file)) {
|
|
30
|
+
const uploadState = this.uploadState.get(file);
|
|
31
|
+
uploadState.request?.abort();
|
|
32
|
+
}
|
|
33
|
+
const alias = this.generateNewAlias();
|
|
34
|
+
this.uploadState.set(file, {
|
|
35
|
+
alias
|
|
36
|
+
});
|
|
37
|
+
const uploadOptions = this.options.getUploadOptions?.(file);
|
|
38
|
+
parameters[S3FileUploader.formatFullAlias(alias)] = {
|
|
39
|
+
contentType: uploadOptions?.fileType ?? file.type,
|
|
40
|
+
prefix: uploadOptions?.filePrefix,
|
|
41
|
+
suffix: uploadOptions?.fileSuffix,
|
|
42
|
+
size: uploadOptions?.fileSize,
|
|
43
|
+
extension: uploadOptions?.fileExtension,
|
|
44
|
+
fileName: uploadOptions?.fileName,
|
|
45
|
+
expiration: uploadOptions?.fileExpiration,
|
|
46
|
+
acl: uploadOptions?.fileAcl
|
|
47
|
+
};
|
|
48
|
+
metadata.abortSignal.addEventListener("abort", () => {
|
|
49
|
+
this.uploadState.get(file)?.request?.abort();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const mutation = GenerateUploadUrlMutationBuilder.GenerateUploadUrlMutationBuilder.buildQuery(parameters);
|
|
53
|
+
try {
|
|
54
|
+
const responseData = await options.contentApiClient.execute(mutation.query, { variables: mutation.variables });
|
|
55
|
+
const limit = pLimit(this.options.concurrency ?? 5);
|
|
56
|
+
const promises = [];
|
|
57
|
+
for (const [file] of files) {
|
|
58
|
+
promises.push(limit(() => this.uploadSingleFile(file, responseData, options)));
|
|
59
|
+
}
|
|
60
|
+
await Promise.all(promises);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
if (error instanceof FileUploadError.FileUploadError) {
|
|
63
|
+
const fileUploadError = error;
|
|
64
|
+
options.onError(Array.from(files).map(([file]) => [file, fileUploadError]));
|
|
65
|
+
} else {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
uploadSingleFile(file, responseData, { onProgress, onError, onSuccess }) {
|
|
71
|
+
return new Promise(async (resolve, reject) => {
|
|
72
|
+
const fileState = this.uploadState.get(file);
|
|
73
|
+
const datumBody = responseData[S3FileUploader.formatFullAlias(fileState.alias)];
|
|
74
|
+
const uploadRequestBody = await readFileAsArrayBuffer.readFileAsArrayBuffer(file);
|
|
75
|
+
const xhr = new XMLHttpRequest();
|
|
76
|
+
fileState.request = xhr;
|
|
77
|
+
xhr.open(datumBody.method, datumBody.url);
|
|
78
|
+
for (const header of datumBody.headers) {
|
|
79
|
+
xhr.setRequestHeader(header.key, header.value);
|
|
80
|
+
}
|
|
81
|
+
xhr.addEventListener("load", () => {
|
|
82
|
+
const successMetadata = {
|
|
83
|
+
fileUrl: datumBody.publicUrl
|
|
84
|
+
};
|
|
85
|
+
onSuccess([[file, successMetadata]]);
|
|
86
|
+
resolve();
|
|
87
|
+
});
|
|
88
|
+
xhr.addEventListener("error", (e) => {
|
|
89
|
+
onError([file]);
|
|
90
|
+
reject(e);
|
|
91
|
+
});
|
|
92
|
+
xhr.upload?.addEventListener("progress", (e) => {
|
|
93
|
+
onProgress([
|
|
94
|
+
[
|
|
95
|
+
file,
|
|
96
|
+
{
|
|
97
|
+
progress: e.loaded / e.total
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
]);
|
|
101
|
+
});
|
|
102
|
+
xhr.send(uploadRequestBody);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.S3FileUploader = S3FileUploader;
|
|
107
|
+
//# sourceMappingURL=S3FileUploader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"S3FileUploader.cjs","sources":["../../../../src/content/upload/S3FileUploader.ts"],"sourcesContent":["import pLimit from 'p-limit'\nimport { readFileAsArrayBuffer } from '../../utils'\nimport { FileUploadError } from './FileUploadError'\nimport type { FileUploader, FileUploaderInitializeOptions } from './FileUploader'\nimport { GenerateUploadUrlMutationBuilder } from './GenerateUploadUrlMutationBuilder'\nimport type { UploadedFileMetadata } from './UploadedFileMetadata'\n\ninterface S3UploadState {\n\trequest?: XMLHttpRequest\n\talias: number\n}\n\nclass S3FileUploader implements FileUploader<S3FileUploader.SuccessMetadata> {\n\tprivate readonly uploadState: WeakMap<File, S3UploadState>\n\n\tpublic constructor(public readonly options: S3FileUploader.Options = {}) {\n\t\tthis.uploadState = new WeakMap()\n\t}\n\n\tprivate generateNewAlias = (() => {\n\t\tlet alias = 1\n\t\treturn () => alias++\n\t})()\n\n\tprivate static formatFullAlias(alias: number) {\n\t\treturn `file${alias}`\n\t}\n\n\tpublic async upload(\n\t\tfiles: Map<File, UploadedFileMetadata>,\n\t\toptions: FileUploaderInitializeOptions,\n\t) {\n\t\tconst parameters: GenerateUploadUrlMutationBuilder.MutationParameters = {}\n\n\t\tfor (const [file, metadata] of files) {\n\t\t\tif (this.uploadState.has(file)) {\n\t\t\t\tconst uploadState = this.uploadState.get(file)!\n\t\t\t\tuploadState.request?.abort()\n\t\t\t}\n\n\t\t\tconst alias = this.generateNewAlias()\n\t\t\tthis.uploadState.set(file, {\n\t\t\t\talias,\n\t\t\t})\n\n\t\t\tconst uploadOptions = this.options.getUploadOptions?.(file)\n\n\t\t\tparameters[S3FileUploader.formatFullAlias(alias)] = {\n\t\t\t\tcontentType: uploadOptions?.fileType ?? file.type,\n\t\t\t\tprefix: uploadOptions?.filePrefix,\n\t\t\t\tsuffix: uploadOptions?.fileSuffix,\n\t\t\t\tsize: uploadOptions?.fileSize,\n\t\t\t\textension: uploadOptions?.fileExtension,\n\t\t\t\tfileName: uploadOptions?.fileName,\n\t\t\t\texpiration: uploadOptions?.fileExpiration,\n\t\t\t\tacl: uploadOptions?.fileAcl,\n\t\t\t}\n\n\t\t\tmetadata.abortSignal.addEventListener('abort', () => {\n\t\t\t\tthis.uploadState.get(file)?.request?.abort()\n\t\t\t})\n\t\t}\n\n\t\tconst mutation = GenerateUploadUrlMutationBuilder.buildQuery(parameters)\n\t\ttry {\n\t\t\tconst responseData = await options.contentApiClient.execute<GenerateUploadUrlMutationBuilder.MutationResponse>(mutation.query, { variables: mutation.variables })\n\t\t\tconst limit = pLimit(this.options.concurrency ?? 5)\n\t\t\tconst promises: Promise<void>[] = []\n\t\t\tfor (const [file] of files) {\n\t\t\t\tpromises.push(limit(() => this.uploadSingleFile(file, responseData, options)))\n\t\t\t}\n\t\t\tawait Promise.all(promises)\n\t\t} catch (error) {\n\t\t\tif (error instanceof FileUploadError) {\n\t\t\t\tconst fileUploadError = error\n\t\t\t\toptions.onError(Array.from(files).map(([file]) => [file, fileUploadError]))\n\n\t\t\t} else {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate uploadSingleFile(\n\t\tfile: File,\n\t\tresponseData: GenerateUploadUrlMutationBuilder.MutationResponse,\n\t\t{ onProgress, onError, onSuccess }: FileUploaderInitializeOptions,\n\t) {\n\t\treturn new Promise<void>(async (resolve, reject) => {\n\t\t\tconst fileState = this.uploadState.get(file)!\n\t\t\tconst datumBody = responseData[S3FileUploader.formatFullAlias(fileState.alias)]\n\t\t\tconst uploadRequestBody = await readFileAsArrayBuffer(file)\n\t\t\tconst xhr = new XMLHttpRequest()\n\n\t\t\tfileState.request = xhr\n\n\t\t\txhr.open(datumBody.method, datumBody.url)\n\n\t\t\tfor (const header of datumBody.headers) {\n\t\t\t\txhr.setRequestHeader(header.key, header.value)\n\t\t\t}\n\t\t\txhr.addEventListener('load', () => {\n\t\t\t\tconst successMetadata: S3FileUploader.SuccessMetadata = {\n\t\t\t\t\tfileUrl: datumBody.publicUrl,\n\t\t\t\t}\n\t\t\t\tonSuccess([[file, successMetadata]])\n\t\t\t\tresolve()\n\t\t\t})\n\t\t\txhr.addEventListener('error', e => {\n\t\t\t\tonError([file])\n\t\t\t\treject(e)\n\t\t\t})\n\t\t\txhr.upload?.addEventListener('progress', e => {\n\t\t\t\tonProgress([\n\t\t\t\t\t[\n\t\t\t\t\t\tfile,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprogress: e.loaded / e.total,\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\txhr.send(uploadRequestBody)\n\t\t})\n\t}\n}\n\nnamespace S3FileUploader {\n\texport interface SuccessMetadata {\n\t\tfileUrl: string\n\t}\n\n\texport interface Options {\n\t\tgetUploadOptions?: (file: File) => S3UploadOptions\n\t\tconcurrency?: number\n\t}\n\n\texport interface S3UploadOptions {\n\t\tfileType?: GenerateUploadUrlMutationBuilder.FileParameters['contentType']\n\t\tfileExpiration?: number\n\t\tfileSize?: number\n\t\tfilePrefix?: string\n\t\tfileSuffix?: string\n\t\tfileName?: string\n\t\tfileExtension?: string\n\t\tfileAcl?: GenerateUploadUrlMutationBuilder.Acl\n\t}\n}\n\nexport { S3FileUploader }\n"],"names":["GenerateUploadUrlMutationBuilder","FileUploadError","readFileAsArrayBuffer"],"mappings":"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"}
|
|
@@ -49,8 +49,7 @@ class S3FileUploader {
|
|
|
49
49
|
}
|
|
50
50
|
const mutation = GenerateUploadUrlMutationBuilder.buildQuery(parameters);
|
|
51
51
|
try {
|
|
52
|
-
const
|
|
53
|
-
const responseData = response.data;
|
|
52
|
+
const responseData = await options.contentApiClient.execute(mutation.query, { variables: mutation.variables });
|
|
54
53
|
const limit = pLimit(this.options.concurrency ?? 5);
|
|
55
54
|
const promises = [];
|
|
56
55
|
for (const [file] of files) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"S3FileUploader.js","sources":["../../../../src/content/upload/S3FileUploader.ts"],"sourcesContent":["import pLimit from 'p-limit'\nimport { readFileAsArrayBuffer } from '../../utils'\nimport { FileUploadError } from './FileUploadError'\nimport type { FileUploader, FileUploaderInitializeOptions } from './FileUploader'\nimport { GenerateUploadUrlMutationBuilder } from './GenerateUploadUrlMutationBuilder'\nimport type { UploadedFileMetadata } from './UploadedFileMetadata'\n\ninterface S3UploadState {\n\trequest?: XMLHttpRequest\n\talias: number\n}\n\nclass S3FileUploader implements FileUploader<S3FileUploader.SuccessMetadata> {\n\tprivate readonly uploadState: WeakMap<File, S3UploadState>\n\n\tpublic constructor(public readonly options: S3FileUploader.Options = {}) {\n\t\tthis.uploadState = new WeakMap()\n\t}\n\n\tprivate generateNewAlias = (() => {\n\t\tlet alias = 1\n\t\treturn () => alias++\n\t})()\n\n\tprivate static formatFullAlias(alias: number) {\n\t\treturn `file${alias}`\n\t}\n\n\tpublic async upload(\n\t\tfiles: Map<File, UploadedFileMetadata>,\n\t\toptions: FileUploaderInitializeOptions,\n\t) {\n\t\tconst parameters: GenerateUploadUrlMutationBuilder.MutationParameters = {}\n\n\t\tfor (const [file, metadata] of files) {\n\t\t\tif (this.uploadState.has(file)) {\n\t\t\t\tconst uploadState = this.uploadState.get(file)!\n\t\t\t\tuploadState.request?.abort()\n\t\t\t}\n\n\t\t\tconst alias = this.generateNewAlias()\n\t\t\tthis.uploadState.set(file, {\n\t\t\t\talias,\n\t\t\t})\n\n\t\t\tconst uploadOptions = this.options.getUploadOptions?.(file)\n\n\t\t\tparameters[S3FileUploader.formatFullAlias(alias)] = {\n\t\t\t\tcontentType: uploadOptions?.fileType ?? file.type,\n\t\t\t\tprefix: uploadOptions?.filePrefix,\n\t\t\t\tsuffix: uploadOptions?.fileSuffix,\n\t\t\t\tsize: uploadOptions?.fileSize,\n\t\t\t\textension: uploadOptions?.fileExtension,\n\t\t\t\tfileName: uploadOptions?.fileName,\n\t\t\t\texpiration: uploadOptions?.fileExpiration,\n\t\t\t\tacl: uploadOptions?.fileAcl,\n\t\t\t}\n\n\t\t\tmetadata.abortSignal.addEventListener('abort', () => {\n\t\t\t\tthis.uploadState.get(file)?.request?.abort()\n\t\t\t})\n\t\t}\n\n\t\tconst mutation = GenerateUploadUrlMutationBuilder.buildQuery(parameters)\n\t\ttry {\n\t\t\tconst
|
|
1
|
+
{"version":3,"file":"S3FileUploader.js","sources":["../../../../src/content/upload/S3FileUploader.ts"],"sourcesContent":["import pLimit from 'p-limit'\nimport { readFileAsArrayBuffer } from '../../utils'\nimport { FileUploadError } from './FileUploadError'\nimport type { FileUploader, FileUploaderInitializeOptions } from './FileUploader'\nimport { GenerateUploadUrlMutationBuilder } from './GenerateUploadUrlMutationBuilder'\nimport type { UploadedFileMetadata } from './UploadedFileMetadata'\n\ninterface S3UploadState {\n\trequest?: XMLHttpRequest\n\talias: number\n}\n\nclass S3FileUploader implements FileUploader<S3FileUploader.SuccessMetadata> {\n\tprivate readonly uploadState: WeakMap<File, S3UploadState>\n\n\tpublic constructor(public readonly options: S3FileUploader.Options = {}) {\n\t\tthis.uploadState = new WeakMap()\n\t}\n\n\tprivate generateNewAlias = (() => {\n\t\tlet alias = 1\n\t\treturn () => alias++\n\t})()\n\n\tprivate static formatFullAlias(alias: number) {\n\t\treturn `file${alias}`\n\t}\n\n\tpublic async upload(\n\t\tfiles: Map<File, UploadedFileMetadata>,\n\t\toptions: FileUploaderInitializeOptions,\n\t) {\n\t\tconst parameters: GenerateUploadUrlMutationBuilder.MutationParameters = {}\n\n\t\tfor (const [file, metadata] of files) {\n\t\t\tif (this.uploadState.has(file)) {\n\t\t\t\tconst uploadState = this.uploadState.get(file)!\n\t\t\t\tuploadState.request?.abort()\n\t\t\t}\n\n\t\t\tconst alias = this.generateNewAlias()\n\t\t\tthis.uploadState.set(file, {\n\t\t\t\talias,\n\t\t\t})\n\n\t\t\tconst uploadOptions = this.options.getUploadOptions?.(file)\n\n\t\t\tparameters[S3FileUploader.formatFullAlias(alias)] = {\n\t\t\t\tcontentType: uploadOptions?.fileType ?? file.type,\n\t\t\t\tprefix: uploadOptions?.filePrefix,\n\t\t\t\tsuffix: uploadOptions?.fileSuffix,\n\t\t\t\tsize: uploadOptions?.fileSize,\n\t\t\t\textension: uploadOptions?.fileExtension,\n\t\t\t\tfileName: uploadOptions?.fileName,\n\t\t\t\texpiration: uploadOptions?.fileExpiration,\n\t\t\t\tacl: uploadOptions?.fileAcl,\n\t\t\t}\n\n\t\t\tmetadata.abortSignal.addEventListener('abort', () => {\n\t\t\t\tthis.uploadState.get(file)?.request?.abort()\n\t\t\t})\n\t\t}\n\n\t\tconst mutation = GenerateUploadUrlMutationBuilder.buildQuery(parameters)\n\t\ttry {\n\t\t\tconst responseData = await options.contentApiClient.execute<GenerateUploadUrlMutationBuilder.MutationResponse>(mutation.query, { variables: mutation.variables })\n\t\t\tconst limit = pLimit(this.options.concurrency ?? 5)\n\t\t\tconst promises: Promise<void>[] = []\n\t\t\tfor (const [file] of files) {\n\t\t\t\tpromises.push(limit(() => this.uploadSingleFile(file, responseData, options)))\n\t\t\t}\n\t\t\tawait Promise.all(promises)\n\t\t} catch (error) {\n\t\t\tif (error instanceof FileUploadError) {\n\t\t\t\tconst fileUploadError = error\n\t\t\t\toptions.onError(Array.from(files).map(([file]) => [file, fileUploadError]))\n\n\t\t\t} else {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate uploadSingleFile(\n\t\tfile: File,\n\t\tresponseData: GenerateUploadUrlMutationBuilder.MutationResponse,\n\t\t{ onProgress, onError, onSuccess }: FileUploaderInitializeOptions,\n\t) {\n\t\treturn new Promise<void>(async (resolve, reject) => {\n\t\t\tconst fileState = this.uploadState.get(file)!\n\t\t\tconst datumBody = responseData[S3FileUploader.formatFullAlias(fileState.alias)]\n\t\t\tconst uploadRequestBody = await readFileAsArrayBuffer(file)\n\t\t\tconst xhr = new XMLHttpRequest()\n\n\t\t\tfileState.request = xhr\n\n\t\t\txhr.open(datumBody.method, datumBody.url)\n\n\t\t\tfor (const header of datumBody.headers) {\n\t\t\t\txhr.setRequestHeader(header.key, header.value)\n\t\t\t}\n\t\t\txhr.addEventListener('load', () => {\n\t\t\t\tconst successMetadata: S3FileUploader.SuccessMetadata = {\n\t\t\t\t\tfileUrl: datumBody.publicUrl,\n\t\t\t\t}\n\t\t\t\tonSuccess([[file, successMetadata]])\n\t\t\t\tresolve()\n\t\t\t})\n\t\t\txhr.addEventListener('error', e => {\n\t\t\t\tonError([file])\n\t\t\t\treject(e)\n\t\t\t})\n\t\t\txhr.upload?.addEventListener('progress', e => {\n\t\t\t\tonProgress([\n\t\t\t\t\t[\n\t\t\t\t\t\tfile,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprogress: e.loaded / e.total,\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\txhr.send(uploadRequestBody)\n\t\t})\n\t}\n}\n\nnamespace S3FileUploader {\n\texport interface SuccessMetadata {\n\t\tfileUrl: string\n\t}\n\n\texport interface Options {\n\t\tgetUploadOptions?: (file: File) => S3UploadOptions\n\t\tconcurrency?: number\n\t}\n\n\texport interface S3UploadOptions {\n\t\tfileType?: GenerateUploadUrlMutationBuilder.FileParameters['contentType']\n\t\tfileExpiration?: number\n\t\tfileSize?: number\n\t\tfilePrefix?: string\n\t\tfileSuffix?: string\n\t\tfileName?: string\n\t\tfileExtension?: string\n\t\tfileAcl?: GenerateUploadUrlMutationBuilder.Acl\n\t}\n}\n\nexport { S3FileUploader }\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class GraphQlLiteral {
|
|
4
|
+
constructor(value) {
|
|
5
|
+
this.value = value;
|
|
6
|
+
{
|
|
7
|
+
console.warn("GraphQlLiteral is deprecated, use the value directly instead.");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return `Literal(${this.value})`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.GraphQlLiteral = GraphQlLiteral;
|
|
15
|
+
//# sourceMappingURL=GraphQlLiteral.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphQlLiteral.cjs","sources":["../../../src/graphQlBuilder/GraphQlLiteral.ts"],"sourcesContent":["/**\n * @deprecated Directly use the value instead.\n */\nexport class GraphQlLiteral<Value extends string = string> {\n\tconstructor(public readonly value: Value) {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.warn('GraphQlLiteral is deprecated, use the value directly instead.')\n\t\t}\n\t}\n\n\tpublic toString() {\n\t\treturn `Literal(${this.value})`\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,eAA8C;AAAA,EAC1D,YAA4B,OAAc;AAAd,SAAA,QAAA;AACF;AACxB,cAAQ,KAAK,+DAA+D;AAAA,IAC7E;AAAA,EACD;AAAA,EAEO,WAAW;AACjB,WAAO,WAAW,KAAK;AAAA,EACxB;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQlLiteral.js","sources":["../../../src/graphQlBuilder/GraphQlLiteral.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"GraphQlLiteral.js","sources":["../../../src/graphQlBuilder/GraphQlLiteral.ts"],"sourcesContent":["/**\n * @deprecated Directly use the value instead.\n */\nexport class GraphQlLiteral<Value extends string = string> {\n\tconstructor(public readonly value: Value) {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.warn('GraphQlLiteral is deprecated, use the value directly instead.')\n\t\t}\n\t}\n\n\tpublic toString() {\n\t\treturn `Literal(${this.value})`\n\t}\n}\n"],"names":[],"mappings":"AAGO,MAAM,eAA8C;AAAA,EAC1D,YAA4B,OAAc;AAAd,SAAA,QAAA;AACF;AACxB,cAAQ,KAAK,+DAA+D;AAAA,IAC7E;AAAA,EACD;AAAA,EAEO,WAAW;AACjB,WAAO,WAAW,KAAK;AAAA,EACxB;AACD;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const graphqlClient = require("@contember/graphql-client");
|
|
4
|
+
class GraphQlClient extends graphqlClient.GraphQlClient {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use execute
|
|
7
|
+
*/
|
|
8
|
+
async sendRequest(query, options = {}) {
|
|
9
|
+
console.debug(query);
|
|
10
|
+
const response = await this.doExecute(query, {
|
|
11
|
+
...options,
|
|
12
|
+
apiToken: options.apiTokenOverride ?? options.apiToken
|
|
13
|
+
});
|
|
14
|
+
if (response.ok) {
|
|
15
|
+
return await response.json();
|
|
16
|
+
}
|
|
17
|
+
const failedRequest = {
|
|
18
|
+
status: response.status,
|
|
19
|
+
statusText: response.statusText,
|
|
20
|
+
responseText: await response.text()
|
|
21
|
+
};
|
|
22
|
+
return Promise.reject(failedRequest);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.GraphQlClient = GraphQlClient;
|
|
26
|
+
//# sourceMappingURL=GraphQlClient.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphQlClient.cjs","sources":["../../../src/graphQlClient/GraphQlClient.ts"],"sourcesContent":["import { GraphQlClient as BaseGraphQLClient, GraphQlClientRequestOptions as BaseGraphQlClientRequestOptions } from '@contember/graphql-client'\n\nexport interface GraphQlClientRequestOptions extends BaseGraphQlClientRequestOptions {\n\t/**\n\t * @deprecated use apiToken\n\t */\n\tapiTokenOverride?: string\n}\n\nexport type GraphQlClientFailedRequestMetadata = Pick<Response, 'status' | 'statusText'> & {\n\tresponseText: string\n}\n\nexport class GraphQlClient extends BaseGraphQLClient {\n\t/**\n\t * @deprecated use execute\n\t */\n\tasync sendRequest<T = unknown>(query: string, options: GraphQlClientRequestOptions = {}): Promise<T> {\n\t\tconsole.debug(query)\n\t\tconst response = await this.doExecute(query, {\n\t\t\t...options,\n\t\t\tapiToken: options.apiTokenOverride ?? options.apiToken,\n\t\t})\n\n\t\tif (response.ok) {\n\t\t\t// It may still have errors (e.g. unfilled fields) but as far as the request goes, it is ok.\n\t\t\treturn await response.json()\n\t\t}\n\n\t\tconst failedRequest: GraphQlClientFailedRequestMetadata = {\n\t\t\tstatus: response.status,\n\t\t\tstatusText: response.statusText,\n\t\t\tresponseText: await response.text(),\n\t\t}\n\n\t\treturn Promise.reject(failedRequest)\n\t}\n\n}\n"],"names":["BaseGraphQLClient"],"mappings":";;;AAaO,MAAM,sBAAsBA,cAAAA,cAAkB;AAAA;AAAA;AAAA;AAAA,EAIpD,MAAM,YAAyB,OAAe,UAAuC,IAAgB;AACpG,YAAQ,MAAM,KAAK;AACnB,UAAM,WAAW,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5C,GAAG;AAAA,MACH,UAAU,QAAQ,oBAAoB,QAAQ;AAAA,IAAA,CAC9C;AAED,QAAI,SAAS,IAAI;AAET,aAAA,MAAM,SAAS;IACvB;AAEA,UAAM,gBAAoD;AAAA,MACzD,QAAQ,SAAS;AAAA,MACjB,YAAY,SAAS;AAAA,MACrB,cAAc,MAAM,SAAS,KAAK;AAAA,IAAA;AAG5B,WAAA,QAAQ,OAAO,aAAa;AAAA,EACpC;AAED;;"}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
async sendRequest(query,
|
|
7
|
-
const resolvedHeaders = { "Content-Type": "application/json", ...headers };
|
|
8
|
-
const resolvedToken = apiTokenOverride ?? this.apiToken;
|
|
9
|
-
if (resolvedToken !== void 0) {
|
|
10
|
-
resolvedHeaders["Authorization"] = `Bearer ${resolvedToken}`;
|
|
11
|
-
}
|
|
1
|
+
import { GraphQlClient as GraphQlClient$1 } from "@contember/graphql-client";
|
|
2
|
+
class GraphQlClient extends GraphQlClient$1 {
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated use execute
|
|
5
|
+
*/
|
|
6
|
+
async sendRequest(query, options = {}) {
|
|
12
7
|
console.debug(query);
|
|
13
|
-
const response = await
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
signal,
|
|
17
|
-
body: JSON.stringify({ query, variables })
|
|
8
|
+
const response = await this.doExecute(query, {
|
|
9
|
+
...options,
|
|
10
|
+
apiToken: options.apiTokenOverride ?? options.apiToken
|
|
18
11
|
});
|
|
19
12
|
if (response.ok) {
|
|
20
13
|
return await response.json();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQlClient.js","sources":["../../../src/graphQlClient/GraphQlClient.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"GraphQlClient.js","sources":["../../../src/graphQlClient/GraphQlClient.ts"],"sourcesContent":["import { GraphQlClient as BaseGraphQLClient, GraphQlClientRequestOptions as BaseGraphQlClientRequestOptions } from '@contember/graphql-client'\n\nexport interface GraphQlClientRequestOptions extends BaseGraphQlClientRequestOptions {\n\t/**\n\t * @deprecated use apiToken\n\t */\n\tapiTokenOverride?: string\n}\n\nexport type GraphQlClientFailedRequestMetadata = Pick<Response, 'status' | 'statusText'> & {\n\tresponseText: string\n}\n\nexport class GraphQlClient extends BaseGraphQLClient {\n\t/**\n\t * @deprecated use execute\n\t */\n\tasync sendRequest<T = unknown>(query: string, options: GraphQlClientRequestOptions = {}): Promise<T> {\n\t\tconsole.debug(query)\n\t\tconst response = await this.doExecute(query, {\n\t\t\t...options,\n\t\t\tapiToken: options.apiTokenOverride ?? options.apiToken,\n\t\t})\n\n\t\tif (response.ok) {\n\t\t\t// It may still have errors (e.g. unfilled fields) but as far as the request goes, it is ok.\n\t\t\treturn await response.json()\n\t\t}\n\n\t\tconst failedRequest: GraphQlClientFailedRequestMetadata = {\n\t\t\tstatus: response.status,\n\t\t\tstatusText: response.statusText,\n\t\t\tresponseText: await response.text(),\n\t\t}\n\n\t\treturn Promise.reject(failedRequest)\n\t}\n\n}\n"],"names":["BaseGraphQLClient"],"mappings":";AAaO,MAAM,sBAAsBA,gBAAkB;AAAA;AAAA;AAAA;AAAA,EAIpD,MAAM,YAAyB,OAAe,UAAuC,IAAgB;AACpG,YAAQ,MAAM,KAAK;AACnB,UAAM,WAAW,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5C,GAAG;AAAA,MACH,UAAU,QAAQ,oBAAoB,QAAQ;AAAA,IAAA,CAC9C;AAED,QAAI,SAAS,IAAI;AAET,aAAA,MAAM,SAAS;IACvB;AAEA,UAAM,gBAAoD;AAAA,MACzD,QAAQ,SAAS;AAAA,MACjB,YAAY,SAAS;AAAA,MACrB,cAAc,MAAM,SAAS,KAAK;AAAA,IAAA;AAG5B,WAAA,QAAQ,OAAO,aAAa;AAAA,EACpC;AAED;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const clientContent = require("@contember/client-content");
|
|
4
|
+
const GraphQlLiteral = require("./graphQlBuilder/GraphQlLiteral.cjs");
|
|
5
|
+
const FileUploadError = require("./content/upload/FileUploadError.cjs");
|
|
6
|
+
const GenerateUploadUrlMutationBuilder = require("./content/upload/GenerateUploadUrlMutationBuilder.cjs");
|
|
7
|
+
const S3FileUploader = require("./content/upload/S3FileUploader.cjs");
|
|
8
|
+
const whereToFilter = require("./content/params/whereToFilter.cjs");
|
|
9
|
+
const formatContentApiRelativeUrl = require("./content/formatContentApiRelativeUrl.cjs");
|
|
10
|
+
const replaceGraphQlLiteral = require("./content/replaceGraphQlLiteral.cjs");
|
|
11
|
+
const graphqlClient = require("@contember/graphql-client");
|
|
12
|
+
const GraphQlClient = require("./graphQlClient/GraphQlClient.cjs");
|
|
13
|
+
const formatSystemApiRelativeUrl = require("./system/formatSystemApiRelativeUrl.cjs");
|
|
14
|
+
const loginMutation = require("./tenant/loginMutation.cjs");
|
|
15
|
+
const tenantApiRelativeUrl = require("./tenant/tenantApiRelativeUrl.cjs");
|
|
16
|
+
const tenantErrorMessages = require("./tenant/tenantErrorMessages.cjs");
|
|
17
|
+
exports.GraphQlBuilder = void 0;
|
|
18
|
+
((GraphQlBuilder2) => {
|
|
19
|
+
GraphQlBuilder2.GraphqlLiteral = GraphQlLiteral.GraphQlLiteral;
|
|
20
|
+
GraphQlBuilder2.GraphQlLiteral = GraphQlLiteral.GraphQlLiteral;
|
|
21
|
+
})(exports.GraphQlBuilder || (exports.GraphQlBuilder = {}));
|
|
22
|
+
exports.GraphQlLiteral = GraphQlLiteral.GraphQlLiteral;
|
|
23
|
+
exports.FileUploadError = FileUploadError.FileUploadError;
|
|
24
|
+
exports.GenerateUploadUrlMutationBuilder = GenerateUploadUrlMutationBuilder.GenerateUploadUrlMutationBuilder;
|
|
25
|
+
exports.S3FileUploader = S3FileUploader.S3FileUploader;
|
|
26
|
+
exports.whereToFilter = whereToFilter.whereToFilter;
|
|
27
|
+
exports.formatContentApiRelativeUrl = formatContentApiRelativeUrl.formatContentApiRelativeUrl;
|
|
28
|
+
exports.replaceGraphQlLiteral = replaceGraphQlLiteral.replaceGraphQlLiteral;
|
|
29
|
+
Object.defineProperty(exports, "GraphQlClientError", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: () => graphqlClient.GraphQlClientError
|
|
32
|
+
});
|
|
33
|
+
exports.GraphQlClient = GraphQlClient.GraphQlClient;
|
|
34
|
+
exports.formatSystemApiRelativeUrl = formatSystemApiRelativeUrl.formatSystemApiRelativeUrl;
|
|
35
|
+
exports.loginMutation = loginMutation.loginMutation;
|
|
36
|
+
exports.tenantApiRelativeUrl = tenantApiRelativeUrl.tenantApiRelativeUrl;
|
|
37
|
+
exports.getTenantErrorMessage = tenantErrorMessages.getTenantErrorMessage;
|
|
38
|
+
exports.tenantErrorMessages = tenantErrorMessages.tenantErrorMessages;
|
|
39
|
+
Object.keys(clientContent).forEach((k) => {
|
|
40
|
+
if (k !== "default" && !exports.hasOwnProperty(k))
|
|
41
|
+
Object.defineProperty(exports, k, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: () => clientContent[k]
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=index.cjs.map
|