@roadmanjs/firebase-admin 0.0.4 → 0.0.8

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 (40) hide show
  1. package/dist/_utils/file.utils.d.ts +6 -0
  2. package/dist/_utils/file.utils.js +13 -0
  3. package/dist/_utils/file.utils.js.map +1 -0
  4. package/dist/_utils/uuid.d.ts +1 -0
  5. package/dist/_utils/uuid.js +9 -0
  6. package/dist/_utils/uuid.js.map +1 -0
  7. package/dist/client/gql/index.d.ts +2 -0
  8. package/dist/client/gql/index.js +15 -0
  9. package/dist/client/gql/index.js.map +1 -0
  10. package/dist/client/gql/media.fragment.d.ts +12 -0
  11. package/dist/client/gql/media.fragment.js +19 -0
  12. package/dist/client/gql/media.fragment.js.map +1 -0
  13. package/dist/client/gql/media.mutation.d.ts +2 -0
  14. package/dist/client/gql/media.mutation.js +25 -0
  15. package/dist/client/gql/media.mutation.js.map +1 -0
  16. package/dist/client/index.d.ts +1 -0
  17. package/dist/client/index.js +14 -0
  18. package/dist/client/index.js.map +1 -0
  19. package/dist/firebase/index.d.ts +1 -0
  20. package/dist/firebase/index.js +2 -1
  21. package/dist/firebase/index.js.map +1 -1
  22. package/dist/media/file.input.d.ts +11 -0
  23. package/dist/media/file.input.js +41 -0
  24. package/dist/media/file.input.js.map +1 -0
  25. package/dist/media/media.methods.d.ts +1 -0
  26. package/dist/media/media.methods.js +37 -0
  27. package/dist/media/media.methods.js.map +1 -0
  28. package/dist/media/media.model.d.ts +18 -0
  29. package/dist/media/media.model.js +47 -0
  30. package/dist/media/media.model.js.map +1 -0
  31. package/dist/media/media.resolver.d.ts +7 -0
  32. package/dist/media/media.resolver.js +157 -0
  33. package/dist/media/media.resolver.js.map +1 -0
  34. package/dist/roadman.d.ts +2 -0
  35. package/dist/roadman.js +6 -2
  36. package/dist/roadman.js.map +1 -1
  37. package/dist/script.d.ts +1 -0
  38. package/dist/script.js +29 -0
  39. package/dist/script.js.map +1 -0
  40. package/package.json +11 -4
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get file extension
3
+ * @param mimetype
4
+ * @returns
5
+ */
6
+ export declare const getFileExtension: (mimetype: string) => string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFileExtension = void 0;
4
+ /**
5
+ * Get file extension
6
+ * @param mimetype
7
+ * @returns
8
+ */
9
+ const getFileExtension = (mimetype) => {
10
+ return (mimetype || 'image/png').split('/')[1];
11
+ };
12
+ exports.getFileExtension = getFileExtension;
13
+ //# sourceMappingURL=file.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.utils.js","sourceRoot":"","sources":["../../src/_utils/file.utils.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACjD,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B"}
@@ -0,0 +1 @@
1
+ export declare const generateUUID: () => string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateUUID = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const generateUUID = () => {
6
+ return (0, uuid_1.v4)();
7
+ };
8
+ exports.generateUUID = generateUUID;
9
+ //# sourceMappingURL=uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/_utils/uuid.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAE3B,MAAM,YAAY,GAAG,GAAW,EAAE;IACrC,OAAO,IAAA,SAAM,GAAE,CAAC;AACpB,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB"}
@@ -0,0 +1,2 @@
1
+ export * from './media.fragment';
2
+ export * from './media.mutation';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./media.fragment"), exports);
14
+ __exportStar(require("./media.mutation"), exports);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/gql/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC"}
@@ -0,0 +1,12 @@
1
+ export interface MediaDataType {
2
+ id?: string;
3
+ name?: string;
4
+ owner?: string;
5
+ filename?: string;
6
+ mimetype?: string;
7
+ encoding?: string;
8
+ url?: string;
9
+ createdAt?: Date;
10
+ updatedAt?: Date;
11
+ }
12
+ export declare const MediaDataTypeFragment: import("graphql").DocumentNode;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MediaDataTypeFragment = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.MediaDataTypeFragment = (0, graphql_tag_1.default) `
9
+ fragment MediaDataTypeFragment on MediaDataType {
10
+ id
11
+ name
12
+ owner
13
+ filename
14
+ mimetype
15
+ encoding
16
+ url
17
+ }
18
+ `;
19
+ //# sourceMappingURL=media.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.fragment.js","sourceRoot":"","sources":["../../../src/client/gql/media.fragment.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA8B;AAcjB,QAAA,qBAAqB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;CAUvC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const UPLOAD_FILES_MUTATION: import("graphql").DocumentNode;
2
+ export declare const UPLOAD_STRING_FILES_MUTATION: import("graphql").DocumentNode;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UPLOAD_STRING_FILES_MUTATION = exports.UPLOAD_FILES_MUTATION = void 0;
7
+ const media_fragment_1 = require("./media.fragment");
8
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
9
+ exports.UPLOAD_FILES_MUTATION = (0, graphql_tag_1.default) `
10
+ mutation UploadFiles($owner: String, $files: [Upload!]!) {
11
+ data: upload(owner: $owner, files: $files) {
12
+ ...MediaDataTypeFragment
13
+ }
14
+ }
15
+ ${media_fragment_1.MediaDataTypeFragment}
16
+ `;
17
+ exports.UPLOAD_STRING_FILES_MUTATION = (0, graphql_tag_1.default) `
18
+ mutation UploadFiles($owner: String, $files: [FileStringInput!]!) {
19
+ data: upload(owner: $owner, files: $files) {
20
+ ...MediaDataTypeFragment
21
+ }
22
+ }
23
+ ${media_fragment_1.MediaDataTypeFragment}
24
+ `;
25
+ //# sourceMappingURL=media.mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.mutation.js","sourceRoot":"","sources":["../../../src/client/gql/media.mutation.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAuD;AACvD,8DAA8B;AAEjB,QAAA,qBAAqB,GAAG,IAAA,qBAAG,EAAA;;;;;;MAMlC,sCAAqB;CAC1B,CAAC;AAEW,QAAA,4BAA4B,GAAG,IAAA,qBAAG,EAAA;;;;;;MAMzC,sCAAqB;CAC1B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './gql';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./gql"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB"}
@@ -1,5 +1,6 @@
1
1
  import * as admin from 'firebase-admin';
