@innvoid/getmarket-sdk 0.2.3 → 0.2.4
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/{chunk-OSYBK5AN.js → chunk-5S2JP7PR.js} +4 -22
- package/dist/chunk-5S2JP7PR.js.map +1 -0
- package/dist/{chunk-R3RR4RLK.js → chunk-UK6LHHJQ.js} +31 -2
- package/dist/chunk-UK6LHHJQ.js.map +1 -0
- package/dist/{chunk-S44JVJZS.js → chunk-WM2QICZQ.js} +16 -1
- package/dist/{chunk-S44JVJZS.js.map → chunk-WM2QICZQ.js.map} +1 -1
- package/dist/clients/index.cjs +30 -0
- package/dist/clients/index.cjs.map +1 -1
- package/dist/clients/index.d.cts +8 -2
- package/dist/clients/index.d.ts +8 -2
- package/dist/clients/index.js +3 -1
- package/dist/core/index.cjs +5 -26
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +5 -17
- package/dist/core/index.d.ts +5 -17
- package/dist/core/index.js +3 -8
- package/dist/index.cjs +49 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -12
- package/dist/middlewares/index.js +2 -4
- package/package.json +2 -2
- package/dist/chunk-KJ64O2EG.js +0 -19
- package/dist/chunk-KJ64O2EG.js.map +0 -1
- package/dist/chunk-OSYBK5AN.js.map +0 -1
- package/dist/chunk-R3RR4RLK.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -59,6 +59,7 @@ __export(src_exports, {
|
|
|
59
59
|
createInternalHttpClient: () => createInternalHttpClient,
|
|
60
60
|
createMdClient: () => createMdClient,
|
|
61
61
|
createMediaClient: () => createMediaClient,
|
|
62
|
+
createMkpClient: () => createMkpClient,
|
|
62
63
|
createPlatformClient: () => createPlatformClient,
|
|
63
64
|
createResClient: () => createResClient,
|
|
64
65
|
getOrSet: () => getOrSet,
|
|
@@ -77,9 +78,7 @@ __export(src_exports, {
|
|
|
77
78
|
requireRolesOrAnyPermission: () => requireRolesOrAnyPermission,
|
|
78
79
|
sendError: () => sendError,
|
|
79
80
|
sendOk: () => sendOk,
|
|
80
|
-
verifyBackendJwtRS256: () => verifyBackendJwtRS256
|
|
81
|
-
withRequestId: () => withRequestId,
|
|
82
|
-
withRequestIdConfig: () => withRequestIdConfig
|
|
81
|
+
verifyBackendJwtRS256: () => verifyBackendJwtRS256
|
|
83
82
|
});
|
|
84
83
|
module.exports = __toCommonJS(src_exports);
|
|
85
84
|
|
|
@@ -404,39 +403,11 @@ function mapAxiosToUpstreamError(err, svc) {
|
|
|
404
403
|
|
|
405
404
|
// src/core/http.ts
|
|
406
405
|
var import_axios = __toESM(require("axios"), 1);
|
|
407
|
-
|
|
408
|
-
// src/middlewares/requestId.ts
|
|
409
|
-
var import_crypto = require("crypto");
|
|
410
|
-
var REQUEST_ID_HEADER = "x-request-id";
|
|
411
|
-
var REQUEST_ID_HEADER_ALT = "x-requestid";
|
|
412
|
-
var RESPONSE_REQUEST_ID_HEADER = "X-Request-Id";
|
|
413
|
-
function requestId(req, res, next) {
|
|
414
|
-
const headerId = req.headers[REQUEST_ID_HEADER] || req.headers[REQUEST_ID_HEADER_ALT];
|
|
415
|
-
const id = headerId?.trim() || (0, import_crypto.randomUUID)();
|
|
416
|
-
req.requestId = id;
|
|
417
|
-
res.locals.requestId = id;
|
|
418
|
-
res.setHeader(RESPONSE_REQUEST_ID_HEADER, id);
|
|
419
|
-
next();
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// src/core/http.ts
|
|
423
|
-
function withRequestId(headers, requestId2) {
|
|
424
|
-
const h2 = headers && typeof headers === "object" ? { ...headers } : {};
|
|
425
|
-
const rid = (requestId2 || "").trim();
|
|
426
|
-
if (rid) h2[REQUEST_ID_HEADER] = rid;
|
|
427
|
-
return h2;
|
|
428
|
-
}
|
|
429
|
-
function withRequestIdConfig(config = {}, requestId2) {
|
|
430
|
-
return {
|
|
431
|
-
...config,
|
|
432
|
-
headers: withRequestId(config.headers, requestId2)
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
406
|
function createHttpClient(opts) {
|
|
436
407
|
return import_axios.default.create({
|
|
437
|
-
baseURL: opts.baseURL,
|
|
438
|
-
timeout: opts.timeoutMs ??
|
|
439
|
-
headers:
|
|
408
|
+
baseURL: opts.baseURL.replace(/\/+$/, ""),
|
|
409
|
+
timeout: opts.timeoutMs ?? 8e3,
|
|
410
|
+
headers: opts.headers ?? {}
|
|
440
411
|
});
|
|
441
412
|
}
|
|
442
413
|
|
|
@@ -579,6 +550,20 @@ function parseHeaders(req, _res, next) {
|
|
|
579
550
|
next();
|
|
580
551
|
}
|
|
581
552
|
|
|
553
|
+
// src/middlewares/requestId.ts
|
|
554
|
+
var import_crypto = require("crypto");
|
|
555
|
+
var REQUEST_ID_HEADER = "x-request-id";
|
|
556
|
+
var REQUEST_ID_HEADER_ALT = "x-requestid";
|
|
557
|
+
var RESPONSE_REQUEST_ID_HEADER = "X-Request-Id";
|
|
558
|
+
function requestId(req, res, next) {
|
|
559
|
+
const headerId = req.headers[REQUEST_ID_HEADER] || req.headers[REQUEST_ID_HEADER_ALT];
|
|
560
|
+
const id = headerId?.trim() || (0, import_crypto.randomUUID)();
|
|
561
|
+
req.requestId = id;
|
|
562
|
+
res.locals.requestId = id;
|
|
563
|
+
res.setHeader(RESPONSE_REQUEST_ID_HEADER, id);
|
|
564
|
+
next();
|
|
565
|
+
}
|
|
566
|
+
|
|
582
567
|
// src/middlewares/internalAuth.ts
|
|
583
568
|
var import_fs = __toESM(require("fs"), 1);
|
|
584
569
|
var import_crypto2 = __toESM(require("crypto"), 1);
|
|
@@ -1552,6 +1537,34 @@ function createMediaClient() {
|
|
|
1552
1537
|
filesRefs: (uids, opts) => files.bulkRefs(uids, opts)
|
|
1553
1538
|
};
|
|
1554
1539
|
}
|
|
1540
|
+
|
|
1541
|
+
// src/clients/mkpClient.ts
|
|
1542
|
+
function createMkpClient() {
|
|
1543
|
+
const env = readServiceEnv("MKP", { apiPrefix: "/internal/v1" });
|
|
1544
|
+
const publications = createBulkRefsClient({
|
|
1545
|
+
namespace: "mkp:publication",
|
|
1546
|
+
baseURL: env.baseURL,
|
|
1547
|
+
apiPrefix: env.apiPrefix,
|
|
1548
|
+
path: "/refs/publications"
|
|
1549
|
+
});
|
|
1550
|
+
const events = createBulkRefsClient({
|
|
1551
|
+
namespace: "mkp:event",
|
|
1552
|
+
baseURL: env.baseURL,
|
|
1553
|
+
apiPrefix: env.apiPrefix,
|
|
1554
|
+
path: "/refs/events"
|
|
1555
|
+
});
|
|
1556
|
+
const promotions = createBulkRefsClient({
|
|
1557
|
+
namespace: "mkp:promotion",
|
|
1558
|
+
baseURL: env.baseURL,
|
|
1559
|
+
apiPrefix: env.apiPrefix,
|
|
1560
|
+
path: "/refs/promotions"
|
|
1561
|
+
});
|
|
1562
|
+
return {
|
|
1563
|
+
publicationsRefs: (uids, opts) => publications.bulkRefs(uids, opts),
|
|
1564
|
+
eventsRefs: (uids, opts) => events.bulkRefs(uids, opts),
|
|
1565
|
+
promotionsRefs: (uids, opts) => promotions.bulkRefs(uids, opts)
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1555
1568
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1556
1569
|
0 && (module.exports = {
|
|
1557
1570
|
HEADER_AUTHORIZATION,
|
|
@@ -1583,6 +1596,7 @@ function createMediaClient() {
|
|
|
1583
1596
|
createInternalHttpClient,
|
|
1584
1597
|
createMdClient,
|
|
1585
1598
|
createMediaClient,
|
|
1599
|
+
createMkpClient,
|
|
1586
1600
|
createPlatformClient,
|
|
1587
1601
|
createResClient,
|
|
1588
1602
|
getOrSet,
|
|
@@ -1601,8 +1615,6 @@ function createMediaClient() {
|
|
|
1601
1615
|
requireRolesOrAnyPermission,
|
|
1602
1616
|
sendError,
|
|
1603
1617
|
sendOk,
|
|
1604
|
-
verifyBackendJwtRS256
|
|
1605
|
-
withRequestId,
|
|
1606
|
-
withRequestIdConfig
|
|
1618
|
+
verifyBackendJwtRS256
|
|
1607
1619
|
});
|
|
1608
1620
|
//# sourceMappingURL=index.cjs.map
|