@appweaver/core 1.1.4 → 1.1.6
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/memory/in-memory.js +10 -6
- package/package.json +7 -7
- package/prisma/client/internal/class.d.ts +2 -2
- package/prisma/client/internal/class.js +2 -2
- package/prisma/client/internal/prismaNamespace.d.ts +68 -17
- package/prisma/client/internal/prismaNamespace.js +4 -4
- package/resource/resource-service.js +6 -4
- package/server/create-server.js +2 -2
package/memory/in-memory.js
CHANGED
|
@@ -53,7 +53,11 @@ class InMemory extends common_1.Memory {
|
|
|
53
53
|
// is below the configured value
|
|
54
54
|
if (this._maxSizeBytes) {
|
|
55
55
|
while (this._approximatedSize > this._maxSizeBytes) {
|
|
56
|
-
|
|
56
|
+
const oldestKey = this._storage.keys().next().value;
|
|
57
|
+
if (oldestKey === undefined) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
await this.removeValue(oldestKey);
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
return true;
|
|
@@ -62,12 +66,12 @@ class InMemory extends common_1.Memory {
|
|
|
62
66
|
return this._storage.has(key);
|
|
63
67
|
}
|
|
64
68
|
async removeValue(key) {
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
69
|
+
const entry = this._storage.get(key);
|
|
70
|
+
if (!entry) {
|
|
67
71
|
return false;
|
|
68
72
|
}
|
|
69
73
|
const deleted = this._storage.delete(key);
|
|
70
|
-
this._approximatedSize -= Buffer.byteLength(
|
|
74
|
+
this._approximatedSize -= Buffer.byteLength(entry.value, 'utf8');
|
|
71
75
|
if (this._approximatedSize < 0) {
|
|
72
76
|
this._approximatedSize = 0;
|
|
73
77
|
}
|
|
@@ -146,14 +150,14 @@ class InMemory extends common_1.Memory {
|
|
|
146
150
|
async cleanupExpired() {
|
|
147
151
|
const now = Date.now();
|
|
148
152
|
// Clean up expired storage entries
|
|
149
|
-
for (const key
|
|
153
|
+
for (const key of Array.from(this._storage.keys())) {
|
|
150
154
|
const entry = this._storage.get(key);
|
|
151
155
|
if (entry && entry.expiresAt && entry.expiresAt < now) {
|
|
152
156
|
await this.removeValue(key);
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
// Clean up expired locks
|
|
156
|
-
for (const key
|
|
160
|
+
for (const key of Array.from(this._locks.keys())) {
|
|
157
161
|
const lock = this._locks.get(key);
|
|
158
162
|
if (lock && lock.expiresAt < now) {
|
|
159
163
|
this._locks.delete(key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appweaver/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Appweaver - the backend framework for AI-first development (@core)",
|
|
5
5
|
"author": "Luka Matosevic",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@fastify/oauth2": "8.2.0",
|
|
39
39
|
"@fastify/rate-limit": "11.0.0",
|
|
40
40
|
"@fastify/request-context": "7.0.0",
|
|
41
|
-
"@fastify/static": "
|
|
41
|
+
"@fastify/static": "10.1.2",
|
|
42
42
|
"@fastify/swagger": "9.7.0",
|
|
43
|
-
"@fastify/swagger-ui": "6.
|
|
43
|
+
"@fastify/swagger-ui": "6.1.1",
|
|
44
44
|
"@fastify/type-provider-typebox": "6.1.0",
|
|
45
45
|
"@sinclair/typebox": "0.34.49",
|
|
46
46
|
"bcrypt": "6.0.0",
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@appweaver/common": "^1.0.0",
|
|
56
|
-
"@prisma/adapter-better-sqlite3": "7.
|
|
57
|
-
"@prisma/client": "7.
|
|
56
|
+
"@prisma/adapter-better-sqlite3": "7.9.1",
|
|
57
|
+
"@prisma/client": "7.9.1",
|
|
58
58
|
"bullmq": "5.79.1",
|
|
59
59
|
"cron": "4.4.0",
|
|
60
60
|
"ioredis": "5.11.1",
|
|
61
61
|
"nodemailer": "9.0.1",
|
|
62
|
-
"prisma": "7.
|
|
62
|
+
"prisma": "7.9.1",
|
|
63
63
|
"rimraf": "6.1.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@appweaver/common": "^1.0.0",
|
|
67
|
-
"@prisma/client": "^7.
|
|
67
|
+
"@prisma/client": "^7.9.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -19,7 +19,7 @@ export interface PrismaClientConstructor {
|
|
|
19
19
|
*/
|
|
20
20
|
new <Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions, LogOpts extends LogOptions<Options> = LogOptions<Options>, OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {
|
|
21
21
|
omit: infer U;
|
|
22
|
-
} ? U : Prisma.PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs>(options: Prisma.
|
|
22
|
+
} ? U : Prisma.PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs>(options: Prisma.PrismaClientConstructorArgs<Options>): PrismaClient<LogOpts, OmitOpts, ExtArgs>;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* ## Prisma Client
|
|
@@ -36,7 +36,7 @@ export interface PrismaClientConstructor {
|
|
|
36
36
|
*
|
|
37
37
|
* Read more in our [docs](https://pris.ly/d/client).
|
|
38
38
|
*/
|
|
39
|
-
export interface PrismaClient<in LogOpts extends Prisma.LogLevel = never, in out OmitOpts extends Prisma.PrismaClientOptions['omit'] =
|
|
39
|
+
export interface PrismaClient<in LogOpts extends Prisma.LogLevel = never, in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = Prisma.PrismaClientOptions['omit'], in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> {
|
|
40
40
|
[K: symbol]: {
|
|
41
41
|
types: Prisma.TypeMap<ExtArgs>['other'];
|
|
42
42
|
};
|
|
@@ -48,8 +48,8 @@ exports.getPrismaClientClass = getPrismaClientClass;
|
|
|
48
48
|
const runtime = __importStar(require("@prisma/client/runtime/client"));
|
|
49
49
|
const config = {
|
|
50
50
|
"previewFeatures": [],
|
|
51
|
-
"clientVersion": "7.
|
|
52
|
-
"engineVersion": "
|
|
51
|
+
"clientVersion": "7.9.1",
|
|
52
|
+
"engineVersion": "e922089b7d7502aff4249d5da3420f6fa55fc6ad",
|
|
53
53
|
"activeProvider": "sqlite",
|
|
54
54
|
"inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Generated by Appweaver. Please do not edit this file manually.\n\ndatasource db {\n provider = \"sqlite\"\n}\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"./client\"\n}\n\nmodel ApiKey {\n id Int @id @default(autoincrement())\n key String\n keyHash String @unique\n name String?\n description String?\n enabled Boolean @default(true)\n expiresAt DateTime?\n\n /// Audit columns\n updatedAt DateTime @updatedAt\n createdAt DateTime @default(now())\n}\n\nmodel OneTimeToken {\n id Int @id @default(autoincrement())\n tokenHash String\n purpose String\n expiresAt DateTime\n data Json\n\n /// Audit columns\n updatedAt DateTime @updatedAt\n createdAt DateTime @default(now())\n\n @@index([tokenHash, purpose])\n}\n\nmodel Permission {\n id Int @id @default(autoincrement())\n name String @unique\n\n /// Related columns\n roles Role[] @relation(\"RolePermissionsPermission\")\n\n /// Audit columns\n updatedAt DateTime @updatedAt\n createdAt DateTime @default(now())\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @unique\n\n /// Related columns\n permissions Permission[] @relation(\"RolePermissionsPermission\")\n\n /// Audit columns\n updatedAt DateTime @updatedAt\n createdAt DateTime @default(now())\n}\n\nmodel Seeder {\n id String @id @default(uuid())\n checksum String\n seederName String @unique\n startedAt DateTime\n finishedAt DateTime\n logs String?\n\n @@map(\"_seeders\")\n}\n\nmodel File {\n id Int @id @default(autoincrement())\n name String @unique\n originalName String\n mimeType String\n sizeBytes Int\n checksum String\n title String?\n description String?\n resourceField String?\n resourceName String?\n resourceId Int?\n\n /// Audit columns\n updatedAt DateTime @updatedAt\n createdAt DateTime @default(now())\n\n @@index([resourceField, resourceName, resourceId])\n}\n",
|
|
55
55
|
"runtimeDataModel": {
|
|
@@ -46,8 +46,8 @@ export type PrismaVersion = {
|
|
|
46
46
|
engine: string;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
* Prisma Client JS version: 7.
|
|
50
|
-
* Query Engine version:
|
|
49
|
+
* Prisma Client JS version: 7.9.1
|
|
50
|
+
* Query Engine version: e922089b7d7502aff4249d5da3420f6fa55fc6ad
|
|
51
51
|
*/
|
|
52
52
|
export declare const prismaVersion: PrismaVersion;
|
|
53
53
|
/**
|
|
@@ -105,6 +105,19 @@ export type Enumerable<T> = T | Array<T>;
|
|
|
105
105
|
export type Subset<T, U> = {
|
|
106
106
|
[key in keyof T]: key extends keyof U ? T[key] : never;
|
|
107
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* Resolved type of the argument passed to the `PrismaClient` constructor.
|
|
110
|
+
*
|
|
111
|
+
* When called without a narrower options type (the common case), this resolves
|
|
112
|
+
* to `PrismaClientOptions` directly, which produces a clear TypeScript error
|
|
113
|
+
* message (`not assignable to parameter of type 'PrismaClientOptions'`) when
|
|
114
|
+
* the argument is missing or incomplete. When the user supplies a narrower
|
|
115
|
+
* options type (e.g. via a literal), it falls back to `Subset` to keep
|
|
116
|
+
* filtering out unknown properties.
|
|
117
|
+
*/
|
|
118
|
+
export type PrismaClientConstructorArgs<Options extends PrismaClientOptions> = [
|
|
119
|
+
PrismaClientOptions
|
|
120
|
+
] extends [Options] ? PrismaClientOptions : Subset<Options, PrismaClientOptions>;
|
|
108
121
|
/**
|
|
109
122
|
* SelectSubset
|
|
110
123
|
* @desc From `T` pick properties that exist in `U`. Simple version of Intersection.
|
|
@@ -127,7 +140,7 @@ type Without<T, U> = {
|
|
|
127
140
|
* XOR is needed to have a real mutually exclusive union type
|
|
128
141
|
* https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types
|
|
129
142
|
*/
|
|
130
|
-
export type XOR<T, U> = T extends object ? U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : U : T;
|
|
143
|
+
export type XOR<T, U> = T extends object ? U extends object ? ((Without<T, U> & U) | (Without<U, T> & T)) & object : U : T;
|
|
131
144
|
/**
|
|
132
145
|
* Is T a Record?
|
|
133
146
|
*/
|
|
@@ -854,19 +867,10 @@ export type BatchPayload = {
|
|
|
854
867
|
export declare const defineExtension: runtime.Types.Extensions.ExtendsHook<"define", TypeMapCb, runtime.Types.Extensions.DefaultArgs>;
|
|
855
868
|
export type DefaultPrismaClient = PrismaClient;
|
|
856
869
|
export type ErrorFormat = 'pretty' | 'colorless' | 'minimal';
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
adapter: runtime.SqlDriverAdapterFactory;
|
|
862
|
-
accelerateUrl?: never;
|
|
863
|
-
} | {
|
|
864
|
-
/**
|
|
865
|
-
* Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database.
|
|
866
|
-
*/
|
|
867
|
-
accelerateUrl: string;
|
|
868
|
-
adapter?: never;
|
|
869
|
-
}) & {
|
|
870
|
+
/**
|
|
871
|
+
* Options common to all variants of `PrismaClientOptions`, regardless of whether you connect to your database through a driver adapter or through Prisma Accelerate.
|
|
872
|
+
*/
|
|
873
|
+
export interface PrismaClientBaseOptions {
|
|
870
874
|
/**
|
|
871
875
|
* @default "colorless"
|
|
872
876
|
*/
|
|
@@ -952,7 +956,54 @@ export type PrismaClientOptions = ({
|
|
|
952
956
|
* ```
|
|
953
957
|
*/
|
|
954
958
|
queryPlanCacheMaxSize?: number;
|
|
955
|
-
}
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* `PrismaClient` options for connecting to your database through Prisma Accelerate instead of a driver adapter.
|
|
962
|
+
*
|
|
963
|
+
* Learn more: https://pris.ly/d/accelerate
|
|
964
|
+
*/
|
|
965
|
+
export interface PrismaClientOptionsWithAccelerateUrl extends PrismaClientBaseOptions {
|
|
966
|
+
/**
|
|
967
|
+
* The Prisma Accelerate connection URL. Use this option to connect to your database through Prisma Accelerate instead of using a driver adapter to connect directly.
|
|
968
|
+
*
|
|
969
|
+
* Learn more: https://pris.ly/d/accelerate
|
|
970
|
+
*/
|
|
971
|
+
accelerateUrl: string;
|
|
972
|
+
adapter?: never;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* `PrismaClient` options for connecting to your database through a driver adapter. This is the common case in Prisma 7.
|
|
976
|
+
*
|
|
977
|
+
* Learn more: https://pris.ly/d/driver-adapters
|
|
978
|
+
*/
|
|
979
|
+
export interface PrismaClientOptionsWithAdapter extends PrismaClientBaseOptions {
|
|
980
|
+
/**
|
|
981
|
+
* A driver adapter that PrismaClient uses to connect to your database, such as the ones provided by `@prisma/adapter-pg`, `@prisma/adapter-libsql`, `@prisma/adapter-planetscale`, etc.
|
|
982
|
+
*
|
|
983
|
+
* A driver adapter is **required** unless you connect to your database through Prisma Accelerate (in which case use `accelerateUrl` instead).
|
|
984
|
+
*
|
|
985
|
+
* Learn more: https://pris.ly/d/driver-adapters
|
|
986
|
+
*
|
|
987
|
+
* @example
|
|
988
|
+
* ```ts
|
|
989
|
+
* import { PrismaPg } from '@prisma/adapter-pg'
|
|
990
|
+
* import { PrismaClient } from './generated/prisma/client'
|
|
991
|
+
*
|
|
992
|
+
* const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
|
|
993
|
+
* const prisma = new PrismaClient({ adapter })
|
|
994
|
+
* ```
|
|
995
|
+
*/
|
|
996
|
+
adapter: runtime.SqlDriverAdapterFactory;
|
|
997
|
+
accelerateUrl?: never;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Options passed to the `PrismaClient` constructor.
|
|
1001
|
+
*
|
|
1002
|
+
* A driver adapter (or, alternatively, a Prisma Accelerate URL) is **required**. See {@link PrismaClientOptionsWithAdapter} and {@link PrismaClientOptionsWithAccelerateUrl} for the two variants. All other properties live in {@link PrismaClientBaseOptions} and are optional.
|
|
1003
|
+
*
|
|
1004
|
+
* Learn more about driver adapters: https://pris.ly/d/driver-adapters
|
|
1005
|
+
*/
|
|
1006
|
+
export type PrismaClientOptions = PrismaClientOptionsWithAccelerateUrl | PrismaClientOptionsWithAdapter;
|
|
956
1007
|
export type GlobalOmitConfig = {
|
|
957
1008
|
apiKey?: Prisma.ApiKeyOmit;
|
|
958
1009
|
oneTimeToken?: Prisma.OneTimeTokenOmit;
|
|
@@ -72,12 +72,12 @@ exports.Sql = runtime.Sql;
|
|
|
72
72
|
exports.Decimal = runtime.Decimal;
|
|
73
73
|
exports.getExtensionContext = runtime.Extensions.getExtensionContext;
|
|
74
74
|
/**
|
|
75
|
-
* Prisma Client JS version: 7.
|
|
76
|
-
* Query Engine version:
|
|
75
|
+
* Prisma Client JS version: 7.9.1
|
|
76
|
+
* Query Engine version: e922089b7d7502aff4249d5da3420f6fa55fc6ad
|
|
77
77
|
*/
|
|
78
78
|
exports.prismaVersion = {
|
|
79
|
-
client: "7.
|
|
80
|
-
engine: "
|
|
79
|
+
client: "7.9.1",
|
|
80
|
+
engine: "e922089b7d7502aff4249d5da3420f6fa55fc6ad"
|
|
81
81
|
};
|
|
82
82
|
exports.NullTypes = {
|
|
83
83
|
DbNull: runtime.NullTypes.DbNull,
|
|
@@ -507,8 +507,10 @@ class ResourceService {
|
|
|
507
507
|
relationSchema?.type === 'array' ||
|
|
508
508
|
fileSchema?.type === 'array';
|
|
509
509
|
const isArrayValue = (0, common_1.isArray)(value);
|
|
510
|
-
// Recursively map nested objects and handle arrays of objects
|
|
511
|
-
|
|
510
|
+
// Recursively map nested objects and handle arrays of objects. Arrays of
|
|
511
|
+
// plain values are mapped below as inclusion, range or relation filters.
|
|
512
|
+
if (((0, common_1.isObject)(value) && !isArrayValue) ||
|
|
513
|
+
(isArrayValue && (0, common_1.isObject)(value[0]))) {
|
|
512
514
|
const resourceName = (0, common_1.extractResourceName)(relationSchema ?? fileSchema);
|
|
513
515
|
if (resourceName) {
|
|
514
516
|
queryFilter[key] = isArrayValue
|
|
@@ -685,8 +687,8 @@ class ResourceService {
|
|
|
685
687
|
}
|
|
686
688
|
// Map relation disconnects if unique keys are no longer present or the
|
|
687
689
|
// new value is null. Delete relations if orphanRemoval is set to true.
|
|
688
|
-
//
|
|
689
|
-
//
|
|
690
|
+
// Relations that are not set on the current resource are left untouched,
|
|
691
|
+
// so no relation action is applied for them.
|
|
690
692
|
if (action === 'update') {
|
|
691
693
|
const currentValue = currentData[key];
|
|
692
694
|
const removalMethod = config?.orphanRemoval ? 'delete' : 'disconnect';
|
package/server/create-server.js
CHANGED
|
@@ -88,10 +88,10 @@ function createServer() {
|
|
|
88
88
|
constraints: common_1.config.SERVER_STATIC_ALLOWED_HOST
|
|
89
89
|
? { host: common_1.config.SERVER_STATIC_ALLOWED_HOST }
|
|
90
90
|
: {},
|
|
91
|
-
setHeaders: (
|
|
91
|
+
setHeaders: (reply) => {
|
|
92
92
|
for (const header of common_1.config.SERVER_STATIC_RESPONSE_HEADERS) {
|
|
93
93
|
const [name, ...valueParts] = header.split(':');
|
|
94
|
-
|
|
94
|
+
reply.header(name.trim(), valueParts.join(':').trim());
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
});
|