@aurabase/aurabase-js 0.3.0 → 0.3.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 (258) hide show
  1. package/package.json +4 -4
  2. package/packages/ai/node_modules/.bin/esbuild +0 -19
  3. package/packages/ai/node_modules/.bin/tsc +0 -22
  4. package/packages/ai/node_modules/.bin/tsserver +0 -22
  5. package/packages/ai/node_modules/.bin/tsup +0 -22
  6. package/packages/ai/node_modules/.bin/tsup-node +0 -22
  7. package/packages/ai/node_modules/.bin/vite +0 -22
  8. package/packages/ai/node_modules/.bin/vitest +0 -22
  9. package/packages/ai/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  10. package/packages/ai/src/AiService.ts +0 -226
  11. package/packages/ai/src/index.ts +0 -18
  12. package/packages/ai/src/sse.ts +0 -141
  13. package/packages/ai/src/types.ts +0 -30
  14. package/packages/ai/tests/chat-stream.test.ts +0 -151
  15. package/packages/ai/tests/rag-namespaces.test.ts +0 -54
  16. package/packages/ai/tests/sse.test.ts +0 -69
  17. package/packages/ai/tsconfig.json +0 -5
  18. package/packages/ai/tsup.config.ts +0 -11
  19. package/packages/aurabase/node_modules/.bin/esbuild +0 -19
  20. package/packages/aurabase/node_modules/.bin/tsc +0 -22
  21. package/packages/aurabase/node_modules/.bin/tsserver +0 -22
  22. package/packages/aurabase/node_modules/.bin/tsup +0 -22
  23. package/packages/aurabase/node_modules/.bin/tsup-node +0 -22
  24. package/packages/aurabase/node_modules/.bin/vite +0 -22
  25. package/packages/aurabase/node_modules/.bin/vitest +0 -22
  26. package/packages/aurabase/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  27. package/packages/aurabase/src/AuraClient.ts +0 -237
  28. package/packages/aurabase/src/index.ts +0 -152
  29. package/packages/aurabase/src/ssr.ts +0 -156
  30. package/packages/aurabase/tests/ai-streaming-rag-e2e.test.ts +0 -82
  31. package/packages/aurabase/tests/ai.test.ts +0 -111
  32. package/packages/aurabase/tests/auth-admin.test.ts +0 -515
  33. package/packages/aurabase/tests/auth-e2e.test.ts +0 -135
  34. package/packages/aurabase/tests/auth-hardening.test.ts +0 -206
  35. package/packages/aurabase/tests/auth.test.ts +0 -947
  36. package/packages/aurabase/tests/database.test.ts +0 -230
  37. package/packages/aurabase/tests/db-types-e2e.test.ts +0 -217
  38. package/packages/aurabase/tests/dispose.test.ts +0 -23
  39. package/packages/aurabase/tests/foreign-token.e2e.test.ts +0 -129
  40. package/packages/aurabase/tests/functions.test.ts +0 -107
  41. package/packages/aurabase/tests/integration.test.ts +0 -413
  42. package/packages/aurabase/tests/live-production-validation.js +0 -241
  43. package/packages/aurabase/tests/live-sdk-production-validation.js +0 -293
  44. package/packages/aurabase/tests/mocks.ts +0 -139
  45. package/packages/aurabase/tests/notifications.test.ts +0 -314
  46. package/packages/aurabase/tests/observability-backup.test.ts +0 -186
  47. package/packages/aurabase/tests/observability-hook.test.ts +0 -130
  48. package/packages/aurabase/tests/production-robustness.test.ts +0 -268
  49. package/packages/aurabase/tests/public-api-surface.test.ts +0 -53
  50. package/packages/aurabase/tests/query-builder.test.ts +0 -329
  51. package/packages/aurabase/tests/readme-smoke-e2e.test.ts +0 -231
  52. package/packages/aurabase/tests/realtime-filter-e2e.test.ts +0 -344
  53. package/packages/aurabase/tests/refresh-locks.test.ts +0 -210
  54. package/packages/aurabase/tests/retry-option.test.ts +0 -17
  55. package/packages/aurabase/tests/rpc-e2e.test.ts +0 -254
  56. package/packages/aurabase/tests/rs256-local-e2e.test.ts +0 -114
  57. package/packages/aurabase/tests/rt-alias-public-e2e.test.ts +0 -235
  58. package/packages/aurabase/tests/rt-http-broadcast-e2e.test.ts +0 -124
  59. package/packages/aurabase/tests/service-role-guard.test.ts +0 -99
  60. package/packages/aurabase/tests/ssr.test.ts +0 -91
  61. package/packages/aurabase/tests/storage-backend-e2e.test.ts +0 -481
  62. package/packages/aurabase/tests/storage-sdk-parity-e2e.test.ts +0 -104
  63. package/packages/aurabase/tests/storage-transform-e2e.test.ts +0 -684
  64. package/packages/aurabase/tests/storage.test.ts +0 -55
  65. package/packages/aurabase/tests/types/client-generic.test-d.ts +0 -79
  66. package/packages/aurabase/tests/types/docs-snippets.test-d.ts +0 -571
  67. package/packages/aurabase/tests/types/error-code.test-d.ts +0 -53
  68. package/packages/aurabase/tsconfig.json +0 -5
  69. package/packages/aurabase/tsconfig.test-d.json +0 -5
  70. package/packages/aurabase/tsup.config.ts +0 -11
  71. package/packages/aurabase/vitest.config.ts +0 -16
  72. package/packages/auth/node_modules/.bin/esbuild +0 -19
  73. package/packages/auth/node_modules/.bin/tsc +0 -22
  74. package/packages/auth/node_modules/.bin/tsserver +0 -22
  75. package/packages/auth/node_modules/.bin/tsup +0 -22
  76. package/packages/auth/node_modules/.bin/tsup-node +0 -22
  77. package/packages/auth/node_modules/.bin/vite +0 -22
  78. package/packages/auth/node_modules/.bin/vitest +0 -22
  79. package/packages/auth/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  80. package/packages/auth/src/AuthAdminService.ts +0 -149
  81. package/packages/auth/src/AuthService.ts +0 -1166
  82. package/packages/auth/src/SessionManager.ts +0 -92
  83. package/packages/auth/src/index.ts +0 -17
  84. package/packages/auth/src/jwks.ts +0 -337
  85. package/packages/auth/src/pkce.ts +0 -27
  86. package/packages/auth/src/types.ts +0 -89
  87. package/packages/auth/tests/auth-lifecycle.test.ts +0 -149
  88. package/packages/auth/tests/detect-session.test.ts +0 -361
  89. package/packages/auth/tests/getclaims.test.ts +0 -780
  90. package/packages/auth/tests/is-mfa-challenge.test.ts +0 -27
  91. package/packages/auth/tests/password-recovery.test.ts +0 -124
  92. package/packages/auth/tests/pkce.test.ts +0 -192
  93. package/packages/auth/tests/session-manager.test.ts +0 -103
  94. package/packages/auth/tests/set-session.test.ts +0 -139
  95. package/packages/auth/tests/verify-otp.test.ts +0 -153
  96. package/packages/auth/tsconfig.json +0 -5
  97. package/packages/auth/tsup.config.ts +0 -11
  98. package/packages/core/node_modules/.bin/esbuild +0 -22
  99. package/packages/core/node_modules/.bin/tsc +0 -22
  100. package/packages/core/node_modules/.bin/tsserver +0 -22
  101. package/packages/core/node_modules/.bin/tsup +0 -22
  102. package/packages/core/node_modules/.bin/tsup-node +0 -22
  103. package/packages/core/node_modules/.bin/vite +0 -22
  104. package/packages/core/node_modules/.bin/vitest +0 -22
  105. package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  106. package/packages/core/src/AuraError.ts +0 -89
  107. package/packages/core/src/BaseService.ts +0 -44
  108. package/packages/core/src/client.ts +0 -34
  109. package/packages/core/src/cookie-utils.ts +0 -42
  110. package/packages/core/src/fetch.ts +0 -435
  111. package/packages/core/src/index.ts +0 -22
  112. package/packages/core/src/retry.ts +0 -63
  113. package/packages/core/src/serialize.ts +0 -6
  114. package/packages/core/src/stores/BaseAuthStore.ts +0 -164
  115. package/packages/core/src/stores/LocalAuthStore.ts +0 -199
  116. package/packages/core/src/types.ts +0 -1042
  117. package/packages/core/tests/auth-store.test.ts +0 -300
  118. package/packages/core/tests/error-code.test.ts +0 -61
  119. package/packages/core/tests/error.test.ts +0 -24
  120. package/packages/core/tests/fetch.test.ts +0 -286
  121. package/packages/core/tests/mocks.ts +0 -139
  122. package/packages/core/tests/observability.test.ts +0 -86
  123. package/packages/core/tests/refresh-hardening.test.ts +0 -164
  124. package/packages/core/tests/refresh-observability.test.ts +0 -111
  125. package/packages/core/tests/retry.test.ts +0 -106
  126. package/packages/core/tests/serialize.test.ts +0 -12
  127. package/packages/core/tests/timeout.test.ts +0 -79
  128. package/packages/core/tsconfig.json +0 -5
  129. package/packages/core/tsup.config.ts +0 -11
  130. package/packages/db/node_modules/.bin/esbuild +0 -19
  131. package/packages/db/node_modules/.bin/tsc +0 -22
  132. package/packages/db/node_modules/.bin/tsserver +0 -22
  133. package/packages/db/node_modules/.bin/tsup +0 -22
  134. package/packages/db/node_modules/.bin/tsup-node +0 -22
  135. package/packages/db/node_modules/.bin/vite +0 -22
  136. package/packages/db/node_modules/.bin/vitest +0 -22
  137. package/packages/db/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  138. package/packages/db/src/DatabaseService.ts +0 -170
  139. package/packages/db/src/QueryBuilder.ts +0 -830
  140. package/packages/db/src/index.ts +0 -2
  141. package/packages/db/src/pgrst-types/common/common.ts +0 -86
  142. package/packages/db/src/pgrst-types/common/rpc.ts +0 -151
  143. package/packages/db/src/pgrst-types/feature-flags.ts +0 -20
  144. package/packages/db/src/pgrst-types/types.ts +0 -134
  145. package/packages/db/src/select-query-parser/parser.ts +0 -479
  146. package/packages/db/src/select-query-parser/result.ts +0 -553
  147. package/packages/db/src/select-query-parser/types.ts +0 -132
  148. package/packages/db/src/select-query-parser/utils.ts +0 -707
  149. package/packages/db/tests/filters.test.ts +0 -81
  150. package/packages/db/tests/mutations-filtered.e2e.test.ts +0 -132
  151. package/packages/db/tests/mutations-filtered.test.ts +0 -188
  152. package/packages/db/tests/order.test.ts +0 -45
  153. package/packages/db/tests/rpc.test.ts +0 -41
  154. package/packages/db/tests/scale/build-large-schema.ts +0 -94
  155. package/packages/db/tests/scale/scale-compile.test.ts +0 -167
  156. package/packages/db/tests/schema.test.ts +0 -77
  157. package/packages/db/tests/single-accept.e2e.test.ts +0 -123
  158. package/packages/db/tests/single.test.ts +0 -211
  159. package/packages/db/tests/types/filters.test-d.ts +0 -52
  160. package/packages/db/tests/types/fixtures.ts +0 -40
  161. package/packages/db/tests/types/from-views.test-d.ts +0 -18
  162. package/packages/db/tests/types/mutations.test-d.ts +0 -23
  163. package/packages/db/tests/types/rpc.test-d.ts +0 -60
  164. package/packages/db/tests/types/schema-shape.test-d.ts +0 -8
  165. package/packages/db/tests/types/select-inference.test-d.ts +0 -38
  166. package/packages/db/tests/vendored/fixtures.ts +0 -83
  167. package/packages/db/tests/vendored/get-result.test-d.ts +0 -75
  168. package/packages/db/tsconfig.json +0 -5
  169. package/packages/db/tsconfig.test-d.json +0 -5
  170. package/packages/db/tsup.config.ts +0 -11
  171. package/packages/db/vitest.config.ts +0 -8
  172. package/packages/functions/node_modules/.bin/esbuild +0 -19
  173. package/packages/functions/node_modules/.bin/tsc +0 -22
  174. package/packages/functions/node_modules/.bin/tsserver +0 -22
  175. package/packages/functions/node_modules/.bin/tsup +0 -22
  176. package/packages/functions/node_modules/.bin/tsup-node +0 -22
  177. package/packages/functions/node_modules/.bin/vite +0 -22
  178. package/packages/functions/node_modules/.bin/vitest +0 -22
  179. package/packages/functions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  180. package/packages/functions/src/FunctionsService.ts +0 -188
  181. package/packages/functions/src/errors.ts +0 -70
  182. package/packages/functions/src/index.ts +0 -6
  183. package/packages/functions/tests/invoke.test.ts +0 -97
  184. package/packages/functions/tests/response-type-errors.test.ts +0 -135
  185. package/packages/functions/tsconfig.json +0 -5
  186. package/packages/functions/tsup.config.ts +0 -11
  187. package/packages/gen/node_modules/.bin/esbuild +0 -19
  188. package/packages/gen/node_modules/.bin/tsc +0 -22
  189. package/packages/gen/node_modules/.bin/tsserver +0 -22
  190. package/packages/gen/node_modules/.bin/tsup +0 -22
  191. package/packages/gen/node_modules/.bin/tsup-node +0 -22
  192. package/packages/gen/node_modules/.bin/vite +0 -22
  193. package/packages/gen/node_modules/.bin/vitest +0 -22
  194. package/packages/gen/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  195. package/packages/gen/src/cli.ts +0 -67
  196. package/packages/gen/src/generate.ts +0 -0
  197. package/packages/gen/src/index.ts +0 -2
  198. package/packages/gen/tests/compile.test.ts +0 -213
  199. package/packages/gen/tests/e2e.test.ts +0 -130
  200. package/packages/gen/tests/generate.test.ts +0 -396
  201. package/packages/gen/tsconfig.json +0 -5
  202. package/packages/gen/tsup.config.ts +0 -11
  203. package/packages/notifications/node_modules/.bin/esbuild +0 -19
  204. package/packages/notifications/node_modules/.bin/tsc +0 -22
  205. package/packages/notifications/node_modules/.bin/tsserver +0 -22
  206. package/packages/notifications/node_modules/.bin/tsup +0 -22
  207. package/packages/notifications/node_modules/.bin/tsup-node +0 -22
  208. package/packages/notifications/node_modules/.bin/vite +0 -22
  209. package/packages/notifications/node_modules/.bin/vitest +0 -22
  210. package/packages/notifications/src/NotificationsService.ts +0 -230
  211. package/packages/notifications/src/index.ts +0 -19
  212. package/packages/notifications/tsconfig.json +0 -5
  213. package/packages/notifications/tsup.config.ts +0 -11
  214. package/packages/realtime/node_modules/.bin/esbuild +0 -19
  215. package/packages/realtime/node_modules/.bin/tsc +0 -22
  216. package/packages/realtime/node_modules/.bin/tsserver +0 -22
  217. package/packages/realtime/node_modules/.bin/tsup +0 -22
  218. package/packages/realtime/node_modules/.bin/tsup-node +0 -22
  219. package/packages/realtime/node_modules/.bin/vite +0 -22
  220. package/packages/realtime/node_modules/.bin/vitest +0 -22
  221. package/packages/realtime/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  222. package/packages/realtime/src/AuraChannel.ts +0 -485
  223. package/packages/realtime/src/HeartbeatManager.ts +0 -73
  224. package/packages/realtime/src/RealtimeService.ts +0 -505
  225. package/packages/realtime/src/columnFilter.ts +0 -301
  226. package/packages/realtime/src/index.ts +0 -4
  227. package/packages/realtime/tests/ack-routing.test.ts +0 -81
  228. package/packages/realtime/tests/column-filter.test.ts +0 -144
  229. package/packages/realtime/tests/dispatch.test.ts +0 -191
  230. package/packages/realtime/tests/heartbeat.test.ts +0 -67
  231. package/packages/realtime/tests/http-broadcast.test.ts +0 -68
  232. package/packages/realtime/tests/realtime-token.test.ts +0 -43
  233. package/packages/realtime/tests/reconnect-race.test.ts +0 -149
  234. package/packages/realtime/tests/ref-id.test.ts +0 -34
  235. package/packages/realtime/tests/set-auth.test.ts +0 -70
  236. package/packages/realtime/tsconfig.json +0 -5
  237. package/packages/realtime/tsup.config.ts +0 -11
  238. package/packages/storage/node_modules/.bin/esbuild +0 -19
  239. package/packages/storage/node_modules/.bin/tsc +0 -22
  240. package/packages/storage/node_modules/.bin/tsserver +0 -22
  241. package/packages/storage/node_modules/.bin/tsup +0 -22
  242. package/packages/storage/node_modules/.bin/tsup-node +0 -22
  243. package/packages/storage/node_modules/.bin/vite +0 -22
  244. package/packages/storage/node_modules/.bin/vitest +0 -22
  245. package/packages/storage/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  246. package/packages/storage/src/DownloadBuilder.ts +0 -60
  247. package/packages/storage/src/StorageService.ts +0 -323
  248. package/packages/storage/src/index.ts +0 -2
  249. package/packages/storage/src/path.ts +0 -35
  250. package/packages/storage/src/transform.ts +0 -15
  251. package/packages/storage/tests/download.test.ts +0 -64
  252. package/packages/storage/tests/parity.test.ts +0 -154
  253. package/packages/storage/tests/path.test.ts +0 -87
  254. package/packages/storage/tests/transform.test.ts +0 -79
  255. package/packages/storage/tsconfig.json +0 -5
  256. package/packages/storage/tsup.config.ts +0 -11
  257. package/pnpm-workspace.yaml +0 -24
  258. package/tsconfig.base.json +0 -15