2
2
  export declare const configureFirebase: () => {
3
3
  auth: typeof admin.auth;
4
+ storage: typeof admin.storage;
4
5
  projectId: any;
5
6
  };
@@ -34,8 +34,9 @@ const configureFirebase = () => {
34
34
  }
35
35
  const { project_id } = config_1.default;
36
36
  const auth = admin.auth;
37
+ const storage = admin.storage;
37
38
  const projectId = project_id;
38
- return { auth, projectId };
39
+ return { auth, storage, projectId };
39
40
  };
40
41
  exports.configureFirebase = configureFirebase;
41
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/firebase/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AAExC,uDAA+B;AAExB,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAClC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;QACpB,KAAK,CAAC,aAAa,CAAC;YAChB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAa,CAAC;YAChD,WAAW,EAAE,WAAW,gBAAM,CAAC,UAAU,iBAAiB;SAC7D,CAAC,CAAC;KACN;IACD,MAAM,EAAC,UAAU,EAAC,GAAG,gBAAM,CAAC;IAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,MAAM,SAAS,GAAG,UAAU,CAAC;IAC7B,OAAO,EAAC,IAAI,EAAE,SAAS,EAAC,CAAC;AAC7B,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/firebase/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AAExC,uDAA+B;AAExB,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAClC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;QACpB,KAAK,CAAC,aAAa,CAAC;YAChB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAa,CAAC;YAChD,WAAW,EAAE,WAAW,gBAAM,CAAC,UAAU,iBAAiB;SAC7D,CAAC,CAAC;KACN;IACD,MAAM,EAAC,UAAU,EAAC,GAAG,gBAAM,CAAC;IAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC9B,MAAM,SAAS,GAAG,UAAU,CAAC;IAC7B,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAC,CAAC;AACtC,CAAC,CAAC;AAZW,QAAA,iBAAiB,qBAY5B"}
@@ -0,0 +1,11 @@
1
+ import { MediaDataType } from './media.model';
2
+ export declare class FileInput implements Partial<MediaDataType & File> {
3
+ filename: string;
4
+ mimetype: string;
5
+ encoding: string;
6
+ }
7
+ export declare class FileStringInput {
8
+ filename: string;
9
+ mimetype: string;
10
+ uri: string;
11
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FileStringInput = exports.FileInput = void 0;
10
+ const couchset_1 = require("couchset");
11
+ let FileInput = class FileInput {
12
+ };
13
+ __decorate([
14
+ (0, couchset_1.Field)()
15
+ ], FileInput.prototype, "filename", void 0);
16
+ __decorate([
17
+ (0, couchset_1.Field)()
18
+ ], FileInput.prototype, "mimetype", void 0);
19
+ __decorate([
20
+ (0, couchset_1.Field)()
21
+ ], FileInput.prototype, "encoding", void 0);
22
+ FileInput = __decorate([
23
+ (0, couchset_1.InputType)()
24
+ ], FileInput);
25
+ exports.FileInput = FileInput;
26
+ let FileStringInput = class FileStringInput {
27
+ };
28
+ __decorate([
29
+ (0, couchset_1.Field)()
30
+ ], FileStringInput.prototype, "filename", void 0);
31
+ __decorate([
32
+ (0, couchset_1.Field)()
33
+ ], FileStringInput.prototype, "mimetype", void 0);
34
+ __decorate([
35
+ (0, couchset_1.Field)()
36
+ ], FileStringInput.prototype, "uri", void 0);
37
+ FileStringInput = __decorate([
38
+ (0, couchset_1.InputType)()
39
+ ], FileStringInput);
40
+ exports.FileStringInput = FileStringInput;
41
+ //# sourceMappingURL=file.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.input.js","sourceRoot":"","sources":["../../src/media/file.input.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA0C;AAK1C,IAAa,SAAS,GAAtB,MAAa,SAAS;CAMrB,CAAA;AALY;IAAR,IAAA,gBAAK,GAAE;2CAAkB;AAEjB;IAAR,IAAA,gBAAK,GAAE;2CAAkB;AAEjB;IAAR,IAAA,gBAAK,GAAE;2CAAkB;AALjB,SAAS;IADrB,IAAA,oBAAS,GAAE;GACC,SAAS,CAMrB;AANY,8BAAS;AAStB,IAAa,eAAe,GAA5B,MAAa,eAAe;CAM3B,CAAA;AALY;IAAR,IAAA,gBAAK,GAAE;iDAAkB;AAEjB;IAAR,IAAA,gBAAK,GAAE;iDAAkB;AAEjB;IAAR,IAAA,gBAAK,GAAE;4CAAa;AALZ,eAAe;IAD3B,IAAA,oBAAS,GAAE;GACC,eAAe,CAM3B;AANY,0CAAe"}
@@ -0,0 +1 @@
1
+ export declare function uploadFileToBucket(filePath: string, fileDest: string, contentType?: string): Promise<string>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadFileToBucket = void 0;
4
+ const firebase_1 = require("../firebase");
5
+ const logs_1 = require("@roadmanjs/logs");
6
+ async function uploadFileToBucket(filePath, fileDest, contentType = 'image/png') {
7
+ const { projectId, storage: adminStorage } = (0, firebase_1.configureFirebase)();
8
+ const storage = adminStorage();
9
+ const bucketName = `${projectId}.appspot.com`;
10
+ // const DefaultPlaceholder = `https://storage.googleapis.com/${bucketName}/placeholder.png`;
11
+ // Uploads a local file to the bucket
12
+ try {
13
+ const bucket = storage.bucket(bucketName);
14
+ await bucket.upload(filePath, {
15
+ public: true,
16
+ destination: fileDest,
17
+ // By setting the option `destination`, you can change the name of the
18
+ // object you are uploading to a bucket.
19
+ metadata: {
20
+ contentType,
21
+ // Enable long-lived HTTP caching headers
22
+ // Use only if the contents of the file will never change
23
+ cacheControl: 'no-cache',
24
+ // cacheControl: 'public, max-age=31536000',
25
+ },
26
+ });
27
+ const publicUrl = `https://storage.googleapis.com/${bucketName}/${fileDest}`;
28
+ (0, logs_1.log)(`Public url -> ${publicUrl}`);
29
+ return publicUrl;
30
+ }
31
+ catch (error) {
32
+ (0, logs_1.log)('error uploading file', JSON.stringify(error));
33
+ throw error;
34
+ }
35
+ }
36
+ exports.uploadFileToBucket = uploadFileToBucket;
37
+ //# sourceMappingURL=media.methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.methods.js","sourceRoot":"","sources":["../../src/media/media.methods.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AAC9C,0CAAoC;AAE7B,KAAK,UAAU,kBAAkB,CACpC,QAAgB,EAChB,QAAgB,EAChB,WAAW,GAAG,WAAW;IAEzB,MAAM,EAAC,SAAS,EAAE,OAAO,EAAE,YAAY,EAAC,GAAG,IAAA,4BAAiB,GAAE,CAAC;IAC/D,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAE/B,MAAM,UAAU,GAAG,GAAG,SAAS,cAAc,CAAC;IAE9C,6FAA6F;IAE7F,qCAAqC;IACrC,IAAI;QACA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;YAC1B,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,QAAQ;YACrB,sEAAsE;YACtE,wCAAwC;YACxC,QAAQ,EAAE;gBACN,WAAW;gBACX,yCAAyC;gBACzC,yDAAyD;gBACzD,YAAY,EAAE,UAAU;gBACxB,4CAA4C;aAC/C;SACJ,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,kCAAkC,UAAU,IAAI,QAAQ,EAAE,CAAC;QAC7E,IAAA,UAAG,EAAC,iBAAiB,SAAS,EAAE,CAAC,CAAC;QAClC,OAAO,SAAS,CAAC;KACpB;IAAC,OAAO,KAAK,EAAE;QACZ,IAAA,UAAG,EAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACnD,MAAM,KAAK,CAAC;KACf;AACL,CAAC;AApCD,gDAoCC"}
@@ -0,0 +1,18 @@
1
+ import { Model } from 'couchset';
2
+ /**
3
+ * GraphQL Types start
4
+ */
5
+ export declare class MediaDataType {
6
+ id?: string;
7
+ name?: string;
8
+ filename?: string;
9
+ mimetype?: string;
10
+ encoding?: string;
11
+ url?: string;
12
+ owner?: string;
13
+ }
14
+ /**
15
+ * GraphQL Types end
16
+ */
17
+ export declare const MediaDataModel: Model;
18
+ export default MediaDataType;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MediaDataModel = exports.MediaDataType = void 0;
10
+ const couchset_1 = require("couchset");
11
+ const modelName = 'Media';
12
+ /**
13
+ * GraphQL Types start
14
+ */
15
+ let MediaDataType = class MediaDataType {
16
+ };
17
+ __decorate([
18
+ (0, couchset_1.Field)(() => String, { nullable: true })
19
+ ], MediaDataType.prototype, "id", void 0);
20
+ __decorate([
21
+ (0, couchset_1.Field)(() => String, { nullable: true })
22
+ ], MediaDataType.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, couchset_1.Field)(() => String, { nullable: true })
25
+ ], MediaDataType.prototype, "filename", void 0);
26
+ __decorate([
27
+ (0, couchset_1.Field)(() => String, { nullable: true })
28
+ ], MediaDataType.prototype, "mimetype", void 0);
29
+ __decorate([
30
+ (0, couchset_1.Field)(() => String, { nullable: true })
31
+ ], MediaDataType.prototype, "encoding", void 0);
32
+ __decorate([
33
+ (0, couchset_1.Field)(() => String, { nullable: true })
34
+ ], MediaDataType.prototype, "url", void 0);
35
+ __decorate([
36
+ (0, couchset_1.Field)(() => String, { nullable: true })
37
+ ], MediaDataType.prototype, "owner", void 0);
38
+ MediaDataType = __decorate([
39
+ (0, couchset_1.ObjectType)()
40
+ ], MediaDataType);
41
+ exports.MediaDataType = MediaDataType;
42
+ /**
43
+ * GraphQL Types end
44
+ */
45
+ exports.MediaDataModel = new couchset_1.Model(modelName);
46
+ exports.default = MediaDataType;
47
+ //# sourceMappingURL=media.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.model.js","sourceRoot":"","sources":["../../src/media/media.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAkD;AAElD,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1B;;GAEG;AAEH,IAAa,aAAa,GAA1B,MAAa,aAAa;CAqBzB,CAAA;AAnBG;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;yCAC1B;AAGZ;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;2CACxB;AAGd;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;+CACpB;AAGlB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;+CACpB;AAGlB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;+CACpB;AAGlB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;0CACzB;AAGb;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;4CACvB;AApBN,aAAa;IADzB,IAAA,qBAAU,GAAE;GACA,aAAa,CAqBzB;AArBY,sCAAa;AAuB1B;;GAEG;AAEU,QAAA,cAAc,GAAU,IAAI,gBAAK,CAAC,SAAS,CAAC,CAAC;AAE1D,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { FileInput, FileStringInput } from './file.input';
2
+ import { MediaDataType } from './media.model';
3
+ export declare class MediaResolver {
4
+ upload(files: FileInput[], owner: string): Promise<MediaDataType[]>;
5
+ uploadString(files: FileStringInput[], owner: string): Promise<MediaDataType[]>;
6
+ }
7
+ export default MediaResolver;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
+ return function (target, key) { decorator(target, key, paramIndex); }
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MediaResolver = void 0;
27
+ const client_graphql_1 = require("@stoqey/client-graphql");
28
+ const graphql_upload_1 = require("graphql-upload");
29
+ const util_1 = require("util");
30
+ const stream_1 = require("stream");
31
+ const type_graphql_1 = require("type-graphql");
32
+ const file_input_1 = require("./file.input");
33
+ const media_model_1 = require("./media.model");
34
+ const uuid_1 = require("../_utils/uuid");
35
+ const file_utils_1 = require("../_utils/file.utils");
36
+ const media_methods_1 = require("./media.methods");
37
+ const logs_1 = require("@roadmanjs/logs");
38
+ const fs_1 = __importDefault(require("fs"));
39
+ const finishes = (0, util_1.promisify)(stream_1.finished);
40
+ let MediaResolver = class MediaResolver {
41
+ // for web based Files
42
+ async upload(files, owner) {
43
+ const [error, allFiles] = await (0, client_graphql_1.awaitTo)(Promise.all(files.map(async (file) => {
44
+ const _a = await file, { encoding, filename, mimetype } = _a, others = __rest(_a, ["encoding", "filename", "mimetype"]);
45
+ const newFileNameID = (0, uuid_1.generateUUID)();
46
+ const fileExt = (0, file_utils_1.getFileExtension)(mimetype);
47
+ const fullfilename = `${newFileNameID}.${fileExt}`;
48
+ const createReadStream = others.createReadStream;
49
+ (0, logs_1.log)('preview ---------------------------->', {
50
+ filename,
51
+ mimetype,
52
+ encoding,
53
+ fileExt,
54
+ });
55
+ // Save file to local
56
+ const localFile = `/tmp/${fullfilename}`;
57
+ const stream = createReadStream();
58
+ const out = fs_1.default.createWriteStream(localFile);
59
+ stream.pipe(out);
60
+ await finishes(out);
61
+ // Save file to cloud
62
+ const savedToCloudUrl = await (0, media_methods_1.uploadFileToBucket)(localFile, fullfilename, mimetype);
63
+ if (!savedToCloudUrl) {
64
+ throw new Error('Not saved to cloud, please try again');
65
+ }
66
+ // Save file to db
67
+ const newMediaData = {
68
+ id: newFileNameID,
69
+ name: filename,
70
+ filename,
71
+ mimetype,
72
+ encoding,
73
+ owner,
74
+ url: savedToCloudUrl,
75
+ };
76
+ await media_model_1.MediaDataModel.create(newMediaData);
77
+ // Return file
78
+ return newMediaData;
79
+ })));
80
+ if (allFiles) {
81
+ return allFiles;
82
+ }
83
+ if (error) {
84
+ console.error(error);
85
+ }
86
+ return [];
87
+ }
88
+ // For expo strings files in base64
89
+ async uploadString(files, owner) {
90
+ const [error, allFiles] = await (0, client_graphql_1.awaitTo)(Promise.all(files.map(async (file) => {
91
+ const { filename, mimetype, uri } = file;
92
+ const encoding = 'base64';
93
+ let uriData = uri;
94
+ const newFileNameID = (0, uuid_1.generateUUID)();
95
+ const fileExt = (0, file_utils_1.getFileExtension)(mimetype);
96
+ const fullfilename = `${newFileNameID}.${fileExt}`;
97
+ (0, logs_1.log)('preview ---------------------------->', {
98
+ filename,
99
+ mimetype,
100
+ fileExt,
101
+ });
102
+ // remove the the prefixes
103
+ // TODO for audio files, and other files, focus on images for now
104
+ // TODO move to utility
105
+ if (fileExt === 'png') {
106
+ uriData = uriData.replace(/^data:image\/png;base64,/, '');
107
+ }
108
+ if (fileExt === 'jpeg') {
109
+ uriData = uriData.replace(/^data:image\/jpeg;base64,/, '');
110
+ }
111
+ // Save file to local
112
+ const localFile = `/tmp/${fullfilename}`;
113
+ fs_1.default.writeFileSync(localFile, uriData, { encoding });
114
+ // Save file to cloud
115
+ const savedToCloudUrl = await (0, media_methods_1.uploadFileToBucket)(localFile, fullfilename, mimetype);
116
+ if (!savedToCloudUrl) {
117
+ throw new Error('Not saved to cloud, please try again');
118
+ }
119
+ // Save file to db
120
+ const newMediaData = {
121
+ id: newFileNameID,
122
+ name: filename,
123
+ filename,
124
+ mimetype,
125
+ encoding,
126
+ owner,
127
+ url: savedToCloudUrl,
128
+ };
129
+ await media_model_1.MediaDataModel.create(newMediaData);
130
+ // Return file
131
+ return newMediaData;
132
+ })));
133
+ if (allFiles) {
134
+ return allFiles;
135
+ }
136
+ if (error) {
137
+ console.error(error);
138
+ }
139
+ return [];
140
+ }
141
+ };
142
+ __decorate([
143
+ (0, type_graphql_1.Mutation)(() => [media_model_1.MediaDataType]),
144
+ __param(0, (0, type_graphql_1.Arg)('files', () => [graphql_upload_1.GraphQLUpload])),
145
+ __param(1, (0, type_graphql_1.Arg)('owner', () => String, { nullable: true }))
146
+ ], MediaResolver.prototype, "upload", null);
147
+ __decorate([
148
+ (0, type_graphql_1.Mutation)(() => [media_model_1.MediaDataType]),
149
+ __param(0, (0, type_graphql_1.Arg)('files', () => [file_input_1.FileStringInput])),
150
+ __param(1, (0, type_graphql_1.Arg)('owner', () => String, { nullable: true }))
151
+ ], MediaResolver.prototype, "uploadString", null);
152
+ MediaResolver = __decorate([
153
+ (0, type_graphql_1.Resolver)(media_model_1.MediaDataType)
154
+ ], MediaResolver);
155
+ exports.MediaResolver = MediaResolver;
156
+ exports.default = MediaResolver;
157
+ //# sourceMappingURL=media.resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.resolver.js","sourceRoot":"","sources":["../../src/media/media.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA+C;AAC/C,mDAA6C;AAC7C,+BAA+B;AAC/B,mCAAgC;AAChC,+CAAqD;AACrD,6CAAwD;AACxD,+CAA4D;AAC5D,yCAA4C;AAC5C,qDAAsD;AACtD,mDAAmD;AACnD,0CAAoC;AACpC,4CAAoB;AAEpB,MAAM,QAAQ,GAAG,IAAA,gBAAS,EAAC,iBAAQ,CAAC,CAAC;AAErC,IAAa,aAAa,GAA1B,MAAa,aAAa;IACtB,sBAAsB;IAEtB,KAAK,CAAC,MAAM,CAER,KAAkB,EAC4B,KAAa;QAE3D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,MAAM,IAAA,wBAAO,EACnC,OAAO,CAAC,GAAG,CACP,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACrB,MAAM,KAAiD,MAAM,IAAI,EAA3D,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,OAA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EAAC,2BAAa,CAAC;GACX,aAAa,CA4JzB;AA5JY,sCAAa;AA8J1B,kBAAe,aAAa,CAAC"}
package/dist/roadman.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { RoadMan } from '@roadmanjs/core';
2
+ import MediaResolver from './media/media.resolver';
2
3
  /**
3
4
  * A firebase roadman
4
5
  * @param RoadmanBuild
5
6
  */
