@things-factory/integration-sftp 9.0.0-beta.25 → 9.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/dist-server/controllers/herbalife/apis/create-serial-number.d.ts +0 -18
- package/dist-server/controllers/herbalife/apis/create-serial-number.js +0 -46
- package/dist-server/controllers/herbalife/apis/create-serial-number.js.map +0 -1
- package/dist-server/controllers/herbalife/apis/create-shipment.d.ts +0 -19
- package/dist-server/controllers/herbalife/apis/create-shipment.js +0 -84
- package/dist-server/controllers/herbalife/apis/create-shipment.js.map +0 -1
- package/dist-server/controllers/herbalife/apis/echo.d.ts +0 -12
- package/dist-server/controllers/herbalife/apis/echo.js +0 -18
- package/dist-server/controllers/herbalife/apis/echo.js.map +0 -1
- package/dist-server/controllers/herbalife/apis/get-outbound-order.d.ts +0 -14
- package/dist-server/controllers/herbalife/apis/get-outbound-order.js +0 -107
- package/dist-server/controllers/herbalife/apis/get-outbound-order.js.map +0 -1
- package/dist-server/controllers/herbalife/apis/index.d.ts +0 -4
- package/dist-server/controllers/herbalife/apis/index.js +0 -8
- package/dist-server/controllers/herbalife/apis/index.js.map +0 -1
- package/dist-server/controllers/herbalife/herbalife.d.ts +0 -8
- package/dist-server/controllers/herbalife/herbalife.js +0 -40
- package/dist-server/controllers/herbalife/herbalife.js.map +0 -1
- package/dist-server/controllers/herbalife/index.d.ts +0 -1
- package/dist-server/controllers/herbalife/index.js +0 -9
- package/dist-server/controllers/herbalife/index.js.map +0 -1
- package/dist-server/controllers/herbalife/platform-action.d.ts +0 -5
- package/dist-server/controllers/herbalife/platform-action.js +0 -30
- package/dist-server/controllers/herbalife/platform-action.js.map +0 -1
- package/dist-server/controllers/index.d.ts +0 -2
- package/dist-server/controllers/index.js +0 -6
- package/dist-server/controllers/index.js.map +0 -1
- package/dist-server/controllers/sftp-api/decorators.d.ts +0 -1
- package/dist-server/controllers/sftp-api/decorators.js +0 -28
- package/dist-server/controllers/sftp-api/decorators.js.map +0 -1
- package/dist-server/controllers/sftp-api/index.d.ts +0 -11
- package/dist-server/controllers/sftp-api/index.js +0 -56
- package/dist-server/controllers/sftp-api/index.js.map +0 -1
- package/dist-server/controllers/sftp-api/types.d.ts +0 -0
- package/dist-server/controllers/sftp-api/types.js +0 -1
- package/dist-server/controllers/sftp-api/types.js.map +0 -1
- package/dist-server/index.d.ts +0 -6
- package/dist-server/index.js +0 -10
- package/dist-server/index.js.map +0 -1
- package/dist-server/middlewares/index.d.ts +0 -1
- package/dist-server/middlewares/index.js +0 -7
- package/dist-server/middlewares/index.js.map +0 -1
- package/dist-server/routes.d.ts +0 -1
- package/dist-server/routes.js +0 -25
- package/dist-server/routes.js.map +0 -1
- package/dist-server/service/index.d.ts +0 -5
- package/dist-server/service/index.js +0 -19
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/service/sftp/index.d.ts +0 -5
- package/dist-server/service/sftp/index.js +0 -9
- package/dist-server/service/sftp/index.js.map +0 -1
- package/dist-server/service/sftp/sftp-mutation.d.ts +0 -15
- package/dist-server/service/sftp/sftp-mutation.js +0 -250
- package/dist-server/service/sftp/sftp-mutation.js.map +0 -1
- package/dist-server/service/sftp/sftp-query.d.ts +0 -11
- package/dist-server/service/sftp/sftp-query.js +0 -74
- package/dist-server/service/sftp/sftp-query.js.map +0 -1
- package/dist-server/service/sftp/sftp-type.d.ts +0 -29
- package/dist-server/service/sftp/sftp-type.js +0 -113
- package/dist-server/service/sftp/sftp-type.js.map +0 -1
- package/dist-server/service/sftp/sftp.d.ts +0 -33
- package/dist-server/service/sftp/sftp.js +0 -163
- package/dist-server/service/sftp/sftp.js.map +0 -1
- package/dist-server/sftp-const.d.ts +0 -11
- package/dist-server/sftp-const.js +0 -16
- package/dist-server/sftp-const.js.map +0 -1
- package/dist-server/sftp-s3.d.ts +0 -1
- package/dist-server/sftp-s3.js +0 -67
- package/dist-server/sftp-s3.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
- package/dist-server/util/generate-files.d.ts +0 -2
- package/dist-server/util/generate-files.js +0 -29
- package/dist-server/util/generate-files.js.map +0 -1
- package/dist-server/util/get-permitted-directories.d.ts +0 -3
- package/dist-server/util/get-permitted-directories.js +0 -15
- package/dist-server/util/get-permitted-directories.js.map +0 -1
- package/dist-server/util/index.d.ts +0 -2
- package/dist-server/util/index.js +0 -6
- package/dist-server/util/index.js.map +0 -1
@@ -1,56 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SftpAPI = void 0;
|
4
|
-
const tslib_1 = require("tslib");
|
5
|
-
const shell_1 = require("@things-factory/shell");
|
6
|
-
const service_1 = require("../../service");
|
7
|
-
const decorators_1 = require("./decorators");
|
8
|
-
class SftpAPI {
|
9
|
-
static registerPlatform(name, action, apis) {
|
10
|
-
SftpAPI.platforms[name] = {
|
11
|
-
action,
|
12
|
-
apis
|
13
|
-
};
|
14
|
-
}
|
15
|
-
static getPlatform(name) {
|
16
|
-
return SftpAPI.platforms[name];
|
17
|
-
}
|
18
|
-
static async getSftp(id) {
|
19
|
-
const repository = (0, shell_1.getRepository)(service_1.Sftp);
|
20
|
-
return await repository.findOne({
|
21
|
-
where: { id },
|
22
|
-
relations: ['domain']
|
23
|
-
});
|
24
|
-
}
|
25
|
-
static echo(sftp, req) { }
|
26
|
-
static getOutboundOrder(sftp, req) { }
|
27
|
-
static createShipment(sftp, req) { }
|
28
|
-
static createSerialNumber(sftp, req) { }
|
29
|
-
}
|
30
|
-
exports.SftpAPI = SftpAPI;
|
31
|
-
SftpAPI.platforms = {};
|
32
|
-
tslib_1.__decorate([
|
33
|
-
decorators_1.api,
|
34
|
-
tslib_1.__metadata("design:type", Function),
|
35
|
-
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
36
|
-
tslib_1.__metadata("design:returntype", Object)
|
37
|
-
], SftpAPI, "echo", null);
|
38
|
-
tslib_1.__decorate([
|
39
|
-
decorators_1.api,
|
40
|
-
tslib_1.__metadata("design:type", Function),
|
41
|
-
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
42
|
-
tslib_1.__metadata("design:returntype", Object)
|
43
|
-
], SftpAPI, "getOutboundOrder", null);
|
44
|
-
tslib_1.__decorate([
|
45
|
-
decorators_1.api,
|
46
|
-
tslib_1.__metadata("design:type", Function),
|
47
|
-
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
48
|
-
tslib_1.__metadata("design:returntype", Object)
|
49
|
-
], SftpAPI, "createShipment", null);
|
50
|
-
tslib_1.__decorate([
|
51
|
-
decorators_1.api,
|
52
|
-
tslib_1.__metadata("design:type", Function),
|
53
|
-
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
54
|
-
tslib_1.__metadata("design:returntype", Object)
|
55
|
-
], SftpAPI, "createSerialNumber", null);
|
56
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/controllers/sftp-api/index.ts"],"names":[],"mappings":";;;;AAAA,iDAAqD;AAErD,2CAAoC;AACpC,6CAAkC;AAElC,MAAa,OAAO;IAGlB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI;QACxC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;YACxB,MAAM;YACN,IAAI;SACL,CAAA;IACH,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAAI;QACrB,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;QACrB,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,cAAI,CAAC,CAAA;QACtC,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,SAAS,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAC,CAAA;IACJ,CAAC;IAGM,AAAP,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAQ,CAAC;IAGvB,AAAP,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,IAAQ,CAAC;IAGnC,AAAP,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,IAAQ,CAAC;IAGjC,AAAP,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,GAAG,IAAQ,CAAC;;AAhC9C,0BAiCC;AAhCQ,iBAAS,GAAG,EAAE,CAAA;AAsBd;IADN,gBAAG;;;;yBAC0B;AAGvB;IADN,gBAAG;;;;qCACsC;AAGnC;IADN,gBAAG;;;;mCACoC;AAGjC;IADN,gBAAG;;;;uCACwC","sourcesContent":["import { getRepository } from '@things-factory/shell'\n\nimport { Sftp } from '../../service'\nimport { api } from './decorators'\n\nexport class SftpAPI {\n static platforms = {}\n\n static registerPlatform(name, action, apis) {\n SftpAPI.platforms[name] = {\n action,\n apis\n }\n }\n\n static getPlatform(name) {\n return SftpAPI.platforms[name]\n }\n\n static async getSftp(id) {\n const repository = getRepository(Sftp)\n return await repository.findOne({\n where: { id },\n relations: ['domain']\n })\n }\n\n @api\n static echo(sftp, req): any {}\n\n @api\n static getOutboundOrder(sftp, req): any {}\n\n @api\n static createShipment(sftp, req): any {}\n\n @api\n static createSerialNumber(sftp, req): any {}\n}\n"]}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../server/controllers/sftp-api/types.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
package/dist-server/index.d.ts
DELETED
package/dist-server/index.js
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const tslib_1 = require("tslib");
|
4
|
-
require("./routes");
|
5
|
-
tslib_1.__exportStar(require("./middlewares"), exports);
|
6
|
-
tslib_1.__exportStar(require("./service"), exports);
|
7
|
-
tslib_1.__exportStar(require("./sftp-const"), exports);
|
8
|
-
tslib_1.__exportStar(require("./controllers"), exports);
|
9
|
-
tslib_1.__exportStar(require("./util"), exports);
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/dist-server/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oBAAiB;AAEjB,wDAA6B;AAC7B,oDAAyB;AACzB,uDAA4B;AAC5B,wDAA6B;AAC7B,iDAAsB","sourcesContent":["import './routes'\n\nexport * from './middlewares'\nexport * from './service'\nexport * from './sftp-const'\nexport * from './controllers'\nexport * from './util'\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function initMiddlewares(app: any): void;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;AAAA,0CAEC;AAFD,SAAgB,eAAe,CAAC,GAAG;IACjC,kCAAkC;AACpC,CAAC","sourcesContent":["export function initMiddlewares(app) {\n /* can add middlewares into app */\n}\n"]}
|
package/dist-server/routes.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
declare const debug: any;
|
package/dist-server/routes.js
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
const debug = require('debug')('things-factory:integration-sftp:routes');
|
2
|
-
process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
|
3
|
-
/*
|
4
|
-
* can add global public routes to application (auth not required, tenancy not required)
|
5
|
-
*
|
6
|
-
* ex) routes.get('/path', async(context, next) => {})
|
7
|
-
* ex) routes.post('/path', async(context, next) => {})
|
8
|
-
*/
|
9
|
-
});
|
10
|
-
process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => {
|
11
|
-
/*
|
12
|
-
* can add global private routes to application (auth required, tenancy not required)
|
13
|
-
*/
|
14
|
-
});
|
15
|
-
process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => {
|
16
|
-
/*
|
17
|
-
* can add domain public routes to application (auth not required, tenancy required)
|
18
|
-
*/
|
19
|
-
});
|
20
|
-
process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
|
21
|
-
/*
|
22
|
-
* can add domain private routes to application (auth required, tenancy required)
|
23
|
-
*/
|
24
|
-
});
|
25
|
-
//# sourceMappingURL=routes.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,wCAAwC,CAAC,CAAA;AAExE,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA","sourcesContent":["const debug = require('debug')('things-factory:integration-sftp:routes')\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n /*\n * can add global public routes to application (auth not required, tenancy not required)\n *\n * ex) routes.get('/path', async(context, next) => {})\n * ex) routes.post('/path', async(context, next) => {})\n */\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {\n /*\n * can add global private routes to application (auth required, tenancy not required)\n */\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n /*\n * can add domain public routes to application (auth not required, tenancy required)\n */\n})\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n /*\n * can add domain private routes to application (auth required, tenancy required)\n */\n})\n"]}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.schema = exports.entities = void 0;
|
4
|
-
const tslib_1 = require("tslib");
|
5
|
-
/* EXPORT ENTITY TYPES */
|
6
|
-
tslib_1.__exportStar(require("./sftp/sftp"), exports);
|
7
|
-
/* IMPORT ENTITIES AND RESOLVERS */
|
8
|
-
const sftp_1 = require("./sftp");
|
9
|
-
exports.entities = [
|
10
|
-
/* ENTITIES */
|
11
|
-
...sftp_1.entities,
|
12
|
-
];
|
13
|
-
exports.schema = {
|
14
|
-
resolverClasses: [
|
15
|
-
/* RESOLVER CLASSES */
|
16
|
-
...sftp_1.resolvers,
|
17
|
-
]
|
18
|
-
};
|
19
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,sDAA2B;AAE3B,mCAAmC;AACnC,iCAA6E;AAEhE,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,eAAY;CACf,CAAA;AAGY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,gBAAa;KACf;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './sftp/sftp'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as SftpEntities, resolvers as SftpResolvers } from './sftp'\n\nexport const entities = [ \n /* ENTITIES */\n\t...SftpEntities,\n] \n\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n\t\t...SftpResolvers,\n ] \n}\n"]}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.resolvers = exports.entities = void 0;
|
4
|
-
const sftp_1 = require("./sftp");
|
5
|
-
const sftp_query_1 = require("./sftp-query");
|
6
|
-
const sftp_mutation_1 = require("./sftp-mutation");
|
7
|
-
exports.entities = [sftp_1.Sftp];
|
8
|
-
exports.resolvers = [sftp_query_1.SftpQuery, sftp_mutation_1.SftpMutation];
|
9
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/sftp/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,6CAAwC;AACxC,mDAA8C;AAEjC,QAAA,QAAQ,GAAG,CAAC,WAAI,CAAC,CAAA;AACjB,QAAA,SAAS,GAAG,CAAC,sBAAS,EAAE,4BAAY,CAAC,CAAA","sourcesContent":["import { Sftp } from './sftp'\nimport { SftpQuery } from './sftp-query'\nimport { SftpMutation } from './sftp-mutation'\n\nexport const entities = [Sftp]\nexport const resolvers = [SftpQuery, SftpMutation]\n"]}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import '../../sftp-s3';
|
2
|
-
import { Bizplace } from '@things-factory/biz-base';
|
3
|
-
import { Sftp } from './sftp';
|
4
|
-
import { NewSftp, SftpPatch } from './sftp-type';
|
5
|
-
export declare class SftpMutation {
|
6
|
-
createSftp(sftp: NewSftp, context: ResolverContext): Promise<Sftp>;
|
7
|
-
updateSftp(id: string, patch: SftpPatch, context: ResolverContext): Promise<Sftp>;
|
8
|
-
updateMultipleSftp(patches: SftpPatch[], context: ResolverContext): Promise<Sftp[]>;
|
9
|
-
deleteSftp(id: string, context: ResolverContext): Promise<boolean>;
|
10
|
-
deleteSftps(ids: string[], context: ResolverContext): Promise<boolean>;
|
11
|
-
syncSftpOrders(customerDomainId: string, context: ResolverContext): Promise<boolean>;
|
12
|
-
syncAllSftpOrders(context: ResolverContext): Promise<Boolean>;
|
13
|
-
}
|
14
|
-
export declare function processSftp(sftpUser: any, context: any, customerBizplaceId: any): Promise<void>;
|
15
|
-
export declare function getCustomerBizplace(customerDomainId: any, tx: any): Promise<Bizplace>;
|
@@ -1,250 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SftpMutation = void 0;
|
4
|
-
exports.processSftp = processSftp;
|
5
|
-
exports.getCustomerBizplace = getCustomerBizplace;
|
6
|
-
const tslib_1 = require("tslib");
|
7
|
-
require("../../sftp-s3");
|
8
|
-
const type_graphql_1 = require("type-graphql");
|
9
|
-
const typeorm_1 = require("typeorm");
|
10
|
-
const biz_base_1 = require("@things-factory/biz-base");
|
11
|
-
const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
|
12
|
-
const shell_1 = require("@things-factory/shell");
|
13
|
-
const controllers_1 = require("../../controllers");
|
14
|
-
const sftp_const_1 = require("../../sftp-const");
|
15
|
-
const util_1 = require("../../util");
|
16
|
-
const sftp_1 = require("./sftp");
|
17
|
-
const sftp_type_1 = require("./sftp-type");
|
18
|
-
let SftpMutation = class SftpMutation {
|
19
|
-
async createSftp(sftp, context) {
|
20
|
-
const { domain, user, tx } = context.state;
|
21
|
-
return await tx.getRepository(sftp_1.Sftp).save(Object.assign(Object.assign({}, sftp), { domain, creator: user, updater: user }));
|
22
|
-
}
|
23
|
-
async updateSftp(id, patch, context) {
|
24
|
-
const { domain, user, tx } = context.state;
|
25
|
-
const repository = tx.getRepository(sftp_1.Sftp);
|
26
|
-
const sftp = await repository.findOne({
|
27
|
-
where: { domain: { id: domain.id }, id }
|
28
|
-
});
|
29
|
-
return await repository.save(Object.assign(Object.assign(Object.assign({}, sftp), patch), { updater: user }));
|
30
|
-
}
|
31
|
-
async updateMultipleSftp(patches, context) {
|
32
|
-
const { domain, user, tx } = context.state;
|
33
|
-
let results = [];
|
34
|
-
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
35
|
-
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
36
|
-
const sftpRepo = tx.getRepository(sftp_1.Sftp);
|
37
|
-
if (_createRecords.length > 0) {
|
38
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
39
|
-
const newRecord = _createRecords[i];
|
40
|
-
const result = await sftpRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
|
41
|
-
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
42
|
-
}
|
43
|
-
}
|
44
|
-
if (_updateRecords.length > 0) {
|
45
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
46
|
-
const newRecord = _updateRecords[i];
|
47
|
-
const sftp = await sftpRepo.findOneBy({ id: newRecord.id });
|
48
|
-
const result = await sftpRepo.save(Object.assign(Object.assign(Object.assign({}, sftp), newRecord), { updater: user }));
|
49
|
-
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
50
|
-
}
|
51
|
-
}
|
52
|
-
return results;
|
53
|
-
}
|
54
|
-
async deleteSftp(id, context) {
|
55
|
-
const { domain, tx } = context.state;
|
56
|
-
await tx.getRepository(sftp_1.Sftp).delete({ domain: { id: domain.id }, id });
|
57
|
-
return true;
|
58
|
-
}
|
59
|
-
async deleteSftps(ids, context) {
|
60
|
-
const { domain, tx } = context.state;
|
61
|
-
await tx.getRepository(sftp_1.Sftp).delete({
|
62
|
-
domain: { id: domain.id },
|
63
|
-
id: (0, typeorm_1.In)(ids)
|
64
|
-
});
|
65
|
-
return true;
|
66
|
-
}
|
67
|
-
async syncSftpOrders(customerDomainId, context) {
|
68
|
-
await (0, typeorm_1.getConnection)().transaction(async (tx) => {
|
69
|
-
const customerDomain = await tx.getRepository(shell_1.Domain).findOneBy({ id: customerDomainId });
|
70
|
-
const customerBizplace = await getCustomerBizplace(customerDomainId, tx);
|
71
|
-
const sftpUsers = await tx.getRepository(sftp_1.Sftp).find({
|
72
|
-
where: { domain: { id: customerDomainId }, status: sftp_1.SftpStatus.ACTIVE },
|
73
|
-
relations: ['fulfillmentCenter']
|
74
|
-
});
|
75
|
-
for (var i = 0; i < sftpUsers.length; i++) {
|
76
|
-
const sftpUser = sftpUsers[i];
|
77
|
-
processSftp(sftpUser, context, customerBizplace.id);
|
78
|
-
}
|
79
|
-
});
|
80
|
-
return true;
|
81
|
-
}
|
82
|
-
async syncAllSftpOrders(context) {
|
83
|
-
try {
|
84
|
-
await (0, typeorm_1.getConnection)().transaction(async (tx) => {
|
85
|
-
const sftps = await tx
|
86
|
-
.getRepository(sftp_1.Sftp)
|
87
|
-
.createQueryBuilder('s')
|
88
|
-
.where('s.status = :status', { status: 'ACTIVE' })
|
89
|
-
.getMany();
|
90
|
-
if (sftps.length === 0)
|
91
|
-
return;
|
92
|
-
for (const sftp of sftps) {
|
93
|
-
const customerBizplace = await getCustomerBizplace(sftp.domainId, tx);
|
94
|
-
await processSftp(sftp, context, customerBizplace.id);
|
95
|
-
}
|
96
|
-
});
|
97
|
-
}
|
98
|
-
catch (e) {
|
99
|
-
console.log(e);
|
100
|
-
}
|
101
|
-
return true;
|
102
|
-
}
|
103
|
-
};
|
104
|
-
exports.SftpMutation = SftpMutation;
|
105
|
-
tslib_1.__decorate([
|
106
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
107
|
-
(0, type_graphql_1.Mutation)(returns => sftp_1.Sftp, { description: 'To create new Sftp' }),
|
108
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('sftp')),
|
109
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
110
|
-
tslib_1.__metadata("design:type", Function),
|
111
|
-
tslib_1.__metadata("design:paramtypes", [sftp_type_1.NewSftp, Object]),
|
112
|
-
tslib_1.__metadata("design:returntype", Promise)
|
113
|
-
], SftpMutation.prototype, "createSftp", null);
|
114
|
-
tslib_1.__decorate([
|
115
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
116
|
-
(0, type_graphql_1.Mutation)(returns => sftp_1.Sftp, { description: 'To modify Sftp information' }),
|
117
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
118
|
-
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
119
|
-
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
120
|
-
tslib_1.__metadata("design:type", Function),
|
121
|
-
tslib_1.__metadata("design:paramtypes", [String, sftp_type_1.SftpPatch, Object]),
|
122
|
-
tslib_1.__metadata("design:returntype", Promise)
|
123
|
-
], SftpMutation.prototype, "updateSftp", null);
|
124
|
-
tslib_1.__decorate([
|
125
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
126
|
-
(0, type_graphql_1.Mutation)(returns => [sftp_1.Sftp], { description: "To modify multiple Sftps' information" }),
|
127
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [sftp_type_1.SftpPatch])),
|
128
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
129
|
-
tslib_1.__metadata("design:type", Function),
|
130
|
-
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
131
|
-
tslib_1.__metadata("design:returntype", Promise)
|
132
|
-
], SftpMutation.prototype, "updateMultipleSftp", null);
|
133
|
-
tslib_1.__decorate([
|
134
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
135
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Sftp' }),
|
136
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
137
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
138
|
-
tslib_1.__metadata("design:type", Function),
|
139
|
-
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
140
|
-
tslib_1.__metadata("design:returntype", Promise)
|
141
|
-
], SftpMutation.prototype, "deleteSftp", null);
|
142
|
-
tslib_1.__decorate([
|
143
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
144
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple sftps' }),
|
145
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
146
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
147
|
-
tslib_1.__metadata("design:type", Function),
|
148
|
-
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
149
|
-
tslib_1.__metadata("design:returntype", Promise)
|
150
|
-
], SftpMutation.prototype, "deleteSftps", null);
|
151
|
-
tslib_1.__decorate([
|
152
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To sync all orders from sftp' }),
|
153
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('customerDomainId', type => String)),
|
154
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
155
|
-
tslib_1.__metadata("design:type", Function),
|
156
|
-
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
157
|
-
tslib_1.__metadata("design:returntype", Promise)
|
158
|
-
], SftpMutation.prototype, "syncSftpOrders", null);
|
159
|
-
tslib_1.__decorate([
|
160
|
-
(0, type_graphql_1.Directive)('@transaction'),
|
161
|
-
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Calls syncSftpOrders for all domain Ids' }),
|
162
|
-
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
163
|
-
tslib_1.__metadata("design:type", Function),
|
164
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
165
|
-
tslib_1.__metadata("design:returntype", Promise)
|
166
|
-
], SftpMutation.prototype, "syncAllSftpOrders", null);
|
167
|
-
exports.SftpMutation = SftpMutation = tslib_1.__decorate([
|
168
|
-
(0, type_graphql_1.Resolver)(sftp_1.Sftp)
|
169
|
-
], SftpMutation);
|
170
|
-
async function processSftp(sftpUser, context, customerBizplaceId) {
|
171
|
-
var _a, e_1, _b, _c;
|
172
|
-
const fulfilmentCenter = sftpUser.fulfillmentCenter;
|
173
|
-
const isDevelopment = sftpUser.isDevelopment;
|
174
|
-
const folderPath = sftpUser.folderPath;
|
175
|
-
const folderType = isDevelopment ? 'dev' : 'prd';
|
176
|
-
let initialDataPath = `${sftpUser.folderPath}/${folderType}${sftp_const_1.SUBMITDATAPATH}/`;
|
177
|
-
const results = await (0, util_1.getPermittedDirectories)({ path: initialDataPath }, context);
|
178
|
-
const filesDirectories = results.filter(result => result.Size > 0);
|
179
|
-
try {
|
180
|
-
for (var _d = true, filesDirectories_1 = tslib_1.__asyncValues(filesDirectories), filesDirectories_1_1; filesDirectories_1_1 = await filesDirectories_1.next(), _a = filesDirectories_1_1.done, !_a; _d = true) {
|
181
|
-
_c = filesDirectories_1_1.value;
|
182
|
-
_d = false;
|
183
|
-
let fileDirectory = _c;
|
184
|
-
let dataPath = `${sftpUser.folderPath}/${folderType}${sftp_const_1.SUBMITDATAPATH}/`;
|
185
|
-
let successPath = `${sftpUser.folderPath}/${folderType}${sftp_const_1.SUCCESSDATAPATH}/`;
|
186
|
-
let failedPath = `${sftpUser.folderPath}/${folderType}${sftp_const_1.FAILEDDATAPATH}/`;
|
187
|
-
const fileKey = fileDirectory.Key;
|
188
|
-
const lastSlashIdx = fileKey.lastIndexOf('/');
|
189
|
-
const fileString = fileKey.substring(lastSlashIdx + 1, fileKey.length);
|
190
|
-
try {
|
191
|
-
const sftp = sftpUser;
|
192
|
-
let result = await controllers_1.SftpAPI.getOutboundOrder(sftp, { folderPath, folderType, fileKey: fileString });
|
193
|
-
let isAccept = result.isAccept;
|
194
|
-
if (isAccept) {
|
195
|
-
delete result.isAccept;
|
196
|
-
if (result) {
|
197
|
-
let { items: releaseOrders } = await integration_fulfillment_1.FulfillmentAPI.getOutboundOrders(fulfilmentCenter, {
|
198
|
-
customerBizplaceId,
|
199
|
-
refNo: result.refNo
|
200
|
-
});
|
201
|
-
if (releaseOrders) {
|
202
|
-
result.collectionOrderNo = result.collectionOrderNo + ' - ' + (releaseOrders.length + 1);
|
203
|
-
}
|
204
|
-
result.requiredDraft = false;
|
205
|
-
const releaseOrder = await integration_fulfillment_1.FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
|
206
|
-
customerBizplaceId,
|
207
|
-
releaseOrder: result
|
208
|
-
});
|
209
|
-
if (releaseOrder) {
|
210
|
-
let movePaths = {
|
211
|
-
source: (dataPath += fileString),
|
212
|
-
destination: (successPath += fileString)
|
213
|
-
};
|
214
|
-
await sftp_const_1.SFTPFILESTORAGE.moveFile(movePaths);
|
215
|
-
}
|
216
|
-
}
|
217
|
-
}
|
218
|
-
else {
|
219
|
-
let movePaths = {
|
220
|
-
source: (dataPath += fileString),
|
221
|
-
destination: (failedPath += fileString)
|
222
|
-
};
|
223
|
-
await sftp_const_1.SFTPFILESTORAGE.moveFile(movePaths);
|
224
|
-
}
|
225
|
-
}
|
226
|
-
catch (e) {
|
227
|
-
let movePaths = {
|
228
|
-
source: (dataPath += fileString),
|
229
|
-
destination: (failedPath += fileString)
|
230
|
-
};
|
231
|
-
await sftp_const_1.SFTPFILESTORAGE.moveFile(movePaths);
|
232
|
-
}
|
233
|
-
}
|
234
|
-
}
|
235
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
236
|
-
finally {
|
237
|
-
try {
|
238
|
-
if (!_d && !_a && (_b = filesDirectories_1.return)) await _b.call(filesDirectories_1);
|
239
|
-
}
|
240
|
-
finally { if (e_1) throw e_1.error; }
|
241
|
-
}
|
242
|
-
}
|
243
|
-
async function getCustomerBizplace(customerDomainId, tx) {
|
244
|
-
const customerDomain = await tx.getRepository(shell_1.Domain).findOneBy({ id: customerDomainId });
|
245
|
-
const customerBizplace = await tx.getRepository(biz_base_1.Bizplace).findOne({
|
246
|
-
where: { domain: { id: customerDomain.id } }
|
247
|
-
});
|
248
|
-
return customerBizplace;
|
249
|
-
}
|
250
|
-
//# sourceMappingURL=sftp-mutation.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"sftp-mutation.js","sourceRoot":"","sources":["../../../server/service/sftp/sftp-mutation.ts"],"names":[],"mappings":";;;AAuKA,kCA+DC;AAED,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C,cAAM,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAA;IAEjG,MAAM,gBAAgB,GAAa,MAAM,EAAE,CAAC,aAAa,CAAC,mBAAQ,CAAC,CAAC,OAAO,CAAC;QAC1E,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,EAAE,EAAE;KAC7C,CAAC,CAAA;IAEF,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["import '../../sftp-s3'\n\nimport { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { EntityManager, getConnection, In } from 'typeorm'\n\nimport { Bizplace } from '@things-factory/biz-base'\nimport { FulfillmentAPI, FulfillmentCenter } from '@things-factory/integration-fulfillment'\nimport { Domain } from '@things-factory/shell'\n\nimport { SftpAPI } from '../../controllers'\nimport { FAILEDDATAPATH, SFTPFILESTORAGE, SUBMITDATAPATH, SUCCESSDATAPATH } from '../../sftp-const'\nimport { getPermittedDirectories } from '../../util'\nimport { Sftp, SftpStatus } from './sftp'\nimport { NewSftp, SftpPatch } from './sftp-type'\n\n@Resolver(Sftp)\nexport class SftpMutation {\n @Directive('@transaction')\n @Mutation(returns => Sftp, { description: 'To create new Sftp' })\n async createSftp(@Arg('sftp') sftp: NewSftp, @Ctx() context: ResolverContext): Promise<Sftp> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(Sftp).save({\n ...sftp,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Sftp, { description: 'To modify Sftp information' })\n async updateSftp(\n @Arg('id') id: string,\n @Arg('patch') patch: SftpPatch,\n @Ctx() context: ResolverContext\n ): Promise<Sftp> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Sftp)\n const sftp = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...sftp,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Sftp], { description: \"To modify multiple Sftps' information\" })\n async updateMultipleSftp(\n @Arg('patches', type => [SftpPatch]) patches: SftpPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Sftp[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const sftpRepo = tx.getRepository(Sftp)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await sftpRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const sftp = await sftpRepo.findOneBy({ id: newRecord.id })\n\n const result = await sftpRepo.save({\n ...sftp,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete Sftp' })\n async deleteSftp(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Sftp).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple sftps' })\n async deleteSftps(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Sftp).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Mutation(returns => Boolean, { description: 'To sync all orders from sftp' })\n async syncSftpOrders(\n @Arg('customerDomainId', type => String) customerDomainId: string,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n await getConnection().transaction(async (tx: EntityManager) => {\n const customerDomain: Domain = await tx.getRepository(Domain).findOneBy({ id: customerDomainId })\n\n const customerBizplace: Bizplace = await getCustomerBizplace(customerDomainId, tx)\n\n const sftpUsers: Sftp[] = await tx.getRepository(Sftp).find({\n where: { domain: { id: customerDomainId }, status: SftpStatus.ACTIVE },\n relations: ['fulfillmentCenter']\n })\n\n for (var i = 0; i < sftpUsers.length; i++) {\n const sftpUser: Sftp = sftpUsers[i]\n processSftp(sftpUser, context, customerBizplace.id)\n }\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'Calls syncSftpOrders for all domain Ids' })\n async syncAllSftpOrders(@Ctx() context: ResolverContext): Promise<Boolean> {\n try {\n await getConnection().transaction(async tx => {\n const sftps = await tx\n .getRepository(Sftp)\n .createQueryBuilder('s')\n .where('s.status = :status', { status: 'ACTIVE' })\n .getMany()\n\n if (sftps.length === 0) return\n for (const sftp of sftps) {\n const customerBizplace = await getCustomerBizplace(sftp.domainId, tx)\n await processSftp(sftp, context, customerBizplace.id)\n }\n })\n } catch (e) {\n console.log(e)\n }\n return true\n }\n}\n\nexport async function processSftp(sftpUser, context, customerBizplaceId) {\n const fulfilmentCenter: FulfillmentCenter = sftpUser.fulfillmentCenter\n const isDevelopment: boolean = sftpUser.isDevelopment\n const folderPath: string = sftpUser.folderPath\n const folderType: string = isDevelopment ? 'dev' : 'prd'\n let initialDataPath: string = `${sftpUser.folderPath}/${folderType}${SUBMITDATAPATH}/`\n const results: any[] = await getPermittedDirectories({ path: initialDataPath }, context)\n const filesDirectories: any[] = results.filter(result => result.Size > 0)\n\n for await (let fileDirectory of filesDirectories) {\n let dataPath: string = `${sftpUser.folderPath}/${folderType}${SUBMITDATAPATH}/`\n let successPath: string = `${sftpUser.folderPath}/${folderType}${SUCCESSDATAPATH}/`\n let failedPath: string = `${sftpUser.folderPath}/${folderType}${FAILEDDATAPATH}/`\n const fileKey: string = fileDirectory.Key\n const lastSlashIdx = fileKey.lastIndexOf('/')\n const fileString: string = fileKey.substring(lastSlashIdx + 1, fileKey.length)\n try {\n const sftp: any = sftpUser\n let result: any = await SftpAPI.getOutboundOrder(sftp, { folderPath, folderType, fileKey: fileString })\n let isAccept: boolean = result.isAccept\n\n if (isAccept) {\n delete result.isAccept\n if (result) {\n let { items: releaseOrders }: any = await FulfillmentAPI.getOutboundOrders(fulfilmentCenter, {\n customerBizplaceId,\n refNo: result.refNo\n })\n\n if (releaseOrders) {\n result.collectionOrderNo = result.collectionOrderNo + ' - ' + (releaseOrders.length + 1)\n }\n\n result.requiredDraft = false\n\n const releaseOrder: any = await FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {\n customerBizplaceId,\n releaseOrder: result\n })\n\n if (releaseOrder) {\n let movePaths = {\n source: (dataPath += fileString),\n destination: (successPath += fileString)\n }\n await SFTPFILESTORAGE.moveFile(movePaths)\n }\n }\n } else {\n let movePaths = {\n source: (dataPath += fileString),\n destination: (failedPath += fileString)\n }\n await SFTPFILESTORAGE.moveFile(movePaths)\n }\n } catch (e) {\n let movePaths = {\n source: (dataPath += fileString),\n destination: (failedPath += fileString)\n }\n await SFTPFILESTORAGE.moveFile(movePaths)\n }\n }\n}\n\nexport async function getCustomerBizplace(customerDomainId, tx): Promise<Bizplace> {\n const customerDomain: Domain = await tx.getRepository(Domain).findOneBy({ id: customerDomainId })\n\n const customerBizplace: Bizplace = await tx.getRepository(Bizplace).findOne({\n where: { domain: { id: customerDomain.id } }\n })\n\n return customerBizplace\n}\n"]}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { User } from '@things-factory/auth-base';
|
2
|
-
import { Domain, ListParam } from '@things-factory/shell';
|
3
|
-
import { Sftp } from './sftp';
|
4
|
-
import { SftpList } from './sftp-type';
|
5
|
-
export declare class SftpQuery {
|
6
|
-
sftp(id: string, context: ResolverContext): Promise<Sftp>;
|
7
|
-
sftps(params: ListParam, context: ResolverContext): Promise<SftpList>;
|
8
|
-
domain(sftp: Sftp): Promise<Domain>;
|
9
|
-
updater(sftp: Sftp): Promise<User>;
|
10
|
-
creator(sftp: Sftp): Promise<User>;
|
11
|
-
}
|
@@ -1,74 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SftpQuery = void 0;
|
4
|
-
const tslib_1 = require("tslib");
|
5
|
-
const type_graphql_1 = require("type-graphql");
|
6
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
7
|
-
const shell_1 = require("@things-factory/shell");
|
8
|
-
const sftp_1 = require("./sftp");
|
9
|
-
const sftp_type_1 = require("./sftp-type");
|
10
|
-
let SftpQuery = class SftpQuery {
|
11
|
-
async sftp(id, context) {
|
12
|
-
const { domain } = context.state;
|
13
|
-
return await (0, shell_1.getRepository)(sftp_1.Sftp).findOne({
|
14
|
-
where: { domain: { id: domain.id }, id }
|
15
|
-
});
|
16
|
-
}
|
17
|
-
async sftps(params, context) {
|
18
|
-
const { domain } = context.state;
|
19
|
-
const convertedParams = (0, shell_1.convertListParams)(params, { domain });
|
20
|
-
const [items, total] = await (0, shell_1.getRepository)(sftp_1.Sftp).findAndCount(convertedParams);
|
21
|
-
return { items, total };
|
22
|
-
}
|
23
|
-
async domain(sftp) {
|
24
|
-
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: sftp.domainId });
|
25
|
-
}
|
26
|
-
async updater(sftp) {
|
27
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: sftp.updaterId });
|
28
|
-
}
|
29
|
-
async creator(sftp) {
|
30
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: sftp.creatorId });
|
31
|
-
}
|
32
|
-
};
|
33
|
-
exports.SftpQuery = SftpQuery;
|
34
|
-
tslib_1.__decorate([
|
35
|
-
(0, type_graphql_1.Query)(returns => sftp_1.Sftp, { description: 'To fetch a Sftp' }),
|
36
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
37
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
38
|
-
tslib_1.__metadata("design:type", Function),
|
39
|
-
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
40
|
-
tslib_1.__metadata("design:returntype", Promise)
|
41
|
-
], SftpQuery.prototype, "sftp", null);
|
42
|
-
tslib_1.__decorate([
|
43
|
-
(0, type_graphql_1.Query)(returns => sftp_type_1.SftpList, { description: 'To fetch multiple Sftps' }),
|
44
|
-
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
45
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
46
|
-
tslib_1.__metadata("design:type", Function),
|
47
|
-
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
48
|
-
tslib_1.__metadata("design:returntype", Promise)
|
49
|
-
], SftpQuery.prototype, "sftps", null);
|
50
|
-
tslib_1.__decorate([
|
51
|
-
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
52
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
53
|
-
tslib_1.__metadata("design:type", Function),
|
54
|
-
tslib_1.__metadata("design:paramtypes", [sftp_1.Sftp]),
|
55
|
-
tslib_1.__metadata("design:returntype", Promise)
|
56
|
-
], SftpQuery.prototype, "domain", null);
|
57
|
-
tslib_1.__decorate([
|
58
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
59
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
60
|
-
tslib_1.__metadata("design:type", Function),
|
61
|
-
tslib_1.__metadata("design:paramtypes", [sftp_1.Sftp]),
|
62
|
-
tslib_1.__metadata("design:returntype", Promise)
|
63
|
-
], SftpQuery.prototype, "updater", null);
|
64
|
-
tslib_1.__decorate([
|
65
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
66
|
-
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
67
|
-
tslib_1.__metadata("design:type", Function),
|
68
|
-
tslib_1.__metadata("design:paramtypes", [sftp_1.Sftp]),
|
69
|
-
tslib_1.__metadata("design:returntype", Promise)
|
70
|
-
], SftpQuery.prototype, "creator", null);
|
71
|
-
exports.SftpQuery = SftpQuery = tslib_1.__decorate([
|
72
|
-
(0, type_graphql_1.Resolver)(sftp_1.Sftp)
|
73
|
-
], SftpQuery);
|
74
|
-
//# sourceMappingURL=sftp-query.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"sftp-query.js","sourceRoot":"","sources":["../../../server/service/sftp/sftp-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAA2F;AAE3F,iCAA6B;AAC7B,2CAAsC;AAG/B,IAAM,SAAS,GAAf,MAAM,SAAS;IAEd,AAAN,KAAK,CAAC,IAAI,CAAY,EAAU,EAAS,OAAwB;QAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,WAAI,CAAC,CAAC,OAAO,CAAC;YACvC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,KAAK,CAA0B,MAAiB,EAAS,OAAwB;QACrF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;QAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,qBAAa,EAAC,WAAI,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAE9E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAU;QAC7B,OAAO,MAAM,IAAA,qBAAa,EAAC,cAAM,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAA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I,GAAE,CAAA;;6CAAO,WAAI;;wCAE/B;oBAjCU,SAAS;IADrB,IAAA,uBAAQ,EAAC,WAAI,CAAC;GACF,SAAS,CAkCrB","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Sftp } from './sftp'\nimport { SftpList } from './sftp-type'\n\n@Resolver(Sftp)\nexport class SftpQuery {\n @Query(returns => Sftp, { description: 'To fetch a Sftp' })\n async sftp(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Sftp> {\n const { domain } = context.state\n\n return await getRepository(Sftp).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => SftpList, { description: 'To fetch multiple Sftps' })\n async sftps(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<SftpList> {\n const { domain } = context.state\n\n const convertedParams = convertListParams(params, { domain })\n const [items, total] = await getRepository(Sftp).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() sftp: Sftp): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: sftp.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() sftp: Sftp): Promise<User> {\n return await getRepository(User).findOneBy({ id: sftp.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() sftp: Sftp): Promise<User> {\n return await getRepository(User).findOneBy({ id: sftp.creatorId })\n }\n}\n"]}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { Sftp, SftpStatus } from './sftp';
|
2
|
-
export declare class NewSftp {
|
3
|
-
name: string;
|
4
|
-
description?: string;
|
5
|
-
status?: SftpStatus;
|
6
|
-
username?: string;
|
7
|
-
publicKey?: string;
|
8
|
-
privateKey?: string;
|
9
|
-
folderPath?: string;
|
10
|
-
isDevelopment?: boolean;
|
11
|
-
platform?: string;
|
12
|
-
}
|
13
|
-
export declare class SftpPatch {
|
14
|
-
id?: string;
|
15
|
-
name?: string;
|
16
|
-
description?: string;
|
17
|
-
status?: SftpStatus;
|
18
|
-
username?: string;
|
19
|
-
publicKey?: string;
|
20
|
-
privateKey?: string;
|
21
|
-
folderPath?: string;
|
22
|
-
isDevelopment?: boolean;
|
23
|
-
platform?: string;
|
24
|
-
cuFlag: string;
|
25
|
-
}
|
26
|
-
export declare class SftpList {
|
27
|
-
items: Sftp[];
|
28
|
-
total: number;
|
29
|
-
}
|