@kyro-cms/core 0.2.4 → 0.2.9
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/{WebhookService-CXJ5oz6L.d.ts → WebhookService-BznDc2AT.d.ts} +1 -1
- package/dist/{WebhookService-Dqx9Is7m.d.cts → WebhookService-mZZ75syh.d.cts} +1 -1
- package/dist/{base-Cfek4fp3.d.cts → base-Db9LkB1N.d.cts} +1 -1
- package/dist/{base-CciYzoDF.d.ts → base-Hu6ij8sZ.d.ts} +1 -1
- package/dist/{chunk-RONAX6UU.js → chunk-KB6QF4HO.js} +389 -142
- package/dist/chunk-KB6QF4HO.js.map +1 -0
- package/dist/{chunk-KDVDIZ4Y.cjs → chunk-PNBZZ76A.cjs} +389 -142
- package/dist/chunk-PNBZZ76A.cjs.map +1 -0
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/drizzle/index.d.cts +2 -2
- package/dist/drizzle/index.d.ts +2 -2
- package/dist/graphql/index.d.cts +2 -2
- package/dist/graphql/index.d.ts +2 -2
- package/dist/{index-CTLPjpMH.d.cts → index-11MDNKce.d.cts} +1 -1
- package/dist/{index-BvZ1iWm2.d.ts → index-Ci6r4xnN.d.ts} +1 -1
- package/dist/index.cjs +234 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +223 -112
- package/dist/index.js.map +1 -1
- package/dist/mongodb/index.d.cts +2 -2
- package/dist/mongodb/index.d.ts +2 -2
- package/dist/rest/index.d.cts +3 -3
- package/dist/rest/index.d.ts +3 -3
- package/dist/templates/index.cjs +23 -23
- package/dist/templates/index.d.cts +1 -1
- package/dist/templates/index.d.ts +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.d.cts +2 -2
- package/dist/trpc/index.d.ts +2 -2
- package/dist/{types-Bt1OEk0S.d.cts → types-kGfsGdos.d.cts} +10 -10
- package/dist/{types-Bt1OEk0S.d.ts → types-kGfsGdos.d.ts} +10 -10
- package/package.json +4 -4
- package/dist/chunk-KDVDIZ4Y.cjs.map +0 -1
- package/dist/chunk-RONAX6UU.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPNBZZ76A_cjs = require('./chunk-PNBZZ76A.cjs');
|
|
4
4
|
var chunkBLMFBDBG_cjs = require('./chunk-BLMFBDBG.cjs');
|
|
5
5
|
var chunk4M5PHMUE_cjs = require('./chunk-4M5PHMUE.cjs');
|
|
6
6
|
var chunkEWP5AT6A_cjs = require('./chunk-EWP5AT6A.cjs');
|
|
@@ -21,7 +21,7 @@ var stream = require('stream');
|
|
|
21
21
|
var https = require('https');
|
|
22
22
|
var http2 = require('http2');
|
|
23
23
|
var zod = require('zod');
|
|
24
|
-
var bcrypt = require('
|
|
24
|
+
var bcrypt = require('bcryptjs');
|
|
25
25
|
var jwt = require('jsonwebtoken');
|
|
26
26
|
var crypto = require('crypto');
|
|
27
27
|
var path = require('path');
|
|
@@ -649,40 +649,111 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
649
649
|
}
|
|
650
650
|
});
|
|
651
651
|
|
|
652
|
+
// node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js
|
|
653
|
+
var ids, ClientHttp2SessionRef;
|
|
654
|
+
var init_ClientHttp2SessionRef = chunkG7VZBCD6_cjs.__esm({
|
|
655
|
+
"node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js"() {
|
|
656
|
+
ids = new Uint16Array(1);
|
|
657
|
+
ClientHttp2SessionRef = class {
|
|
658
|
+
id = ids[0]++;
|
|
659
|
+
total = 0;
|
|
660
|
+
max = 0;
|
|
661
|
+
session;
|
|
662
|
+
refs = 0;
|
|
663
|
+
constructor(session) {
|
|
664
|
+
session.unref();
|
|
665
|
+
this.session = session;
|
|
666
|
+
}
|
|
667
|
+
retain() {
|
|
668
|
+
if (this.session.destroyed) {
|
|
669
|
+
throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");
|
|
670
|
+
}
|
|
671
|
+
this.refs += 1;
|
|
672
|
+
this.total += 1;
|
|
673
|
+
this.max = Math.max(this.refs, this.max);
|
|
674
|
+
this.session.ref();
|
|
675
|
+
}
|
|
676
|
+
free() {
|
|
677
|
+
if (this.session.destroyed) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
this.refs -= 1;
|
|
681
|
+
if (this.refs === 0) {
|
|
682
|
+
this.session.unref();
|
|
683
|
+
}
|
|
684
|
+
if (this.refs < 0) {
|
|
685
|
+
throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.");
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
deref() {
|
|
689
|
+
return this.session;
|
|
690
|
+
}
|
|
691
|
+
close() {
|
|
692
|
+
if (!this.session.closed) {
|
|
693
|
+
this.session.close();
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
destroy() {
|
|
697
|
+
this.refs = 0;
|
|
698
|
+
if (!this.session.destroyed) {
|
|
699
|
+
this.session.destroy();
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
useCount() {
|
|
703
|
+
return this.refs;
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
|
|
652
709
|
// node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js
|
|
653
710
|
var NodeHttp2ConnectionPool;
|
|
654
711
|
var init_node_http2_connection_pool = chunkG7VZBCD6_cjs.__esm({
|
|
655
712
|
"node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js"() {
|
|
713
|
+
init_ClientHttp2SessionRef();
|
|
656
714
|
NodeHttp2ConnectionPool = class {
|
|
657
715
|
sessions = [];
|
|
716
|
+
maxConcurrency = 0;
|
|
658
717
|
constructor(sessions) {
|
|
659
|
-
this.sessions = sessions ?? [];
|
|
718
|
+
this.sessions = (sessions ?? []).map((session) => new ClientHttp2SessionRef(session));
|
|
660
719
|
}
|
|
661
720
|
poll() {
|
|
662
|
-
|
|
663
|
-
|
|
721
|
+
let cleanup = false;
|
|
722
|
+
for (const session of this.sessions) {
|
|
723
|
+
if (session.deref().destroyed) {
|
|
724
|
+
cleanup = true;
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
if (!this.maxConcurrency || session.useCount() < this.maxConcurrency) {
|
|
728
|
+
return session;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (cleanup) {
|
|
732
|
+
for (const session of this.sessions) {
|
|
733
|
+
if (session.deref().destroyed) {
|
|
734
|
+
this.remove(session);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
664
737
|
}
|
|
665
738
|
}
|
|
666
|
-
offerLast(
|
|
667
|
-
this.sessions.push(
|
|
668
|
-
}
|
|
669
|
-
contains(session) {
|
|
670
|
-
return this.sessions.includes(session);
|
|
739
|
+
offerLast(ref) {
|
|
740
|
+
this.sessions.push(ref);
|
|
671
741
|
}
|
|
672
|
-
remove(
|
|
673
|
-
|
|
742
|
+
remove(ref) {
|
|
743
|
+
const ix = this.sessions.indexOf(ref);
|
|
744
|
+
if (ix > -1) {
|
|
745
|
+
this.sessions.splice(ix, 1);
|
|
746
|
+
}
|
|
674
747
|
}
|
|
675
748
|
[Symbol.iterator]() {
|
|
676
749
|
return this.sessions[Symbol.iterator]();
|
|
677
750
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}
|
|
685
|
-
}
|
|
751
|
+
setMaxConcurrency(maxConcurrency) {
|
|
752
|
+
this.maxConcurrency = maxConcurrency;
|
|
753
|
+
}
|
|
754
|
+
destroy(ref) {
|
|
755
|
+
this.remove(ref);
|
|
756
|
+
ref.destroy();
|
|
686
757
|
}
|
|
687
758
|
};
|
|
688
759
|
}
|
|
@@ -690,26 +761,29 @@ var init_node_http2_connection_pool = chunkG7VZBCD6_cjs.__esm({
|
|
|
690
761
|
var NodeHttp2ConnectionManager;
|
|
691
762
|
var init_node_http2_connection_manager = chunkG7VZBCD6_cjs.__esm({
|
|
692
763
|
"node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js"() {
|
|
764
|
+
init_ClientHttp2SessionRef();
|
|
693
765
|
init_node_http2_connection_pool();
|
|
694
766
|
NodeHttp2ConnectionManager = class {
|
|
767
|
+
config;
|
|
768
|
+
connectionPools = /* @__PURE__ */ new Map();
|
|
695
769
|
constructor(config) {
|
|
696
770
|
this.config = config;
|
|
697
771
|
if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
|
|
698
772
|
throw new RangeError("maxConcurrency must be greater than zero.");
|
|
699
773
|
}
|
|
700
774
|
}
|
|
701
|
-
config;
|
|
702
|
-
sessionCache = /* @__PURE__ */ new Map();
|
|
703
775
|
lease(requestContext, connectionConfiguration) {
|
|
704
776
|
const url = this.getUrlString(requestContext);
|
|
705
|
-
const
|
|
706
|
-
if (
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
709
|
-
|
|
777
|
+
const pool = this.getPool(url);
|
|
778
|
+
if (!this.config.disableConcurrency && !connectionConfiguration.isEventStream) {
|
|
779
|
+
const available = pool.poll();
|
|
780
|
+
if (available) {
|
|
781
|
+
available.retain();
|
|
782
|
+
return available;
|
|
710
783
|
}
|
|
711
784
|
}
|
|
712
|
-
const
|
|
785
|
+
const ref = new ClientHttp2SessionRef(http2__default.default.connect(url));
|
|
786
|
+
const session = ref.deref();
|
|
713
787
|
if (this.config.maxConcurrency) {
|
|
714
788
|
session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
|
|
715
789
|
if (err) {
|
|
@@ -717,47 +791,49 @@ var init_node_http2_connection_manager = chunkG7VZBCD6_cjs.__esm({
|
|
|
717
791
|
}
|
|
718
792
|
});
|
|
719
793
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
794
|
+
const graceful = () => {
|
|
795
|
+
this.removeFromPoolAndClose(url, ref);
|
|
796
|
+
};
|
|
797
|
+
const ensureDestroyed = () => {
|
|
798
|
+
this.removeFromPoolAndCheckedDestroy(url, ref);
|
|
724
799
|
};
|
|
725
|
-
session.on("goaway",
|
|
726
|
-
session.on("error",
|
|
727
|
-
session.on("frameError",
|
|
728
|
-
session.on("close",
|
|
800
|
+
session.on("goaway", graceful);
|
|
801
|
+
session.on("error", ensureDestroyed);
|
|
802
|
+
session.on("frameError", ensureDestroyed);
|
|
803
|
+
session.on("close", ensureDestroyed);
|
|
729
804
|
if (connectionConfiguration.requestTimeout) {
|
|
730
|
-
session.setTimeout(connectionConfiguration.requestTimeout,
|
|
731
|
-
}
|
|
732
|
-
const connectionPool = this.sessionCache.get(url) || new NodeHttp2ConnectionPool();
|
|
733
|
-
connectionPool.offerLast(session);
|
|
734
|
-
this.sessionCache.set(url, connectionPool);
|
|
735
|
-
return session;
|
|
736
|
-
}
|
|
737
|
-
deleteSession(authority, session) {
|
|
738
|
-
const existingConnectionPool = this.sessionCache.get(authority);
|
|
739
|
-
if (!existingConnectionPool) {
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
if (!existingConnectionPool.contains(session)) {
|
|
743
|
-
return;
|
|
805
|
+
session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
|
|
744
806
|
}
|
|
745
|
-
|
|
746
|
-
|
|
807
|
+
pool.offerLast(ref);
|
|
808
|
+
ref.retain();
|
|
809
|
+
return ref;
|
|
810
|
+
}
|
|
811
|
+
release(_requestContext, ref) {
|
|
812
|
+
ref.free();
|
|
747
813
|
}
|
|
748
|
-
|
|
749
|
-
const
|
|
750
|
-
|
|
814
|
+
createIsolatedSession(requestContext, connectionConfiguration) {
|
|
815
|
+
const url = this.getUrlString(requestContext);
|
|
816
|
+
const ref = new ClientHttp2SessionRef(http2__default.default.connect(url));
|
|
817
|
+
const session = ref.deref();
|
|
818
|
+
session.settings({ maxConcurrentStreams: 1 });
|
|
819
|
+
const ensureDestroyed = () => {
|
|
820
|
+
ref.destroy();
|
|
821
|
+
};
|
|
822
|
+
session.on("error", ensureDestroyed);
|
|
823
|
+
session.on("frameError", ensureDestroyed);
|
|
824
|
+
session.on("close", ensureDestroyed);
|
|
825
|
+
if (connectionConfiguration.requestTimeout) {
|
|
826
|
+
session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
|
|
827
|
+
}
|
|
828
|
+
ref.retain();
|
|
829
|
+
return ref;
|
|
751
830
|
}
|
|
752
831
|
destroy() {
|
|
753
|
-
for (const [
|
|
754
|
-
for (const session of connectionPool) {
|
|
755
|
-
|
|
756
|
-
session.destroy();
|
|
757
|
-
}
|
|
758
|
-
connectionPool.remove(session);
|
|
832
|
+
for (const [url, connectionPool] of this.connectionPools) {
|
|
833
|
+
for (const session of [...connectionPool]) {
|
|
834
|
+
session.destroy();
|
|
759
835
|
}
|
|
760
|
-
this.
|
|
836
|
+
this.connectionPools.delete(url);
|
|
761
837
|
}
|
|
762
838
|
}
|
|
763
839
|
setMaxConcurrentStreams(maxConcurrentStreams) {
|
|
@@ -765,10 +841,47 @@ var init_node_http2_connection_manager = chunkG7VZBCD6_cjs.__esm({
|
|
|
765
841
|
throw new RangeError("maxConcurrentStreams must be greater than zero.");
|
|
766
842
|
}
|
|
767
843
|
this.config.maxConcurrency = maxConcurrentStreams;
|
|
844
|
+
for (const pool of this.connectionPools.values()) {
|
|
845
|
+
pool.setMaxConcurrency(maxConcurrentStreams);
|
|
846
|
+
}
|
|
768
847
|
}
|
|
769
848
|
setDisableConcurrentStreams(disableConcurrentStreams) {
|
|
770
849
|
this.config.disableConcurrency = disableConcurrentStreams;
|
|
771
850
|
}
|
|
851
|
+
debug() {
|
|
852
|
+
const pools = {};
|
|
853
|
+
for (const [url, pool] of this.connectionPools) {
|
|
854
|
+
const sessions = [];
|
|
855
|
+
for (const ref of pool) {
|
|
856
|
+
sessions.push({
|
|
857
|
+
id: ref.id,
|
|
858
|
+
active: ref.useCount(),
|
|
859
|
+
maxConcurrent: ref.max,
|
|
860
|
+
totalRequests: ref.total
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
pools[url] = { sessions };
|
|
864
|
+
}
|
|
865
|
+
return pools;
|
|
866
|
+
}
|
|
867
|
+
removeFromPoolAndClose(authority, ref) {
|
|
868
|
+
this.connectionPools.get(authority)?.remove(ref);
|
|
869
|
+
ref.close();
|
|
870
|
+
}
|
|
871
|
+
removeFromPoolAndCheckedDestroy(authority, ref) {
|
|
872
|
+
this.connectionPools.get(authority)?.remove(ref);
|
|
873
|
+
ref.destroy();
|
|
874
|
+
}
|
|
875
|
+
getPool(url) {
|
|
876
|
+
if (!this.connectionPools.has(url)) {
|
|
877
|
+
const pool = new NodeHttp2ConnectionPool();
|
|
878
|
+
if (this.config.maxConcurrency) {
|
|
879
|
+
pool.setMaxConcurrency(this.config.maxConcurrency);
|
|
880
|
+
}
|
|
881
|
+
this.connectionPools.set(url, pool);
|
|
882
|
+
}
|
|
883
|
+
return this.connectionPools.get(url);
|
|
884
|
+
}
|
|
772
885
|
getUrlString(request) {
|
|
773
886
|
return request.destination.toString();
|
|
774
887
|
}
|
|
@@ -809,15 +922,17 @@ var init_node_http2_handler = chunkG7VZBCD6_cjs.__esm({
|
|
|
809
922
|
destroy() {
|
|
810
923
|
this.connectionManager.destroy();
|
|
811
924
|
}
|
|
812
|
-
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
925
|
+
async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
|
|
813
926
|
if (!this.config) {
|
|
814
927
|
this.config = await this.configProvider;
|
|
815
|
-
this.
|
|
816
|
-
|
|
817
|
-
|
|
928
|
+
const { disableConcurrentStreams: disableConcurrentStreams2, maxConcurrentStreams } = this.config;
|
|
929
|
+
this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams2 ?? false);
|
|
930
|
+
if (maxConcurrentStreams) {
|
|
931
|
+
this.connectionManager.setMaxConcurrentStreams(maxConcurrentStreams);
|
|
818
932
|
}
|
|
819
933
|
}
|
|
820
934
|
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
935
|
+
const useIsolatedSession = disableConcurrentStreams || isEventStream;
|
|
821
936
|
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
822
937
|
return new Promise((_resolve, _reject) => {
|
|
823
938
|
let fulfilled = false;
|
|
@@ -845,18 +960,20 @@ var init_node_http2_handler = chunkG7VZBCD6_cjs.__esm({
|
|
|
845
960
|
}
|
|
846
961
|
const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
|
|
847
962
|
const requestContext = { destination: new URL(authority) };
|
|
848
|
-
const
|
|
963
|
+
const connectConfig = {
|
|
849
964
|
requestTimeout: this.config?.sessionTimeout,
|
|
850
|
-
|
|
851
|
-
}
|
|
965
|
+
isEventStream
|
|
966
|
+
};
|
|
967
|
+
const ref = useIsolatedSession ? this.connectionManager.createIsolatedSession(requestContext, connectConfig) : this.connectionManager.lease(requestContext, connectConfig);
|
|
968
|
+
const session = ref.deref();
|
|
852
969
|
const rejectWithDestroy = (err) => {
|
|
853
|
-
if (
|
|
854
|
-
|
|
970
|
+
if (useIsolatedSession) {
|
|
971
|
+
ref.destroy();
|
|
855
972
|
}
|
|
856
973
|
fulfilled = true;
|
|
857
974
|
reject(err);
|
|
858
975
|
};
|
|
859
|
-
const queryString = buildQueryString(query
|
|
976
|
+
const queryString = buildQueryString(query ?? {});
|
|
860
977
|
let path2 = request.path;
|
|
861
978
|
if (queryString) {
|
|
862
979
|
path2 += `?${queryString}`;
|
|
@@ -864,28 +981,14 @@ var init_node_http2_handler = chunkG7VZBCD6_cjs.__esm({
|
|
|
864
981
|
if (request.fragment) {
|
|
865
982
|
path2 += `#${request.fragment}`;
|
|
866
983
|
}
|
|
867
|
-
const
|
|
984
|
+
const clientHttp2Stream = session.request({
|
|
868
985
|
...request.headers,
|
|
869
986
|
[http2.constants.HTTP2_HEADER_PATH]: path2,
|
|
870
987
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
871
988
|
});
|
|
872
|
-
session.ref();
|
|
873
|
-
req.on("response", (headers) => {
|
|
874
|
-
const httpResponse = new HttpResponse({
|
|
875
|
-
statusCode: headers[":status"] || -1,
|
|
876
|
-
headers: getTransformedHeaders(headers),
|
|
877
|
-
body: req
|
|
878
|
-
});
|
|
879
|
-
fulfilled = true;
|
|
880
|
-
resolve({ response: httpResponse });
|
|
881
|
-
if (disableConcurrentStreams) {
|
|
882
|
-
session.close();
|
|
883
|
-
this.connectionManager.deleteSession(authority, session);
|
|
884
|
-
}
|
|
885
|
-
});
|
|
886
989
|
if (effectiveRequestTimeout) {
|
|
887
|
-
|
|
888
|
-
|
|
990
|
+
clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
|
|
991
|
+
clientHttp2Stream.close();
|
|
889
992
|
const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
|
|
890
993
|
timeoutError.name = "TimeoutError";
|
|
891
994
|
rejectWithDestroy(timeoutError);
|
|
@@ -893,35 +996,48 @@ var init_node_http2_handler = chunkG7VZBCD6_cjs.__esm({
|
|
|
893
996
|
}
|
|
894
997
|
if (abortSignal) {
|
|
895
998
|
const onAbort = () => {
|
|
896
|
-
|
|
999
|
+
clientHttp2Stream.close();
|
|
897
1000
|
const abortError = buildAbortError(abortSignal);
|
|
898
1001
|
rejectWithDestroy(abortError);
|
|
899
1002
|
};
|
|
900
1003
|
if (typeof abortSignal.addEventListener === "function") {
|
|
901
1004
|
const signal = abortSignal;
|
|
902
1005
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
903
|
-
|
|
1006
|
+
clientHttp2Stream.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
904
1007
|
} else {
|
|
905
1008
|
abortSignal.onabort = onAbort;
|
|
906
1009
|
}
|
|
907
1010
|
}
|
|
908
|
-
|
|
1011
|
+
clientHttp2Stream.on("frameError", (type, code, id) => {
|
|
909
1012
|
rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
|
|
910
1013
|
});
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${
|
|
1014
|
+
clientHttp2Stream.on("error", rejectWithDestroy);
|
|
1015
|
+
clientHttp2Stream.on("aborted", () => {
|
|
1016
|
+
rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${clientHttp2Stream.rstCode}.`));
|
|
1017
|
+
});
|
|
1018
|
+
clientHttp2Stream.on("response", (headers) => {
|
|
1019
|
+
const httpResponse = new HttpResponse({
|
|
1020
|
+
statusCode: headers[":status"] ?? -1,
|
|
1021
|
+
headers: getTransformedHeaders(headers),
|
|
1022
|
+
body: clientHttp2Stream
|
|
1023
|
+
});
|
|
1024
|
+
fulfilled = true;
|
|
1025
|
+
resolve({ response: httpResponse });
|
|
1026
|
+
if (useIsolatedSession) {
|
|
1027
|
+
session.close();
|
|
1028
|
+
}
|
|
914
1029
|
});
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1030
|
+
clientHttp2Stream.on("close", () => {
|
|
1031
|
+
if (useIsolatedSession) {
|
|
1032
|
+
ref.destroy();
|
|
1033
|
+
} else {
|
|
1034
|
+
this.connectionManager.release(requestContext, ref);
|
|
919
1035
|
}
|
|
920
1036
|
if (!fulfilled) {
|
|
921
1037
|
rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response"));
|
|
922
1038
|
}
|
|
923
1039
|
});
|
|
924
|
-
writeRequestBodyPromise = writeRequestBody(
|
|
1040
|
+
writeRequestBodyPromise = writeRequestBody(clientHttp2Stream, request, effectiveRequestTimeout);
|
|
925
1041
|
});
|
|
926
1042
|
}
|
|
927
1043
|
updateHttpClientConfig(key, value) {
|
|
@@ -936,11 +1052,6 @@ var init_node_http2_handler = chunkG7VZBCD6_cjs.__esm({
|
|
|
936
1052
|
httpHandlerConfigs() {
|
|
937
1053
|
return this.config ?? {};
|
|
938
1054
|
}
|
|
939
|
-
destroySession(session) {
|
|
940
|
-
if (!session.destroyed) {
|
|
941
|
-
session.destroy();
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
1055
|
};
|
|
945
1056
|
}
|
|
946
1057
|
});
|
|
@@ -3604,9 +3715,9 @@ var AuditLogger = class {
|
|
|
3604
3715
|
}
|
|
3605
3716
|
async getUserActivity(userId, limit = 50) {
|
|
3606
3717
|
const key = `${this.prefix}user:${userId}`;
|
|
3607
|
-
const
|
|
3718
|
+
const ids2 = await this.redis.zrange(key, 0, limit - 1);
|
|
3608
3719
|
const logs = [];
|
|
3609
|
-
for (const id of
|
|
3720
|
+
for (const id of ids2) {
|
|
3610
3721
|
const log = await this.get(id);
|
|
3611
3722
|
if (log) logs.push(log);
|
|
3612
3723
|
}
|
|
@@ -3623,8 +3734,8 @@ var AuditLogger = class {
|
|
|
3623
3734
|
let successCount = 0;
|
|
3624
3735
|
const uniqueUsers = /* @__PURE__ */ new Set();
|
|
3625
3736
|
for (const key of keys) {
|
|
3626
|
-
const
|
|
3627
|
-
for (const id of
|
|
3737
|
+
const ids2 = await this.redis.zrange(key, 0, -1);
|
|
3738
|
+
for (const id of ids2) {
|
|
3628
3739
|
const log = await this.get(id);
|
|
3629
3740
|
if (log) {
|
|
3630
3741
|
totalEvents++;
|
|
@@ -6591,10 +6702,10 @@ var MediaService = class _MediaService {
|
|
|
6591
6702
|
const [updated] = await this.db.update(mediaSchema).set({ ...data, updatedAt: /* @__PURE__ */ new Date() }).where(mediaSchema.id.equals(id)).returning();
|
|
6592
6703
|
return updated ? this.rowToMedia(updated) : null;
|
|
6593
6704
|
}
|
|
6594
|
-
async updateMany(
|
|
6705
|
+
async updateMany(ids2, data) {
|
|
6595
6706
|
const now = this.now();
|
|
6596
6707
|
if (this.dialect === "sqlite") {
|
|
6597
|
-
for (const id of
|
|
6708
|
+
for (const id of ids2) {
|
|
6598
6709
|
const sets = ["updated_at = ?"];
|
|
6599
6710
|
const p = [now];
|
|
6600
6711
|
if (data.folder !== void 0) {
|
|
@@ -6609,7 +6720,7 @@ var MediaService = class _MediaService {
|
|
|
6609
6720
|
}
|
|
6610
6721
|
} else {
|
|
6611
6722
|
const { media: mediaSchema } = await (this.dialect === "mysql" ? import('./mysql-media-AI6YK767.cjs') : import('./media-WKP5AOX2.cjs'));
|
|
6612
|
-
for (const id of
|
|
6723
|
+
for (const id of ids2) {
|
|
6613
6724
|
await this.db.update(mediaSchema).set({ ...data, updatedAt: /* @__PURE__ */ new Date() }).where(mediaSchema.id.equals(id));
|
|
6614
6725
|
}
|
|
6615
6726
|
}
|
|
@@ -6722,47 +6833,47 @@ function defineConfig(config) {
|
|
|
6722
6833
|
|
|
6723
6834
|
Object.defineProperty(exports, "allSettingsGlobals", {
|
|
6724
6835
|
enumerable: true,
|
|
6725
|
-
get: function () { return
|
|
6836
|
+
get: function () { return chunkPNBZZ76A_cjs.allSettingsGlobals; }
|
|
6726
6837
|
});
|
|
6727
6838
|
Object.defineProperty(exports, "blogCollections", {
|
|
6728
6839
|
enumerable: true,
|
|
6729
|
-
get: function () { return
|
|
6840
|
+
get: function () { return chunkPNBZZ76A_cjs.blogCollections; }
|
|
6730
6841
|
});
|
|
6731
6842
|
Object.defineProperty(exports, "blogGlobals", {
|
|
6732
6843
|
enumerable: true,
|
|
6733
|
-
get: function () { return
|
|
6844
|
+
get: function () { return chunkPNBZZ76A_cjs.blogGlobals; }
|
|
6734
6845
|
});
|
|
6735
6846
|
Object.defineProperty(exports, "coreSettingsGlobals", {
|
|
6736
6847
|
enumerable: true,
|
|
6737
|
-
get: function () { return
|
|
6848
|
+
get: function () { return chunkPNBZZ76A_cjs.coreSettingsGlobals; }
|
|
6738
6849
|
});
|
|
6739
6850
|
Object.defineProperty(exports, "createTemplateConfig", {
|
|
6740
6851
|
enumerable: true,
|
|
6741
|
-
get: function () { return
|
|
6852
|
+
get: function () { return chunkPNBZZ76A_cjs.createTemplateConfig; }
|
|
6742
6853
|
});
|
|
6743
6854
|
Object.defineProperty(exports, "ecommerceCollections", {
|
|
6744
6855
|
enumerable: true,
|
|
6745
|
-
get: function () { return
|
|
6856
|
+
get: function () { return chunkPNBZZ76A_cjs.ecommerceCollections; }
|
|
6746
6857
|
});
|
|
6747
6858
|
Object.defineProperty(exports, "ecommerceGlobals", {
|
|
6748
6859
|
enumerable: true,
|
|
6749
|
-
get: function () { return
|
|
6860
|
+
get: function () { return chunkPNBZZ76A_cjs.ecommerceGlobals; }
|
|
6750
6861
|
});
|
|
6751
6862
|
Object.defineProperty(exports, "ecommerceSettingsGlobals", {
|
|
6752
6863
|
enumerable: true,
|
|
6753
|
-
get: function () { return
|
|
6864
|
+
get: function () { return chunkPNBZZ76A_cjs.ecommerceSettingsGlobals; }
|
|
6754
6865
|
});
|
|
6755
6866
|
Object.defineProperty(exports, "kitchenSinkCollections", {
|
|
6756
6867
|
enumerable: true,
|
|
6757
|
-
get: function () { return
|
|
6868
|
+
get: function () { return chunkPNBZZ76A_cjs.kitchenSinkCollections; }
|
|
6758
6869
|
});
|
|
6759
6870
|
Object.defineProperty(exports, "mediaCollections", {
|
|
6760
6871
|
enumerable: true,
|
|
6761
|
-
get: function () { return
|
|
6872
|
+
get: function () { return chunkPNBZZ76A_cjs.mediaCollections; }
|
|
6762
6873
|
});
|
|
6763
6874
|
Object.defineProperty(exports, "minimalCollections", {
|
|
6764
6875
|
enumerable: true,
|
|
6765
|
-
get: function () { return
|
|
6876
|
+
get: function () { return chunkPNBZZ76A_cjs.minimalCollections; }
|
|
6766
6877
|
});
|
|
6767
6878
|
Object.defineProperty(exports, "RedisAuthAdapter", {
|
|
6768
6879
|
enumerable: true,
|