@graphoria/server 0.2.2 → 0.3.0

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.
Files changed (160) hide show
  1. package/README.md +25 -20
  2. package/dist/src/ai/tools/core.d.ts +6 -1
  3. package/dist/src/ai/tools/core.d.ts.map +1 -1
  4. package/dist/src/ai/tools/core.test.d.ts +2 -0
  5. package/dist/src/ai/tools/core.test.d.ts.map +1 -0
  6. package/dist/src/analyzeQuery/costLimit.d.ts +30 -0
  7. package/dist/src/analyzeQuery/costLimit.d.ts.map +1 -0
  8. package/dist/src/analyzeQuery/costLimit.test.d.ts +2 -0
  9. package/dist/src/analyzeQuery/costLimit.test.d.ts.map +1 -0
  10. package/dist/src/analyzeQuery/depthLimit.d.ts.map +1 -1
  11. package/dist/src/analyzeQuery/fragments.d.ts +6 -0
  12. package/dist/src/analyzeQuery/fragments.d.ts.map +1 -0
  13. package/dist/src/config/types/ai.d.ts +0 -6
  14. package/dist/src/config/types/ai.d.ts.map +1 -1
  15. package/dist/src/config/types/auth.d.ts +8 -29
  16. package/dist/src/config/types/auth.d.ts.map +1 -1
  17. package/dist/src/config/types/cron.d.ts +0 -94
  18. package/dist/src/config/types/cron.d.ts.map +1 -1
  19. package/dist/src/config/types/db.d.ts +2 -87
  20. package/dist/src/config/types/db.d.ts.map +1 -1
  21. package/dist/src/config/types/operation.d.ts +4 -0
  22. package/dist/src/config/types/operation.d.ts.map +1 -1
  23. package/dist/src/config/types/operation.test.d.ts +2 -0
  24. package/dist/src/config/types/operation.test.d.ts.map +1 -0
  25. package/dist/src/config/types/queue.d.ts +0 -47
  26. package/dist/src/config/types/queue.d.ts.map +1 -1
  27. package/dist/src/config/types/remote-rest.d.ts +0 -9
  28. package/dist/src/config/types/remote-rest.d.ts.map +1 -1
  29. package/dist/src/config/types/remote-schema.d.ts +0 -10
  30. package/dist/src/config/types/remote-schema.d.ts.map +1 -1
  31. package/dist/src/configuration/crossReferences.d.ts +27 -0
  32. package/dist/src/configuration/crossReferences.d.ts.map +1 -0
  33. package/dist/src/configuration/crossReferences.test.d.ts +2 -0
  34. package/dist/src/configuration/crossReferences.test.d.ts.map +1 -0
  35. package/dist/src/configuration/getSchemas/index.d.ts +70 -4
  36. package/dist/src/configuration/getSchemas/index.d.ts.map +1 -1
  37. package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts +3 -0
  38. package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts.map +1 -1
  39. package/dist/src/configuration/gql/handleGraphQLRequestFactory.d.ts +32 -2
  40. package/dist/src/configuration/gql/handleGraphQLRequestFactory.d.ts.map +1 -1
  41. package/dist/src/configuration/gql/handleGraphQLSubscriptionFactory.d.ts.map +1 -1
  42. package/dist/src/configuration/index.d.ts +41 -2
  43. package/dist/src/configuration/index.d.ts.map +1 -1
  44. package/dist/src/configuration/rest/handleRESTRequestFactory.d.ts.map +1 -1
  45. package/dist/src/configuration/rest/index.d.ts.map +1 -1
  46. package/dist/src/console/api.d.ts +7 -5
  47. package/dist/src/console/api.d.ts.map +1 -1
  48. package/dist/src/console/session.d.ts +21 -0
  49. package/dist/src/console/session.d.ts.map +1 -0
  50. package/dist/src/console/session.test.d.ts +2 -0
  51. package/dist/src/console/session.test.d.ts.map +1 -0
  52. package/dist/src/cron/index.d.ts +1 -1
  53. package/dist/src/cron/index.d.ts.map +1 -1
  54. package/dist/src/cron/index.test.d.ts +2 -0
  55. package/dist/src/cron/index.test.d.ts.map +1 -0
  56. package/dist/src/databases/common.d.ts +12 -4
  57. package/dist/src/databases/common.d.ts.map +1 -1
  58. package/dist/src/databases/core/executor.d.ts +6 -2
  59. package/dist/src/databases/core/executor.d.ts.map +1 -1
  60. package/dist/src/databases/core/function-mapping.d.ts +4 -3
  61. package/dist/src/databases/core/function-mapping.d.ts.map +1 -1
  62. package/dist/src/databases/core/query-builder.d.ts +7 -1
  63. package/dist/src/databases/core/query-builder.d.ts.map +1 -1
  64. package/dist/src/databases/engines/mssql/connection.d.ts +29 -6
  65. package/dist/src/databases/engines/mssql/connection.d.ts.map +1 -1
  66. package/dist/src/databases/engines/mssql/connection.test.d.ts +2 -0
  67. package/dist/src/databases/engines/mssql/connection.test.d.ts.map +1 -0
  68. package/dist/src/databases/engines/mssql/format.d.ts +2 -1
  69. package/dist/src/databases/engines/mssql/format.d.ts.map +1 -1
  70. package/dist/src/databases/engines/mssql/query/index.d.ts +3 -2
  71. package/dist/src/databases/engines/mssql/query/index.d.ts.map +1 -1
  72. package/dist/src/databases/engines/mysql/connection.d.ts +16 -0
  73. package/dist/src/databases/engines/mysql/connection.d.ts.map +1 -1
  74. package/dist/src/databases/engines/mysql/connection.test.d.ts +2 -0
  75. package/dist/src/databases/engines/mysql/connection.test.d.ts.map +1 -0
  76. package/dist/src/databases/engines/mysql/format.d.ts +2 -1
  77. package/dist/src/databases/engines/mysql/format.d.ts.map +1 -1
  78. package/dist/src/databases/engines/mysql/query/index.d.ts +3 -2
  79. package/dist/src/databases/engines/mysql/query/index.d.ts.map +1 -1
  80. package/dist/src/databases/engines/postgresql/connection.d.ts +25 -6
  81. package/dist/src/databases/engines/postgresql/connection.d.ts.map +1 -1
  82. package/dist/src/databases/engines/postgresql/connection.test.d.ts +2 -0
  83. package/dist/src/databases/engines/postgresql/connection.test.d.ts.map +1 -0
  84. package/dist/src/databases/engines/postgresql/format.d.ts +2 -1
  85. package/dist/src/databases/engines/postgresql/format.d.ts.map +1 -1
  86. package/dist/src/databases/engines/postgresql/query/index.d.ts +3 -2
  87. package/dist/src/databases/engines/postgresql/query/index.d.ts.map +1 -1
  88. package/dist/src/databases/high-level-operations.d.ts +2 -0
  89. package/dist/src/databases/high-level-operations.d.ts.map +1 -1
  90. package/dist/src/databases/transformers/data-transformers.d.ts +2 -0
  91. package/dist/src/databases/transformers/data-transformers.d.ts.map +1 -1
  92. package/dist/src/index.d.ts.map +1 -1
  93. package/dist/src/singletons/env.d.ts +19 -0
  94. package/dist/src/singletons/env.d.ts.map +1 -1
  95. package/dist/src/singletons/queryTimeout.d.ts +3 -0
  96. package/dist/src/singletons/queryTimeout.d.ts.map +1 -0
  97. package/dist/src/subscriptions/strategies/database.d.ts.map +1 -1
  98. package/dist/src/subscriptions/strategies/database.test.d.ts +2 -0
  99. package/dist/src/subscriptions/strategies/database.test.d.ts.map +1 -0
  100. package/dist/src/subscriptions/types.d.ts +4 -1
  101. package/dist/src/subscriptions/types.d.ts.map +1 -1
  102. package/dist/src/subscriptions/utils/polling.d.ts.map +1 -1
  103. package/dist/src/types/env.d.ts +73 -0
  104. package/dist/src/types/env.d.ts.map +1 -1
  105. package/dist/src/types/zod/auth.d.ts +12 -0
  106. package/dist/src/types/zod/auth.d.ts.map +1 -1
  107. package/dist/src/types/zod/configuration.d.ts +28 -0
  108. package/dist/src/types/zod/configuration.d.ts.map +1 -1
  109. package/dist/src/utils/rateLimit.d.ts +65 -0
  110. package/dist/src/utils/rateLimit.d.ts.map +1 -0
  111. package/dist/src/utils/rateLimit.test.d.ts +2 -0
  112. package/dist/src/utils/rateLimit.test.d.ts.map +1 -0
  113. package/dist/src/utils/responses.d.ts +3 -0
  114. package/dist/src/utils/responses.d.ts.map +1 -1
  115. package/dist/tsconfig.tsbuildinfo +1 -1
  116. package/package.json +13 -13
  117. package/playgrounds/console/index.html +7 -7
  118. package/playgrounds/graphiql/index.html +535 -536
  119. package/playgrounds/scalar/index.html +1 -1
  120. package/src/ai/tools/core.ts +30 -6
  121. package/src/analyzeQuery/costLimit.ts +236 -0
  122. package/src/analyzeQuery/depthLimit.ts +4 -23
  123. package/src/analyzeQuery/fragments.ts +18 -0
  124. package/src/config/types/auth.ts +7 -0
  125. package/src/config/types/db.ts +7 -0
  126. package/src/config/types/operation.ts +4 -0
  127. package/src/configuration/crossReferences.ts +340 -0
  128. package/src/configuration/getSchemas/type-definition-generator/index.ts +1 -1
  129. package/src/configuration/gql/buildExecute.ts +1 -1
  130. package/src/configuration/gql/handleGraphQLRequestFactory.ts +80 -10
  131. package/src/configuration/gql/handleGraphQLSubscriptionFactory.ts +22 -2
  132. package/src/configuration/index.ts +24 -6
  133. package/src/configuration/rest/handleRESTRequestFactory.ts +6 -4
  134. package/src/configuration/rest/index.ts +11 -2
  135. package/src/console/api.ts +51 -10
  136. package/src/console/session.ts +125 -0
  137. package/src/cron/index.ts +6 -2
  138. package/src/databases/common.ts +55 -10
  139. package/src/databases/core/executor.ts +12 -2
  140. package/src/databases/core/function-mapping.ts +5 -0
  141. package/src/databases/core/query-builder.ts +7 -0
  142. package/src/databases/engines/mssql/connection.ts +66 -14
  143. package/src/databases/engines/mssql/format.ts +3 -1
  144. package/src/databases/engines/mssql/query/index.ts +12 -2
  145. package/src/databases/engines/mysql/connection.ts +30 -13
  146. package/src/databases/engines/mysql/format.ts +3 -1
  147. package/src/databases/engines/mysql/query/index.ts +25 -4
  148. package/src/databases/engines/postgresql/connection.ts +76 -15
  149. package/src/databases/engines/postgresql/format.ts +3 -1
  150. package/src/databases/engines/postgresql/query/index.ts +12 -3
  151. package/src/databases/high-level-operations.ts +13 -2
  152. package/src/index.ts +82 -13
  153. package/src/singletons/queryTimeout.ts +20 -0
  154. package/src/subscriptions/strategies/database.ts +19 -3
  155. package/src/subscriptions/types.ts +4 -1
  156. package/src/subscriptions/utils/polling.ts +6 -3
  157. package/src/types/env.ts +21 -1
  158. package/src/utils/rateLimit.ts +209 -0
  159. package/src/utils/responses.ts +10 -0
  160. package/src/ai/README.md +0 -257
