@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.d.cts
CHANGED
|
@@ -3,15 +3,15 @@ export { createContext, createCountProcedure, createCreateProcedure, createDelet
|
|
|
3
3
|
import * as graphql from 'graphql';
|
|
4
4
|
import * as hono from 'hono';
|
|
5
5
|
import * as hono_types from 'hono/types';
|
|
6
|
-
import { R as Registry } from './index-
|
|
7
|
-
export { c as createRegistry, g as getRegistry, r as resetRegistry } from './index-
|
|
8
|
-
import { w as BaseAdapter, K as KyroConfig, Q as User, W as Request$1, i as CollectionConfig, G as GlobalConfig, F as Field, x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs, X as Hook } from './types-
|
|
9
|
-
export { Y as ALL_FIELD_TYPES, Z as AccessArgs, _ as AccessControl, $ as AdapterConfig, A as AdminConfig, a as ArrayField, b as AuthConfig, B as BaseField, c as Block, f as BlocksField, a0 as COMPLEX_FIELD_TYPES, C as CheckboxField, g as CodeField, h as CollapsibleField, a1 as CollectionAccess, a2 as CollectionHooks, j as ColorField, a3 as CreateResult, D as DateField, E as EmailField, a4 as FieldAccess, k as FieldAdmin, a5 as FieldHooks, l as FieldType, a6 as GlobalAccess, a7 as GlobalHooks, m as GroupField, a8 as HookArgs, I as ImageField, n as ImageSize, J as JSONField, a9 as LAYOUT_FIELD_TYPES, M as MarkdownField, N as NumberField, aa as PRIMITIVE_FIELD_TYPES, P as PasswordField, v as PluginConfig, ab as RELATIONAL_FIELD_TYPES, R as RadioField, o as RelationshipField, p as RichTextBlock, q as RichTextField, r as RowField, S as SelectField, T as TabsField, s as TextField, t as TextareaField, U as UploadConfig, u as UploadField, ac as ValidateOptions, V as VersionConfig, ad as WhereClause, ae as evaluateAccess, af as getWhereClause, ag as isArrayField, ah as isBlocksField, ai as isGroupField, aj as isImageField, ak as isLayoutField, al as isNumberField, am as isRelationshipField, an as isRichTextField, ao as isSelectField, ap as isTextField, aq as isUploadField, ar as mergeWhereClauses, as as runFieldHooks, at as runHooks } from './types-
|
|
6
|
+
import { R as Registry } from './index-11MDNKce.cjs';
|
|
7
|
+
export { c as createRegistry, g as getRegistry, r as resetRegistry } from './index-11MDNKce.cjs';
|
|
8
|
+
import { w as BaseAdapter, K as KyroConfig, Q as User, W as Request$1, i as CollectionConfig, G as GlobalConfig, F as Field, x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs, X as Hook } from './types-kGfsGdos.cjs';
|
|
9
|
+
export { Y as ALL_FIELD_TYPES, Z as AccessArgs, _ as AccessControl, $ as AdapterConfig, A as AdminConfig, a as ArrayField, b as AuthConfig, B as BaseField, c as Block, f as BlocksField, a0 as COMPLEX_FIELD_TYPES, C as CheckboxField, g as CodeField, h as CollapsibleField, a1 as CollectionAccess, a2 as CollectionHooks, j as ColorField, a3 as CreateResult, D as DateField, E as EmailField, a4 as FieldAccess, k as FieldAdmin, a5 as FieldHooks, l as FieldType, a6 as GlobalAccess, a7 as GlobalHooks, m as GroupField, a8 as HookArgs, I as ImageField, n as ImageSize, J as JSONField, a9 as LAYOUT_FIELD_TYPES, M as MarkdownField, N as NumberField, aa as PRIMITIVE_FIELD_TYPES, P as PasswordField, v as PluginConfig, ab as RELATIONAL_FIELD_TYPES, R as RadioField, o as RelationshipField, p as RichTextBlock, q as RichTextField, r as RowField, S as SelectField, T as TabsField, s as TextField, t as TextareaField, U as UploadConfig, u as UploadField, ac as ValidateOptions, V as VersionConfig, ad as WhereClause, ae as evaluateAccess, af as getWhereClause, ag as isArrayField, ah as isBlocksField, ai as isGroupField, aj as isImageField, ak as isLayoutField, al as isNumberField, am as isRelationshipField, an as isRichTextField, ao as isSelectField, ap as isTextField, aq as isUploadField, ar as mergeWhereClauses, as as runFieldHooks, at as runHooks } from './types-kGfsGdos.cjs';
|
|
10
10
|
import { KyroPubSub, KyroWSServer } from './ws/index.cjs';
|
|
11
11
|
export { PubSub, createWSServer } from './ws/index.cjs';
|
|
12
12
|
import { ZodTypeAny } from 'zod';
|
|
13
13
|
export { z } from 'zod';
|
|
14
|
-
import { A as AbstractBaseAdapter } from './base-
|
|
14
|
+
import { A as AbstractBaseAdapter } from './base-Db9LkB1N.cjs';
|
|
15
15
|
import { Dialect } from './drizzle/index.cjs';
|
|
16
16
|
export { DrizzleAdapter, PostgresAuthAdapter, collectionToDrizzleSchema, createDatabase, createDrizzleAdapter, fieldToDrizzleType, runMigrations, seedDefaultRoles } from './drizzle/index.cjs';
|
|
17
17
|
export { MongoDBAdapter, createMongoDBAdapter } from './mongodb/index.cjs';
|
|
@@ -22,8 +22,8 @@ export { q as AccountLockout, A as AdminStylingConfig, C as CSSGenerator, F as F
|
|
|
22
22
|
import { f as AuthUser, c as AuthAdapter, a as AuditLog, b as AuditLogFilter, U as UserRole, S as Session, e as AuthTokenConfig, R as RegisterData, d as AuthResult, L as LoginCredentials, J as JWTPayload } from './types-BSR91JFN.cjs';
|
|
23
23
|
export { A as AuditAction, g as AuditLogger, h as createAuditContext } from './types-BSR91JFN.cjs';
|
|
24
24
|
import Database from 'better-sqlite3';
|
|
25
|
-
import { W as WebhookPayload, a as WebhookDelivery, b as WebhookConfig } from './WebhookService-
|
|
26
|
-
export { A as ALL_WEBHOOK_EVENTS, C as CreateWebhookData, U as UpdateWebhookData, c as WEBHOOK_COLLECTION, d as WEBHOOK_DELIVERY_COLLECTION, e as WEBHOOK_EVENTS, f as WebhookEvent, g as WebhookService, h as WebhookTriggerResult, i as createWebhookService } from './WebhookService-
|
|
25
|
+
import { W as WebhookPayload, a as WebhookDelivery, b as WebhookConfig } from './WebhookService-mZZ75syh.cjs';
|
|
26
|
+
export { A as ALL_WEBHOOK_EVENTS, C as CreateWebhookData, U as UpdateWebhookData, c as WEBHOOK_COLLECTION, d as WEBHOOK_DELIVERY_COLLECTION, e as WEBHOOK_EVENTS, f as WebhookEvent, g as WebhookService, h as WebhookTriggerResult, i as createWebhookService } from './WebhookService-mZZ75syh.cjs';
|
|
27
27
|
export { TemplateConfig, allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals, createTemplateConfig, ecommerceCollections, ecommerceGlobals, ecommerceSettingsGlobals, kitchenSinkCollections, mediaCollections, minimalCollections } from './templates/index.cjs';
|
|
28
28
|
import 'ws';
|
|
29
29
|
import 'drizzle-orm/postgres-js';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,15 @@ export { createContext, createCountProcedure, createCreateProcedure, createDelet
|
|
|
3
3
|
import * as graphql from 'graphql';
|
|
4
4
|
import * as hono from 'hono';
|
|
5
5
|
import * as hono_types from 'hono/types';
|
|
6
|
-
import { R as Registry } from './index-
|
|
7
|
-
export { c as createRegistry, g as getRegistry, r as resetRegistry } from './index-
|
|
8
|
-
import { w as BaseAdapter, K as KyroConfig, Q as User, W as Request$1, i as CollectionConfig, G as GlobalConfig, F as Field, x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs, X as Hook } from './types-
|
|
9
|
-
export { Y as ALL_FIELD_TYPES, Z as AccessArgs, _ as AccessControl, $ as AdapterConfig, A as AdminConfig, a as ArrayField, b as AuthConfig, B as BaseField, c as Block, f as BlocksField, a0 as COMPLEX_FIELD_TYPES, C as CheckboxField, g as CodeField, h as CollapsibleField, a1 as CollectionAccess, a2 as CollectionHooks, j as ColorField, a3 as CreateResult, D as DateField, E as EmailField, a4 as FieldAccess, k as FieldAdmin, a5 as FieldHooks, l as FieldType, a6 as GlobalAccess, a7 as GlobalHooks, m as GroupField, a8 as HookArgs, I as ImageField, n as ImageSize, J as JSONField, a9 as LAYOUT_FIELD_TYPES, M as MarkdownField, N as NumberField, aa as PRIMITIVE_FIELD_TYPES, P as PasswordField, v as PluginConfig, ab as RELATIONAL_FIELD_TYPES, R as RadioField, o as RelationshipField, p as RichTextBlock, q as RichTextField, r as RowField, S as SelectField, T as TabsField, s as TextField, t as TextareaField, U as UploadConfig, u as UploadField, ac as ValidateOptions, V as VersionConfig, ad as WhereClause, ae as evaluateAccess, af as getWhereClause, ag as isArrayField, ah as isBlocksField, ai as isGroupField, aj as isImageField, ak as isLayoutField, al as isNumberField, am as isRelationshipField, an as isRichTextField, ao as isSelectField, ap as isTextField, aq as isUploadField, ar as mergeWhereClauses, as as runFieldHooks, at as runHooks } from './types-
|
|
6
|
+
import { R as Registry } from './index-Ci6r4xnN.js';
|
|
7
|
+
export { c as createRegistry, g as getRegistry, r as resetRegistry } from './index-Ci6r4xnN.js';
|
|
8
|
+
import { w as BaseAdapter, K as KyroConfig, Q as User, W as Request$1, i as CollectionConfig, G as GlobalConfig, F as Field, x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs, X as Hook } from './types-kGfsGdos.js';
|
|
9
|
+
export { Y as ALL_FIELD_TYPES, Z as AccessArgs, _ as AccessControl, $ as AdapterConfig, A as AdminConfig, a as ArrayField, b as AuthConfig, B as BaseField, c as Block, f as BlocksField, a0 as COMPLEX_FIELD_TYPES, C as CheckboxField, g as CodeField, h as CollapsibleField, a1 as CollectionAccess, a2 as CollectionHooks, j as ColorField, a3 as CreateResult, D as DateField, E as EmailField, a4 as FieldAccess, k as FieldAdmin, a5 as FieldHooks, l as FieldType, a6 as GlobalAccess, a7 as GlobalHooks, m as GroupField, a8 as HookArgs, I as ImageField, n as ImageSize, J as JSONField, a9 as LAYOUT_FIELD_TYPES, M as MarkdownField, N as NumberField, aa as PRIMITIVE_FIELD_TYPES, P as PasswordField, v as PluginConfig, ab as RELATIONAL_FIELD_TYPES, R as RadioField, o as RelationshipField, p as RichTextBlock, q as RichTextField, r as RowField, S as SelectField, T as TabsField, s as TextField, t as TextareaField, U as UploadConfig, u as UploadField, ac as ValidateOptions, V as VersionConfig, ad as WhereClause, ae as evaluateAccess, af as getWhereClause, ag as isArrayField, ah as isBlocksField, ai as isGroupField, aj as isImageField, ak as isLayoutField, al as isNumberField, am as isRelationshipField, an as isRichTextField, ao as isSelectField, ap as isTextField, aq as isUploadField, ar as mergeWhereClauses, as as runFieldHooks, at as runHooks } from './types-kGfsGdos.js';
|
|
10
10
|
import { KyroPubSub, KyroWSServer } from './ws/index.js';
|
|
11
11
|
export { PubSub, createWSServer } from './ws/index.js';
|
|
12
12
|
import { ZodTypeAny } from 'zod';
|
|
13
13
|
export { z } from 'zod';
|
|
14
|
-
import { A as AbstractBaseAdapter } from './base-
|
|
14
|
+
import { A as AbstractBaseAdapter } from './base-Hu6ij8sZ.js';
|
|
15
15
|
import { Dialect } from './drizzle/index.js';
|
|
16
16
|
export { DrizzleAdapter, PostgresAuthAdapter, collectionToDrizzleSchema, createDatabase, createDrizzleAdapter, fieldToDrizzleType, runMigrations, seedDefaultRoles } from './drizzle/index.js';
|
|
17
17
|
export { MongoDBAdapter, createMongoDBAdapter } from './mongodb/index.js';
|
|
@@ -22,8 +22,8 @@ export { q as AccountLockout, A as AdminStylingConfig, C as CSSGenerator, F as F
|
|
|
22
22
|
import { f as AuthUser, c as AuthAdapter, a as AuditLog, b as AuditLogFilter, U as UserRole, S as Session, e as AuthTokenConfig, R as RegisterData, d as AuthResult, L as LoginCredentials, J as JWTPayload } from './types-BSR91JFN.js';
|
|
23
23
|
export { A as AuditAction, g as AuditLogger, h as createAuditContext } from './types-BSR91JFN.js';
|
|
24
24
|
import Database from 'better-sqlite3';
|
|
25
|
-
import { W as WebhookPayload, a as WebhookDelivery, b as WebhookConfig } from './WebhookService-
|
|
26
|
-
export { A as ALL_WEBHOOK_EVENTS, C as CreateWebhookData, U as UpdateWebhookData, c as WEBHOOK_COLLECTION, d as WEBHOOK_DELIVERY_COLLECTION, e as WEBHOOK_EVENTS, f as WebhookEvent, g as WebhookService, h as WebhookTriggerResult, i as createWebhookService } from './WebhookService-
|
|
25
|
+
import { W as WebhookPayload, a as WebhookDelivery, b as WebhookConfig } from './WebhookService-BznDc2AT.js';
|
|
26
|
+
export { A as ALL_WEBHOOK_EVENTS, C as CreateWebhookData, U as UpdateWebhookData, c as WEBHOOK_COLLECTION, d as WEBHOOK_DELIVERY_COLLECTION, e as WEBHOOK_EVENTS, f as WebhookEvent, g as WebhookService, h as WebhookTriggerResult, i as createWebhookService } from './WebhookService-BznDc2AT.js';
|
|
27
27
|
export { TemplateConfig, allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals, createTemplateConfig, ecommerceCollections, ecommerceGlobals, ecommerceSettingsGlobals, kitchenSinkCollections, mediaCollections, minimalCollections } from './templates/index.js';
|
|
28
28
|
import 'ws';
|
|
29
29
|
import 'drizzle-orm/postgres-js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals, createTemplateConfig, ecommerceCollections, ecommerceGlobals, ecommerceSettingsGlobals, kitchenSinkCollections, mediaCollections, minimalCollections } from './chunk-
|
|
1
|
+
export { allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals, createTemplateConfig, ecommerceCollections, ecommerceGlobals, ecommerceSettingsGlobals, kitchenSinkCollections, mediaCollections, minimalCollections } from './chunk-KB6QF4HO.js';
|
|
2
2
|
export { RedisAuthAdapter } from './chunk-GLCPGZPM.js';
|
|
3
3
|
import { PasswordPolicy, SQLiteAuthAdapter } from './chunk-RRYXQMZG.js';
|
|
4
4
|
export { PasswordPolicy, SQLiteAuthAdapter, autoBootstrap, bootstrapAdmin, getBootstrapFromEnv } from './chunk-RRYXQMZG.js';
|
|
@@ -29,7 +29,7 @@ import { Agent, request } from 'https';
|
|
|
29
29
|
import http2, { constants } from 'http2';
|
|
30
30
|
import { z } from 'zod';
|
|
31
31
|
export { z } from 'zod';
|
|
32
|
-
import bcrypt from '
|
|
32
|
+
import bcrypt from 'bcryptjs';
|
|
33
33
|
import jwt from 'jsonwebtoken';
|
|
34
34
|
import { randomBytes, createHash } from 'crypto';
|
|
35
35
|
import path, { join, basename, extname } from '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 = __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 = __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 = __esm({
|
|
|
690
761
|
var NodeHttp2ConnectionManager;
|
|
691
762
|
var init_node_http2_connection_manager = __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.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 = __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,
|
|
805
|
+
session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
|
|
731
806
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
const existingConnectionPool = this.sessionCache.get(authority);
|
|
739
|
-
if (!existingConnectionPool) {
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
if (!existingConnectionPool.contains(session)) {
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
existingConnectionPool.remove(session);
|
|
746
|
-
this.sessionCache.set(authority, existingConnectionPool);
|
|
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.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 = __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 = __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 = __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 = __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
|
[constants.HTTP2_HEADER_PATH]: path2,
|
|
870
987
|
[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 = __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}.`));
|
|
914
1017
|
});
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
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
|
+
}
|
|
1029
|
+
});
|
|
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 = __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-CDZUS7YX.js') : import('./media-HOT3O7RW.js'));
|
|
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
|
}
|