@constructive-io/graphql-server 2.14.8 → 2.15.1

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 (219) hide show
  1. package/codegen/orm/client.d.ts +55 -0
  2. package/codegen/orm/client.js +75 -0
  3. package/codegen/orm/index.d.ts +632 -0
  4. package/codegen/orm/index.js +182 -0
  5. package/codegen/orm/input-types.d.ts +13248 -0
  6. package/codegen/orm/input-types.js +7 -0
  7. package/codegen/orm/models/api.d.ts +42 -0
  8. package/codegen/orm/models/api.js +77 -0
  9. package/codegen/orm/models/apiExtension.d.ts +42 -0
  10. package/codegen/orm/models/apiExtension.js +77 -0
  11. package/codegen/orm/models/apiModule.d.ts +42 -0
  12. package/codegen/orm/models/apiModule.js +77 -0
  13. package/codegen/orm/models/apiSchema.d.ts +42 -0
  14. package/codegen/orm/models/apiSchema.js +77 -0
  15. package/codegen/orm/models/app.d.ts +42 -0
  16. package/codegen/orm/models/app.js +77 -0
  17. package/codegen/orm/models/checkConstraint.d.ts +42 -0
  18. package/codegen/orm/models/checkConstraint.js +77 -0
  19. package/codegen/orm/models/connectedAccountsModule.d.ts +42 -0
  20. package/codegen/orm/models/connectedAccountsModule.js +77 -0
  21. package/codegen/orm/models/cryptoAddressesModule.d.ts +42 -0
  22. package/codegen/orm/models/cryptoAddressesModule.js +77 -0
  23. package/codegen/orm/models/cryptoAuthModule.d.ts +42 -0
  24. package/codegen/orm/models/cryptoAuthModule.js +77 -0
  25. package/codegen/orm/models/database.d.ts +42 -0
  26. package/codegen/orm/models/database.js +77 -0
  27. package/codegen/orm/models/databaseExtension.d.ts +42 -0
  28. package/codegen/orm/models/databaseExtension.js +77 -0
  29. package/codegen/orm/models/databaseProvision.d.ts +42 -0
  30. package/codegen/orm/models/databaseProvision.js +77 -0
  31. package/codegen/orm/models/defaultIdsModule.d.ts +42 -0
  32. package/codegen/orm/models/defaultIdsModule.js +77 -0
  33. package/codegen/orm/models/denormalizedTableField.d.ts +42 -0
  34. package/codegen/orm/models/denormalizedTableField.js +77 -0
  35. package/codegen/orm/models/domain.d.ts +42 -0
  36. package/codegen/orm/models/domain.js +77 -0
  37. package/codegen/orm/models/emailsModule.d.ts +42 -0
  38. package/codegen/orm/models/emailsModule.js +77 -0
  39. package/codegen/orm/models/encryptedSecretsModule.d.ts +42 -0
  40. package/codegen/orm/models/encryptedSecretsModule.js +77 -0
  41. package/codegen/orm/models/extension.d.ts +42 -0
  42. package/codegen/orm/models/extension.js +77 -0
  43. package/codegen/orm/models/field.d.ts +42 -0
  44. package/codegen/orm/models/field.js +77 -0
  45. package/codegen/orm/models/fieldModule.d.ts +42 -0
  46. package/codegen/orm/models/fieldModule.js +77 -0
  47. package/codegen/orm/models/foreignKeyConstraint.d.ts +42 -0
  48. package/codegen/orm/models/foreignKeyConstraint.js +77 -0
  49. package/codegen/orm/models/fullTextSearch.d.ts +42 -0
  50. package/codegen/orm/models/fullTextSearch.js +77 -0
  51. package/codegen/orm/models/hierarchyModule.d.ts +42 -0
  52. package/codegen/orm/models/hierarchyModule.js +77 -0
  53. package/codegen/orm/models/index.d.ts +64 -0
  54. package/codegen/orm/models/index.js +127 -0
  55. package/codegen/orm/models/indexModel.d.ts +42 -0
  56. package/codegen/orm/models/indexModel.js +77 -0
  57. package/codegen/orm/models/invitesModule.d.ts +42 -0
  58. package/codegen/orm/models/invitesModule.js +77 -0
  59. package/codegen/orm/models/levelsModule.d.ts +42 -0
  60. package/codegen/orm/models/levelsModule.js +77 -0
  61. package/codegen/orm/models/limitFunction.d.ts +42 -0
  62. package/codegen/orm/models/limitFunction.js +77 -0
  63. package/codegen/orm/models/limitsModule.d.ts +42 -0
  64. package/codegen/orm/models/limitsModule.js +77 -0
  65. package/codegen/orm/models/membershipTypesModule.d.ts +42 -0
  66. package/codegen/orm/models/membershipTypesModule.js +77 -0
  67. package/codegen/orm/models/membershipsModule.d.ts +42 -0
  68. package/codegen/orm/models/membershipsModule.js +77 -0
  69. package/codegen/orm/models/module.d.ts +42 -0
  70. package/codegen/orm/models/module.js +77 -0
  71. package/codegen/orm/models/moduleDefinition.d.ts +42 -0
  72. package/codegen/orm/models/moduleDefinition.js +77 -0
  73. package/codegen/orm/models/moduleField.d.ts +42 -0
  74. package/codegen/orm/models/moduleField.js +77 -0
  75. package/codegen/orm/models/moduleInputRecord.d.ts +42 -0
  76. package/codegen/orm/models/moduleInputRecord.js +77 -0
  77. package/codegen/orm/models/moduleOutput.d.ts +42 -0
  78. package/codegen/orm/models/moduleOutput.js +77 -0
  79. package/codegen/orm/models/permissionsModule.d.ts +42 -0
  80. package/codegen/orm/models/permissionsModule.js +77 -0
  81. package/codegen/orm/models/phoneNumbersModule.d.ts +42 -0
  82. package/codegen/orm/models/phoneNumbersModule.js +77 -0
  83. package/codegen/orm/models/policy.d.ts +42 -0
  84. package/codegen/orm/models/policy.js +77 -0
  85. package/codegen/orm/models/primaryKeyConstraint.d.ts +42 -0
  86. package/codegen/orm/models/primaryKeyConstraint.js +77 -0
  87. package/codegen/orm/models/procedure.d.ts +42 -0
  88. package/codegen/orm/models/procedure.js +77 -0
  89. package/codegen/orm/models/profilesModule.d.ts +42 -0
  90. package/codegen/orm/models/profilesModule.js +77 -0
  91. package/codegen/orm/models/rlsFunction.d.ts +42 -0
  92. package/codegen/orm/models/rlsFunction.js +77 -0
  93. package/codegen/orm/models/rlsModule.d.ts +42 -0
  94. package/codegen/orm/models/rlsModule.js +77 -0
  95. package/codegen/orm/models/schema.d.ts +42 -0
  96. package/codegen/orm/models/schema.js +77 -0
  97. package/codegen/orm/models/schemaGrant.d.ts +42 -0
  98. package/codegen/orm/models/schemaGrant.js +77 -0
  99. package/codegen/orm/models/secretsModule.d.ts +42 -0
  100. package/codegen/orm/models/secretsModule.js +77 -0
  101. package/codegen/orm/models/site.d.ts +42 -0
  102. package/codegen/orm/models/site.js +77 -0
  103. package/codegen/orm/models/siteMetadatum.d.ts +42 -0
  104. package/codegen/orm/models/siteMetadatum.js +77 -0
  105. package/codegen/orm/models/siteModule.d.ts +42 -0
  106. package/codegen/orm/models/siteModule.js +77 -0
  107. package/codegen/orm/models/siteTheme.d.ts +42 -0
  108. package/codegen/orm/models/siteTheme.js +77 -0
  109. package/codegen/orm/models/table.d.ts +42 -0
  110. package/codegen/orm/models/table.js +77 -0
  111. package/codegen/orm/models/tableGrant.d.ts +42 -0
  112. package/codegen/orm/models/tableGrant.js +77 -0
  113. package/codegen/orm/models/tokensModule.d.ts +42 -0
  114. package/codegen/orm/models/tokensModule.js +77 -0
  115. package/codegen/orm/models/trigger.d.ts +42 -0
  116. package/codegen/orm/models/trigger.js +77 -0
  117. package/codegen/orm/models/triggerFunction.d.ts +42 -0
  118. package/codegen/orm/models/triggerFunction.js +77 -0
  119. package/codegen/orm/models/uniqueConstraint.d.ts +42 -0
  120. package/codegen/orm/models/uniqueConstraint.js +77 -0
  121. package/codegen/orm/models/userAuthModule.d.ts +42 -0
  122. package/codegen/orm/models/userAuthModule.js +77 -0
  123. package/codegen/orm/models/usersModule.d.ts +42 -0
  124. package/codegen/orm/models/usersModule.js +77 -0
  125. package/codegen/orm/models/uuidModule.d.ts +42 -0
  126. package/codegen/orm/models/uuidModule.js +77 -0
  127. package/codegen/orm/mutation/index.d.ts +531 -0
  128. package/codegen/orm/mutation/index.js +596 -0
  129. package/codegen/orm/query/index.d.ts +274 -0
  130. package/codegen/orm/query/index.js +290 -0
  131. package/codegen/orm/query-builder.d.ts +80 -0
  132. package/codegen/orm/query-builder.js +249 -0
  133. package/codegen/orm/select-types.d.ts +50 -0
  134. package/codegen/orm/select-types.js +7 -0
  135. package/codegen/orm/types.d.ts +6 -0
  136. package/codegen/orm/types.js +23 -0
  137. package/esm/codegen/orm/client.js +70 -0
  138. package/esm/codegen/orm/index.js +162 -0
  139. package/esm/codegen/orm/input-types.js +6 -0
  140. package/esm/codegen/orm/models/api.js +73 -0
  141. package/esm/codegen/orm/models/apiExtension.js +73 -0
  142. package/esm/codegen/orm/models/apiModule.js +73 -0
  143. package/esm/codegen/orm/models/apiSchema.js +73 -0
  144. package/esm/codegen/orm/models/app.js +73 -0
  145. package/esm/codegen/orm/models/checkConstraint.js +73 -0
  146. package/esm/codegen/orm/models/connectedAccountsModule.js +73 -0
  147. package/esm/codegen/orm/models/cryptoAddressesModule.js +73 -0
  148. package/esm/codegen/orm/models/cryptoAuthModule.js +73 -0
  149. package/esm/codegen/orm/models/database.js +73 -0
  150. package/esm/codegen/orm/models/databaseExtension.js +73 -0
  151. package/esm/codegen/orm/models/databaseProvision.js +73 -0
  152. package/esm/codegen/orm/models/defaultIdsModule.js +73 -0
  153. package/esm/codegen/orm/models/denormalizedTableField.js +73 -0
  154. package/esm/codegen/orm/models/domain.js +73 -0
  155. package/esm/codegen/orm/models/emailsModule.js +73 -0
  156. package/esm/codegen/orm/models/encryptedSecretsModule.js +73 -0
  157. package/esm/codegen/orm/models/extension.js +73 -0
  158. package/esm/codegen/orm/models/field.js +73 -0
  159. package/esm/codegen/orm/models/fieldModule.js +73 -0
  160. package/esm/codegen/orm/models/foreignKeyConstraint.js +73 -0
  161. package/esm/codegen/orm/models/fullTextSearch.js +73 -0
  162. package/esm/codegen/orm/models/hierarchyModule.js +73 -0
  163. package/esm/codegen/orm/models/index.js +64 -0
  164. package/esm/codegen/orm/models/indexModel.js +73 -0
  165. package/esm/codegen/orm/models/invitesModule.js +73 -0
  166. package/esm/codegen/orm/models/levelsModule.js +73 -0
  167. package/esm/codegen/orm/models/limitFunction.js +73 -0
  168. package/esm/codegen/orm/models/limitsModule.js +73 -0
  169. package/esm/codegen/orm/models/membershipTypesModule.js +73 -0
  170. package/esm/codegen/orm/models/membershipsModule.js +73 -0
  171. package/esm/codegen/orm/models/module.js +73 -0
  172. package/esm/codegen/orm/models/moduleDefinition.js +73 -0
  173. package/esm/codegen/orm/models/moduleField.js +73 -0
  174. package/esm/codegen/orm/models/moduleInputRecord.js +73 -0
  175. package/esm/codegen/orm/models/moduleOutput.js +73 -0
  176. package/esm/codegen/orm/models/permissionsModule.js +73 -0
  177. package/esm/codegen/orm/models/phoneNumbersModule.js +73 -0
  178. package/esm/codegen/orm/models/policy.js +73 -0
  179. package/esm/codegen/orm/models/primaryKeyConstraint.js +73 -0
  180. package/esm/codegen/orm/models/procedure.js +73 -0
  181. package/esm/codegen/orm/models/profilesModule.js +73 -0
  182. package/esm/codegen/orm/models/rlsFunction.js +73 -0
  183. package/esm/codegen/orm/models/rlsModule.js +73 -0
  184. package/esm/codegen/orm/models/schema.js +73 -0
  185. package/esm/codegen/orm/models/schemaGrant.js +73 -0
  186. package/esm/codegen/orm/models/secretsModule.js +73 -0
  187. package/esm/codegen/orm/models/site.js +73 -0
  188. package/esm/codegen/orm/models/siteMetadatum.js +73 -0
  189. package/esm/codegen/orm/models/siteModule.js +73 -0
  190. package/esm/codegen/orm/models/siteTheme.js +73 -0
  191. package/esm/codegen/orm/models/table.js +73 -0
  192. package/esm/codegen/orm/models/tableGrant.js +73 -0
  193. package/esm/codegen/orm/models/tokensModule.js +73 -0
  194. package/esm/codegen/orm/models/trigger.js +73 -0
  195. package/esm/codegen/orm/models/triggerFunction.js +73 -0
  196. package/esm/codegen/orm/models/uniqueConstraint.js +73 -0
  197. package/esm/codegen/orm/models/userAuthModule.js +73 -0
  198. package/esm/codegen/orm/models/usersModule.js +73 -0
  199. package/esm/codegen/orm/models/uuidModule.js +73 -0
  200. package/esm/codegen/orm/mutation/index.js +593 -0
  201. package/esm/codegen/orm/query/index.js +287 -0
  202. package/esm/codegen/orm/query-builder.js +238 -0
  203. package/esm/codegen/orm/select-types.js +6 -0
  204. package/esm/codegen/orm/types.js +7 -0
  205. package/esm/middleware/api.js +10 -9
  206. package/esm/middleware/gql.js +118 -123
  207. package/esm/middleware/graphile.js +19 -3
  208. package/esm/scripts/codegen-schema.js +71 -0
  209. package/esm/server.js +21 -0
  210. package/middleware/api.js +9 -8
  211. package/middleware/gql.d.ts +25 -5
  212. package/middleware/gql.js +122 -127
  213. package/middleware/graphile.js +19 -3
  214. package/middleware/types.d.ts +1 -0
  215. package/package.json +15 -11
  216. package/scripts/codegen-schema.d.ts +1 -0
  217. package/scripts/codegen-schema.js +76 -0
  218. package/server.js +21 -0
  219. package/types.d.ts +2 -2