package/README.md CHANGED
@@ -76,26 +76,31 @@ await close(); // release database connections
76
76
 
77
77
  The server reads a small set of environment variables. Every variable has a sensible default except `JWT_SECRET` (or PASETO equivalents) and `ADMIN_SECRET`, both of which are required.
78
78
 
79
- | Variable | Default | Purpose |
80
- | ---------------------- | ------------------------------ | -------------------------------------------------------------------------- |
81
- | `PORT` | `3000` | HTTP port for `createBunServer`. |
82
- | `JWT_SECRET` | _required_ | Symmetric secret for JWT signing. |
83
- | `JWT_EXPIRES_IN` | `5m` | Access-token lifetime. |
84
- | `JWT_RT_EXPIRES_IN` | `7d` | Refresh-token lifetime. |
85
- | `PASETO_LOCAL_KEY` | _required for_ `paseto_local` | XChaCha20-Poly1305 key (`k4.local.…`). |
86
- | `PASETO_SECRET_KEY` | _required for_ `paseto_public` | Ed25519 secret (`k4.secret.…`). |
87
- | `PASETO_PUBLIC_KEY` | _required for_ `paseto_public` | Ed25519 public (`k4.public.…`). |
88
- | `ADMIN_SECRET` | _required_ | Bypasses RBAC when sent in the admin header. |
89
- | `REDIS_URL` | `redis://localhost:6379` | Refresh-token rotation + cache. |
90
- | `GRAPHQL_API_ENDPOINT` | `/graphql` | GraphQL endpoint path. |
91
- | `REST_API_PREFIX` | `/rest` | REST API prefix. |
92
- | `GRAPHIQL_ENDPOINT` | `/graphiql` | Built-in GraphiQL playground path. |
93
- | `SCALAR_ENDPOINT` | `/scalar` | Scalar API documentation path. |
94
- | `OPENAPI_ENDPOINT` | `/openapi.json` | OpenAPI document path. |
95
- | `CORS_ENABLED` | `true` | Toggle CORS preflight handler. |
96
- | `MAX_QUERY_DEPTH` | `0` (disabled) | Reject queries deeper than this guard against abusive nested selections. |
97
-
98
- The complete list lives in [`packages/server/src/types/env.ts`](./src/types/env.ts).
79
+ | Variable | Default | Purpose |
80
+ | ---------------------- | ------------------------------ | ---------------------------------------------------------------------------------- |
81
+ | `PORT` | `3000` | HTTP port for `createBunServer`. |
82
+ | `JWT_SECRET` | _required_ | Symmetric secret for JWT signing. |
83
+ | `JWT_EXPIRES_IN` | `5m` | Access-token lifetime. |
84
+ | `JWT_RT_EXPIRES_IN` | `7d` | Refresh-token lifetime. |
85
+ | `PASETO_LOCAL_KEY` | _required for_ `paseto_local` | XChaCha20-Poly1305 key (`k4.local.…`). |
86
+ | `PASETO_SECRET_KEY` | _required for_ `paseto_public` | Ed25519 secret (`k4.secret.…`). |
87
+ | `PASETO_PUBLIC_KEY` | _required for_ `paseto_public` | Ed25519 public (`k4.public.…`). |
88
+ | `ADMIN_SECRET` | _required_ | Bypasses RBAC when sent in the admin header. |
89
+ | `REDIS_URL` | `redis://localhost:6379` | Refresh-token rotation + cache. |
90
+ | `GRAPHQL_API_ENDPOINT` | `/graphql` | GraphQL endpoint path. |
91
+ | `REST_API_PREFIX` | `/rest` | REST API prefix. |
92
+ | `GRAPHIQL_ENDPOINT` | `/graphiql` | Built-in GraphiQL playground path. |
93
+ | `SCALAR_ENDPOINT` | `/scalar` | Scalar API documentation path. |
94
+ | `OPENAPI_ENDPOINT` | `/openapi.json` | OpenAPI document path. |
95
+ | `CORS_ENABLED` | `true` | Toggle CORS preflight handler. |
96
+ | `MAX_QUERY_DEPTH` | `8` | Reject caller queries deeper than this. `0` disables the limit. |
97
+ | `DEFAULT_PAGE_SIZE` | `100` | Page size applied to a list field that asks for no limit. `0` leaves it unbounded. |
98
+ | `MAX_PAGE_SIZE` | `1000` | Reject a list field asking for more rows than this. `0` removes the ceiling. |
99
+
100
+ The complete list lives in [`packages/server/src/types/env.ts`](./src/types/env.ts). Two more limits
101
+ are not in the table above because they ship **off** — `MAX_QUERY_COST` and `RATE_LIMIT_MAX` — and a
102
+ third, `QUERY_TIMEOUT_MS`, bounds every statement at `10000` ms. All five are documented together in
103
+ [Resource Limits](../../docs/LIMITS.md).
99
104
 