@@ -1,18 +0,0 @@
1
- import { expectTypeOf } from 'vitest'
2
- import { DatabaseService } from '../../src/DatabaseService'
3
- import type { Database } from './fixtures'
4
-
5
- declare const db: DatabaseService<Database>
6
-
7
- // COMPL LOT 4 : `from()` accepte les Views (générées par LOT C), pas seulement les
8
- // Tables. La vue `active_users` est non updatable → uniquement queryable en lecture.
9
-
10
- test('from(view).select(col) compile et infère le Row de la vue', async () => {
11
- const { data } = await db.from('active_users').select('email')
12
- expectTypeOf(data).toEqualTypeOf<{ email: string }[] | null>()
13
- })
14
-
15
- test('from(view).select(*) → Row complète de la vue', async () => {
16
- const { data } = await db.from('active_users').select('*')
17
- expectTypeOf(data).toEqualTypeOf<{ id: string; email: string }[] | null>()
18
- })
@@ -1,23 +0,0 @@
1
- import { DatabaseService } from '../../src/DatabaseService'
2
- import type { Database } from './fixtures'
3
-
4
- declare const db: DatabaseService<Database>
5
-
6
- test('insert exige les champs requis', () => {
7
- db.from('posts').insert({ author_id: 'u', title: 't' }) // OK (id optionnel)
8
- // @ts-expect-error title requis manquant
9
- db.from('posts').insert({ author_id: 'u' })
10
- })
11
-
12
- test('update accepte un body partiel typé', () => {
13
- db.from('posts').update('id1', { title: 'new' }) // OK
14
- // @ts-expect-error colonne inconnue
15
- db.from('posts').update('id1', { nope: 1 })
16
- })
17
-
18
- test('upsert typé sur Insert (array ou objet)', () => {
19
- db.from('posts').upsert({ author_id: 'u', title: 't' }) // OK
20
- db.from('posts').upsert([{ author_id: 'u', title: 't' }]) // OK
21
- // @ts-expect-error title requis manquant
22
- db.from('posts').upsert({ author_id: 'u' })
23
- })
@@ -1,60 +0,0 @@
1
- import { expectTypeOf } from 'vitest'
2
- import { DatabaseService } from '../../src/DatabaseService'
3
-
4
- // Fixture Database locale avec une fonction scalaire et une fonction SETOF liée
5
- // à une table (parité avec la sortie attendue de `@aurabase/gen` Phase B).
6
- type DB = {
7
- public: {
8
- Tables: {
9
- things: {
10
- Row: { id: number; name: string }
11
- Insert: { id?: number; name: string }
12
- Update: { id?: number; name?: string }
13
- Relationships: []
14
- }
15
- }
16
- Views: Record<string, never>
17
- Functions: {
18
- add: { Args: { a: number; b: number }; Returns: number }
19
- list_things: {
20
- Args: Record<string, never>
21
- Returns: { id: number; name: string }[]
22
- SetofOptions: { isSetofReturn: true; isOneToOne: false; to: 'things'; from: '*' }
23
- }
24
- }
25
- Enums: Record<string, never>
26
- CompositeTypes: Record<string, never>
27
- }
28
- }
29
-
30
- declare const db: DatabaseService<DB>
31
- // Fallback permissif : Database = any (comportement historique conservé).
32
- declare const untyped: DatabaseService
33
-
34
- test('rpc fort : args typés sur Schema["Functions"]', () => {
35
- db.rpc('add', { a: 1, b: 2 }) // OK
36
- // @ts-expect-error mauvais type d'arg (a doit être number)
37
- db.rpc('add', { a: 'x', b: 2 })
38
- })
39
-
40
- test('rpc SETOF : select post-rpc typé sur la table liée (SetofOptions.to)', async () => {
41
- const { data } = await db.rpc('list_things', {}).select('id,name').single()
42
- expectTypeOf(data).toMatchTypeOf<{ id: number; name: string } | null>()
43
- })
44
-
45
- // Verrouille le fix #1 (double-emballage) : `Fn['Result']` est DÉJÀ la charge
46
- // utile complète (scalaire pour une fonction scalaire, tableau pour un SETOF)
47
- // — le 5e générique du builder ne doit PAS ajouter un `[]` par-dessus.
48
- test('rpc fort : retour scalaire (Result), pas de sur-emballage en tableau', async () => {
49
- const { data } = await db.rpc('add', { a: 1, b: 2 })
50
- expectTypeOf(data).toEqualTypeOf<number | null>()
51
- })
52
-
53
- test('rpc SETOF sans .select() : Result est déjà un tableau (pas `[][]`)', async () => {
54
- const { data } = await db.rpc('list_things', {})
55
- expectTypeOf(data).toEqualTypeOf<{ id: number; name: string }[] | null>()
56
- })
57
-
58
- test('rpc fallback permissif (Database = any)', () => {
59
- untyped.rpc('whatever', { anything: true }) // OK, pas d'erreur de compilation
60
- })
@@ -1,8 +0,0 @@
1
- import { expectTypeOf } from 'vitest'
2
- import type { GenericSchema } from '../../src/pgrst-types/common/common'
3
- import type { Database } from './fixtures'
4
-
5
- // Un Database à la forme générée par @aurabase/gen (Phase 1) doit satisfaire GenericSchema.
6
- test('le Database généré satisfait GenericSchema', () => {
7
- expectTypeOf<Database['public']>().toMatchTypeOf<GenericSchema>()
8
- })
@@ -1,38 +0,0 @@
1
- import { expectTypeOf } from 'vitest'
2
- import { DatabaseService } from '../../src/DatabaseService'
3
- import type { Database } from './fixtures'
4
-
5
- declare const db: DatabaseService<Database>
6
-
7
- test('select colonnes → type restreint', async () => {
8
- const { data } = await db.from('users').select('id, email')
9
- expectTypeOf(data).toEqualTypeOf<{ id: string; email: string }[] | null>()
10
- })
11
-
12
- test('select embed many-to-one → objet imbriqué', async () => {
13
- // Contrat postgrest-js : la FK `posts.author_id` étant NOT NULL dans la Row,
14
- // l'embed many-to-one est non nullable (deviendrait `| null` si author_id: string | null).
15
- const { data } = await db.from('posts').select('title, author:users(email)')
16
- expectTypeOf(data).toEqualTypeOf<{ title: string; author: { email: string } }[] | null>()
17
- })
18
-
19
- test('single() → objet | null', async () => {
20
- const { data } = await db.from('users').select('id').single()
21
- expectTypeOf(data).toEqualTypeOf<{ id: string } | null>()
22
- })
23
-
24
- test('maybeSingle() → objet | null', async () => {
25
- const { data } = await db.from('users').select('email').maybeSingle()
26
- expectTypeOf(data).toEqualTypeOf<{ email: string } | null>()
27
- })
28
-
29
- test('select * → Row complète', async () => {
30
- const { data } = await db.from('users').select('*')
31
- expectTypeOf(data).toEqualTypeOf<{ id: string; email: string; bio: string | null }[] | null>()
32
- })
33
-
34
- test("client non typé (Database = any) → data permissif, pas d'erreur de compilation", async () => {
35
- const untyped = db as unknown as DatabaseService
36
- const { data } = await untyped.from('whatever').select('a, b')
37
- expectTypeOf(data).not.toBeNever()
38
- })
@@ -1,83 +0,0 @@
1
- // LOT 6 (I7 — vendoré sans tests type-level) : fixture dédiée aux tests de
2
- // régression sur le code vendoré (`select-query-parser/*`, `pgrst-types/*`).
3
- // Volontairement distincte de `tests/types/fixtures.ts` (utilisé par les tests
4
- // de `DatabaseService`/`QueryBuilder`) : celle-ci couvre en plus le cas
5
- // one-to-many (tableau) et un embed imbriqué sur 2 niveaux, nécessaires pour
6
- // tester `GetResult` directement (voir `get-result.test-d.ts`).
7
- export interface Database {
8
- public: {
9
- Tables: {
10
- users: {
11
- Row: { id: string; email: string }
12
- Insert: { id?: string; email: string }
13
- Update: { id?: string; email?: string }
14
- Relationships: []
15
- }
16
- // many-to-one NOT NULL : posts.author_id -> users.id
17
- posts: {
18
- Row: { id: string; author_id: string; title: string }
19
- Insert: { id?: string; author_id: string; title: string }
20
- Update: { id?: string; author_id?: string; title?: string }
21
- Relationships: [
22
- {
23
- foreignKeyName: 'posts_author_id_fkey'
24
- columns: ['author_id']
25
- isOneToOne: false
26
- referencedRelation: 'users'
27
- referencedColumns: ['id']
28
- },
29
- ]
30
- }
31
- // many-to-one NULLABLE : reviews.reviewer_id -> users.id (nullable)
32
- reviews: {
33
- Row: { id: string; reviewer_id: string | null; comment: string }
34
- Insert: { id?: string; reviewer_id?: string | null; comment: string }
35
- Update: { id?: string; reviewer_id?: string | null; comment?: string }
36
- Relationships: [
37
- {
38
- foreignKeyName: 'reviews_reviewer_id_fkey'
39
- columns: ['reviewer_id']
40
- isOneToOne: false
41
- referencedRelation: 'users'
42
- referencedColumns: ['id']
43
- },
44
- ]
45
- }
46
- // one-to-many (côté "many") : comments.post_id -> posts.id NOT NULL.
47
- // Embedder `comments` DEPUIS `posts` donne un tableau (voir get-result.test-d.ts).
48
- comments: {
49
- Row: { id: string; post_id: string; body: string }
50
- Insert: { id?: string; post_id: string; body: string }
51
- Update: { id?: string; post_id?: string; body?: string }
52
- Relationships: [
53
- {
54
- foreignKeyName: 'comments_post_id_fkey'
55
- columns: ['post_id']
56
- isOneToOne: false
57
- referencedRelation: 'posts'
58
- referencedColumns: ['id']
59
- },
60
- ]
61
- }
62
- // 2e niveau d'imbrication pour l'embed profond : replies.comment_id -> comments.id.
63
- replies: {
64
- Row: { id: string; comment_id: string; text: string }
65
- Insert: { id?: string; comment_id: string; text: string }
66
- Update: { id?: string; comment_id?: string; text?: string }
67
- Relationships: [
68
- {
69
- foreignKeyName: 'replies_comment_id_fkey'
70
- columns: ['comment_id']
71
- isOneToOne: false
72
- referencedRelation: 'comments'
73
- referencedColumns: ['id']
74
- },
75
- ]
76
- }
77
- }
78
- Views: Record<string, never>
79
- Functions: Record<string, never>
80
- Enums: Record<string, never>
81
- CompositeTypes: Record<string, never>
82
- }
83
- }
@@ -1,75 +0,0 @@
1
- // LOT 6 (I7 — vendoré sans tests type-level) : régression de forme sur le
2
- // résolveur vendoré (`GetResult`, `select-query-parser/*`), testé ICI
3
- // directement (pas via `DatabaseService`/`QueryBuilder`) pour détecter une
4
- // régression de comportement dès le prochain resync (voir VENDORED.md),
5
- // indépendamment de l'évolution du reste du query builder.
6
- //
7
- // Couvre les trois formes d'embed dont la nullabilité/l'arité diffère :
8
- // - many-to-one NOT NULL → objet non-null
9
- // - many-to-one NULLABLE → objet | null
10
- // - one-to-many → tableau
11
- // … plus l'aliasing (colonne scalaire + clé d'embed) et un embed imbriqué sur
12
- // 2 niveaux (tableau de tableaux correctement typé).
13
- import { expectTypeOf } from 'vitest'
14
- import type { GetResult } from '../../src/select-query-parser/result'
15
- import type { Database } from './fixtures'
16
-
17
- type Public = Database['public']
18
- // Même pin que `AuraClientOptionsT` (src/QueryBuilder.ts) — voir VENDORED.md
19
- // « PostgrestVersion figé à '12' ».
20
- type ClientOpts = { PostgrestVersion: '12' }
21
-
22
- type PostsRow = Public['Tables']['posts']['Row']
23
- type PostsRel = Public['Tables']['posts']['Relationships']
24
- type ReviewsRow = Public['Tables']['reviews']['Row']
25
- type ReviewsRel = Public['Tables']['reviews']['Relationships']
26
-
27
- test('embed many-to-one NOT NULL (posts.author_id -> users, NOT NULL) → objet non-null, clé aliasée', () => {
28
- type Result = GetResult<Public, PostsRow, 'posts', PostsRel, '*, author:users(email)', ClientOpts>
29
- expectTypeOf<Result>().toEqualTypeOf<{
30
- id: string
31
- author_id: string
32
- title: string
33
- author: { email: string }
34
- }>()
35
- })
36
-
37
- test('embed many-to-one NULLABLE (reviews.reviewer_id -> users, nullable) → objet | null', () => {
38
- type Result = GetResult<Public, ReviewsRow, 'reviews', ReviewsRel, '*, reviewer:users(email)', ClientOpts>
39
- expectTypeOf<Result>().toEqualTypeOf<{
40
- id: string
41
- reviewer_id: string | null
42
- comment: string
43
- reviewer: { email: string } | null
44
- }>()
45
- })
46
-
47
- test('embed one-to-many (posts -> comments, comments.post_id -> posts) → tableau', () => {
48
- type Result = GetResult<Public, PostsRow, 'posts', PostsRel, '*, comments(*)', ClientOpts>
49
- expectTypeOf<Result>().toEqualTypeOf<{
50
- id: string
51
- author_id: string
52
- title: string
53
- comments: { id: string; post_id: string; body: string }[]
54
- }>()
55
- })
56
-
57
- test('alias sur colonne scalaire', () => {
58
- type Result = GetResult<Public, PostsRow, 'posts', PostsRel, 'renamedTitle:title', ClientOpts>
59
- expectTypeOf<Result>().toEqualTypeOf<{ renamedTitle: string }>()
60
- })
61
-
62
- test('embed imbriqué 2 niveaux (posts -> comments -> replies) → forme correcte (tableau de tableaux)', () => {
63
- type Result = GetResult<Public, PostsRow, 'posts', PostsRel, '*, comments(*, replies(*))', ClientOpts>
64
- expectTypeOf<Result>().toEqualTypeOf<{
65
- id: string
66
- author_id: string
67
- title: string
68
- comments: {
69
- id: string
70
- post_id: string
71
- body: string
72
- replies: { id: string; comment_id: string; text: string }[]
73
- }[]
74
- }>()
75
- })
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": { "outDir": "dist", "rootDir": "src" },
4
- "include": ["src"]
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": { "noEmit": true, "rootDir": "." },
4
- "include": ["src", "tests/**/*.test-d.ts"]
5
- }
@@ -1,11 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
-
3
- export default defineConfig({
4
- entry: ['src/index.ts'],
5
- format: ['cjs', 'esm'],
6
- dts: true,
7
- splitting: false,
8
- clean: true,
9
- treeshake: true,
10
- minify: false,
11
- })
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'vitest/config'
2
-
3
- export default defineConfig({
4
- test: {
5
- typecheck: { enabled: true, include: ['tests/**/*.test-d.ts'] },
6
- include: ['tests/**/*.test.ts'],
7
- },
8
- })
@@ -1,19 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/esbuild@0.27.7/node_modules/esbuild/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/esbuild@0.27.7/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/esbuild@0.27.7/node_modules/esbuild/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/esbuild@0.27.7/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- "$basedir/../../../../node_modules/.pnpm/esbuild@0.27.7/node_modules/esbuild/bin/esbuild" "$@"
18
- exit $?
19
- # cmd-shim-target=/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/esbuild@0.27.7/node_modules/esbuild/bin/esbuild
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
19
- else
20
- exec node "$basedir/../typescript/bin/tsc" "$@"
21
- fi
22
- # cmd-shim-target=/Users/affanedaylami/aurabase/aurabase-js/packages/functions/node_modules/typescript/bin/tsc
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
19
- else
20
- exec node "$basedir/../typescript/bin/tsserver" "$@"
21
- fi
22
- # cmd-shim-target=/Users/affanedaylami/aurabase/aurabase-js/packages/functions/node_modules/typescript/bin/tsserver
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules/tsup/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules/tsup/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../tsup/dist/cli-default.js" "$@"
19
- else
20
- exec node "$basedir/../tsup/dist/cli-default.js" "$@"
21
- fi
22
- # cmd-shim-target=/Users/affanedaylami/aurabase/aurabase-js/packages/functions/node_modules/tsup/dist/cli-default.js
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules/tsup/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules/tsup/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.16_typescript@5.9.3/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../tsup/dist/cli-node.js" "$@"
19
- else
20
- exec node "$basedir/../tsup/dist/cli-node.js" "$@"
21
- fi
22
- # cmd-shim-target=/Users/affanedaylami/aurabase/aurabase-js/packages/functions/node_modules/tsup/dist/cli-node.js
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7/node_modules/vite/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7/node_modules/vite/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7/node_modules/vite/bin/vite.js" "$@"
19
- else
20
- exec node "$basedir/../../../../node_modules/.pnpm/vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7/node_modules/vite/bin/vite.js" "$@"
21
- fi
22
- # cmd-shim-target=/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7/node_modules/vite/bin/vite.js
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vitest@4.1.9_@types+node@20.14.15_vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7_/node_modules/vitest/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vitest@4.1.9_@types+node@20.14.15_vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7_/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vitest@4.1.9_@types+node@20.14.15_vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7_/node_modules/vitest/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/vitest@4.1.9_@types+node@20.14.15_vite@8.1.3_@types+node@20.14.15_esbuild@0.27.7_/node_modules:/Users/affanedaylami/aurabase/aurabase-js/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../vitest/vitest.mjs" "$@"
19
- else
20
- exec node "$basedir/../vitest/vitest.mjs" "$@"
21
- fi
22
- # cmd-shim-target=/Users/affanedaylami/aurabase/aurabase-js/packages/functions/node_modules/vitest/vitest.mjs
@@ -1 +0,0 @@
1
- {"version":"4.1.9","results":[[":tests/invoke.test.ts",{"duration":941.5190000000002,"failed":false}],[":tests/response-type-errors.test.ts",{"duration":806.7056659999998,"failed":false}]]}