@nmshd/connector-types 7.0.0-alpha.4 → 7.0.0-alpha.5
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/QRCode.d.ts +7 -0
- package/dist/QRCode.d.ts.map +1 -0
- package/dist/QRCode.js +52 -0
- package/dist/QRCode.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/httpServer/BaseController.d.ts +2 -5
- package/dist/infrastructure/httpServer/BaseController.d.ts.map +1 -1
- package/dist/infrastructure/httpServer/BaseController.js +3 -39
- package/dist/infrastructure/httpServer/BaseController.js.map +1 -1
- package/package.json +4 -4
package/dist/QRCode.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCode.d.ts","sourceRoot":"","sources":["../src/QRCode.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;IACK,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA3C,OAAO;IAEA,QAAQ,IAAI,MAAM;WAIL,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM9D"}
|
package/dist/QRCode.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.QRCode = void 0;
|
|
37
|
+
const qrcodeLibrary = __importStar(require("qrcode"));
|
|
38
|
+
class QRCode {
|
|
39
|
+
constructor(base64) {
|
|
40
|
+
this.base64 = base64;
|
|
41
|
+
}
|
|
42
|
+
asBase64() {
|
|
43
|
+
return this.base64;
|
|
44
|
+
}
|
|
45
|
+
static async for(reference) {
|
|
46
|
+
const dataUrl = await qrcodeLibrary.toDataURL(reference.startsWith("http") ? reference : `nmshd://tr#${reference}`);
|
|
47
|
+
const base64 = dataUrl.split(",")[1];
|
|
48
|
+
return new QRCode(base64);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.QRCode = QRCode;
|
|
52
|
+
//# sourceMappingURL=QRCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCode.js","sourceRoot":"","sources":["../src/QRCode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AAExC,MAAa,MAAM;IACf,YAAqC,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEhD,QAAQ;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAiB;QACrC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,SAAS,EAAE,CAAC,CAAC;QACpH,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAErC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACJ;AAbD,wBAaC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./ConnectorMode"), exports);
|
|
|
19
19
|
__exportStar(require("./ConnectorRuntimeModule"), exports);
|
|
20
20
|
__exportStar(require("./DocumentationLink"), exports);
|
|
21
21
|
__exportStar(require("./infrastructure"), exports);
|
|
22
|
+
__exportStar(require("./QRCode"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,kDAAgC;AAChC,2DAAyC;AACzC,sDAAoC;AACpC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,kDAAgC;AAChC,2DAAyC;AACzC,sDAAoC;AACpC,mDAAiC;AACjC,2CAAyB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Result } from "@js-soft/ts-utils";
|
|
2
2
|
import { Return } from "@nmshd/typescript-rest";
|
|
3
3
|
import express from "express";
|
|
4
|
+
import { QRCode } from "../../QRCode";
|
|
4
5
|
import { Envelope } from "./common/Envelope";
|
|
5
6
|
import { Mimetype } from "./common/Mimetype";
|
|
6
7
|
export declare abstract class BaseController {
|
|
@@ -10,10 +11,6 @@ export declare abstract class BaseController {
|
|
|
10
11
|
private json;
|
|
11
12
|
private guard;
|
|
12
13
|
protected file<T extends Result<any>>(result: T, contentPredicate: (result: T) => Buffer | string | Uint8Array | undefined, filenamePredicate: (result: T) => string, mimetypePredicate: (result: T) => Mimetype, response: express.Response, status: number): void;
|
|
13
|
-
protected qrCode<T extends Result<
|
|
14
|
-
reference: {
|
|
15
|
-
url: string;
|
|
16
|
-
};
|
|
17
|
-
}>>(result: T, filename: string, response: express.Response, status: number): Promise<void>;
|
|
14
|
+
protected qrCode<T extends Result<any>>(result: T, qrPredicate: (result: T) => Promise<QRCode>, filename: string, response: express.Response, status: number): Promise<void>;
|
|
18
15
|
}
|
|
19
16
|
//# sourceMappingURL=BaseController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseController.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/BaseController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseController.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/BaseController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,8BAAsB,cAAc;IAChC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;IAIrE,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ;IAI5C,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAK/C,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,KAAK;IAMb,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,EAChC,MAAM,EAAE,CAAC,EACT,gBAAgB,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,EACzE,iBAAiB,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EACxC,iBAAiB,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,QAAQ,EAC1C,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,MAAM,EAAE,MAAM,GACf,IAAI;cAyBS,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,EACxC,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,EAC3C,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;CAcnB"}
|
|
@@ -1,41 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.BaseController = void 0;
|
|
37
4
|
const typescript_rest_1 = require("@nmshd/typescript-rest");
|
|
38
|
-
const qrcodeLibrary = __importStar(require("qrcode"));
|
|
39
5
|
const Envelope_1 = require("./common/Envelope");
|
|
40
6
|
const Mimetype_1 = require("./common/Mimetype");
|
|
41
7
|
class BaseController {
|
|
@@ -81,13 +47,11 @@ class BaseController {
|
|
|
81
47
|
.setHeader("content-disposition", `attachment;filename=${encodeURIComponent(filename)}`)
|
|
82
48
|
.send(buffer);
|
|
83
49
|
}
|
|
84
|
-
async qrCode(result, filename, response, status) {
|
|
50
|
+
async qrCode(result, qrPredicate, filename, response, status) {
|
|
85
51
|
this.guard(result);
|
|
86
52
|
const mimetype = Mimetype_1.Mimetype.png();
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const base64 = dataUrl.split(",")[1];
|
|
90
|
-
const buffer = Buffer.from(base64, "base64");
|
|
53
|
+
const qrCode = await qrPredicate(result);
|
|
54
|
+
const buffer = Buffer.from(qrCode.asBase64(), "base64");
|
|
91
55
|
response
|
|
92
56
|
.status(status)
|
|
93
57
|
.setHeader("content-type", mimetype.value)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseController.js","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/BaseController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseController.js","sourceRoot":"","sources":["../../../src/infrastructure/httpServer/BaseController.ts"],"names":[],"mappings":";;;AACA,4DAAgD;AAGhD,gDAA6C;AAC7C,gDAA6C;AAE7C,MAAsB,cAAc;IACtB,OAAO,CAAI,MAAiB;QAClC,OAAO,IAAI,wBAAM,CAAC,WAAW,CAAW,GAAG,EAAE,IAAI,CAAC,IAAI,CAAI,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IAES,EAAE,CAAI,MAAiB;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAES,SAAS,CAAI,MAAiB;QACpC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACnB,OAAO;IACX,CAAC;IAEO,IAAI,CAAI,MAAiB;QAC7B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACnB,OAAO,mBAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAEO,KAAK,CAAI,MAAiB;QAC9B,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,MAAM,CAAC,KAAK,CAAC;QACvB,CAAC;IACL,CAAC;IAES,IAAI,CACV,MAAS,EACT,gBAAyE,EACzE,iBAAwC,EACxC,iBAA0C,EAC1C,QAA0B,EAC1B,MAAc;QAEd,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEnB,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAE3C,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAE/D,IAAI,MAAc,CAAC;QACnB,IAAI,OAAO,YAAY,MAAM,EAAE,CAAC;YAC5B,M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"@types/node": "^22.15.
|
|
31
|
+
"@types/node": "^22.15.21",
|
|
32
32
|
"@types/qrcode": "^1.5.5",
|
|
33
33
|
"typescript": "^5.8.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@js-soft/docdb-access-abstractions": "^1.1.0",
|
|
37
37
|
"@js-soft/ts-utils": "^2.3.3",
|
|
38
|
-
"@nmshd/runtime": "^
|
|
39
|
-
"@nmshd/typescript-rest": "^3.1.
|
|
38
|
+
"@nmshd/runtime": "^6.50.0",
|
|
39
|
+
"@nmshd/typescript-rest": "^3.1.4",
|
|
40
40
|
"express": "^5.1.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"qrcode": "^1.5.4"
|
|
48
48
|
},
|
|
49
|
-
"version": "7.0.0-alpha.
|
|
49
|
+
"version": "7.0.0-alpha.5"
|
|
50
50
|
}
|