100
105
  ## Configuration helpers
101
106
 
@@ -18,7 +18,7 @@ export type ValidationError = {
18
18
  column: number;
19
19
  }>;
20
20
  };
21
- export type ValidateQueryFn = (query: string) => {
21
+ export type ValidateQueryFn = (query: string, variables?: Record<string, unknown>) => {
22
22
  hasErrors: boolean;
23
23
  validationErrors: readonly ValidationError[];
24
24
  };
@@ -26,6 +26,11 @@ export type ValidateQueryFn = (query: string) => {
26
26
  * Build a query validator for a role. Without a positive depth limit it
27
27
  * delegates to the role's own `hasErrors`; with one it layers a depth-limit
28
28
  * rule on the standard rule set.
29
+ *
30
+ * The cost budget applies on both branches, and there is no MCP-specific
31
+ * override for it. MCP gets its own depth knob because an agent legitimately
32
+ * writes deeper queries than an application does; nothing makes the same
33
+ * argument for asking a database for more rows.
29
34
  */
30
35
  export declare const makeValidateQuery: (role: RoleEntities, maxQueryDepth?: number) => ValidateQueryFn;
31
36
  export type GraphqlExecOutcome = {
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/ai/tools/core.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAKtE;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAE3C,eAAO,MAAM,YAAY,YACvB,OAAO,EACP,WAAW,EACX,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,iBAAiB,CACT,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,iBAAiB,QACvB,MAAM,SACJ,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,KAC9C,UAA6D,CAAC;AAEjE,eAAO,MAAM,yBAAyB,UAAW,MAAM,KAAG,OAKzD,CAAC;AAyJF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,SAAS,eAAe,EAAE,CAAC;CAC9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,SACrB,YAAY,kBAAkB,MAAM,KAAG,eAU7C,CAAC;AAIJ,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,WAAW,CA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BACH,eAAe,wBACR;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,KAC3E,OAAO,CAAC,kBAAkB,CA0B5B,CAAC;AAIF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SACrB,YAAY,oBACA;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KACvD,cAAc,EA+EhB,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SACvB,YAAY,kBACF;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,CAAA;CAAE,KAClD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IA0G5B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=core.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.test.d.ts","sourceRoot":"","sources":["../../../../src/ai/tools/core.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { GraphQLError } from "graphql";
2
+ import type { DocumentNode, GraphQLSchema } from "graphql";
3
+ /**
4
+ * Page bounds the estimate is drawn against. `maxPageSize` is carried, not read:
5
+ * a resolved limit above it is rejected at execution, so the walk never has to
6
+ * clamp — but the estimator needs it the day that ordering changes.
7
+ */
8
+ export type CostPageLimits = {
9
+ defaultPageSize: number;
10
+ maxPageSize: number;
11
+ };
12
+ /**
13
+ * Estimate how many rows a document asks a database for, before executing it.
14
+ *
15
+ * Every field costs 1 for itself plus the cost of its children multiplied by the
16
+ * page size it requests — the `limit` argument for a list field, resolved through
17
+ * `variables`, falling back to `defaultPageSize`; 1 for anything that returns a
18
+ * single row. Fragment spreads are expanded, so moving a fan-out into a fragment
19
+ * does not hide it.
20
+ *
21
+ * A document carrying several operations is scored by its most expensive one:
22
+ * a request executes one of them.
23
+ */
24
+ export declare const estimateQueryCost: (document: DocumentNode, schema: GraphQLSchema, variables: Record<string, unknown>, pageLimits: CostPageLimits) => number;
25
+ /**
26
+ * Reject a document whose estimated cost exceeds `maxCost`. Returns `null` when
27
+ * it is within budget.
28
+ */
29
+ export declare const checkQueryCost: (document: DocumentNode, schema: GraphQLSchema, variables: Record<string, unknown>, pageLimits: CostPageLimits, maxCost: number) => GraphQLError | null;
30
+ //# sourceMappingURL=costLimit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"costLimit.d.ts","sourceRoot":"","sources":["../../../src/analyzeQuery/costLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2B,MAAM,SAAS,CAAC;AAEhE,OAAO,KAAK,EACV,YAAY,EAGZ,aAAa,EAId,MAAM,SAAS,CAAC;AAKjB;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4KF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,aAClB,YAAY,UACd,aAAa,aACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,cACtB,cAAc,KACzB,MAA0E,CAAC;AAE9E;;;GAGG;AACH,eAAO,MAAM,cAAc,aACf,YAAY,UACd,aAAa,aACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,cACtB,cAAc,WACjB,MAAM,KACd,YAAY,GAAG,IAWjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=costLimit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"costLimit.test.d.ts","sourceRoot":"","sources":["../../../src/analyzeQuery/costLimit.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"depthLimit.d.ts","sourceRoot":"","sources":["../../../src/analyzeQuery/depthLimit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,UAAU,EAGV,iBAAiB,EAClB,MAAM,SAAS,CAAC;AA6EjB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,aACd,MAAM,eACP,iBAAiB,KAAG,UAuB7B,CAAC"}
1
+ {"version":3,"file":"depthLimit.d.ts","sourceRoot":"","sources":["../../../src/analyzeQuery/depthLimit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,UAAU,EAA0B,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAgE9F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,aACd,MAAM,eACP,iBAAiB,KAAG,UAuB7B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DocumentNode, FragmentDefinitionNode } from "graphql";
2
+ /**
3
+ * Collect all fragment definitions from a document.
4
+ */
5
+ export declare const collectFragments: (document: DocumentNode) => Map<string, FragmentDefinitionNode>;
6
+ //# sourceMappingURL=fragments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/analyzeQuery/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,gBAAgB,aAAc,YAAY,KAAG,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAU3F,CAAC"}
@@ -4,7 +4,6 @@ import { z } from "zod";
4
4
  * When enabled, exposes a `/mcp` endpoint for LLM agents.
5
5
  */
6
6
  export declare const MCPZod: z.ZodObject<{
7
- /** Whether the MCP server is enabled. Off by default. */
8
7
  enabled: z.ZodDefault<z.ZodBoolean>;
9
8
  }, z.core.$strict>;
10
9
  /** Authoring type for MCP configuration */
@@ -18,15 +17,10 @@ export type MCPConfig = z.input<typeof MCPZod>;
18
17
  * `DEEPSEEK_API_KEY`, `OLLAMA_HOST`), not from this config.
19
18
  */
20
19
  export declare const AIZod: z.ZodObject<{
21
- /** Whether the AI agent is enabled. Off by default. */
22
20
  enabled: z.ZodDefault<z.ZodBoolean>;
23
- /** Overrides the built-in system prompt sent to the LLM. */
24
21
  systemPrompt: z.ZodOptional<z.ZodString>;
25
- /** REST endpoint path for the agent (default: "/ai"). */
26
22
  endpoint: z.ZodDefault<z.ZodString>;
27
- /** Model Context Protocol (MCP) server. Off by default. See MCP.md. */
28
23
  mcp: z.ZodDefault<z.ZodOptional<z.ZodObject<{
29
- /** Whether the MCP server is enabled. Off by default. */
30
24
  enabled: z.ZodDefault<z.ZodBoolean>;
31
25
  }, z.core.$strict>>>;
32
26
  }, z.core.$strict>;
@@ -1 +1 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../../src/config/types/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,MAAM;IACjB,yDAAyD;;kBAEzD,CAAC;AAEH,2CAA2C;AAC3C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK;IAChB,uDAAuD;;IAEvD,4DAA4D;;IAE5D,yDAAyD;;IAEzD,uEAAuE;;QAtBvE,yDAAyD;;;kBAwBzD,CAAC;AAEH,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../../src/config/types/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,MAAM;;kBAGjB,CAAC;AAEH,2CAA2C;AAC3C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK;;;;;;;kBAShB,CAAC;AAEH,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -53,11 +53,8 @@ export type FilterCondition = z.input<typeof FilterConditionZod>;
53
53
  * Table-level permission configuration
54
54
  */
55
55
  export declare const TablePermissionZod: z.ZodObject<{
56
- /** Allowed columns — "ALL" or array of column names */
57
56
  columns: z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodArray<z.ZodString>]>;
58
- /** Role-based query filtering (WHERE clause) */
59
57
  filter: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
60
- /** Role-based default ordering (ORDER BY clause) */
61
58
  orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
59
  column: z.ZodString;
63
60
  direction: z.ZodEnum<{
@@ -75,13 +72,9 @@ export type TablePermission = z.input<typeof TablePermissionZod>;
75
72
  * Permission configuration for a role
76
73
  */
77
74
  export declare const RolePermissionZod: z.ZodDefault<z.ZodObject<{
78
- /** Tables accessible by this role */
79
75
  tables: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodObject<{
80
- /** Allowed columns — "ALL" or array of column names */
81
76
  columns: z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodArray<z.ZodString>]>;
82
- /** Role-based query filtering (WHERE clause) */
83
77
  filter: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
84
- /** Role-based default ordering (ORDER BY clause) */
85
78
  orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
86
79
  column: z.ZodString;
87
80
  direction: z.ZodEnum<{
@@ -94,42 +87,29 @@ export declare const RolePermissionZod: z.ZodDefault<z.ZodObject<{
94
87
  }>;
95
88
  }, z.core.$strict>>>;
96
89
  }, z.core.$strict>]>>]>>>;
97
- /** Stored procedures accessible by this role */
98
90
  storedProcedures: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
99
- /** Queues accessible by this role */
100
91
  queues: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
101
- /** Operations accessible by this role */
102
92
  operations: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
103
- /** Remote schemas accessible by this role */
104
93
  remoteSchemas: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
105
- /** Remote REST APIs accessible by this role */
106
94
  remoteREST: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
95
+ rateLimit: z.ZodOptional<z.ZodObject<{
96
+ max: z.ZodNumber;
97
+ windowMs: z.ZodOptional<z.ZodNumber>;
98
+ }, z.core.$strict>>;
107
99
  }, z.core.$strict>>;
108
100
  export type RolePermission = z.input<typeof RolePermissionZod>;
109
101
  /**
110
102
  * Authentication configuration
111
103
  */
112
104
  export declare const AuthConfigZod: z.ZodDefault<z.ZodOptional<z.ZodObject<{
113
- /** Whether authentication is enabled */
114
105
  enabled: z.ZodBoolean;
115
- /** Database name where auth tables are stored */
116
106
  database: z.ZodString;
117
- /** Schema name for auth tables (default: "auth") */
118
107
  schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
119
- /**
120
- * Whether Graphoria should run CREATE SCHEMA / TABLE IF NOT EXISTS for the
121
- * auth user table on every boot. Default: false.
122
- */
123
108
  autoCreateTables: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
124
- /** Permissions per role */
125
109
  permissions: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDefault<z.ZodObject<{
126
- /** Tables accessible by this role */
127
110
  tables: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodObject<{
128
- /** Allowed columns — "ALL" or array of column names */
129
111
  columns: z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodArray<z.ZodString>]>;
130
- /** Role-based query filtering (WHERE clause) */
131
112
  filter: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
132
- /** Role-based default ordering (ORDER BY clause) */
133
113
  orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
134
114
  column: z.ZodString;
135
115
  direction: z.ZodEnum<{
@@ -142,16 +122,15 @@ export declare const AuthConfigZod: z.ZodDefault<z.ZodOptional<z.ZodObject<{
142
122
  }>;
143
123
  }, z.core.$strict>>>;
144
124
  }, z.core.$strict>]>>]>>>;
145
- /** Stored procedures accessible by this role */
146
125
  storedProcedures: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
147
- /** Queues accessible by this role */
148
126
  queues: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
149
- /** Operations accessible by this role */
150
127
  operations: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
151
- /** Remote schemas accessible by this role */
152
128
  remoteSchemas: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
153
- /** Remote REST APIs accessible by this role */
154
129
  remoteREST: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"ALL">]>>>;