6
7
  export declare const firebaseRoadman: RoadMan;
8
+ export declare const getMediaFileUploadResolvers: () => (typeof MediaResolver)[];
package/dist/roadman.js CHANGED
@@ -3,17 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.firebaseRoadman = void 0;
6
+ exports.getMediaFileUploadResolvers = exports.firebaseRoadman = void 0;
7
+ const media_resolver_1 = __importDefault(require("./media/media.resolver"));
7
8
  const chalk_1 = __importDefault(require("chalk"));
8
9
  const firebase_1 = require("./firebase");
10
+ const logs_1 = require("@roadmanjs/logs");
9
11
  /**
10
12
  * A firebase roadman
11
13
  * @param RoadmanBuild
12
14
  */
13
15
  const firebaseRoadman = async (args) => {
14
16
  const { projectId } = (0, firebase_1.configureFirebase)();
15
- console.log('ROADMAN: Firebase', chalk_1.default.greenBright('**************************************ProjectID********************', projectId));
17
+ (0, logs_1.log)('ROADMAN: Firebase', chalk_1.default.greenBright('**************************************ProjectID********************', projectId));
16
18
  return args;
17
19
  };
18
20
  exports.firebaseRoadman = firebaseRoadman;
21
+ const getMediaFileUploadResolvers = () => [media_resolver_1.default];
22
+ exports.getMediaFileUploadResolvers = getMediaFileUploadResolvers;
19
23
  //# sourceMappingURL=roadman.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"roadman.js","sourceRoot":"","sources":["../src/roadman.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,yCAA6C;AAE7C;;;GAGG;AACI,MAAM,eAAe,GAAY,KAAK,EAAE,IAAkB,EAAyB,EAAE;IACxF,MAAM,EAAC,SAAS,EAAC,GAAG,IAAA,4BAAiB,GAAE,CAAC;IAExC,OAAO,CAAC,GAAG,CACP,mBAAmB,EACnB,eAAK,CAAC,WAAW,CACb,qEAAqE,EACrE,SAAS,CACZ,CACJ,CAAC;IAEF,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,eAAe,mBAY1B"}
