@social-mail/social-mail-web-server 1.8.470 → 1.8.471

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.
@@ -0,0 +1,11 @@
1
+ import Page from "@entity-access/server-pages/dist/Page.js";
2
+ import SocialMailContext from "../../../../../../server/model/SocialMailContext.js";
3
+ import PuppeteerService from "../../../../../../server/services/puppeteer/PuppeteerService.js";
4
+ import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
5
+ export default class extends Page {
6
+ db: SocialMailContext;
7
+ puppeteerService: PuppeteerService;
8
+ journalID: any;
9
+ run(): Promise<TempFileResult>;
10
+ }
11
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../../../../src/wwwroot/routes/store/journals/[journalID]/pdf/get.tsx"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAC5D,OAAO,iBAAiB,MAAM,qDAAqD,CAAC;AACpF,OAAO,gBAAgB,MAAM,iEAAiE,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAE7E,MAAM,CAAC,OAAO,MAAO,SAAQ,IAAI;IAG7B,EAAE,EAAE,iBAAiB,CAAC;IAGtB,gBAAgB,EAAE,gBAAgB,CAAC;IAGnC,SAAS,EAAE,GAAG,CAAC;IAET,GAAG;CA2BZ"}
@@ -0,0 +1,48 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import Inject from "@entity-access/entity-access/dist/di/di.js";
11
+ import { Route } from "@entity-access/server-pages/dist/core/Route.js";
12
+ import Page from "@entity-access/server-pages/dist/Page.js";
13
+ import SocialMailContext from "../../../../../../server/model/SocialMailContext.js";
14
+ import PuppeteerService from "../../../../../../server/services/puppeteer/PuppeteerService.js";
15
+ import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
16
+ export default class default_1 extends Page {
17
+ async run() {
18
+ const { journalID } = this;
19
+ const journal = await this.db.storeJournals
20
+ .where({ journalID }, (p) => (x) => x.journalID === p.journalID)
21
+ .include((x) => [x.store.hosts])
22
+ .first();
23
+ const host = journal.store.hosts[0].host;
24
+ const fileName = `${journal.invoiceID}.pdf`;
25
+ const file = await this.puppeteerService.generate({
26
+ url: `https://${host}/store/journals/${journalID}`,
27
+ output: "pdf"
28
+ });
29
+ return new TempFileResult(file, {
30
+ contentDisposition: "inline",
31
+ fileName,
32
+ contentType: "application/pdf"
33
+ });
34
+ }
35
+ }
36
+ __decorate([
37
+ Inject,
38
+ __metadata("design:type", SocialMailContext)
39
+ ], default_1.prototype, "db", void 0);
40
+ __decorate([
41
+ Inject,
42
+ __metadata("design:type", PuppeteerService)
43
+ ], default_1.prototype, "puppeteerService", void 0);
44
+ __decorate([
45
+ Route("journalID"),
46
+ __metadata("design:type", Object)
47
+ ], default_1.prototype, "journalID", void 0);
48
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../../../src/wwwroot/routes/store/journals/[journalID]/pdf/get.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,4CAA4C,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,gDAAgD,CAAC;AACvE,OAAO,IAAI,MAAM,0CAA0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  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.8.470",
3
+ "version": "1.8.471",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,7 +17,7 @@ export default async function seedUI(config: DBConfig) {
17
17
  await config.saveVersion(UIPackageConfig, {
18
18
  package: "@social-mail/social-mail-client",
19
19
  view: "dist/web/AppIndex",
20
- version: "1.9.117"
20
+ version: "1.9.118"
21
21
  });
22
22
 
23
23
  await config.saveVersion(WebComponentsPackageConfig, {
@@ -0,0 +1,46 @@
1
+ import Inject from "@entity-access/entity-access/dist/di/di.js";
2
+ import { Route } from "@entity-access/server-pages/dist/core/Route.js";
3
+ import Page from "@entity-access/server-pages/dist/Page.js";
4
+ import SocialMailContext from "../../../../../../server/model/SocialMailContext.js";
5
+ import PuppeteerService from "../../../../../../server/services/puppeteer/PuppeteerService.js";
6
+ import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
7
+
8
+ export default class extends Page {
9
+
10
+ @Inject
11
+ db: SocialMailContext;
12
+
13
+ @Inject
14
+ puppeteerService: PuppeteerService;
15
+
16
+ @Route("journalID")
17
+ journalID: any;
18
+
19
+ async run() {
20
+
21
+ const { journalID } = this;
22
+
23
+ const journal = await this.db.storeJournals
24
+ .where({ journalID }, (p) => (x) =>
25
+ x.journalID === p.journalID
26
+ )
27
+ .include((x) => [x.store.hosts])
28
+ .first();
29
+
30
+ const host = journal.store.hosts[0].host;
31
+
32
+ const fileName = `${journal.invoiceID}.pdf`;
33
+
34
+ const file = await this.puppeteerService.generate({
35
+ url: `https://${host}/store/journals/${journalID}`,
36
+ output: "pdf"
37
+ });
38
+
39
+
40
+ return new TempFileResult(file, {
41
+ contentDisposition: "inline",
42
+ fileName,
43
+ contentType: "application/pdf"
44
+ });
45
+ }
46
+ }