130
+ rateLimit: z.ZodOptional<z.ZodObject<{
131
+ max: z.ZodNumber;
132
+ windowMs: z.ZodOptional<z.ZodNumber>;
133
+ }, z.core.$strict>>;
155
134
  }, z.core.$strict>>>>>;
156
135
  }, z.core.$strict>>>;
157
136
  export type AuthConfig = z.input<typeof AuthConfigZod>;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/config/types/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;kBAG3B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,YAC3B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,CACF,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKjE,CAAC;AAEF,MAAM,MAA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AAO,MAAM,gBAAgB;;;;;;;;;;kBAG3B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,YAC3B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,CACF,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKjE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAMjE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;kBAO7B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;mBAmD1B,CAAC;AAEL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAM/D;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAuBtB,CAAC;AAEL,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -35,129 +35,35 @@ export type CronTickCallback<TVariables = Record<string, unknown>> = (options: {
35
35
  * This allows TypeScript to infer the variables type
36
36
  */
37
37
  export declare const createTypedCronJobZod: <TVariables extends DefaultVariables>() => z.ZodObject<{
38
- /**
39
- * Unique name/identifier for the cron job
40
- */
41
38
  name: z.ZodString;
42
- /**
43
- * Cron pattern or ISO 8601 date string
44
- * Examples:
45
- * - "0 0 * * *" (daily at midnight)
46
- * - "*\/5 * * * *" (every 5 minutes)
47
- * - "2024-01-23T00:00:00" (specific date/time)
48
- */
49
39
  pattern: z.ZodString;
50
- /**
51
- * Optional GraphQL query to execute when the cron job runs
52
- * If not provided, you must use the gqlQuery function in onTick callback
53
- */
54
40
  query: z.ZodOptional<z.ZodString>;
55
- /**
56
- * Optional variables to pass to the GraphQL query
57
- */
58
41
  variables: z.ZodOptional<z.ZodCustom<TVariables, TVariables>>;
59
- /**
60
- * Optional timezone (e.g., "America/New_York", "Europe/Stockholm")
61
- */
62
42
  timezone: z.ZodOptional<z.ZodString>;
63
- /**
64
- * Whether the job should be paused from start
65
- */
66
43
  paused: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
67
- /**
68
- * Maximum number of times the job should run
69
- */
70
44
  maxRuns: z.ZodOptional<z.ZodNumber>;
71
- /**
72
- * Minimum number of seconds between triggers
73
- */
74
45
  interval: z.ZodOptional<z.ZodNumber>;
75
- /**
76
- * ISO 8601 formatted datetime to start the job
77
- */
78
46
  startAt: z.ZodOptional<z.ZodString>;
79
- /**
80
- * ISO 8601 formatted datetime to stop the job
81
- */
82
47
  stopAt: z.ZodOptional<z.ZodString>;
83
- /**
84
- * Enable over-run protection (blocks new triggers while old one is in progress)
85
- */
86
48
  protect: z.ZodOptional<z.ZodBoolean>;
87
- /**
88
- * Whether to catch errors silently or handle them
89
- */
90
49
  catchErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
91
- /**
92
- * Context to pass along with the cron job (for logging, etc.)
93
- */
94
50
  context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
95
- /**
96
- * Callback executed on each tick
97
- */
98
51
  onTick: z.ZodOptional<z.ZodCustom<CronTickCallback<TVariables>, CronTickCallback<TVariables>>>;
99
52
  }, z.core.$strict>;
100
53
  export declare const TypedCronJobZod: z.ZodObject<{
101
- /**
102
- * Unique name/identifier for the cron job
103
- */
104
54
  name: z.ZodString;
105
- /**
106
- * Cron pattern or ISO 8601 date string
107
- * Examples:
108
- * - "0 0 * * *" (daily at midnight)
109
- * - "*\/5 * * * *" (every 5 minutes)
110
- * - "2024-01-23T00:00:00" (specific date/time)
111
- */
112
55
  pattern: z.ZodString;
113
- /**
114
- * Optional GraphQL query to execute when the cron job runs
115
- * If not provided, you must use the gqlQuery function in onTick callback
116
- */
117
56
  query: z.ZodOptional<z.ZodString>;
118
- /**
119
- * Optional variables to pass to the GraphQL query
120
- */
121
57
  variables: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
122
- /**
123
- * Optional timezone (e.g., "America/New_York", "Europe/Stockholm")
124
- */
125
58
  timezone: z.ZodOptional<z.ZodString>;
126
- /**
127
- * Whether the job should be paused from start
128
- */
129
59
  paused: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
130
- /**
131
- * Maximum number of times the job should run
132
- */
133
60
  maxRuns: z.ZodOptional<z.ZodNumber>;
134
- /**
135
- * Minimum number of seconds between triggers
136
- */
137
61
  interval: z.ZodOptional<z.ZodNumber>;
138
- /**
139
- * ISO 8601 formatted datetime to start the job
140
- */
141
62
  startAt: z.ZodOptional<z.ZodString>;
142
- /**
143
- * ISO 8601 formatted datetime to stop the job
144
- */
145
63
  stopAt: z.ZodOptional<z.ZodString>;
146
- /**
147
- * Enable over-run protection (blocks new triggers while old one is in progress)
148
- */
149
64
  protect: z.ZodOptional<z.ZodBoolean>;
150
- /**
151
- * Whether to catch errors silently or handle them
152
- */
153
65
  catchErrors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
154
- /**
155
- * Context to pass along with the cron job (for logging, etc.)
156
- */
157
66
  context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
158
- /**
159
- * Callback executed on each tick
160
- */
161
67
  onTick: z.ZodOptional<z.ZodCustom<CronTickCallback<Record<string, unknown>>, CronTickCallback<Record<string, unknown>>>>;
162
68
  }, z.core.$strict>;
163
69
  export type CronJobType = z.input<typeof TypedCronJobZod>;
@@ -1 +1 @@
1
- {"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../../src/config/types/cron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,sBAAsB,wCAAoC,CAAC;AAExE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,UAAU,GAAG,gBAAgB,IAAI;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,UAAU,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CACnE,OAAO,EAAE;IACP,QAAQ,EAAE,CAAC,OAAO,GAAG,OAAO,EAC1B,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,CAAC,EAAE,OAAO,KACV,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,CAAC;IACpD,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,EACD,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,E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