1
+ {"version":3,"file":"roadman.js","sourceRoot":"","sources":["../src/roadman.ts"],"names":[],"mappings":";;;;;;AAEA,4EAAmD;AACnD,kDAA0B;AAC1B,yCAA6C;AAC7C,0CAAoC;AAEpC;;;GAGG;AACI,MAAM,eAAe,GAAY,KAAK,EAAE,IAAkB,EAAyB,EAAE;IACxF,MAAM,EAAC,SAAS,EAAC,GAAG,IAAA,4BAAiB,GAAE,CAAC;IAExC,IAAA,UAAG,EACC,mBAAmB,EACnB,eAAK,CAAC,WAAW,CACb,qEAAqE,EACrE,SAAS,CACZ,CACJ,CAAC;IAEF,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,eAAe,mBAY1B;AAEK,MAAM,2BAA2B,GAAG,GAAG,EAAE,CAAC,CAAC,wBAAa,CAAC,CAAC;AAApD,QAAA,2BAA2B,+BAAyB"}
@@ -0,0 +1 @@
1
+ export {};
package/dist/script.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@roadmanjs/utils");
4
+ // Automatically run this
5
+ (async () => {
6
+ const args = [
7
+ { cmd: 'rm', dir: 'dist-client' },
8
+ { cmd: 'mkdir', dir: 'dist-client' },
9
+ { cmd: 'cp', dir: 'dist/client/gql', newDir: 'dist-client' },
10
+ { cmd: 'cp', dir: 'register', newDir: 'dist-client/register' },
11
+ { cmd: 'cp', dir: 'docs', newDir: 'dist-client/docs' },
12
+ { cmd: 'cp', dir: 'README.md', newDir: 'dist-client/README.md' },
13
+ // {cmd: 'cp', dir: 'LICENSE', newDir: 'dist-client/LICENSE'},
14
+ { cmd: 'cp', dir: 'dist/client/index.js', newDir: 'dist-client/index.js' },
15
+ { cmd: 'cp', dir: 'dist/client/index.d.ts', newDir: 'dist-client/index.d.ts' },
16
+ { cmd: 'cp', dir: 'dist/client/index.js.map', newDir: 'dist-client/index.js.map' },
17
+ ];
18
+ (0, utils_1.buildDirs)(args);
19
+ await (0, utils_1.createClientPackageJson)({
20
+ name: '@roadmanjs/firebase-client',
21
+ description: 'GraphQL client gql for @roadmanjs/firebase-admin',
22
+ extraProps: {
23
+ main: 'index.js',
24
+ types: 'index.d.ts',
25
+ files: ['index.d.ts', 'docs/', '/gql', 'register/', 'LICENSE'],
26
+ },
27
+ });
28
+ })();
29
+ //# sourceMappingURL=script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.js","sourceRoot":"","sources":["../src/script.ts"],"names":[],"mappings":";;AAAA,4CAA4E;AAE5E,yBAAyB;AACzB,CAAC,KAAK,IAAI,EAAE;IACR,MAAM,IAAI,GAAa;QACnB,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,EAAC;QAC/B,EAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAC;QAClC,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAC;QAC1D,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,sBAAsB,EAAC;QAC5D,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAC;QACpD,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,uBAAuB,EAAC;QAC9D,8DAA8D;QAC9D,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,EAAE,MAAM,EAAE,sBAAsB,EAAC;QACxE,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,wBAAwB,EAAE,MAAM,EAAE,wBAAwB,EAAC;QAC5E,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,0BAA0B,EAAE,MAAM,EAAE,0BAA0B,EAAC;KACnF,CAAC;IAEF,IAAA,iBAAS,EAAC,IAAI,CAAC,CAAC;IAEhB,MAAM,IAAA,+BAAuB,EAAC;QAC1B,IAAI,EAAE,4BAA4B;QAClC,WAAW,EAAE,kDAAkD;QAE/D,UAAU,EAAE;YACR,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,YAAY;YACnB,KAAK,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC;SACjE;KACJ,CAAC,CAAC;AACP,CAAC,CAAC,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roadmanjs/firebase-admin",
3
- "version": "0.0.4",
3
+ "version": "0.0.8",
4
4
  "description": "A roadman for firebase-admin",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "private": false,
