@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.
- package/package.json +4 -4
- package/packages/ai/node_modules/.bin/esbuild +0 -19
- package/packages/ai/node_modules/.bin/tsc +0 -22
- package/packages/ai/node_modules/.bin/tsserver +0 -22
- package/packages/ai/node_modules/.bin/tsup +0 -22
- package/packages/ai/node_modules/.bin/tsup-node +0 -22
- package/packages/ai/node_modules/.bin/vite +0 -22
- package/packages/ai/node_modules/.bin/vitest +0 -22
- package/packages/ai/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/ai/src/AiService.ts +0 -226
- package/packages/ai/src/index.ts +0 -18
- package/packages/ai/src/sse.ts +0 -141
- package/packages/ai/src/types.ts +0 -30
- package/packages/ai/tests/chat-stream.test.ts +0 -151
- package/packages/ai/tests/rag-namespaces.test.ts +0 -54
- package/packages/ai/tests/sse.test.ts +0 -69
- package/packages/ai/tsconfig.json +0 -5
- package/packages/ai/tsup.config.ts +0 -11
- package/packages/aurabase/node_modules/.bin/esbuild +0 -19
- package/packages/aurabase/node_modules/.bin/tsc +0 -22
- package/packages/aurabase/node_modules/.bin/tsserver +0 -22
- package/packages/aurabase/node_modules/.bin/tsup +0 -22
- package/packages/aurabase/node_modules/.bin/tsup-node +0 -22
- package/packages/aurabase/node_modules/.bin/vite +0 -22
- package/packages/aurabase/node_modules/.bin/vitest +0 -22
- package/packages/aurabase/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/aurabase/src/AuraClient.ts +0 -237
- package/packages/aurabase/src/index.ts +0 -152
- package/packages/aurabase/src/ssr.ts +0 -156
- package/packages/aurabase/tests/ai-streaming-rag-e2e.test.ts +0 -82
- package/packages/aurabase/tests/ai.test.ts +0 -111
- package/packages/aurabase/tests/auth-admin.test.ts +0 -515
- package/packages/aurabase/tests/auth-e2e.test.ts +0 -135
- package/packages/aurabase/tests/auth-hardening.test.ts +0 -206
- package/packages/aurabase/tests/auth.test.ts +0 -947
- package/packages/aurabase/tests/database.test.ts +0 -230
- package/packages/aurabase/tests/db-types-e2e.test.ts +0 -217
- package/packages/aurabase/tests/dispose.test.ts +0 -23
- package/packages/aurabase/tests/foreign-token.e2e.test.ts +0 -129
- package/packages/aurabase/tests/functions.test.ts +0 -107
- package/packages/aurabase/tests/integration.test.ts +0 -413
- package/packages/aurabase/tests/live-production-validation.js +0 -241
- package/packages/aurabase/tests/live-sdk-production-validation.js +0 -293
- package/packages/aurabase/tests/mocks.ts +0 -139
- package/packages/aurabase/tests/notifications.test.ts +0 -314
- package/packages/aurabase/tests/observability-backup.test.ts +0 -186
- package/packages/aurabase/tests/observability-hook.test.ts +0 -130
- package/packages/aurabase/tests/production-robustness.test.ts +0 -268
- package/packages/aurabase/tests/public-api-surface.test.ts +0 -53
- package/packages/aurabase/tests/query-builder.test.ts +0 -329
- package/packages/aurabase/tests/readme-smoke-e2e.test.ts +0 -231
- package/packages/aurabase/tests/realtime-filter-e2e.test.ts +0 -344
- package/packages/aurabase/tests/refresh-locks.test.ts +0 -210
- package/packages/aurabase/tests/retry-option.test.ts +0 -17
- package/packages/aurabase/tests/rpc-e2e.test.ts +0 -254
- package/packages/aurabase/tests/rs256-local-e2e.test.ts +0 -114
- package/packages/aurabase/tests/rt-alias-public-e2e.test.ts +0 -235
- package/packages/aurabase/tests/rt-http-broadcast-e2e.test.ts +0 -124
- package/packages/aurabase/tests/service-role-guard.test.ts +0 -99
- package/packages/aurabase/tests/ssr.test.ts +0 -91
- package/packages/aurabase/tests/storage-backend-e2e.test.ts +0 -481
- package/packages/aurabase/tests/storage-sdk-parity-e2e.test.ts +0 -104
- package/packages/aurabase/tests/storage-transform-e2e.test.ts +0 -684
- package/packages/aurabase/tests/storage.test.ts +0 -55
- package/packages/aurabase/tests/types/client-generic.test-d.ts +0 -79
- package/packages/aurabase/tests/types/docs-snippets.test-d.ts +0 -571
- package/packages/aurabase/tests/types/error-code.test-d.ts +0 -53
- package/packages/aurabase/tsconfig.json +0 -5
- package/packages/aurabase/tsconfig.test-d.json +0 -5
- package/packages/aurabase/tsup.config.ts +0 -11
- package/packages/aurabase/vitest.config.ts +0 -16
- package/packages/auth/node_modules/.bin/esbuild +0 -19
- package/packages/auth/node_modules/.bin/tsc +0 -22
- package/packages/auth/node_modules/.bin/tsserver +0 -22
- package/packages/auth/node_modules/.bin/tsup +0 -22
- package/packages/auth/node_modules/.bin/tsup-node +0 -22
- package/packages/auth/node_modules/.bin/vite +0 -22
- package/packages/auth/node_modules/.bin/vitest +0 -22
- package/packages/auth/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/auth/src/AuthAdminService.ts +0 -149
- package/packages/auth/src/AuthService.ts +0 -1166
- package/packages/auth/src/SessionManager.ts +0 -92
- package/packages/auth/src/index.ts +0 -17
- package/packages/auth/src/jwks.ts +0 -337
- package/packages/auth/src/pkce.ts +0 -27
- package/packages/auth/src/types.ts +0 -89
- package/packages/auth/tests/auth-lifecycle.test.ts +0 -149
- package/packages/auth/tests/detect-session.test.ts +0 -361
- package/packages/auth/tests/getclaims.test.ts +0 -780
- package/packages/auth/tests/is-mfa-challenge.test.ts +0 -27
- package/packages/auth/tests/password-recovery.test.ts +0 -124
- package/packages/auth/tests/pkce.test.ts +0 -192
- package/packages/auth/tests/session-manager.test.ts +0 -103
- package/packages/auth/tests/set-session.test.ts +0 -139
- package/packages/auth/tests/verify-otp.test.ts +0 -153
- package/packages/auth/tsconfig.json +0 -5
- package/packages/auth/tsup.config.ts +0 -11
- package/packages/core/node_modules/.bin/esbuild +0 -22
- package/packages/core/node_modules/.bin/tsc +0 -22
- package/packages/core/node_modules/.bin/tsserver +0 -22
- package/packages/core/node_modules/.bin/tsup +0 -22
- package/packages/core/node_modules/.bin/tsup-node +0 -22
- package/packages/core/node_modules/.bin/vite +0 -22
- package/packages/core/node_modules/.bin/vitest +0 -22
- package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/core/src/AuraError.ts +0 -89
- package/packages/core/src/BaseService.ts +0 -44
- package/packages/core/src/client.ts +0 -34
- package/packages/core/src/cookie-utils.ts +0 -42
- package/packages/core/src/fetch.ts +0 -435
- package/packages/core/src/index.ts +0 -22
- package/packages/core/src/retry.ts +0 -63
- package/packages/core/src/serialize.ts +0 -6
- package/packages/core/src/stores/BaseAuthStore.ts +0 -164
- package/packages/core/src/stores/LocalAuthStore.ts +0 -199
- package/packages/core/src/types.ts +0 -1042
- package/packages/core/tests/auth-store.test.ts +0 -300
- package/packages/core/tests/error-code.test.ts +0 -61
- package/packages/core/tests/error.test.ts +0 -24
- package/packages/core/tests/fetch.test.ts +0 -286
- package/packages/core/tests/mocks.ts +0 -139
- package/packages/core/tests/observability.test.ts +0 -86
- package/packages/core/tests/refresh-hardening.test.ts +0 -164
- package/packages/core/tests/refresh-observability.test.ts +0 -111
- package/packages/core/tests/retry.test.ts +0 -106
- package/packages/core/tests/serialize.test.ts +0 -12
- package/packages/core/tests/timeout.test.ts +0 -79
- package/packages/core/tsconfig.json +0 -5
- package/packages/core/tsup.config.ts +0 -11
- package/packages/db/node_modules/.bin/esbuild +0 -19
- package/packages/db/node_modules/.bin/tsc +0 -22
- package/packages/db/node_modules/.bin/tsserver +0 -22
- package/packages/db/node_modules/.bin/tsup +0 -22
- package/packages/db/node_modules/.bin/tsup-node +0 -22
- package/packages/db/node_modules/.bin/vite +0 -22
- package/packages/db/node_modules/.bin/vitest +0 -22
- package/packages/db/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/db/src/DatabaseService.ts +0 -170
- package/packages/db/src/QueryBuilder.ts +0 -830
- package/packages/db/src/index.ts +0 -2
- package/packages/db/src/pgrst-types/common/common.ts +0 -86
- package/packages/db/src/pgrst-types/common/rpc.ts +0 -151
- package/packages/db/src/pgrst-types/feature-flags.ts +0 -20
- package/packages/db/src/pgrst-types/types.ts +0 -134
- package/packages/db/src/select-query-parser/parser.ts +0 -479
- package/packages/db/src/select-query-parser/result.ts +0 -553
- package/packages/db/src/select-query-parser/types.ts +0 -132
- package/packages/db/src/select-query-parser/utils.ts +0 -707
- package/packages/db/tests/filters.test.ts +0 -81
- package/packages/db/tests/mutations-filtered.e2e.test.ts +0 -132
- package/packages/db/tests/mutations-filtered.test.ts +0 -188
- package/packages/db/tests/order.test.ts +0 -45
- package/packages/db/tests/rpc.test.ts +0 -41
- package/packages/db/tests/scale/build-large-schema.ts +0 -94
- package/packages/db/tests/scale/scale-compile.test.ts +0 -167
- package/packages/db/tests/schema.test.ts +0 -77
- package/packages/db/tests/single-accept.e2e.test.ts +0 -123
- package/packages/db/tests/single.test.ts +0 -211
- package/packages/db/tests/types/filters.test-d.ts +0 -52
- package/packages/db/tests/types/fixtures.ts +0 -40
- package/packages/db/tests/types/from-views.test-d.ts +0 -18
- package/packages/db/tests/types/mutations.test-d.ts +0 -23
- package/packages/db/tests/types/rpc.test-d.ts +0 -60
- package/packages/db/tests/types/schema-shape.test-d.ts +0 -8
- package/packages/db/tests/types/select-inference.test-d.ts +0 -38
- package/packages/db/tests/vendored/fixtures.ts +0 -83
- package/packages/db/tests/vendored/get-result.test-d.ts +0 -75
- package/packages/db/tsconfig.json +0 -5
- package/packages/db/tsconfig.test-d.json +0 -5
- package/packages/db/tsup.config.ts +0 -11
- package/packages/db/vitest.config.ts +0 -8
- package/packages/functions/node_modules/.bin/esbuild +0 -19
- package/packages/functions/node_modules/.bin/tsc +0 -22
- package/packages/functions/node_modules/.bin/tsserver +0 -22
- package/packages/functions/node_modules/.bin/tsup +0 -22
- package/packages/functions/node_modules/.bin/tsup-node +0 -22
- package/packages/functions/node_modules/.bin/vite +0 -22
- package/packages/functions/node_modules/.bin/vitest +0 -22
- package/packages/functions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/functions/src/FunctionsService.ts +0 -188
- package/packages/functions/src/errors.ts +0 -70
- package/packages/functions/src/index.ts +0 -6
- package/packages/functions/tests/invoke.test.ts +0 -97
- package/packages/functions/tests/response-type-errors.test.ts +0 -135
- package/packages/functions/tsconfig.json +0 -5
- package/packages/functions/tsup.config.ts +0 -11
- package/packages/gen/node_modules/.bin/esbuild +0 -19
- package/packages/gen/node_modules/.bin/tsc +0 -22
- package/packages/gen/node_modules/.bin/tsserver +0 -22
- package/packages/gen/node_modules/.bin/tsup +0 -22
- package/packages/gen/node_modules/.bin/tsup-node +0 -22
- package/packages/gen/node_modules/.bin/vite +0 -22
- package/packages/gen/node_modules/.bin/vitest +0 -22
- package/packages/gen/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/gen/src/cli.ts +0 -67
- package/packages/gen/src/generate.ts +0 -0
- package/packages/gen/src/index.ts +0 -2
- package/packages/gen/tests/compile.test.ts +0 -213
- package/packages/gen/tests/e2e.test.ts +0 -130
- package/packages/gen/tests/generate.test.ts +0 -396
- package/packages/gen/tsconfig.json +0 -5
- package/packages/gen/tsup.config.ts +0 -11
- package/packages/notifications/node_modules/.bin/esbuild +0 -19
- package/packages/notifications/node_modules/.bin/tsc +0 -22
- package/packages/notifications/node_modules/.bin/tsserver +0 -22
- package/packages/notifications/node_modules/.bin/tsup +0 -22
- package/packages/notifications/node_modules/.bin/tsup-node +0 -22
- package/packages/notifications/node_modules/.bin/vite +0 -22
- package/packages/notifications/node_modules/.bin/vitest +0 -22
- package/packages/notifications/src/NotificationsService.ts +0 -230
- package/packages/notifications/src/index.ts +0 -19
- package/packages/notifications/tsconfig.json +0 -5
- package/packages/notifications/tsup.config.ts +0 -11
- package/packages/realtime/node_modules/.bin/esbuild +0 -19
- package/packages/realtime/node_modules/.bin/tsc +0 -22
- package/packages/realtime/node_modules/.bin/tsserver +0 -22
- package/packages/realtime/node_modules/.bin/tsup +0 -22
- package/packages/realtime/node_modules/.bin/tsup-node +0 -22
- package/packages/realtime/node_modules/.bin/vite +0 -22
- package/packages/realtime/node_modules/.bin/vitest +0 -22
- package/packages/realtime/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/realtime/src/AuraChannel.ts +0 -485
- package/packages/realtime/src/HeartbeatManager.ts +0 -73
- package/packages/realtime/src/RealtimeService.ts +0 -505
- package/packages/realtime/src/columnFilter.ts +0 -301
- package/packages/realtime/src/index.ts +0 -4
- package/packages/realtime/tests/ack-routing.test.ts +0 -81
- package/packages/realtime/tests/column-filter.test.ts +0 -144
- package/packages/realtime/tests/dispatch.test.ts +0 -191
- package/packages/realtime/tests/heartbeat.test.ts +0 -67
- package/packages/realtime/tests/http-broadcast.test.ts +0 -68
- package/packages/realtime/tests/realtime-token.test.ts +0 -43
- package/packages/realtime/tests/reconnect-race.test.ts +0 -149
- package/packages/realtime/tests/ref-id.test.ts +0 -34
- package/packages/realtime/tests/set-auth.test.ts +0 -70
- package/packages/realtime/tsconfig.json +0 -5
- package/packages/realtime/tsup.config.ts +0 -11
- package/packages/storage/node_modules/.bin/esbuild +0 -19
- package/packages/storage/node_modules/.bin/tsc +0 -22
- package/packages/storage/node_modules/.bin/tsserver +0 -22
- package/packages/storage/node_modules/.bin/tsup +0 -22
- package/packages/storage/node_modules/.bin/tsup-node +0 -22
- package/packages/storage/node_modules/.bin/vite +0 -22
- package/packages/storage/node_modules/.bin/vitest +0 -22
- package/packages/storage/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/storage/src/DownloadBuilder.ts +0 -60
- package/packages/storage/src/StorageService.ts +0 -323
- package/packages/storage/src/index.ts +0 -2
- package/packages/storage/src/path.ts +0 -35
- package/packages/storage/src/transform.ts +0 -15
- package/packages/storage/tests/download.test.ts +0 -64
- package/packages/storage/tests/parity.test.ts +0 -154
- package/packages/storage/tests/path.test.ts +0 -87
- package/packages/storage/tests/transform.test.ts +0 -79
- package/packages/storage/tsconfig.json +0 -5
- package/packages/storage/tsup.config.ts +0 -11
- package/pnpm-workspace.yaml +0 -24
- package/tsconfig.base.json +0 -15
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, afterEach } from 'vitest'
|
|
2
|
-
import { fetchWithAuth } from '../src/fetch'
|
|
3
|
-
import { BaseAuthStore } from '../src/stores/BaseAuthStore'
|
|
4
|
-
import type { AuraClientLike } from '../src/client'
|
|
5
|
-
import type { AuraObservabilityEvent } from '../src/types'
|
|
6
|
-
|
|
7
|
-
afterEach(() => vi.useRealTimers())
|
|
8
|
-
|
|
9
|
-
/** fetch qui ne résout jamais, mais rejette (AbortError) si son signal est aborté. */
|
|
10
|
-
const hangFetch = (async (_url: string, init: RequestInit) =>
|
|
11
|
-
new Promise<Response>((_res, rej) => {
|
|
12
|
-
init.signal?.addEventListener('abort', () =>
|
|
13
|
-
rej(Object.assign(new Error('aborted'), { name: 'AbortError' })),
|
|
14
|
-
)
|
|
15
|
-
})) as unknown as typeof globalThis.fetch
|
|
16
|
-
|
|
17
|
-
function client(
|
|
18
|
-
requestTimeoutMs?: number,
|
|
19
|
-
fetchFn: typeof globalThis.fetch = hangFetch,
|
|
20
|
-
onEvent?: (e: AuraObservabilityEvent) => void,
|
|
21
|
-
): AuraClientLike {
|
|
22
|
-
return {
|
|
23
|
-
baseUrl: 'http://x', projectId: 'p', apiKey: 'k', fetchFn,
|
|
24
|
-
authStore: new BaseAuthStore(),
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
auth: { refreshSession: async () => ({ data: null, error: null }) as any },
|
|
27
|
-
...(requestTimeoutMs !== undefined ? { requestTimeoutMs } : {}),
|
|
28
|
-
...(onEvent ? { onEvent } : {}),
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
describe('fetchWithAuth — timeout par défaut', () => {
|
|
33
|
-
it('un serveur qui « hang » est coupé et renvoie le code `timeout`', async () => {
|
|
34
|
-
vi.useFakeTimers()
|
|
35
|
-
const p = fetchWithAuth('http://x/slow', { method: 'GET' }, client(100))
|
|
36
|
-
await vi.advanceTimersByTimeAsync(100)
|
|
37
|
-
const res = await p
|
|
38
|
-
expect(res.data).toBeNull()
|
|
39
|
-
expect(res.error?.code).toBe('timeout')
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('requestTimeoutMs: 0 désactive le timeout (aucune coupure)', async () => {
|
|
43
|
-
vi.useFakeTimers()
|
|
44
|
-
let settled = false
|
|
45
|
-
const p = fetchWithAuth('http://x/slow', { method: 'GET' }, client(0)).then((r) => { settled = true; return r })
|
|
46
|
-
await vi.advanceTimersByTimeAsync(60_000)
|
|
47
|
-
expect(settled).toBe(false) // toujours en attente → pas de timeout
|
|
48
|
-
void p
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it("un `signal` fourni par l'appelant désactive le timeout par défaut", async () => {
|
|
52
|
-
vi.useFakeTimers()
|
|
53
|
-
const ac = new AbortController()
|
|
54
|
-
let settled = false
|
|
55
|
-
const p = fetchWithAuth('http://x/slow', { method: 'GET', signal: ac.signal }, client(100)).then((r) => { settled = true; return r })
|
|
56
|
-
await vi.advanceTimersByTimeAsync(100)
|
|
57
|
-
// Le timeout par défaut ne s'applique pas (l'appelant gère son annulation).
|
|
58
|
-
expect(settled).toBe(false)
|
|
59
|
-
ac.abort()
|
|
60
|
-
await Promise.resolve()
|
|
61
|
-
void p
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
it('LOT 3 (I8) : un timeout émet {kind:"timeout", url}', async () => {
|
|
65
|
-
vi.useFakeTimers()
|
|
66
|
-
const events: AuraObservabilityEvent[] = []
|
|
67
|
-
const p = fetchWithAuth('http://x/slow', { method: 'GET' }, client(100, hangFetch, (e) => events.push(e)))
|
|
68
|
-
await vi.advanceTimersByTimeAsync(100)
|
|
69
|
-
await p
|
|
70
|
-
expect(events).toContainEqual({ kind: 'timeout', url: 'http://x/slow' })
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('une requête normale (résolue) n’est pas affectée', async () => {
|
|
74
|
-
const okFetch = (async () => new Response(JSON.stringify({ data: { ok: true } }), { status: 200, headers: { 'Content-Type': 'application/json' } })) as unknown as typeof globalThis.fetch
|
|
75
|
-
const res = await fetchWithAuth<{ ok: boolean }>('http://x/y', { method: 'GET' }, client(100, okFetch))
|
|
76
|
-
expect(res.error).toBeNull()
|
|
77
|
-
expect(res.data).toEqual({ ok: true })
|
|
78
|
-
})
|
|
79
|
-
})
|
|
@@ -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/db/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/db/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/db/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/db/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/db/node_modules/vitest/vitest.mjs
|
package/packages/db/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":"4.1.9","results":[[":tests/single.test.ts",{"duration":1128.5402080000003,"failed":false}],[":tests/filters.test.ts",{"duration":9.051457999999911,"failed":false}],[":tests/order.test.ts",{"duration":16.057416999999987,"failed":false}],[":tests/schema.test.ts",{"duration":752.6503750000002,"failed":false}],[":tests/types/schema-shape.test-d.ts",{"duration":0,"failed":false}],[":tests/types/select-inference.test-d.ts",{"duration":0,"failed":false}],[":tests/types/filters.test-d.ts",{"duration":0,"failed":false}],[":tests/types/mutations.test-d.ts",{"duration":0,"failed":false}],[":tests/rpc.test.ts",{"duration":1077.0271250000005,"failed":false}],[":tests/types/rpc.test-d.ts",{"duration":0,"failed":false}],[":tests/scale/scale-compile.test.ts",{"duration":18075.547792,"failed":false}],[":tests/vendored/get-result.test-d.ts",{"duration":0,"failed":false}],[":tests/mutations-filtered.test.ts",{"duration":1143.7555410000004,"failed":false}],[":tests/mutations-filtered.e2e.test.ts",{"duration":0,"failed":false}],[":tests/single-accept.e2e.test.ts",{"duration":0,"failed":false}],[":tests/types/from-views.test-d.ts",{"duration":0,"failed":false}]]}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { BaseService } from '@aurabase/core'
|
|
2
|
-
import type { AuraResponse, SchemaTable, SchemaFunction, SchemaEnum, AuraClientLike } from '@aurabase/core'
|
|
3
|
-
import { AuraQueryBuilder, AuraFilterBuilder } from './QueryBuilder'
|
|
4
|
-
import type { AuraClientOptionsT } from './QueryBuilder'
|
|
5
|
-
import type { GenericSchema } from './pgrst-types/common/common'
|
|
6
|
-
import type { GetRpcFunctionFilterBuilderByArgs } from './pgrst-types/common/rpc'
|
|
7
|
-
|
|
8
|
-
export interface RpcOptions {
|
|
9
|
-
count?: 'exact' | 'planned' | 'estimated'
|
|
10
|
-
head?: boolean
|
|
11
|
-
get?: boolean
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// -- rpc() : typage vendoré (Schema['Functions']) + repli permissif -----------
|
|
15
|
-
//
|
|
16
|
-
// Signature UNIQUE (pas de 2 surcharges séparées) : la borne du paramètre `args`
|
|
17
|
-
// se calcule à partir de `Schema['Functions'][FnName]` — connue → Args strict
|
|
18
|
-
// (erreur de compilation sur un mauvais type d'argument) ; inconnue / Functions
|
|
19
|
-
// vide (`Record<string, never>`, valeur indexée = `never`) / Database non typé
|
|
20
|
-
// (`Schema = any`) → Args permissif (`Record<string, unknown>`).
|
|
21
|
-
//
|
|
22
|
-
// Un design classique à 2 surcharges (forte + `fn: string` fourre-tout) a été
|
|
23
|
-
// essayé et rejeté : vérifié empiriquement (cf. rapport de tâche), TypeScript
|
|
24
|
-
// retombe SILENCIEUSEMENT sur la surcharge permissive dès qu'un mauvais type
|
|
25
|
-
// d'argument est passé à une fonction connue — la 2e surcharge, structurellement
|
|
26
|
-
// compatible (elle accepte n'importe quel objet), absorbe l'appel sans erreur ;
|
|
27
|
-
// le `@ts-expect-error` du type-test devient alors "unused" (aucune erreur réelle
|
|
28
|
-
// détectée). Le calcul conditionnel ci-dessous produit le même comportement
|
|
29
|
-
// observable (fort si connu, permissif sinon) sans ce trou.
|
|
30
|
-
type RpcArgsFor<Schema extends GenericSchema, FnName extends string> = [
|
|
31
|
-
Schema['Functions'][FnName],
|
|
32
|
-
] extends [never]
|
|
33
|
-
? Record<string, unknown>
|
|
34
|
-
: FnName extends keyof Schema['Functions']
|
|
35
|
-
? Schema['Functions'][FnName]['Args']
|
|
36
|
-
: Record<string, unknown>
|
|
37
|
-
|
|
38
|
-
type RpcResultFor<Schema extends GenericSchema, FnName extends string, Args> = [
|
|
39
|
-
Schema['Functions'][FnName],
|
|
40
|
-
] extends [never]
|
|
41
|
-
? { Row: any; Result: any; RelationName: any; Relationships: any }
|
|
42
|
-
: FnName extends string & keyof Schema['Functions']
|
|
43
|
-
? GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args>
|
|
44
|
-
: { Row: any; Result: any; RelationName: any; Relationships: any }
|
|
45
|
-
|
|
46
|
-
export class DatabaseService<
|
|
47
|
-
Database = any,
|
|
48
|
-
Schema extends GenericSchema = Database extends { public: infer S }
|
|
49
|
-
? S extends GenericSchema
|
|
50
|
-
? S
|
|
51
|
-
: any
|
|
52
|
-
: any,
|
|
53
|
-
> extends BaseService {
|
|
54
|
-
constructor(client: AuraClientLike) {
|
|
55
|
-
super(client)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private get prefix(): string {
|
|
59
|
-
return `/v1/db/${this.client.projectId}`
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Start a query on a table. Returns a chainable QueryBuilder dont `.select()`
|
|
64
|
-
* infère son type de résultat via `GetResult` (parité PostgREST/Supabase) quand
|
|
65
|
-
* un `Database` typé est fourni à `createClient<Database>()`.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* const { data, error } = await db.from('posts').eq('published', true).limit(10)
|
|
69
|
-
*/
|
|
70
|
-
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(
|
|
71
|
-
table: TableName,
|
|
72
|
-
): AuraQueryBuilder<Schema, Table, TableName, AuraClientOptionsT>
|
|
73
|
-
// COMPL LOT 4 : `from()` accepte aussi les Views (générées par LOT C). Surcharge
|
|
74
|
-
// dédiée (pattern postgrest-js) → `Relation` est résolu depuis `Schema['Views']`.
|
|
75
|
-
// `GenericView` (union updatable/non-updatable) : une vue non updatable ne porte
|
|
76
|
-
// pas `Insert`/`Update` → `insert()/update()/upsert()` retombent sur `never`
|
|
77
|
-
// (typage strict, cf. AuraQueryBuilder), seule la lecture (`select`) est offerte.
|
|
78
|
-
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(
|
|
79
|
-
view: ViewName,
|
|
80
|
-
): AuraQueryBuilder<Schema, View, ViewName, AuraClientOptionsT>
|
|
81
|
-
// Repli non typé (Database = any) : conserve le comportement historique permissif.
|
|
82
|
-
from(table: string): AuraQueryBuilder<any, any, any, AuraClientOptionsT>
|
|
83
|
-
from(table: string): AuraQueryBuilder<any, any, any, AuraClientOptionsT> {
|
|
84
|
-
return new AuraQueryBuilder(this.client, `${this.prefix}/${table}`)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Exécute une requête SQL brute (passthrough direct vers Postgres).
|
|
89
|
-
*
|
|
90
|
-
* ⚠️ N'est PAS en lecture seule : SELECT, INSERT, UPDATE, DELETE et DDL
|
|
91
|
-
* s'exécutent réellement et persistent, dans la limite des GRANTs du rôle
|
|
92
|
-
* Postgres connecté pour ce projet (seule barrière de sécurité — il n'y a
|
|
93
|
-
* aucun filtre applicatif par type d'instruction côté serveur). Ne pas
|
|
94
|
-
* exposer cet endpoint sans restriction à des clients non fiables.
|
|
95
|
-
*/
|
|
96
|
-
async sql<T = unknown>(query: string, params?: unknown[]): Promise<AuraResponse<T>> {
|
|
97
|
-
return this.request<T>('POST', `${this.prefix}/raw`, { query, params })
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Appelle une fonction Postgres exposée par PostgREST (`POST|GET|HEAD /rpc/{fn}`).
|
|
102
|
-
* Signature forte quand `Schema['Functions']` connaît `fn` (typage vendoré
|
|
103
|
-
* `GetRpcFunctionFilterBuilderByArgs`, parité postgrest-js) ; sinon repli permissif.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* const { data } = await db.rpc('add', { a: 1, b: 2 })
|
|
107
|
-
* const { data } = await db.rpc('list_things', {}).eq('id', 2).select('id,name').single()
|
|
108
|
-
*/
|
|
109
|
-
rpc<
|
|
110
|
-
FnName extends string,
|
|
111
|
-
Args extends RpcArgsFor<Schema, FnName> = RpcArgsFor<Schema, FnName>,
|
|
112
|
-
Fn extends { Row: any; Result: any; RelationName: any; Relationships: any } = RpcResultFor<
|
|
113
|
-
Schema,
|
|
114
|
-
FnName,
|
|
115
|
-
Args
|
|
116
|
-
>,
|
|
117
|
-
>(
|
|
118
|
-
fn: FnName,
|
|
119
|
-
args?: Args,
|
|
120
|
-
options?: RpcOptions,
|
|
121
|
-
): AuraFilterBuilder<Schema, Fn['Row'], Fn['RelationName'], Fn['Relationships'], Fn['Result'], AuraClientOptionsT> {
|
|
122
|
-
const verb: 'POST' | 'GET' | 'HEAD' = options?.head ? 'HEAD' : options?.get ? 'GET' : 'POST'
|
|
123
|
-
const builder = new AuraFilterBuilder<any, any, any, any, any, AuraClientOptionsT>(
|
|
124
|
-
this.client,
|
|
125
|
-
`${this.prefix}/rpc/${fn}`,
|
|
126
|
-
)._initRpc(args ?? {}, verb, options?.count)
|
|
127
|
-
return builder as AuraFilterBuilder<
|
|
128
|
-
Schema,
|
|
129
|
-
Fn['Row'],
|
|
130
|
-
Fn['RelationName'],
|
|
131
|
-
Fn['Relationships'],
|
|
132
|
-
Fn['Result'],
|
|
133
|
-
AuraClientOptionsT
|
|
134
|
-
>
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Fetch the schema (tables & colonnes, fonctions Postgres exposées via PostgREST,
|
|
139
|
-
* types enum et vues) pour le projet courant.
|
|
140
|
-
*/
|
|
141
|
-
async schema(): Promise<
|
|
142
|
-
AuraResponse<{
|
|
143
|
-
tables: SchemaTable[]
|
|
144
|
-
functions: SchemaFunction[]
|
|
145
|
-
enums: SchemaEnum[]
|
|
146
|
-
views: SchemaTable[]
|
|
147
|
-
}>
|
|
148
|
-
> {
|
|
149
|
-
// Le backend renvoie un SchemaDefinition `{ project_id, engine, tables, functions,
|
|
150
|
-
// enums, views }` (LOT B). `enums`/`views` sont absents pour les adapters NoSQL et
|
|
151
|
-
// les backends antérieurs → repli `[]` (rétrocompat).
|
|
152
|
-
const res = await this.request<{
|
|
153
|
-
tables?: SchemaTable[]
|
|
154
|
-
functions?: SchemaFunction[]
|
|
155
|
-
enums?: SchemaEnum[]
|
|
156
|
-
views?: SchemaTable[]
|
|
157
|
-
}>('GET', `${this.prefix}/schema`)
|
|
158
|
-
if (res.error) return { data: null, error: res.error, meta: res.meta }
|
|
159
|
-
return {
|
|
160
|
-
data: {
|
|
161
|
-
tables: res.data?.tables ?? [],
|
|
162
|
-
functions: res.data?.functions ?? [],
|
|
163
|
-
enums: res.data?.enums ?? [],
|
|
164
|
-
views: res.data?.views ?? [],
|
|
165
|
-
},
|
|
166
|
-
error: null,
|
|
167
|
-
meta: res.meta,
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|