@graphoria/server 0.2.0 → 0.2.2
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/src/ai/agent/providers/ollama.d.ts.map +1 -1
- package/dist/src/ai/mcp/create-server.d.ts.map +1 -1
- package/dist/src/ai/mcp/index.d.ts +5 -2
- package/dist/src/ai/mcp/index.d.ts.map +1 -1
- package/dist/src/ai/tools/agent.d.ts.map +1 -1
- package/dist/src/ai/tools/core.d.ts.map +1 -1
- package/dist/src/ai/tools/query-data.d.ts +2 -2
- package/dist/src/ai/tools/query-data.d.ts.map +1 -1
- package/dist/src/analyzeQuery/analyzers/fragmentAnalyzer.d.ts.map +1 -1
- package/dist/src/analyzeQuery/analyzers/operationAnalyzer.d.ts.map +1 -1
- package/dist/src/analyzeQuery/analyzers/selectionAnalyzer.d.ts.map +1 -1
- package/dist/src/analyzeQuery/analyzers/variableAnalyzer.d.ts.map +1 -1
- package/dist/src/analyzeQuery/depthLimit.d.ts.map +1 -1
- package/dist/src/analyzeQuery/directiveUtils.d.ts.map +1 -1
- package/dist/src/analyzeQuery/resolveVariables.d.ts +17 -2
- package/dist/src/analyzeQuery/resolveVariables.d.ts.map +1 -1
- package/dist/src/analyzeQuery/typeUtils.d.ts.map +1 -1
- package/dist/src/analyzeQuery/valueExtractors.d.ts.map +1 -1
- package/dist/src/authentication/duration.d.ts.map +1 -1
- package/dist/src/authentication/index.d.ts.map +1 -1
- package/dist/src/authentication/jwt.d.ts.map +1 -1
- package/dist/src/authentication/paseto.d.ts.map +1 -1
- package/dist/src/authentication/tokenRepository.d.ts +2 -1
- package/dist/src/authentication/tokenRepository.d.ts.map +1 -1
- package/dist/src/cli/seedAuth.d.ts.map +1 -1
- package/dist/src/cli/seedAuthArgs.d.ts.map +1 -1
- package/dist/src/config/helpers/cronHelper.d.ts.map +1 -1
- package/dist/src/config/helpers/operationHelper.d.ts +1 -1
- package/dist/src/config/helpers/operationHelper.d.ts.map +1 -1
- package/dist/src/config/helpers/queueHelper.d.ts.map +1 -1
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/types/auth.d.ts +11 -5
- package/dist/src/config/types/auth.d.ts.map +1 -1
- package/dist/src/config/types/auth.test.d.ts +2 -0
- package/dist/src/config/types/auth.test.d.ts.map +1 -0
- package/dist/src/config/types/db.d.ts +36 -20
- package/dist/src/config/types/db.d.ts.map +1 -1
- package/dist/src/config/types/operation.d.ts +6 -6
- package/dist/src/config/types/queue.d.ts +4 -4
- package/dist/src/configuration/getSchemas/index.d.ts +109 -103
- package/dist/src/configuration/getSchemas/index.d.ts.map +1 -1
- package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts +59 -50
- package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts.map +1 -1
- package/dist/src/configuration/getSchemas/type-definition-generator/index.d.ts.map +1 -1
- package/dist/src/configuration/gql/buildExecute.d.ts.map +1 -1
- package/dist/src/configuration/gql/gqlAuthOperations.d.ts.map +1 -1
- package/dist/src/configuration/gql/handleGraphQLRequestFactory.d.ts.map +1 -1
- package/dist/src/configuration/gql/handleGraphQLSubscriptionFactory.d.ts.map +1 -1
- package/dist/src/configuration/index.d.ts +100 -95
- package/dist/src/configuration/index.d.ts.map +1 -1
- package/dist/src/configuration/rest/generateOpenAPI.d.ts.map +1 -1
- package/dist/src/configuration/rest/handleRESTRequestFactory.d.ts.map +1 -1
- package/dist/src/configuration/rest/index.d.ts.map +1 -1
- package/dist/src/configuration/rest/openApiErrors.d.ts.map +1 -1
- package/dist/src/configuration/rest/parseStringParams.d.ts +15 -0
- package/dist/src/configuration/rest/parseStringParams.d.ts.map +1 -0
- package/dist/src/configuration/rest/parseStringParams.test.d.ts +2 -0
- package/dist/src/configuration/rest/parseStringParams.test.d.ts.map +1 -0
- package/dist/src/console/api.d.ts.map +1 -1
- package/dist/src/cron/index.d.ts.map +1 -1
- package/dist/src/databases/auth/auth-operations.d.ts.map +1 -1
- package/dist/src/databases/auth/password.d.ts.map +1 -1
- package/dist/src/databases/common.d.ts +7 -3
- package/dist/src/databases/common.d.ts.map +1 -1
- package/dist/src/databases/core/executor.d.ts.map +1 -1
- package/dist/src/databases/core/identifier.d.ts.map +1 -1
- package/dist/src/databases/core/query-builder.d.ts +4 -3
- package/dist/src/databases/core/query-builder.d.ts.map +1 -1
- package/dist/src/databases/directives.d.ts.map +1 -1
- package/dist/src/databases/engines/mssql/auth.d.ts.map +1 -1
- package/dist/src/databases/engines/mssql/connection.d.ts.map +1 -1
- package/dist/src/databases/engines/mssql/format.d.ts.map +1 -1
- package/dist/src/databases/engines/mssql/getStructure.d.ts +13 -12
- package/dist/src/databases/engines/mssql/getStructure.d.ts.map +1 -1
- package/dist/src/databases/engines/mssql/getViews.d.ts.map +1 -1
- package/dist/src/databases/engines/mssql/query/index.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/auth.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/connection.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/format.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/getStructure.d.ts +13 -12
- package/dist/src/databases/engines/mysql/getStructure.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/getViews.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/placeholders.d.ts.map +1 -1
- package/dist/src/databases/engines/mysql/query/index.d.ts.map +1 -1
- package/dist/src/databases/engines/postgresql/auth.d.ts.map +1 -1
- package/dist/src/databases/engines/postgresql/connection.d.ts.map +1 -1
- package/dist/src/databases/engines/postgresql/format.d.ts.map +1 -1
- package/dist/src/databases/engines/postgresql/getStructure.d.ts +13 -12
- package/dist/src/databases/engines/postgresql/getStructure.d.ts.map +1 -1
- package/dist/src/databases/engines/postgresql/getViews.d.ts.map +1 -1
- package/dist/src/databases/engines/postgresql/query/index.d.ts.map +1 -1
- package/dist/src/databases/engines/shared/claims.d.ts.map +1 -1
- package/dist/src/databases/high-level-operations.d.ts +11 -59
- package/dist/src/databases/high-level-operations.d.ts.map +1 -1
- package/dist/src/databases/identifierMapping.test.d.ts +2 -0
- package/dist/src/databases/identifierMapping.test.d.ts.map +1 -0
- package/dist/src/databases/metadata/structure.d.ts +13 -12
- package/dist/src/databases/metadata/structure.d.ts.map +1 -1
- package/dist/src/databases/schemaBuilder/generateCreateTable/index.d.ts.map +1 -1
- package/dist/src/databases/schemaBuilder/generateCreateView/index.d.ts.map +1 -1
- package/dist/src/databases/schemaBuilder/generateInsert/index.d.ts.map +1 -1
- package/dist/src/databases/schemaBuilder/generateSchemaCreation/index.d.ts.map +1 -1
- package/dist/src/databases/schemaBuilder/mssqlToPostgres/convertView.d.ts.map +1 -1
- package/dist/src/databases/schemaBuilder/utils.d.ts +2 -2
- package/dist/src/databases/schemaBuilder/utils.d.ts.map +1 -1
- package/dist/src/databases/sqlTypeUtils.d.ts.map +1 -1
- package/dist/src/databases/transformers/data-transformers.d.ts +37 -34
- package/dist/src/databases/transformers/data-transformers.d.ts.map +1 -1
- package/dist/src/databases/transformers/genResolverName.d.ts.map +1 -1
- package/dist/src/databases/transformers/graphqlName.d.ts +23 -0
- package/dist/src/databases/transformers/graphqlName.d.ts.map +1 -0
- package/dist/src/databases/transformers/graphqlName.test.d.ts +2 -0
- package/dist/src/databases/transformers/graphqlName.test.d.ts.map +1 -0
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logging/index.d.ts.map +1 -1
- package/dist/src/queues/kafka.d.ts.map +1 -1
- package/dist/src/queues/rabbitmq.d.ts.map +1 -1
- package/dist/src/remoteREST/index.d.ts.map +1 -1
- package/dist/src/remoteREST/parse.d.ts.map +1 -1
- package/dist/src/remoteREST/proxy.d.ts.map +1 -1
- package/dist/src/remoteREST/transform.d.ts.map +1 -1
- package/dist/src/remoteSchemas/index.d.ts.map +1 -1
- package/dist/src/remoteSchemas/introspect.d.ts.map +1 -1
- package/dist/src/remoteSchemas/proxy.d.ts.map +1 -1
- package/dist/src/remoteSchemas/transform.d.ts.map +1 -1
- package/dist/src/singletons/ai.d.ts.map +1 -1
- package/dist/src/singletons/authentication.d.ts.map +1 -1
- package/dist/src/singletons/cache/lruCacheStore.d.ts.map +1 -1
- package/dist/src/singletons/cache/redisCacheStore.d.ts.map +1 -1
- package/dist/src/singletons/cache/registry.d.ts.map +1 -1
- package/dist/src/singletons/cron.d.ts.map +1 -1
- package/dist/src/singletons/databases.d.ts.map +1 -1
- package/dist/src/singletons/env.d.ts +191 -188
- package/dist/src/singletons/env.d.ts.map +1 -1
- package/dist/src/singletons/queues.d.ts.map +1 -1
- package/dist/src/subscriptions/strategies/index.d.ts.map +1 -1
- package/dist/src/subscriptions/utils/polling.d.ts.map +1 -1
- package/dist/src/types/db.d.ts.map +1 -1
- package/dist/src/types/env.d.ts +647 -636
- package/dist/src/types/env.d.ts.map +1 -1
- package/dist/src/types/resolver.d.ts.map +1 -1
- package/dist/src/types/zod/auth.d.ts +18 -18
- package/dist/src/types/zod/configuration.d.ts +300 -295
- package/dist/src/types/zod/configuration.d.ts.map +1 -1
- package/dist/src/types/zod/db.d.ts +89 -80
- package/dist/src/types/zod/db.d.ts.map +1 -1
- package/dist/src/types/zod/queue.d.ts +80 -80
- package/dist/src/types/zod/queue.d.ts.map +1 -1
- package/dist/src/utils/benchmark.d.ts.map +1 -1
- package/dist/src/utils/responses.d.ts.map +1 -1
- package/dist/src/utils/safeJSONParse.d.ts.map +1 -1
- package/dist/src/utils/selection.d.ts.map +1 -1
- package/dist/src/utils/sessionVariables.d.ts +5 -1
- package/dist/src/utils/sessionVariables.d.ts.map +1 -1
- package/dist/src/utils/writeSchema.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/playgrounds/console/index.html +18 -15
- package/playgrounds/graphiql/index.html +854 -622
- package/playgrounds/scalar/index.html +5 -5
- package/src/ai/README.md +257 -0
- package/src/analyzeQuery/analyzers/selectionAnalyzer.ts +7 -1
- package/src/analyzeQuery/resolveVariables.ts +130 -16
- package/src/authentication/jwt.ts +3 -1
- package/src/authentication/paseto.ts +3 -1
- package/src/authentication/tokenRepository.ts +12 -4
- package/src/config/types/auth.ts +7 -1
- package/src/config/types/db.ts +8 -0
- package/src/configuration/getSchemas/mergeEntities/index.ts +26 -1
- package/src/configuration/getSchemas/type-definition-generator/index.ts +11 -6
- package/src/configuration/rest/handleRESTRequestFactory.ts +5 -7
- package/src/configuration/rest/parseStringParams.ts +92 -0
- package/src/databases/common.ts +13 -2
- package/src/databases/engines/mssql/query/index.ts +25 -12
- package/src/databases/engines/mysql/connection.ts +1 -0
- package/src/databases/engines/mysql/query/index.ts +21 -8
- package/src/databases/engines/postgresql/query/index.ts +21 -7
- package/src/databases/high-level-operations.ts +2 -2
- package/src/databases/transformers/genResolverName.ts +3 -3
- package/src/databases/transformers/graphqlName.ts +28 -0
- package/src/logging/index.ts +3 -1
- package/src/types/db.ts +0 -1
- package/src/types/zod/db.ts +5 -7
- package/src/types/zod/queue.ts +2 -10
- package/src/utils/sessionVariables.ts +7 -1
package/src/types/zod/db.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
BunSQLConnectionOptionsZod,
|
|
5
|
-
DatabaseConnectionZod,
|
|
6
|
-
DatabaseSchemaConfigZod,
|
|
7
|
-
MSSQLConnectionOptionsZod,
|
|
8
|
-
TableRelationshipZod as TableRelationshipBaseZod,
|
|
9
|
-
} from "../../config";
|
|
3
|
+
import { TableRelationshipZod as TableRelationshipBaseZod } from "../../config";
|
|
10
4
|
import { genResolverName } from "../../databases/transformers/genResolverName";
|
|
5
|
+
import { sanitizeGraphQLName } from "../../databases/transformers/graphqlName";
|
|
11
6
|
|
|
12
7
|
// Re-export base types and schemas from the config module
|
|
13
8
|
export type {
|
|
@@ -43,6 +38,9 @@ export const TableColumnZod = z
|
|
|
43
38
|
})
|
|
44
39
|
.transform((val) => ({
|
|
45
40
|
name: val.name,
|
|
41
|
+
// The SQL identifier stays in `name`; `fieldName` is what GraphQL exposes it as.
|
|
42
|
+
// Nothing emitting SQL may read `fieldName`, nothing emitting SDL may read `name`.
|
|
43
|
+
fieldName: sanitizeGraphQLName(val.name),
|
|
46
44
|
dataType: val.dataType,
|
|
47
45
|
isNullable: typeof val.isNullable === "boolean" ? val.isNullable : val.isNullable === 1,
|
|
48
46
|
description: val.description ?? null,
|
package/src/types/zod/queue.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
KafkaConnectionZod,
|
|
6
|
-
PublisherConfigZod,
|
|
7
|
-
RabbitMQConnectionZod,
|
|
8
|
-
ReconnectConfigZod,
|
|
9
|
-
SubscriberConfigZod,
|
|
10
|
-
TopicConfigZod,
|
|
11
|
-
} from "../../config";
|
|
12
|
-
import type { CacheContext, SubscriberHandler } from "../../config";
|
|
3
|
+
import { BaseQueueConfigZod, KafkaConnectionZod, RabbitMQConnectionZod } from "../../config";
|
|
4
|
+
import type { SubscriberHandler } from "../../config";
|
|
13
5
|
|
|
14
6
|
// Re-export base types and schemas from the config module
|
|
15
7
|
export type {
|
|
@@ -37,6 +37,10 @@ const resolveDotPath = (obj: Record<string, unknown>, path: string): unknown =>
|
|
|
37
37
|
*
|
|
38
38
|
* @param filter - Filter object with potential session variables
|
|
39
39
|
* @param session - JWT payload containing user session data
|
|
40
|
+
* @param onResolved - Called with each substituted claim value; its return value
|
|
41
|
+
* is what lands in the filter. The caller uses this to parameterize the value
|
|
42
|
+
* rather than letting it be inlined into SQL — a claim is attacker-influenced
|
|
43
|
+
* whenever users can change their own profile data.
|
|
40
44
|
* @returns Filter object with session variables replaced
|
|
41
45
|
*
|
|
42
46
|
* @example
|
|
@@ -54,6 +58,7 @@ const resolveDotPath = (obj: Record<string, unknown>, path: string): unknown =>
|
|
|
54
58
|
export const replaceSessionVariables = (
|
|
55
59
|
filter: Record<string, unknown>,
|
|
56
60
|
session: SessionContext | null,
|
|
61
|
+
onResolved?: (value: unknown) => unknown,
|
|
57
62
|
): Record<string, unknown> => {
|
|
58
63
|
if (!filter || !session) {
|
|
59
64
|
return filter;
|
|
@@ -79,7 +84,7 @@ export const replaceSessionVariables = (
|
|
|
79
84
|
);
|
|
80
85
|
}
|
|
81
86
|
|
|
82
|
-
processedOperators[operator] = sessionValue;
|
|
87
|
+
processedOperators[operator] = onResolved ? onResolved(sessionValue) : sessionValue;
|
|
83
88
|
}
|
|
84
89
|
// Recursively handle nested objects
|
|
85
90
|
else if (
|
|
@@ -90,6 +95,7 @@ export const replaceSessionVariables = (
|
|
|
90
95
|
processedOperators[operator] = replaceSessionVariables(
|
|
91
96
|
operatorValue as Record<string, unknown>,
|
|
92
97
|
session,
|
|
98
|
+
onResolved,
|
|
93
99
|
);
|
|
94
100
|
}
|
|
95
101
|
// Keep other values as-is
|