20
20
  "scripts": {
21
21
  "lint": "tslint \"src/**/*.ts\" --project tsconfig.json",
22
- "build": "rimraf dist && ./node_modules/.bin/tsc --skipLibCheck",
22
+ "build": "rm -rf dist && ./node_modules/.bin/tsc --skipLibCheck && npm run client",
23
+ "client": "node dist/script.js",
23
24
  "test": "mocha src/*test.ts --exit",
24
- "prepublishOnly": "npm run build",
25
25
  "eslint": "eslint ./src --fix --ext=ts"
26
26
  },
27
27
  "lint-staged": {
@@ -39,10 +39,12 @@
39
39
  "@types/chalk": "^2.2.0",
40
40
  "@types/debug": "^4.1.5",
41
41
  "@types/dotenv": "^8.2.0",
42
+ "@types/graphql-upload": "8.0.6",
42
43
  "@types/lodash": "^4.14.168",
43
44
  "@types/mocha": "^8.2.0",
44
45
  "@types/node": "^10.0.3",
45
46
  "@types/source-map-support": "^0.4.0",
47
+ "@types/uuid": "8.3.1",
46
48
  "@typescript-eslint/eslint-plugin": "^3.4.0",
47
49
  "@typescript-eslint/parser": "^3.4.0",
48
50
  "chai": "^4.2.0",
@@ -69,10 +71,15 @@
69
71
  },
70
72
  "dependencies": {
71
73
  "@roadmanjs/core": "^0.0.3",
74
+ "@roadmanjs/couchset": "^0.0.6",
75
+ "@roadmanjs/logs": "^0.0.1",
76
+ "@roadmanjs/utils": "^0.0.4",
72
77
  "chalk": "^4.1.0",
73
78
  "debug": "^4.3.1",
74
79
  "dotenv": "^8.2.0",
75
80
  "firebase-admin": "^10.0.0",
76
- "lodash": "^4.17.20"
81
+ "graphql-upload": "^13.0.0",
82
+ "lodash": "^4.17.20",
83
+ "uuid": "^8.3.2"
77
84
  }
78
85
  }