@@ -0,0 +1,287 @@
1
+ import { QueryBuilder, buildCustomDocument } from '../query-builder';
2
+ // ============================================================================
3
+ // Query Operations Factory
4
+ // ============================================================================
5
+ export function createQueryOperations(client) {
6
+ return {
7
+ checkConstraintByTableIdAndName: (args, options) => new QueryBuilder({
8
+ client,
9
+ operation: 'query',
10
+ operationName: 'CheckConstraintByTableIdAndName',
11
+ fieldName: 'checkConstraintByTableIdAndName',
12
+ ...buildCustomDocument('query', 'CheckConstraintByTableIdAndName', 'checkConstraintByTableIdAndName', options?.select, args, [
13
+ { name: 'tableId', type: 'UUID!' },
14
+ { name: 'name', type: 'String!' },
15
+ ]),
16
+ }),
17
+ databaseBySchemaName: (args, options) => new QueryBuilder({
18
+ client,
19
+ operation: 'query',
20
+ operationName: 'DatabaseBySchemaName',
21
+ fieldName: 'databaseBySchemaName',
22
+ ...buildCustomDocument('query', 'DatabaseBySchemaName', 'databaseBySchemaName', options?.select, args, [{ name: 'schemaName', type: 'String!' }]),
23
+ }),
24
+ databaseByPrivateSchemaName: (args, options) => new QueryBuilder({
25
+ client,
26
+ operation: 'query',
27
+ operationName: 'DatabaseByPrivateSchemaName',
28
+ fieldName: 'databaseByPrivateSchemaName',
29
+ ...buildCustomDocument('query', 'DatabaseByPrivateSchemaName', 'databaseByPrivateSchemaName', options?.select, args, [{ name: 'privateSchemaName', type: 'String!' }]),
30
+ }),
31
+ databaseExtension: (args, options) => new QueryBuilder({
32
+ client,
33
+ operation: 'query',
34
+ operationName: 'DatabaseExtension',
35
+ fieldName: 'databaseExtension',
36
+ ...buildCustomDocument('query', 'DatabaseExtension', 'databaseExtension', options?.select, args, [{ name: 'name', type: 'String!' }]),
37
+ }),
38
+ fieldByTableIdAndName: (args, options) => new QueryBuilder({
39
+ client,
40
+ operation: 'query',
41
+ operationName: 'FieldByTableIdAndName',
42
+ fieldName: 'fieldByTableIdAndName',
43
+ ...buildCustomDocument('query', 'FieldByTableIdAndName', 'fieldByTableIdAndName', options?.select, args, [
44
+ { name: 'tableId', type: 'UUID!' },
45
+ { name: 'name', type: 'String!' },
46
+ ]),
47
+ }),
48
+ foreignKeyConstraintByTableIdAndName: (args, options) => new QueryBuilder({
49
+ client,
50
+ operation: 'query',
51
+ operationName: 'ForeignKeyConstraintByTableIdAndName',
52
+ fieldName: 'foreignKeyConstraintByTableIdAndName',
53
+ ...buildCustomDocument('query', 'ForeignKeyConstraintByTableIdAndName', 'foreignKeyConstraintByTableIdAndName', options?.select, args, [
54
+ { name: 'tableId', type: 'UUID!' },
55
+ { name: 'name', type: 'String!' },
56
+ ]),
57
+ }),
58
+ indexByDatabaseIdAndName: (args, options) => new QueryBuilder({
59
+ client,
60
+ operation: 'query',
61
+ operationName: 'IndexByDatabaseIdAndName',
62
+ fieldName: 'indexByDatabaseIdAndName',
63
+ ...buildCustomDocument('query', 'IndexByDatabaseIdAndName', 'indexByDatabaseIdAndName', options?.select, args, [
64
+ { name: 'databaseId', type: 'UUID!' },
65
+ { name: 'name', type: 'String!' },
66
+ ]),
67
+ }),
68
+ limitFunctionByDatabaseIdAndName: (args, options) => new QueryBuilder({
69
+ client,
70
+ operation: 'query',
71
+ operationName: 'LimitFunctionByDatabaseIdAndName',
72
+ fieldName: 'limitFunctionByDatabaseIdAndName',
73
+ ...buildCustomDocument('query', 'LimitFunctionByDatabaseIdAndName', 'limitFunctionByDatabaseIdAndName', options?.select, args, [
74
+ { name: 'databaseId', type: 'UUID!' },
75
+ { name: 'name', type: 'String!' },
76
+ ]),
77
+ }),
78
+ policyByTableIdAndName: (args, options) => new QueryBuilder({
79
+ client,
80
+ operation: 'query',
81
+ operationName: 'PolicyByTableIdAndName',
82
+ fieldName: 'policyByTableIdAndName',
83
+ ...buildCustomDocument('query', 'PolicyByTableIdAndName', 'policyByTableIdAndName', options?.select, args, [
84
+ { name: 'tableId', type: 'UUID!' },
85
+ { name: 'name', type: 'String!' },
86
+ ]),
87
+ }),
88
+ primaryKeyConstraintByTableIdAndName: (args, options) => new QueryBuilder({
89
+ client,
90
+ operation: 'query',
91
+ operationName: 'PrimaryKeyConstraintByTableIdAndName',
92
+ fieldName: 'primaryKeyConstraintByTableIdAndName',
93
+ ...buildCustomDocument('query', 'PrimaryKeyConstraintByTableIdAndName', 'primaryKeyConstraintByTableIdAndName', options?.select, args, [
94
+ { name: 'tableId', type: 'UUID!' },
95
+ { name: 'name', type: 'String!' },
96
+ ]),
97
+ }),
98
+ procedureByDatabaseIdAndName: (args, options) => new QueryBuilder({
99
+ client,
100
+ operation: 'query',
101
+ operationName: 'ProcedureByDatabaseIdAndName',
102
+ fieldName: 'procedureByDatabaseIdAndName',
103
+ ...buildCustomDocument('query', 'ProcedureByDatabaseIdAndName', 'procedureByDatabaseIdAndName', options?.select, args, [
104
+ { name: 'databaseId', type: 'UUID!' },
105
+ { name: 'name', type: 'String!' },
106
+ ]),
107
+ }),
108
+ rlsFunctionByDatabaseIdAndName: (args, options) => new QueryBuilder({
109
+ client,
110
+ operation: 'query',
111
+ operationName: 'RlsFunctionByDatabaseIdAndName',
112
+ fieldName: 'rlsFunctionByDatabaseIdAndName',
113
+ ...buildCustomDocument('query', 'RlsFunctionByDatabaseIdAndName', 'rlsFunctionByDatabaseIdAndName', options?.select, args, [
114
+ { name: 'databaseId', type: 'UUID!' },
115
+ { name: 'name', type: 'String!' },
116
+ ]),
117
+ }),
118
+ schemaByDatabaseIdAndName: (args, options) => new QueryBuilder({
119
+ client,
120
+ operation: 'query',
121
+ operationName: 'SchemaByDatabaseIdAndName',
122
+ fieldName: 'schemaByDatabaseIdAndName',
123
+ ...buildCustomDocument('query', 'SchemaByDatabaseIdAndName', 'schemaByDatabaseIdAndName', options?.select, args, [
124
+ { name: 'databaseId', type: 'UUID!' },
125
+ { name: 'name', type: 'String!' },
126
+ ]),
127
+ }),
128
+ schemaBySchemaName: (args, options) => new QueryBuilder({
129
+ client,
130
+ operation: 'query',
131
+ operationName: 'SchemaBySchemaName',
132
+ fieldName: 'schemaBySchemaName',
133
+ ...buildCustomDocument('query', 'SchemaBySchemaName', 'schemaBySchemaName', options?.select, args, [{ name: 'schemaName', type: 'String!' }]),
134
+ }),
135
+ tableByDatabaseIdAndName: (args, options) => new QueryBuilder({
136
+ client,
137
+ operation: 'query',
138
+ operationName: 'TableByDatabaseIdAndName',
139
+ fieldName: 'tableByDatabaseIdAndName',
140
+ ...buildCustomDocument('query', 'TableByDatabaseIdAndName', 'tableByDatabaseIdAndName', options?.select, args, [
141
+ { name: 'databaseId', type: 'UUID!' },
142
+ { name: 'name', type: 'String!' },
143
+ ]),
144
+ }),
145
+ triggerByTableIdAndName: (args, options) => new QueryBuilder({
146
+ client,
147
+ operation: 'query',
148
+ operationName: 'TriggerByTableIdAndName',
149
+ fieldName: 'triggerByTableIdAndName',
150
+ ...buildCustomDocument('query', 'TriggerByTableIdAndName', 'triggerByTableIdAndName', options?.select, args, [
151
+ { name: 'tableId', type: 'UUID!' },
152
+ { name: 'name', type: 'String!' },
153
+ ]),
154
+ }),
155
+ triggerFunctionByDatabaseIdAndName: (args, options) => new QueryBuilder({
156
+ client,
157
+ operation: 'query',
158
+ operationName: 'TriggerFunctionByDatabaseIdAndName',
159
+ fieldName: 'triggerFunctionByDatabaseIdAndName',
160
+ ...buildCustomDocument('query', 'TriggerFunctionByDatabaseIdAndName', 'triggerFunctionByDatabaseIdAndName', options?.select, args, [
161
+ { name: 'databaseId', type: 'UUID!' },
162
+ { name: 'name', type: 'String!' },
163
+ ]),
164
+ }),
165
+ uniqueConstraintByTableIdAndName: (args, options) => new QueryBuilder({
166
+ client,
167
+ operation: 'query',
168
+ operationName: 'UniqueConstraintByTableIdAndName',
169
+ fieldName: 'uniqueConstraintByTableIdAndName',
170
+ ...buildCustomDocument('query', 'UniqueConstraintByTableIdAndName', 'uniqueConstraintByTableIdAndName', options?.select, args, [
171
+ { name: 'tableId', type: 'UUID!' },
172
+ { name: 'name', type: 'String!' },
173
+ ]),
174
+ }),
175
+ apiExtensionBySchemaNameAndApiId: (args, options) => new QueryBuilder({
176
+ client,
177
+ operation: 'query',
178
+ operationName: 'ApiExtensionBySchemaNameAndApiId',
179
+ fieldName: 'apiExtensionBySchemaNameAndApiId',
180
+ ...buildCustomDocument('query', 'ApiExtensionBySchemaNameAndApiId', 'apiExtensionBySchemaNameAndApiId', options?.select, args, [
181
+ { name: 'schemaName', type: 'String!' },
182
+ { name: 'apiId', type: 'UUID!' },
183
+ ]),
184
+ }),
185
+ apiSchemaByApiIdAndSchemaId: (args, options) => new QueryBuilder({
186
+ client,
187
+ operation: 'query',
188
+ operationName: 'ApiSchemaByApiIdAndSchemaId',
189
+ fieldName: 'apiSchemaByApiIdAndSchemaId',
190
+ ...buildCustomDocument('query', 'ApiSchemaByApiIdAndSchemaId', 'apiSchemaByApiIdAndSchemaId', options?.select, args, [
191
+ { name: 'apiId', type: 'UUID!' },
192
+ { name: 'schemaId', type: 'UUID!' },
193
+ ]),
194
+ }),
195
+ apiByDatabaseIdAndName: (args, options) => new QueryBuilder({
196
+ client,
197
+ operation: 'query',
198
+ operationName: 'ApiByDatabaseIdAndName',
199
+ fieldName: 'apiByDatabaseIdAndName',
200
+ ...buildCustomDocument('query', 'ApiByDatabaseIdAndName', 'apiByDatabaseIdAndName', options?.select, args, [
201
+ { name: 'databaseId', type: 'UUID!' },
202
+ { name: 'name', type: 'String!' },
203
+ ]),
204
+ }),
205
+ appBySiteId: (args, options) => new QueryBuilder({
206
+ client,
207
+ operation: 'query',
208
+ operationName: 'AppBySiteId',
209
+ fieldName: 'appBySiteId',
210
+ ...buildCustomDocument('query', 'AppBySiteId', 'appBySiteId', options?.select, args, [{ name: 'siteId', type: 'UUID!' }]),
211
+ }),
212
+ domainBySubdomainAndDomain: (args, options) => new QueryBuilder({
213
+ client,
214
+ operation: 'query',
215
+ operationName: 'DomainBySubdomainAndDomain',
216
+ fieldName: 'domainBySubdomainAndDomain',
217
+ ...buildCustomDocument('query', 'DomainBySubdomainAndDomain', 'domainBySubdomainAndDomain', options?.select, args, [
218
+ { name: 'subdomain', type: 'String!' },
219
+ { name: 'domain', type: 'String!' },
220
+ ]),
221
+ }),
222
+ hierarchyModuleByDatabaseId: (args, options) => new QueryBuilder({
223
+ client,
224
+ operation: 'query',
225
+ operationName: 'HierarchyModuleByDatabaseId',
226
+ fieldName: 'hierarchyModuleByDatabaseId',
227
+ ...buildCustomDocument('query', 'HierarchyModuleByDatabaseId', 'hierarchyModuleByDatabaseId', options?.select, args, [{ name: 'databaseId', type: 'UUID!' }]),
228
+ }),
229
+ moduleDefinitionByNameAndContext: (args, options) => new QueryBuilder({
230
+ client,
231
+ operation: 'query',
232
+ operationName: 'ModuleDefinitionByNameAndContext',
233
+ fieldName: 'moduleDefinitionByNameAndContext',
234
+ ...buildCustomDocument('query', 'ModuleDefinitionByNameAndContext', 'moduleDefinitionByNameAndContext', options?.select, args, [
235
+ { name: 'name', type: 'String!' },
236
+ { name: 'context', type: 'String!' },
237
+ ]),
238
+ }),
239
+ moduleFieldByModuleDefnIdAndName: (args, options) => new QueryBuilder({
240
+ client,
241
+ operation: 'query',
242
+ operationName: 'ModuleFieldByModuleDefnIdAndName',
243
+ fieldName: 'moduleFieldByModuleDefnIdAndName',
244
+ ...buildCustomDocument('query', 'ModuleFieldByModuleDefnIdAndName', 'moduleFieldByModuleDefnIdAndName', options?.select, args, [
245
+ { name: 'moduleDefnId', type: 'UUID!' },
246
+ { name: 'name', type: 'String!' },
247
+ ]),
248
+ }),
249
+ moduleInputRecordByModuleIdAndName: (args, options) => new QueryBuilder({
250
+ client,
251
+ operation: 'query',
252
+ operationName: 'ModuleInputRecordByModuleIdAndName',
253
+ fieldName: 'moduleInputRecordByModuleIdAndName',
254
+ ...buildCustomDocument('query', 'ModuleInputRecordByModuleIdAndName', 'moduleInputRecordByModuleIdAndName', options?.select, args, [
255
+ { name: 'moduleId', type: 'UUID!' },
256
+ { name: 'name', type: 'String!' },
257
+ ]),
258
+ }),
259
+ moduleOutputByModuleIdAndName: (args, options) => new QueryBuilder({
260
+ client,
261
+ operation: 'query',
262
+ operationName: 'ModuleOutputByModuleIdAndName',
263
+ fieldName: 'moduleOutputByModuleIdAndName',
264
+ ...buildCustomDocument('query', 'ModuleOutputByModuleIdAndName', 'moduleOutputByModuleIdAndName', options?.select, args, [
265
+ { name: 'moduleId', type: 'UUID!' },
266
+ { name: 'name', type: 'String!' },
267
+ ]),
268
+ }),
269
+ profilesModuleByDatabaseIdAndMembershipType: (args, options) => new QueryBuilder({
270
+ client,
271
+ operation: 'query',
272
+ operationName: 'ProfilesModuleByDatabaseIdAndMembershipType',
273
+ fieldName: 'profilesModuleByDatabaseIdAndMembershipType',
274
+ ...buildCustomDocument('query', 'ProfilesModuleByDatabaseIdAndMembershipType', 'profilesModuleByDatabaseIdAndMembershipType', options?.select, args, [
275
+ { name: 'databaseId', type: 'UUID!' },
276
+ { name: 'membershipType', type: 'Int!' },
277
+ ]),
278
+ }),
279
+ rlsModuleByApiId: (args, options) => new QueryBuilder({
280
+ client,
281
+ operation: 'query',
282
+ operationName: 'RlsModuleByApiId',
283
+ fieldName: 'rlsModuleByApiId',
284
+ ...buildCustomDocument('query', 'RlsModuleByApiId', 'rlsModuleByApiId', options?.select, args, [{ name: 'apiId', type: 'UUID!' }]),
285
+ }),
286
+ };
287
+ }
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Query Builder - Builds and executes GraphQL operations
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import { GraphQLRequestError } from './client';
7
+ export class QueryBuilder {
8
+ config;
9
+ constructor(config) {
10
+ this.config = config;
11
+ }
12
+ /**
13
+ * Execute the query and return a discriminated union result
14
+ * Use result.ok to check success, or .unwrap() to throw on error
15
+ */
16
+ async execute() {
17
+ return this.config.client.execute(this.config.document, this.config.variables);
18
+ }
19
+ /**
20
+ * Execute and unwrap the result, throwing GraphQLRequestError on failure
21
+ * @throws {GraphQLRequestError} If the query returns errors
22
+ */
23
+ async unwrap() {
24
+ const result = await this.execute();
25
+ if (!result.ok) {
26
+ throw new GraphQLRequestError(result.errors, result.data);
27
+ }
28
+ return result.data;
29
+ }
30
+ /**
31
+ * Execute and unwrap, returning defaultValue on error instead of throwing
32
+ */
33
+ async unwrapOr(defaultValue) {
34
+ const result = await this.execute();
35
+ if (!result.ok) {
36
+ return defaultValue;
37
+ }
38
+ return result.data;
39
+ }
40
+ /**
41
+ * Execute and unwrap, calling onError callback on failure
42
+ */
43
+ async unwrapOrElse(onError) {
44
+ const result = await this.execute();
45
+ if (!result.ok) {
46
+ return onError(result.errors);
47
+ }
48
+ return result.data;
49
+ }
50
+ toGraphQL() {
51
+ return this.config.document;
52
+ }
53
+ getVariables() {
54
+ return this.config.variables;
55
+ }
56
+ }
57
+ // ============================================================================
58
+ // Document Builders
59
+ // ============================================================================
60
+ export function buildSelections(select) {
61
+ if (!select)
62
+ return '';
63
+ const fields = [];
64
+ for (const [key, value] of Object.entries(select)) {
65
+ if (value === false || value === undefined)
66
+ continue;
67
+ if (value === true) {
68
+ fields.push(key);
69
+ continue;
70
+ }
71
+ if (typeof value === 'object' && value !== null) {
72
+ const nested = value;
73
+ if (nested.select) {
74
+ const nestedSelections = buildSelections(nested.select);
75
+ // Check if this is a connection type (has pagination args or explicit connection flag)
76
+ const isConnection = nested.connection === true ||
77
+ nested.first !== undefined ||
78
+ nested.filter !== undefined;
79
+ if (isConnection) {
80
+ // Connection type - wrap in nodes/totalCount/pageInfo
81
+ const args = [];
82
+ if (nested.first !== undefined)
83
+ args.push(`first: ${nested.first}`);
84
+ if (nested.orderBy?.length)
85
+ args.push(`orderBy: [${nested.orderBy.join(', ')}]`);
86
+ const argsStr = args.length > 0 ? `(${args.join(', ')})` : '';
87
+ fields.push(`${key}${argsStr} {
88
+ nodes { ${nestedSelections} }
89
+ totalCount
90
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
91
+ }`);
92
+ }
93
+ else {
94
+ // Regular nested object - just wrap in braces
95
+ fields.push(`${key} { ${nestedSelections} }`);
96
+ }
97
+ }
98
+ }
99
+ }
100
+ return fields.join('\n ');
101
+ }
102
+ export function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName) {
103
+ const selections = select ? buildSelections(select) : 'id';
104
+ const varDefs = [];
105
+ const queryArgs = [];
106
+ const variables = {};
107
+ if (args.where) {
108
+ varDefs.push(`$where: ${filterTypeName}`);
109
+ queryArgs.push('filter: $where');
110
+ variables.where = args.where;
111
+ }
112
+ if (args.orderBy?.length) {
113
+ varDefs.push(`$orderBy: [${orderByTypeName}!]`);
114
+ queryArgs.push('orderBy: $orderBy');
115
+ variables.orderBy = args.orderBy;
116
+ }
117
+ if (args.first !== undefined) {
118
+ varDefs.push('$first: Int');
119
+ queryArgs.push('first: $first');
120
+ variables.first = args.first;
121
+ }
122
+ if (args.last !== undefined) {
123
+ varDefs.push('$last: Int');
124
+ queryArgs.push('last: $last');
125
+ variables.last = args.last;
126
+ }
127
+ if (args.after) {
128
+ varDefs.push('$after: Cursor');
129
+ queryArgs.push('after: $after');
130
+ variables.after = args.after;
131
+ }
132
+ if (args.before) {
133
+ varDefs.push('$before: Cursor');
134
+ queryArgs.push('before: $before');
135
+ variables.before = args.before;
136
+ }
137
+ if (args.offset !== undefined) {
138
+ varDefs.push('$offset: Int');
139
+ queryArgs.push('offset: $offset');
140
+ variables.offset = args.offset;
141
+ }
142
+ const varDefsStr = varDefs.length > 0 ? `(${varDefs.join(', ')})` : '';
143
+ const queryArgsStr = queryArgs.length > 0 ? `(${queryArgs.join(', ')})` : '';
144
+ const document = `query ${operationName}Query${varDefsStr} {
145
+ ${queryField}${queryArgsStr} {
146
+ nodes { ${selections} }
147
+ totalCount
148
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
149
+ }
150
+ }`;
151
+ return { document, variables };
152
+ }
153
+ export function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName) {
154
+ const selections = select ? buildSelections(select) : 'id';
155
+ const varDefs = ['$first: Int'];
156
+ const queryArgs = ['first: $first'];
157
+ const variables = { first: 1 };
158
+ if (args.where) {
159
+ varDefs.push(`$where: ${filterTypeName}`);
160
+ queryArgs.push('filter: $where');
161
+ variables.where = args.where;
162
+ }
163
+ const document = `query ${operationName}Query(${varDefs.join(', ')}) {
164
+ ${queryField}(${queryArgs.join(', ')}) {
165
+ nodes { ${selections} }
166
+ }
167
+ }`;
168
+ return { document, variables };
169
+ }
170
+ export function buildCreateDocument(operationName, mutationField, entityField, select, data, inputTypeName) {
171
+ const selections = select ? buildSelections(select) : 'id';
172
+ const document = `mutation ${operationName}Mutation($input: ${inputTypeName}!) {
173
+ ${mutationField}(input: $input) {
174
+ ${entityField} { ${selections} }
175
+ }
176
+ }`;
177
+ return {
178
+ document,
179
+ variables: { input: { [entityField]: data } },
180
+ };
181
+ }
182
+ export function buildUpdateDocument(operationName, mutationField, entityField, select, where, data, inputTypeName) {
183
+ const selections = select ? buildSelections(select) : 'id';
184
+ const document = `mutation ${operationName}Mutation($input: ${inputTypeName}!) {
185
+ ${mutationField}(input: $input) {
186
+ ${entityField} { ${selections} }
187
+ }
188
+ }`;
189
+ return {
190
+ document,
191
+ variables: { input: { id: where.id, patch: data } },
192
+ };
193
+ }
194
+ export function buildDeleteDocument(operationName, mutationField, entityField, where, inputTypeName) {
195
+ const document = `mutation ${operationName}Mutation($input: ${inputTypeName}!) {
196
+ ${mutationField}(input: $input) {
197
+ ${entityField} { id }
198
+ }
199
+ }`;
200
+ return {
201
+ document,
202
+ variables: { input: { id: where.id } },
203
+ };
204
+ }
205
+ export function buildCustomDocument(operationType, operationName, fieldName, select, args, variableDefinitions) {
206
+ // Check if select is wrapped with connection metadata
207
+ let actualSelect = select;
208
+ let isConnection = false;
209
+ if (select && typeof select === 'object' && 'select' in select) {
210
+ const wrapper = select;
211
+ if (wrapper.select) {
212
+ actualSelect = wrapper.select;
213
+ isConnection = wrapper.connection === true;
214
+ }
215
+ }
216
+ const selections = actualSelect ? buildSelections(actualSelect) : '';
217
+ const varDefs = variableDefinitions.map((v) => `$${v.name}: ${v.type}`);
218
+ const fieldArgs = variableDefinitions.map((v) => `${v.name}: $${v.name}`);
219
+ const varDefsStr = varDefs.length > 0 ? `(${varDefs.join(', ')})` : '';
220
+ const fieldArgsStr = fieldArgs.length > 0 ? `(${fieldArgs.join(', ')})` : '';
221
+ let selectionsBlock;
222
+ if (isConnection) {
223
+ // Wrap in connection structure
224
+ selectionsBlock = ` {
225
+ nodes { ${selections} }
226
+ totalCount
227
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
228
+ }`;
229
+ }
230
+ else {
231
+ selectionsBlock = selections ? ` { ${selections} }` : '';
232
+ }
233
+ const opType = operationType === 'query' ? 'query' : 'mutation';
234
+ const document = `${opType} ${operationName}${varDefsStr} {
235
+ ${fieldName}${fieldArgsStr}${selectionsBlock}
236
+ }`;
237
+ return { document, variables: (args ?? {}) };
238
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Type utilities for select inference
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Types re-export
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ // Re-export all types from input-types
7
+ export * from './input-types';
@@ -6,14 +6,14 @@ import { getGraphileSettings } from 'graphile-settings';
6
6
  import { getPgPool } from 'pg-cache';
7
7
  import errorPage50x from '../errors/50x';
8
8
  import errorPage404Message from '../errors/404-message';
9
- import { ApiByNameQuery, ApiQuery, ListOfAllDomainsOfDb } from './gql';
9
+ import { buildApiByDatabaseIdAndName, buildDomainLookup, buildListApis, } from './gql';
10
10
  import './types'; // for Request type
11
11
  const log = new Logger('api');
12
12
  const isDev = () => getNodeEnv() === 'development';
13
13
  const transformServiceToApi = (svc) => {
14
14
  const api = svc.data.api;
15
- const schemaNames = api.schemaNamesFromExt?.nodes?.map((n) => n.schemaName) || [];
16
- const additionalSchemas = api.schemaNames?.nodes?.map((n) => n.schemaName) || [];
15
+ const schemaNames = api.apiExtensions?.nodes?.map((n) => n.schemaName) || [];
16
+ const additionalSchemas = api.schemasByApiSchemaApiIdAndSchemaId?.nodes?.map((n) => n.schemaName) || [];
17
17
  let domains = [];
18
18
  if (api.database?.sites?.nodes) {
19
19
  domains = api.database.sites.nodes.reduce((acc, site) => {
@@ -161,10 +161,11 @@ const getMetaSchema = ({ opts, key, databaseId, }) => {
161
161
  return svc;
162
162
  };
163
163
  const queryServiceByDomainAndSubdomain = async ({ opts, key, client, domain, subdomain, }) => {
164
+ const doc = buildDomainLookup({ domain, subdomain });
164
165
  const result = await client.query({
165
166
  role: 'administrator',
166
- query: ApiQuery,
167
- variables: { domain, subdomain },
167
+ query: doc.document,
168
+ variables: doc.variables,
168
169
  });
169
170
  if (result.errors?.length) {
170
171
  log.error('GraphQL query errors:', result.errors);
@@ -183,10 +184,11 @@ const queryServiceByDomainAndSubdomain = async ({ opts, key, client, domain, sub
183
184
  return null;
184
185
  };
185
186
  const queryServiceByApiName = async ({ opts, key, client, databaseId, name, }) => {
187
+ const doc = buildApiByDatabaseIdAndName({ databaseId, name });
186
188
  const result = await client.query({
187
189
  role: 'administrator',
188
- query: ApiByNameQuery,
189
- variables: { databaseId, name },
190
+ query: doc.document,
191
+ variables: doc.variables,
190
192
  });
191
193
  if (result.errors?.length) {
192
194
  log.error('GraphQL query errors:', result.errors);
@@ -312,8 +314,7 @@ export const getApiConfig = async (opts, req) => {
312
314
  const fallbackResult = await client.query({
313
315
  role: 'administrator',
314
316
  // @ts-ignore
315
- query: ListOfAllDomainsOfDb,
316
- // variables: { databaseId }
317
+ query: buildListApis().document,
317
318
  });
318
319
  if (!fallbackResult.errors?.length &&
319
320
  fallbackResult.data?.apis?.nodes?.length) {