@ai-matrx/media 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/files/engine/api/assets.d.ts +223 -0
  3. package/dist/files/engine/api/assets.js +124 -0
  4. package/dist/files/engine/api/assets.js.map +1 -0
  5. package/dist/files/engine/api/direct.d.ts +43 -0
  6. package/dist/files/engine/api/direct.js +73 -0
  7. package/dist/files/engine/api/direct.js.map +1 -0
  8. package/dist/files/engine/api/fileOrganization.d.ts +34 -0
  9. package/dist/files/engine/api/fileOrganization.js +38 -0
  10. package/dist/files/engine/api/fileOrganization.js.map +1 -0
  11. package/dist/files/engine/api/files.d.ts +249 -0
  12. package/dist/files/engine/api/files.js +231 -0
  13. package/dist/files/engine/api/files.js.map +1 -0
  14. package/dist/files/engine/api/folders.d.ts +63 -0
  15. package/dist/files/engine/api/folders.js +56 -0
  16. package/dist/files/engine/api/folders.js.map +1 -0
  17. package/dist/files/engine/api/office.d.ts +27 -0
  18. package/dist/files/engine/api/office.js +19 -0
  19. package/dist/files/engine/api/office.js.map +1 -0
  20. package/dist/files/engine/api/permissions.d.ts +37 -0
  21. package/dist/files/engine/api/permissions.js +109 -0
  22. package/dist/files/engine/api/permissions.js.map +1 -0
  23. package/dist/files/engine/api/versions.d.ts +26 -0
  24. package/dist/files/engine/api/versions.js +37 -0
  25. package/dist/files/engine/api/versions.js.map +1 -0
  26. package/dist/files/engine/cache/idb-store.d.ts +95 -0
  27. package/dist/files/engine/cache/idb-store.js +172 -0
  28. package/dist/files/engine/cache/idb-store.js.map +1 -0
  29. package/dist/files/engine/cache/policy.d.ts +14 -0
  30. package/dist/files/engine/cache/policy.js +40 -0
  31. package/dist/files/engine/cache/policy.js.map +1 -0
  32. package/dist/files/engine/cache/register-service-worker.d.ts +57 -0
  33. package/dist/files/engine/cache/register-service-worker.js +80 -0
  34. package/dist/files/engine/cache/register-service-worker.js.map +1 -0
  35. package/dist/files/engine/db-types.d.ts +48865 -0
  36. package/dist/files/engine/db-types.js +1 -0
  37. package/dist/files/engine/db-types.js.map +1 -0
  38. package/dist/files/engine/filesDb.d.ts +1913 -0
  39. package/dist/files/engine/filesDb.js +28 -0
  40. package/dist/files/engine/filesDb.js.map +1 -0
  41. package/dist/files/engine/handler/handler.d.ts +82 -0
  42. package/dist/files/engine/handler/handler.js +124 -0
  43. package/dist/files/engine/handler/handler.js.map +1 -0
  44. package/dist/files/engine/handler/hooks/useFile.d.ts +17 -0
  45. package/dist/files/engine/handler/hooks/useFile.js +75 -0
  46. package/dist/files/engine/handler/hooks/useFile.js.map +1 -0
  47. package/dist/files/engine/handler/hooks/useFileUpload.d.ts +76 -0
  48. package/dist/files/engine/handler/hooks/useFileUpload.js +67 -0
  49. package/dist/files/engine/handler/hooks/useFileUpload.js.map +1 -0
  50. package/dist/files/engine/handler/input/normalize.d.ts +14 -0
  51. package/dist/files/engine/handler/input/normalize.js +365 -0
  52. package/dist/files/engine/handler/input/normalize.js.map +1 -0
  53. package/dist/files/engine/handler/intelligence/access.d.ts +35 -0
  54. package/dist/files/engine/handler/intelligence/access.js +85 -0
  55. package/dist/files/engine/handler/intelligence/access.js.map +1 -0
  56. package/dist/files/engine/handler/intelligence/magic-bytes.d.ts +21 -0
  57. package/dist/files/engine/handler/intelligence/magic-bytes.js +67 -0
  58. package/dist/files/engine/handler/intelligence/magic-bytes.js.map +1 -0
  59. package/dist/files/engine/handler/output/target.d.ts +19 -0
  60. package/dist/files/engine/handler/output/target.js +222 -0
  61. package/dist/files/engine/handler/output/target.js.map +1 -0
  62. package/dist/files/engine/handler/resolver.d.ts +34 -0
  63. package/dist/files/engine/handler/resolver.js +133 -0
  64. package/dist/files/engine/handler/resolver.js.map +1 -0
  65. package/dist/files/engine/handler/types.d.ts +367 -0
  66. package/dist/files/engine/handler/types.js +1 -0
  67. package/dist/files/engine/handler/types.js.map +1 -0
  68. package/dist/files/engine/handler/upload.d.ts +32 -0
  69. package/dist/files/engine/handler/upload.js +295 -0
  70. package/dist/files/engine/handler/upload.js.map +1 -0
  71. package/dist/files/engine/handler/utils/classify.d.ts +14 -0
  72. package/dist/files/engine/handler/utils/classify.js +27 -0
  73. package/dist/files/engine/handler/utils/classify.js.map +1 -0
  74. package/dist/files/engine/handler/utils/prefer-locator.d.ts +32 -0
  75. package/dist/files/engine/handler/utils/prefer-locator.js +34 -0
  76. package/dist/files/engine/handler/utils/prefer-locator.js.map +1 -0
  77. package/dist/files/engine/handler/utils/python-base.d.ts +129 -0
  78. package/dist/files/engine/handler/utils/python-base.js +60 -0
  79. package/dist/files/engine/handler/utils/python-base.js.map +1 -0
  80. package/dist/files/engine/hooks/blob-cache.d.ts +130 -0
  81. package/dist/files/engine/hooks/blob-cache.js +162 -0
  82. package/dist/files/engine/hooks/blob-cache.js.map +1 -0
  83. package/dist/files/engine/hooks/office-extraction-cache.d.ts +28 -0
  84. package/dist/files/engine/hooks/office-extraction-cache.js +67 -0
  85. package/dist/files/engine/hooks/office-extraction-cache.js.map +1 -0
  86. package/dist/files/engine/host/configure.d.ts +166 -0
  87. package/dist/files/engine/host/configure.js +30 -0
  88. package/dist/files/engine/host/configure.js.map +1 -0
  89. package/dist/files/engine/host/org.d.ts +8 -0
  90. package/dist/files/engine/host/org.js +16 -0
  91. package/dist/files/engine/host/org.js.map +1 -0
  92. package/dist/files/engine/host/python-client.d.ts +60 -0
  93. package/dist/files/engine/host/python-client.js +46 -0
  94. package/dist/files/engine/host/python-client.js.map +1 -0
  95. package/dist/files/engine/host/share-links.d.ts +20 -0
  96. package/dist/files/engine/host/share-links.js +32 -0
  97. package/dist/files/engine/host/share-links.js.map +1 -0
  98. package/dist/files/engine/host/store.d.ts +24 -0
  99. package/dist/files/engine/host/store.js +23 -0
  100. package/dist/files/engine/host/store.js.map +1 -0
  101. package/dist/files/engine/host/supabase.d.ts +3808 -0
  102. package/dist/files/engine/host/supabase.js +33 -0
  103. package/dist/files/engine/host/supabase.js.map +1 -0
  104. package/dist/files/engine/host/toast.d.ts +14 -0
  105. package/dist/files/engine/host/toast.js +20 -0
  106. package/dist/files/engine/host/toast.js.map +1 -0
  107. package/dist/files/engine/host/typed-client.d.ts +136 -0
  108. package/dist/files/engine/host/typed-client.js +66 -0
  109. package/dist/files/engine/host/typed-client.js.map +1 -0
  110. package/dist/files/engine/index.d.ts +22 -0
  111. package/dist/files/engine/index.js +49 -0
  112. package/dist/files/engine/index.js.map +1 -0
  113. package/dist/files/engine/media/our-file-sources.d.ts +39 -0
  114. package/dist/files/engine/media/our-file-sources.js +83 -0
  115. package/dist/files/engine/media/our-file-sources.js.map +1 -0
  116. package/dist/files/engine/media/signed-url.d.ts +1 -0
  117. package/dist/files/engine/media/signed-url.js +6 -0
  118. package/dist/files/engine/media/signed-url.js.map +1 -0
  119. package/dist/files/engine/redux/converters.d.ts +73 -0
  120. package/dist/files/engine/redux/converters.js +286 -0
  121. package/dist/files/engine/redux/converters.js.map +1 -0
  122. package/dist/files/engine/redux/file-hydration.d.ts +15 -0
  123. package/dist/files/engine/redux/file-hydration.js +46 -0
  124. package/dist/files/engine/redux/file-hydration.js.map +1 -0
  125. package/dist/files/engine/redux/file-tree-auth-boundary.d.ts +5 -0
  126. package/dist/files/engine/redux/file-tree-auth-boundary.js +28 -0
  127. package/dist/files/engine/redux/file-tree-auth-boundary.js.map +1 -0
  128. package/dist/files/engine/redux/file-tree-timeout.d.ts +32 -0
  129. package/dist/files/engine/redux/file-tree-timeout.js +73 -0
  130. package/dist/files/engine/redux/file-tree-timeout.js.map +1 -0
  131. package/dist/files/engine/redux/mutation-toast-middleware.d.ts +27 -0
  132. package/dist/files/engine/redux/mutation-toast-middleware.js +103 -0
  133. package/dist/files/engine/redux/mutation-toast-middleware.js.map +1 -0
  134. package/dist/files/engine/redux/realtime-middleware.d.ts +61 -0
  135. package/dist/files/engine/redux/realtime-middleware.js +431 -0
  136. package/dist/files/engine/redux/realtime-middleware.js.map +1 -0
  137. package/dist/files/engine/redux/request-ledger.d.ts +68 -0
  138. package/dist/files/engine/redux/request-ledger.js +66 -0
  139. package/dist/files/engine/redux/request-ledger.js.map +1 -0
  140. package/dist/files/engine/redux/selectors.d.ts +3254 -0
  141. package/dist/files/engine/redux/selectors.js +428 -0
  142. package/dist/files/engine/redux/selectors.js.map +1 -0
  143. package/dist/files/engine/redux/slice.d.ts +157 -0
  144. package/dist/files/engine/redux/slice.js +836 -0
  145. package/dist/files/engine/redux/slice.js.map +1 -0
  146. package/dist/files/engine/redux/thunks.d.ts +449 -0
  147. package/dist/files/engine/redux/thunks.js +1684 -0
  148. package/dist/files/engine/redux/thunks.js.map +1 -0
  149. package/dist/files/engine/redux/tree-utils.d.ts +90 -0
  150. package/dist/files/engine/redux/tree-utils.js +200 -0
  151. package/dist/files/engine/redux/tree-utils.js.map +1 -0
  152. package/dist/files/engine/support/claimsUser.d.ts +77 -0
  153. package/dist/files/engine/support/claimsUser.js +48 -0
  154. package/dist/files/engine/support/claimsUser.js.map +1 -0
  155. package/dist/files/engine/support/datetime.d.ts +6 -0
  156. package/dist/files/engine/support/datetime.js +15 -0
  157. package/dist/files/engine/support/datetime.js.map +1 -0
  158. package/dist/files/engine/support/document-visibility.d.ts +14 -0
  159. package/dist/files/engine/support/document-visibility.js +28 -0
  160. package/dist/files/engine/support/document-visibility.js.map +1 -0
  161. package/dist/files/engine/support/logger.d.ts +28 -0
  162. package/dist/files/engine/support/logger.js +36 -0
  163. package/dist/files/engine/support/logger.js.map +1 -0
  164. package/dist/files/engine/types.d.ts +1081 -0
  165. package/dist/files/engine/types.js +30 -0
  166. package/dist/files/engine/types.js.map +1 -0
  167. package/dist/files/engine/upload/cloudUpload.d.ts +182 -0
  168. package/dist/files/engine/upload/cloudUpload.js +418 -0
  169. package/dist/files/engine/upload/cloudUpload.js.map +1 -0
  170. package/dist/files/engine/upload/tusUpload.d.ts +100 -0
  171. package/dist/files/engine/upload/tusUpload.js +258 -0
  172. package/dist/files/engine/upload/tusUpload.js.map +1 -0
  173. package/dist/files/engine/upload/uploadDedupGuard.d.ts +58 -0
  174. package/dist/files/engine/upload/uploadDedupGuard.js +41 -0
  175. package/dist/files/engine/upload/uploadDedupGuard.js.map +1 -0
  176. package/dist/files/engine/upload/uploadGuardOpeners.d.ts +70 -0
  177. package/dist/files/engine/upload/uploadGuardOpeners.js +54 -0
  178. package/dist/files/engine/upload/uploadGuardOpeners.js.map +1 -0
  179. package/dist/files/engine/utils/file-types.d.ts +243 -0
  180. package/dist/files/engine/utils/file-types.js +1722 -0
  181. package/dist/files/engine/utils/file-types.js.map +1 -0
  182. package/dist/files/engine/utils/user-visible.d.ts +133 -0
  183. package/dist/files/engine/utils/user-visible.js +115 -0
  184. package/dist/files/engine/utils/user-visible.js.map +1 -0
  185. package/package.json +393 -9
@@ -0,0 +1,1913 @@
1
+ /**
2
+ * features/files/filesDb.ts
3
+ *
4
+ * The cloud-files tables live in the dedicated `files` Postgres schema (moved
5
+ * out of `public` in the 2026 DB restructure; the `cld_` prefix was dropped).
6
+ * supabase-js reaches a non-public schema via `.schema(...)`, so every table
7
+ * read/write for these tables must go through `client.schema('files')`.
8
+ *
9
+ * Use this helper instead of inlining `.schema('files')` everywhere:
10
+ *
11
+ * const db = filesDb(supabase);
12
+ * const { data } = await db.from('files').select(FILES_TABLE_COLUMNS);
13
+ * await db.from('folders').upsert(...); // files.folders
14
+ *
15
+ * NEVER `select('*')` on `files.files` / `files.file_versions` — the
16
+ * server-only `storage_uri` column grant is REVOKEd and `*` errors.
17
+ *
18
+ * Works with the browser client, the SSR server client, and the admin client —
19
+ * they all expose `.schema()`.
20
+ *
21
+ * NOTE: file-permission grants are NOT in this schema — they live in the
22
+ * canonical `iam.permissions` store (resource_type='file'/'folder'). Reach
23
+ * those via `iamDb(supabase).rpc('fn_list_resource_permissions', ...)` (see
24
+ * utils/supabase/iamDb.ts) — list/grant/revoke are admin-gated inside the
25
+ * RPC (iam.has_access), never a plain `.from('permissions')` select.
26
+ */
27
+ import type { SupabaseClient } from "@supabase/supabase-js";
28
+ import type { Database } from "./db-types.js";
29
+ /** A supabase client scoped to the `files` schema. */
30
+ export declare function filesDb<C extends SupabaseClient<Database>>(client: C): import("@supabase/postgrest-js").PostgrestClient<import("./db-types.js").FilesDatabase, {
31
+ PostgrestVersion: "14.5";
32
+ }, "files", {
33
+ Tables: {
34
+ account_tiers: {
35
+ Row: {
36
+ created_at: string;
37
+ created_by: string | null;
38
+ deleted_at: string | null;
39
+ features: import("./db-types.js").Json;
40
+ id: string;
41
+ is_default_for_guests: boolean;
42
+ is_default_for_users: boolean;
43
+ max_bulk_items: number | null;
44
+ max_daily_upload_bytes: number | null;
45
+ max_daily_uploads: number | null;
46
+ max_file_size_bytes: number | null;
47
+ max_files: number | null;
48
+ max_share_links_per_resource: number | null;
49
+ max_storage_bytes: number | null;
50
+ max_versions_per_file: number | null;
51
+ metadata: import("./db-types.js").Json;
52
+ name: string;
53
+ organization_id: string;
54
+ published_to_web: boolean;
55
+ published_to_web_at: string | null;
56
+ published_to_web_by: string | null;
57
+ rate_limit_downloads_per_min: number | null;
58
+ rate_limit_general_per_min: number | null;
59
+ rate_limit_uploads_per_min: number | null;
60
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
61
+ tier_key: string;
62
+ updated_at: string;
63
+ updated_by: string | null;
64
+ version: number;
65
+ visibility: Database["platform"]["Enums"]["visibility"];
66
+ };
67
+ Insert: {
68
+ created_at?: string;
69
+ created_by?: string | null;
70
+ deleted_at?: string | null;
71
+ features?: import("./db-types.js").Json;
72
+ id?: string;
73
+ is_default_for_guests?: boolean;
74
+ is_default_for_users?: boolean;
75
+ max_bulk_items?: number | null;
76
+ max_daily_upload_bytes?: number | null;
77
+ max_daily_uploads?: number | null;
78
+ max_file_size_bytes?: number | null;
79
+ max_files?: number | null;
80
+ max_share_links_per_resource?: number | null;
81
+ max_storage_bytes?: number | null;
82
+ max_versions_per_file?: number | null;
83
+ metadata?: import("./db-types.js").Json;
84
+ name: string;
85
+ organization_id: string;
86
+ published_to_web?: boolean;
87
+ published_to_web_at?: string | null;
88
+ published_to_web_by?: string | null;
89
+ rate_limit_downloads_per_min?: number | null;
90
+ rate_limit_general_per_min?: number | null;
91
+ rate_limit_uploads_per_min?: number | null;
92
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
93
+ tier_key: string;
94
+ updated_at?: string;
95
+ updated_by?: string | null;
96
+ version?: number;
97
+ visibility?: Database["platform"]["Enums"]["visibility"];
98
+ };
99
+ Update: {
100
+ created_at?: string;
101
+ created_by?: string | null;
102
+ deleted_at?: string | null;
103
+ features?: import("./db-types.js").Json;
104
+ id?: string;
105
+ is_default_for_guests?: boolean;
106
+ is_default_for_users?: boolean;
107
+ max_bulk_items?: number | null;
108
+ max_daily_upload_bytes?: number | null;
109
+ max_daily_uploads?: number | null;
110
+ max_file_size_bytes?: number | null;
111
+ max_files?: number | null;
112
+ max_share_links_per_resource?: number | null;
113
+ max_storage_bytes?: number | null;
114
+ max_versions_per_file?: number | null;
115
+ metadata?: import("./db-types.js").Json;
116
+ name?: string;
117
+ organization_id?: string;
118
+ published_to_web?: boolean;
119
+ published_to_web_at?: string | null;
120
+ published_to_web_by?: string | null;
121
+ rate_limit_downloads_per_min?: number | null;
122
+ rate_limit_general_per_min?: number | null;
123
+ rate_limit_uploads_per_min?: number | null;
124
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
125
+ tier_key?: string;
126
+ updated_at?: string;
127
+ updated_by?: string | null;
128
+ version?: number;
129
+ visibility?: Database["platform"]["Enums"]["visibility"];
130
+ };
131
+ Relationships: [];
132
+ };
133
+ analysis: {
134
+ Row: {
135
+ analyzer_version: string;
136
+ classification: import("./db-types.js").Json | null;
137
+ completed_at: string | null;
138
+ created_at: string;
139
+ custom_fields: import("./db-types.js").Json;
140
+ deleted_at: string | null;
141
+ detectors_run: import("./db-types.js").Json;
142
+ file_id: string;
143
+ id: string;
144
+ metadata: import("./db-types.js").Json;
145
+ mime_type: string | null;
146
+ organization_id: string;
147
+ owner_id: string;
148
+ page_count: number | null;
149
+ progress: import("./db-types.js").Json;
150
+ started_at: string;
151
+ status: string;
152
+ summary_counts: import("./db-types.js").Json;
153
+ text_source_map: import("./db-types.js").Json | null;
154
+ thumbnail_url: string | null;
155
+ updated_at: string;
156
+ };
157
+ Insert: {
158
+ analyzer_version?: string;
159
+ classification?: import("./db-types.js").Json | null;
160
+ completed_at?: string | null;
161
+ created_at?: string;
162
+ custom_fields?: import("./db-types.js").Json;
163
+ deleted_at?: string | null;
164
+ detectors_run?: import("./db-types.js").Json;
165
+ file_id: string;
166
+ id?: string;
167
+ metadata?: import("./db-types.js").Json;
168
+ mime_type?: string | null;
169
+ organization_id: string;
170
+ owner_id: string;
171
+ page_count?: number | null;
172
+ progress?: import("./db-types.js").Json;
173
+ started_at?: string;
174
+ status?: string;
175
+ summary_counts?: import("./db-types.js").Json;
176
+ text_source_map?: import("./db-types.js").Json | null;
177
+ thumbnail_url?: string | null;
178
+ updated_at?: string;
179
+ };
180
+ Update: {
181
+ analyzer_version?: string;
182
+ classification?: import("./db-types.js").Json | null;
183
+ completed_at?: string | null;
184
+ created_at?: string;
185
+ custom_fields?: import("./db-types.js").Json;
186
+ deleted_at?: string | null;
187
+ detectors_run?: import("./db-types.js").Json;
188
+ file_id?: string;
189
+ id?: string;
190
+ metadata?: import("./db-types.js").Json;
191
+ mime_type?: string | null;
192
+ organization_id?: string;
193
+ owner_id?: string;
194
+ page_count?: number | null;
195
+ progress?: import("./db-types.js").Json;
196
+ started_at?: string;
197
+ status?: string;
198
+ summary_counts?: import("./db-types.js").Json;
199
+ text_source_map?: import("./db-types.js").Json | null;
200
+ thumbnail_url?: string | null;
201
+ updated_at?: string;
202
+ };
203
+ Relationships: [{
204
+ foreignKeyName: "file_analysis_file_id_fkey";
205
+ columns: ["file_id"];
206
+ isOneToOne: true;
207
+ referencedRelation: "files";
208
+ referencedColumns: ["id"];
209
+ }];
210
+ };
211
+ analysis_result: {
212
+ Row: {
213
+ confidence_tier: string;
214
+ created_at: string;
215
+ custom_fields: import("./db-types.js").Json;
216
+ detector_kind: string;
217
+ detector_version: string;
218
+ elapsed_ms: number;
219
+ error: string | null;
220
+ file_id: string;
221
+ id: string;
222
+ metadata: import("./db-types.js").Json;
223
+ organization_id: string;
224
+ page_id: string | null;
225
+ payload: import("./db-types.js").Json | null;
226
+ payload_bytes: number;
227
+ payload_uri: string | null;
228
+ status: string;
229
+ summary: import("./db-types.js").Json;
230
+ text_sources: string[];
231
+ };
232
+ Insert: {
233
+ confidence_tier?: string;
234
+ created_at?: string;
235
+ custom_fields?: import("./db-types.js").Json;
236
+ detector_kind: string;
237
+ detector_version?: string;
238
+ elapsed_ms?: number;
239
+ error?: string | null;
240
+ file_id: string;
241
+ id?: string;
242
+ metadata?: import("./db-types.js").Json;
243
+ organization_id: string;
244
+ page_id?: string | null;
245
+ payload?: import("./db-types.js").Json | null;
246
+ payload_bytes?: number;
247
+ payload_uri?: string | null;
248
+ status?: string;
249
+ summary?: import("./db-types.js").Json;
250
+ text_sources?: string[];
251
+ };
252
+ Update: {
253
+ confidence_tier?: string;
254
+ created_at?: string;
255
+ custom_fields?: import("./db-types.js").Json;
256
+ detector_kind?: string;
257
+ detector_version?: string;
258
+ elapsed_ms?: number;
259
+ error?: string | null;
260
+ file_id?: string;
261
+ id?: string;
262
+ metadata?: import("./db-types.js").Json;
263
+ organization_id?: string;
264
+ page_id?: string | null;
265
+ payload?: import("./db-types.js").Json | null;
266
+ payload_bytes?: number;
267
+ payload_uri?: string | null;
268
+ status?: string;
269
+ summary?: import("./db-types.js").Json;
270
+ text_sources?: string[];
271
+ };
272
+ Relationships: [{
273
+ foreignKeyName: "file_analysis_result_file_id_fkey";
274
+ columns: ["file_id"];
275
+ isOneToOne: false;
276
+ referencedRelation: "files";
277
+ referencedColumns: ["id"];
278
+ }, {
279
+ foreignKeyName: "file_analysis_result_page_id_fkey";
280
+ columns: ["page_id"];
281
+ isOneToOne: false;
282
+ referencedRelation: "pages";
283
+ referencedColumns: ["id"];
284
+ }];
285
+ };
286
+ entities: {
287
+ Row: {
288
+ canonical_value: string;
289
+ created_at: string;
290
+ custom_fields: import("./db-types.js").Json;
291
+ deleted_at: string | null;
292
+ file_id: string;
293
+ id: string;
294
+ is_user_named: boolean;
295
+ label: string;
296
+ label_category: string;
297
+ metadata: import("./db-types.js").Json;
298
+ normalized_value: import("./db-types.js").Json | null;
299
+ organization_id: string;
300
+ owner_id: string;
301
+ source_annotation_id: string | null;
302
+ updated_at: string;
303
+ version: number;
304
+ };
305
+ Insert: {
306
+ canonical_value: string;
307
+ created_at?: string;
308
+ custom_fields?: import("./db-types.js").Json;
309
+ deleted_at?: string | null;
310
+ file_id: string;
311
+ id?: string;
312
+ is_user_named?: boolean;
313
+ label: string;
314
+ label_category?: string;
315
+ metadata?: import("./db-types.js").Json;
316
+ normalized_value?: import("./db-types.js").Json | null;
317
+ organization_id: string;
318
+ owner_id: string;
319
+ source_annotation_id?: string | null;
320
+ updated_at?: string;
321
+ version?: number;
322
+ };
323
+ Update: {
324
+ canonical_value?: string;
325
+ created_at?: string;
326
+ custom_fields?: import("./db-types.js").Json;
327
+ deleted_at?: string | null;
328
+ file_id?: string;
329
+ id?: string;
330
+ is_user_named?: boolean;
331
+ label?: string;
332
+ label_category?: string;
333
+ metadata?: import("./db-types.js").Json;
334
+ normalized_value?: import("./db-types.js").Json | null;
335
+ organization_id?: string;
336
+ owner_id?: string;
337
+ source_annotation_id?: string | null;
338
+ updated_at?: string;
339
+ version?: number;
340
+ };
341
+ Relationships: [{
342
+ foreignKeyName: "file_entities_file_id_fkey";
343
+ columns: ["file_id"];
344
+ isOneToOne: false;
345
+ referencedRelation: "files";
346
+ referencedColumns: ["id"];
347
+ }, {
348
+ foreignKeyName: "file_entities_source_annotation_id_fkey";
349
+ columns: ["source_annotation_id"];
350
+ isOneToOne: false;
351
+ referencedRelation: "page_annotations";
352
+ referencedColumns: ["id"];
353
+ }];
354
+ };
355
+ file_rag_jobs: {
356
+ Row: {
357
+ attempt_count: number;
358
+ completed_at: string | null;
359
+ created_at: string;
360
+ custom_fields: import("./db-types.js").Json;
361
+ error: import("./db-types.js").Json | null;
362
+ file_id: string;
363
+ id: string;
364
+ metadata: import("./db-types.js").Json;
365
+ organization_id: string;
366
+ scheduled_for: string;
367
+ skipped_reason: string | null;
368
+ started_at: string | null;
369
+ status: string;
370
+ trigger_source: string;
371
+ updated_at: string;
372
+ user_id: string;
373
+ };
374
+ Insert: {
375
+ attempt_count?: number;
376
+ completed_at?: string | null;
377
+ created_at?: string;
378
+ custom_fields?: import("./db-types.js").Json;
379
+ error?: import("./db-types.js").Json | null;
380
+ file_id: string;
381
+ id?: string;
382
+ metadata?: import("./db-types.js").Json;
383
+ organization_id: string;
384
+ scheduled_for?: string;
385
+ skipped_reason?: string | null;
386
+ started_at?: string | null;
387
+ status?: string;
388
+ trigger_source?: string;
389
+ updated_at?: string;
390
+ user_id: string;
391
+ };
392
+ Update: {
393
+ attempt_count?: number;
394
+ completed_at?: string | null;
395
+ created_at?: string;
396
+ custom_fields?: import("./db-types.js").Json;
397
+ error?: import("./db-types.js").Json | null;
398
+ file_id?: string;
399
+ id?: string;
400
+ metadata?: import("./db-types.js").Json;
401
+ organization_id?: string;
402
+ scheduled_for?: string;
403
+ skipped_reason?: string | null;
404
+ started_at?: string | null;
405
+ status?: string;
406
+ trigger_source?: string;
407
+ updated_at?: string;
408
+ user_id?: string;
409
+ };
410
+ Relationships: [{
411
+ foreignKeyName: "cld_file_rag_jobs_file_id_fkey";
412
+ columns: ["file_id"];
413
+ isOneToOne: false;
414
+ referencedRelation: "files";
415
+ referencedColumns: ["id"];
416
+ }];
417
+ };
418
+ file_versions: {
419
+ Row: {
420
+ change_summary: string | null;
421
+ checksum: string | null;
422
+ created_at: string;
423
+ created_by: string | null;
424
+ custom_fields: import("./db-types.js").Json;
425
+ file_id: string;
426
+ id: string;
427
+ metadata: import("./db-types.js").Json;
428
+ organization_id: string;
429
+ size_bytes: number | null;
430
+ storage_uri: string;
431
+ version_number: number;
432
+ };
433
+ Insert: {
434
+ change_summary?: string | null;
435
+ checksum?: string | null;
436
+ created_at?: string;
437
+ created_by?: string | null;
438
+ custom_fields?: import("./db-types.js").Json;
439
+ file_id: string;
440
+ id?: string;
441
+ metadata?: import("./db-types.js").Json;
442
+ organization_id: string;
443
+ size_bytes?: number | null;
444
+ storage_uri: string;
445
+ version_number: number;
446
+ };
447
+ Update: {
448
+ change_summary?: string | null;
449
+ checksum?: string | null;
450
+ created_at?: string;
451
+ created_by?: string | null;
452
+ custom_fields?: import("./db-types.js").Json;
453
+ file_id?: string;
454
+ id?: string;
455
+ metadata?: import("./db-types.js").Json;
456
+ organization_id?: string;
457
+ size_bytes?: number | null;
458
+ storage_uri?: string;
459
+ version_number?: number;
460
+ };
461
+ Relationships: [{
462
+ foreignKeyName: "cld_file_versions_file_id_fkey";
463
+ columns: ["file_id"];
464
+ isOneToOne: false;
465
+ referencedRelation: "files";
466
+ referencedColumns: ["id"];
467
+ }];
468
+ };
469
+ files: {
470
+ Row: {
471
+ artifact_kind: string | null;
472
+ canonical_processed_document_id: string | null;
473
+ checksum: string | null;
474
+ client_modified_at: string | null;
475
+ created_at: string;
476
+ created_by: string;
477
+ current_version: number;
478
+ custom_fields: import("./db-types.js").Json;
479
+ deleted_at: string | null;
480
+ derivation_kind: string | null;
481
+ derivation_metadata: import("./db-types.js").Json;
482
+ duplicate_of_file_id: string | null;
483
+ duration_ms: number | null;
484
+ file_name: string;
485
+ file_path: string;
486
+ height: number | null;
487
+ id: string;
488
+ metadata: import("./db-types.js").Json;
489
+ mime_type: string | null;
490
+ organization_id: string;
491
+ origin_device_id: string | null;
492
+ parent_file_id: string | null;
493
+ parent_folder_id: string | null;
494
+ parent_record_id: string | null;
495
+ parent_record_type: string | null;
496
+ provider_session_id: string | null;
497
+ published_to_web: boolean;
498
+ published_to_web_at: string | null;
499
+ published_to_web_by: string | null;
500
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
501
+ size_bytes: number | null;
502
+ storage_uri: string;
503
+ updated_at: string;
504
+ updated_by: string | null;
505
+ version: number;
506
+ visibility: Database["platform"]["Enums"]["visibility"];
507
+ width: number | null;
508
+ };
509
+ Insert: {
510
+ artifact_kind?: string | null;
511
+ canonical_processed_document_id?: string | null;
512
+ checksum?: string | null;
513
+ client_modified_at?: string | null;
514
+ created_at?: string;
515
+ created_by: string;
516
+ current_version?: number;
517
+ custom_fields?: import("./db-types.js").Json;
518
+ deleted_at?: string | null;
519
+ derivation_kind?: string | null;
520
+ derivation_metadata?: import("./db-types.js").Json;
521
+ duplicate_of_file_id?: string | null;
522
+ duration_ms?: number | null;
523
+ file_name: string;
524
+ file_path: string;
525
+ height?: number | null;
526
+ id?: string;
527
+ metadata?: import("./db-types.js").Json;
528
+ mime_type?: string | null;
529
+ organization_id: string;
530
+ origin_device_id?: string | null;
531
+ parent_file_id?: string | null;
532
+ parent_folder_id?: string | null;
533
+ parent_record_id?: string | null;
534
+ parent_record_type?: string | null;
535
+ provider_session_id?: string | null;
536
+ published_to_web?: boolean;
537
+ published_to_web_at?: string | null;
538
+ published_to_web_by?: string | null;
539
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
540
+ size_bytes?: number | null;
541
+ storage_uri: string;
542
+ updated_at?: string;
543
+ updated_by?: string | null;
544
+ version?: number;
545
+ visibility?: Database["platform"]["Enums"]["visibility"];
546
+ width?: number | null;
547
+ };
548
+ Update: {
549
+ artifact_kind?: string | null;
550
+ canonical_processed_document_id?: string | null;
551
+ checksum?: string | null;
552
+ client_modified_at?: string | null;
553
+ created_at?: string;
554
+ created_by?: string;
555
+ current_version?: number;
556
+ custom_fields?: import("./db-types.js").Json;
557
+ deleted_at?: string | null;
558
+ derivation_kind?: string | null;
559
+ derivation_metadata?: import("./db-types.js").Json;
560
+ duplicate_of_file_id?: string | null;
561
+ duration_ms?: number | null;
562
+ file_name?: string;
563
+ file_path?: string;
564
+ height?: number | null;
565
+ id?: string;
566
+ metadata?: import("./db-types.js").Json;
567
+ mime_type?: string | null;
568
+ organization_id?: string;
569
+ origin_device_id?: string | null;
570
+ parent_file_id?: string | null;
571
+ parent_folder_id?: string | null;
572
+ parent_record_id?: string | null;
573
+ parent_record_type?: string | null;
574
+ provider_session_id?: string | null;
575
+ published_to_web?: boolean;
576
+ published_to_web_at?: string | null;
577
+ published_to_web_by?: string | null;
578
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
579
+ size_bytes?: number | null;
580
+ storage_uri?: string;
581
+ updated_at?: string;
582
+ updated_by?: string | null;
583
+ version?: number;
584
+ visibility?: Database["platform"]["Enums"]["visibility"];
585
+ width?: number | null;
586
+ };
587
+ Relationships: [{
588
+ foreignKeyName: "cld_files_duplicate_of_file_id_fkey";
589
+ columns: ["duplicate_of_file_id"];
590
+ isOneToOne: false;
591
+ referencedRelation: "files";
592
+ referencedColumns: ["id"];
593
+ }, {
594
+ foreignKeyName: "cld_files_parent_file_id_fkey";
595
+ columns: ["parent_file_id"];
596
+ isOneToOne: false;
597
+ referencedRelation: "files";
598
+ referencedColumns: ["id"];
599
+ }, {
600
+ foreignKeyName: "cld_files_parent_folder_id_fkey";
601
+ columns: ["parent_folder_id"];
602
+ isOneToOne: false;
603
+ referencedRelation: "folders";
604
+ referencedColumns: ["id"];
605
+ }];
606
+ };
607
+ folders: {
608
+ Row: {
609
+ created_at: string;
610
+ created_by: string;
611
+ custom_fields: import("./db-types.js").Json;
612
+ deleted_at: string | null;
613
+ folder_name: string;
614
+ folder_path: string;
615
+ id: string;
616
+ is_system: boolean;
617
+ metadata: import("./db-types.js").Json;
618
+ organization_id: string;
619
+ parent_id: string | null;
620
+ published_to_web: boolean;
621
+ published_to_web_at: string | null;
622
+ published_to_web_by: string | null;
623
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
624
+ updated_at: string;
625
+ updated_by: string | null;
626
+ version: number;
627
+ visibility: Database["platform"]["Enums"]["visibility"];
628
+ };
629
+ Insert: {
630
+ created_at?: string;
631
+ created_by: string;
632
+ custom_fields?: import("./db-types.js").Json;
633
+ deleted_at?: string | null;
634
+ folder_name: string;
635
+ folder_path: string;
636
+ id?: string;
637
+ is_system?: boolean;
638
+ metadata?: import("./db-types.js").Json;
639
+ organization_id: string;
640
+ parent_id?: string | null;
641
+ published_to_web?: boolean;
642
+ published_to_web_at?: string | null;
643
+ published_to_web_by?: string | null;
644
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
645
+ updated_at?: string;
646
+ updated_by?: string | null;
647
+ version?: number;
648
+ visibility?: Database["platform"]["Enums"]["visibility"];
649
+ };
650
+ Update: {
651
+ created_at?: string;
652
+ created_by?: string;
653
+ custom_fields?: import("./db-types.js").Json;
654
+ deleted_at?: string | null;
655
+ folder_name?: string;
656
+ folder_path?: string;
657
+ id?: string;
658
+ is_system?: boolean;
659
+ metadata?: import("./db-types.js").Json;
660
+ organization_id?: string;
661
+ parent_id?: string | null;
662
+ published_to_web?: boolean;
663
+ published_to_web_at?: string | null;
664
+ published_to_web_by?: string | null;
665
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
666
+ updated_at?: string;
667
+ updated_by?: string | null;
668
+ version?: number;
669
+ visibility?: Database["platform"]["Enums"]["visibility"];
670
+ };
671
+ Relationships: [{
672
+ foreignKeyName: "cld_folders_parent_id_fkey";
673
+ columns: ["parent_id"];
674
+ isOneToOne: false;
675
+ referencedRelation: "folders";
676
+ referencedColumns: ["id"];
677
+ }];
678
+ };
679
+ idempotency: {
680
+ Row: {
681
+ created_at: string;
682
+ endpoint: string;
683
+ expires_at: string;
684
+ idempotency_key: string;
685
+ owner_id: string;
686
+ request_hash: string;
687
+ resource_id: string | null;
688
+ resource_type: string | null;
689
+ response_body: import("./db-types.js").Json;
690
+ status_code: number;
691
+ };
692
+ Insert: {
693
+ created_at?: string;
694
+ endpoint: string;
695
+ expires_at?: string;
696
+ idempotency_key: string;
697
+ owner_id: string;
698
+ request_hash: string;
699
+ resource_id?: string | null;
700
+ resource_type?: string | null;
701
+ response_body: import("./db-types.js").Json;
702
+ status_code: number;
703
+ };
704
+ Update: {
705
+ created_at?: string;
706
+ endpoint?: string;
707
+ expires_at?: string;
708
+ idempotency_key?: string;
709
+ owner_id?: string;
710
+ request_hash?: string;
711
+ resource_id?: string | null;
712
+ resource_type?: string | null;
713
+ response_body?: import("./db-types.js").Json;
714
+ status_code?: number;
715
+ };
716
+ Relationships: [];
717
+ };
718
+ machine_written_prefixes: {
719
+ Row: {
720
+ created_at: string;
721
+ created_by: string | null;
722
+ deleted_at: string | null;
723
+ description: string | null;
724
+ deselect_by_default: boolean;
725
+ id: string;
726
+ is_active: boolean;
727
+ label: string;
728
+ metadata: import("./db-types.js").Json;
729
+ organization_id: string;
730
+ prefix: string;
731
+ published_to_web: boolean;
732
+ published_to_web_at: string | null;
733
+ published_to_web_by: string | null;
734
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
735
+ updated_at: string;
736
+ updated_by: string | null;
737
+ version: number;
738
+ visibility: Database["platform"]["Enums"]["visibility"];
739
+ writer: string;
740
+ };
741
+ Insert: {
742
+ created_at?: string;
743
+ created_by?: string | null;
744
+ deleted_at?: string | null;
745
+ description?: string | null;
746
+ deselect_by_default?: boolean;
747
+ id?: string;
748
+ is_active?: boolean;
749
+ label: string;
750
+ metadata?: import("./db-types.js").Json;
751
+ organization_id: string;
752
+ prefix: string;
753
+ published_to_web?: boolean;
754
+ published_to_web_at?: string | null;
755
+ published_to_web_by?: string | null;
756
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
757
+ updated_at?: string;
758
+ updated_by?: string | null;
759
+ version?: number;
760
+ visibility?: Database["platform"]["Enums"]["visibility"];
761
+ writer: string;
762
+ };
763
+ Update: {
764
+ created_at?: string;
765
+ created_by?: string | null;
766
+ deleted_at?: string | null;
767
+ description?: string | null;
768
+ deselect_by_default?: boolean;
769
+ id?: string;
770
+ is_active?: boolean;
771
+ label?: string;
772
+ metadata?: import("./db-types.js").Json;
773
+ organization_id?: string;
774
+ prefix?: string;
775
+ published_to_web?: boolean;
776
+ published_to_web_at?: string | null;
777
+ published_to_web_by?: string | null;
778
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
779
+ updated_at?: string;
780
+ updated_by?: string | null;
781
+ version?: number;
782
+ visibility?: Database["platform"]["Enums"]["visibility"];
783
+ writer?: string;
784
+ };
785
+ Relationships: [];
786
+ };
787
+ overrides: {
788
+ Row: {
789
+ created_at: string;
790
+ created_by: string | null;
791
+ custom_fields: import("./db-types.js").Json;
792
+ deleted_at: string | null;
793
+ file_id: string;
794
+ id: string;
795
+ metadata: import("./db-types.js").Json;
796
+ notes: string | null;
797
+ organization_id: string;
798
+ override_kind: string;
799
+ override_value: import("./db-types.js").Json;
800
+ owner_id: string;
801
+ page_id: string | null;
802
+ updated_at: string;
803
+ version: number;
804
+ };
805
+ Insert: {
806
+ created_at?: string;
807
+ created_by?: string | null;
808
+ custom_fields?: import("./db-types.js").Json;
809
+ deleted_at?: string | null;
810
+ file_id: string;
811
+ id?: string;
812
+ metadata?: import("./db-types.js").Json;
813
+ notes?: string | null;
814
+ organization_id: string;
815
+ override_kind: string;
816
+ override_value: import("./db-types.js").Json;
817
+ owner_id: string;
818
+ page_id?: string | null;
819
+ updated_at?: string;
820
+ version?: number;
821
+ };
822
+ Update: {
823
+ created_at?: string;
824
+ created_by?: string | null;
825
+ custom_fields?: import("./db-types.js").Json;
826
+ deleted_at?: string | null;
827
+ file_id?: string;
828
+ id?: string;
829
+ metadata?: import("./db-types.js").Json;
830
+ notes?: string | null;
831
+ organization_id?: string;
832
+ override_kind?: string;
833
+ override_value?: import("./db-types.js").Json;
834
+ owner_id?: string;
835
+ page_id?: string | null;
836
+ updated_at?: string;
837
+ version?: number;
838
+ };
839
+ Relationships: [{
840
+ foreignKeyName: "file_overrides_file_id_fkey";
841
+ columns: ["file_id"];
842
+ isOneToOne: false;
843
+ referencedRelation: "files";
844
+ referencedColumns: ["id"];
845
+ }, {
846
+ foreignKeyName: "file_overrides_page_id_fkey";
847
+ columns: ["page_id"];
848
+ isOneToOne: false;
849
+ referencedRelation: "pages";
850
+ referencedColumns: ["id"];
851
+ }];
852
+ };
853
+ page_annotations: {
854
+ Row: {
855
+ bbox: import("./db-types.js").Json;
856
+ created_at: string;
857
+ created_by: string | null;
858
+ custom_fields: import("./db-types.js").Json;
859
+ deleted_at: string | null;
860
+ entity_id: string | null;
861
+ extracted_text: string | null;
862
+ extracted_text_source: string;
863
+ file_id: string;
864
+ id: string;
865
+ is_user_locked: boolean;
866
+ label: string;
867
+ label_category: string;
868
+ last_edited_by: string | null;
869
+ metadata: import("./db-types.js").Json;
870
+ normalized_value: import("./db-types.js").Json | null;
871
+ notes: string | null;
872
+ organization_id: string;
873
+ owner_id: string;
874
+ page_id: string | null;
875
+ page_number: number;
876
+ parent_result_id: string | null;
877
+ redact: boolean;
878
+ redaction_span_id: string | null;
879
+ source: string;
880
+ status: string;
881
+ updated_at: string;
882
+ version: number;
883
+ };
884
+ Insert: {
885
+ bbox: import("./db-types.js").Json;
886
+ created_at?: string;
887
+ created_by?: string | null;
888
+ custom_fields?: import("./db-types.js").Json;
889
+ deleted_at?: string | null;
890
+ entity_id?: string | null;
891
+ extracted_text?: string | null;
892
+ extracted_text_source?: string;
893
+ file_id: string;
894
+ id?: string;
895
+ is_user_locked?: boolean;
896
+ label: string;
897
+ label_category?: string;
898
+ last_edited_by?: string | null;
899
+ metadata?: import("./db-types.js").Json;
900
+ normalized_value?: import("./db-types.js").Json | null;
901
+ notes?: string | null;
902
+ organization_id: string;
903
+ owner_id: string;
904
+ page_id?: string | null;
905
+ page_number: number;
906
+ parent_result_id?: string | null;
907
+ redact?: boolean;
908
+ redaction_span_id?: string | null;
909
+ source?: string;
910
+ status?: string;
911
+ updated_at?: string;
912
+ version?: number;
913
+ };
914
+ Update: {
915
+ bbox?: import("./db-types.js").Json;
916
+ created_at?: string;
917
+ created_by?: string | null;
918
+ custom_fields?: import("./db-types.js").Json;
919
+ deleted_at?: string | null;
920
+ entity_id?: string | null;
921
+ extracted_text?: string | null;
922
+ extracted_text_source?: string;
923
+ file_id?: string;
924
+ id?: string;
925
+ is_user_locked?: boolean;
926
+ label?: string;
927
+ label_category?: string;
928
+ last_edited_by?: string | null;
929
+ metadata?: import("./db-types.js").Json;
930
+ normalized_value?: import("./db-types.js").Json | null;
931
+ notes?: string | null;
932
+ organization_id?: string;
933
+ owner_id?: string;
934
+ page_id?: string | null;
935
+ page_number?: number;
936
+ parent_result_id?: string | null;
937
+ redact?: boolean;
938
+ redaction_span_id?: string | null;
939
+ source?: string;
940
+ status?: string;
941
+ updated_at?: string;
942
+ version?: number;
943
+ };
944
+ Relationships: [{
945
+ foreignKeyName: "file_page_annotations_entity_fk";
946
+ columns: ["entity_id"];
947
+ isOneToOne: false;
948
+ referencedRelation: "entities";
949
+ referencedColumns: ["id"];
950
+ }, {
951
+ foreignKeyName: "file_page_annotations_file_id_fkey";
952
+ columns: ["file_id"];
953
+ isOneToOne: false;
954
+ referencedRelation: "files";
955
+ referencedColumns: ["id"];
956
+ }, {
957
+ foreignKeyName: "file_page_annotations_page_id_fkey";
958
+ columns: ["page_id"];
959
+ isOneToOne: false;
960
+ referencedRelation: "pages";
961
+ referencedColumns: ["id"];
962
+ }, {
963
+ foreignKeyName: "file_page_annotations_parent_result_id_fkey";
964
+ columns: ["parent_result_id"];
965
+ isOneToOne: false;
966
+ referencedRelation: "analysis_result";
967
+ referencedColumns: ["id"];
968
+ }];
969
+ };
970
+ pages: {
971
+ Row: {
972
+ created_at: string;
973
+ custom_fields: import("./db-types.js").Json;
974
+ deleted_at: string | null;
975
+ excluded_at: string | null;
976
+ excluded_by: string | null;
977
+ excluded_reason: string | null;
978
+ file_id: string;
979
+ height_pt: number | null;
980
+ id: string;
981
+ metadata: import("./db-types.js").Json;
982
+ ocr_confidence: number | null;
983
+ organization_id: string;
984
+ owner_id: string;
985
+ page_index: number;
986
+ processed_document_page_id: string | null;
987
+ rotation: number;
988
+ source_page_index: number;
989
+ status: string;
990
+ text_source: string;
991
+ thumbnail_url: string | null;
992
+ updated_at: string;
993
+ user_modified: boolean;
994
+ width_pt: number | null;
995
+ };
996
+ Insert: {
997
+ created_at?: string;
998
+ custom_fields?: import("./db-types.js").Json;
999
+ deleted_at?: string | null;
1000
+ excluded_at?: string | null;
1001
+ excluded_by?: string | null;
1002
+ excluded_reason?: string | null;
1003
+ file_id: string;
1004
+ height_pt?: number | null;
1005
+ id?: string;
1006
+ metadata?: import("./db-types.js").Json;
1007
+ ocr_confidence?: number | null;
1008
+ organization_id: string;
1009
+ owner_id: string;
1010
+ page_index: number;
1011
+ processed_document_page_id?: string | null;
1012
+ rotation?: number;
1013
+ source_page_index: number;
1014
+ status?: string;
1015
+ text_source?: string;
1016
+ thumbnail_url?: string | null;
1017
+ updated_at?: string;
1018
+ user_modified?: boolean;
1019
+ width_pt?: number | null;
1020
+ };
1021
+ Update: {
1022
+ created_at?: string;
1023
+ custom_fields?: import("./db-types.js").Json;
1024
+ deleted_at?: string | null;
1025
+ excluded_at?: string | null;
1026
+ excluded_by?: string | null;
1027
+ excluded_reason?: string | null;
1028
+ file_id?: string;
1029
+ height_pt?: number | null;
1030
+ id?: string;
1031
+ metadata?: import("./db-types.js").Json;
1032
+ ocr_confidence?: number | null;
1033
+ organization_id?: string;
1034
+ owner_id?: string;
1035
+ page_index?: number;
1036
+ processed_document_page_id?: string | null;
1037
+ rotation?: number;
1038
+ source_page_index?: number;
1039
+ status?: string;
1040
+ text_source?: string;
1041
+ thumbnail_url?: string | null;
1042
+ updated_at?: string;
1043
+ user_modified?: boolean;
1044
+ width_pt?: number | null;
1045
+ };
1046
+ Relationships: [{
1047
+ foreignKeyName: "file_pages_file_id_fkey";
1048
+ columns: ["file_id"];
1049
+ isOneToOne: false;
1050
+ referencedRelation: "files";
1051
+ referencedColumns: ["id"];
1052
+ }];
1053
+ };
1054
+ rate_limit_buckets: {
1055
+ Row: {
1056
+ actor_id: string;
1057
+ bucket_kind: string;
1058
+ counter: number;
1059
+ minute_bucket: string;
1060
+ };
1061
+ Insert: {
1062
+ actor_id: string;
1063
+ bucket_kind: string;
1064
+ counter?: number;
1065
+ minute_bucket: string;
1066
+ };
1067
+ Update: {
1068
+ actor_id?: string;
1069
+ bucket_kind?: string;
1070
+ counter?: number;
1071
+ minute_bucket?: string;
1072
+ };
1073
+ Relationships: [];
1074
+ };
1075
+ structure: {
1076
+ Row: {
1077
+ bucket_id: string;
1078
+ created_at: string;
1079
+ custom_fields: import("./db-types.js").Json;
1080
+ file_id: string | null;
1081
+ id: string;
1082
+ is_folder: boolean;
1083
+ metadata: import("./db-types.js").Json;
1084
+ name: string;
1085
+ organization_id: string;
1086
+ parent_path: string | null;
1087
+ path: string;
1088
+ updated_at: string | null;
1089
+ };
1090
+ Insert: {
1091
+ bucket_id: string;
1092
+ created_at?: string;
1093
+ custom_fields?: import("./db-types.js").Json;
1094
+ file_id?: string | null;
1095
+ id?: string;
1096
+ is_folder: boolean;
1097
+ metadata?: import("./db-types.js").Json;
1098
+ name: string;
1099
+ organization_id: string;
1100
+ parent_path?: string | null;
1101
+ path: string;
1102
+ updated_at?: string | null;
1103
+ };
1104
+ Update: {
1105
+ bucket_id?: string;
1106
+ created_at?: string;
1107
+ custom_fields?: import("./db-types.js").Json;
1108
+ file_id?: string | null;
1109
+ id?: string;
1110
+ is_folder?: boolean;
1111
+ metadata?: import("./db-types.js").Json;
1112
+ name?: string;
1113
+ organization_id?: string;
1114
+ parent_path?: string | null;
1115
+ path?: string;
1116
+ updated_at?: string | null;
1117
+ };
1118
+ Relationships: [{
1119
+ foreignKeyName: "structure_file_id_fkey";
1120
+ columns: ["file_id"];
1121
+ isOneToOne: false;
1122
+ referencedRelation: "files";
1123
+ referencedColumns: ["id"];
1124
+ }];
1125
+ };
1126
+ sync_mappings: {
1127
+ Row: {
1128
+ bytes_total: number | null;
1129
+ created_at: string;
1130
+ created_by: string | null;
1131
+ custom_fields: import("./db-types.js").Json;
1132
+ deleted_at: string | null;
1133
+ desired_state: string;
1134
+ device_id: string;
1135
+ direction: string;
1136
+ folder_id: string | null;
1137
+ id: string;
1138
+ items_total: number | null;
1139
+ knobs: import("./db-types.js").Json;
1140
+ last_seen_at: string | null;
1141
+ last_synced_at: string | null;
1142
+ local_path: string;
1143
+ local_path_display: string | null;
1144
+ metadata: import("./db-types.js").Json;
1145
+ organization_id: string;
1146
+ published_to_web: boolean;
1147
+ published_to_web_at: string | null;
1148
+ published_to_web_by: string | null;
1149
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
1150
+ state: string;
1151
+ state_changed_at: string | null;
1152
+ state_reason: string | null;
1153
+ updated_at: string;
1154
+ updated_by: string | null;
1155
+ version: number;
1156
+ visibility: Database["platform"]["Enums"]["visibility"];
1157
+ };
1158
+ Insert: {
1159
+ bytes_total?: number | null;
1160
+ created_at?: string;
1161
+ created_by?: string | null;
1162
+ custom_fields?: import("./db-types.js").Json;
1163
+ deleted_at?: string | null;
1164
+ desired_state?: string;
1165
+ device_id: string;
1166
+ direction?: string;
1167
+ folder_id?: string | null;
1168
+ id?: string;
1169
+ items_total?: number | null;
1170
+ knobs?: import("./db-types.js").Json;
1171
+ last_seen_at?: string | null;
1172
+ last_synced_at?: string | null;
1173
+ local_path: string;
1174
+ local_path_display?: string | null;
1175
+ metadata?: import("./db-types.js").Json;
1176
+ organization_id: string;
1177
+ published_to_web?: boolean;
1178
+ published_to_web_at?: string | null;
1179
+ published_to_web_by?: string | null;
1180
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
1181
+ state?: string;
1182
+ state_changed_at?: string | null;
1183
+ state_reason?: string | null;
1184
+ updated_at?: string;
1185
+ updated_by?: string | null;
1186
+ version?: number;
1187
+ visibility?: Database["platform"]["Enums"]["visibility"];
1188
+ };
1189
+ Update: {
1190
+ bytes_total?: number | null;
1191
+ created_at?: string;
1192
+ created_by?: string | null;
1193
+ custom_fields?: import("./db-types.js").Json;
1194
+ deleted_at?: string | null;
1195
+ desired_state?: string;
1196
+ device_id?: string;
1197
+ direction?: string;
1198
+ folder_id?: string | null;
1199
+ id?: string;
1200
+ items_total?: number | null;
1201
+ knobs?: import("./db-types.js").Json;
1202
+ last_seen_at?: string | null;
1203
+ last_synced_at?: string | null;
1204
+ local_path?: string;
1205
+ local_path_display?: string | null;
1206
+ metadata?: import("./db-types.js").Json;
1207
+ organization_id?: string;
1208
+ published_to_web?: boolean;
1209
+ published_to_web_at?: string | null;
1210
+ published_to_web_by?: string | null;
1211
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
1212
+ state?: string;
1213
+ state_changed_at?: string | null;
1214
+ state_reason?: string | null;
1215
+ updated_at?: string;
1216
+ updated_by?: string | null;
1217
+ version?: number;
1218
+ visibility?: Database["platform"]["Enums"]["visibility"];
1219
+ };
1220
+ Relationships: [{
1221
+ foreignKeyName: "sync_mappings_folder_id_fkey";
1222
+ columns: ["folder_id"];
1223
+ isOneToOne: false;
1224
+ referencedRelation: "folders";
1225
+ referencedColumns: ["id"];
1226
+ }];
1227
+ };
1228
+ uploads_inflight: {
1229
+ Row: {
1230
+ bucket: string;
1231
+ created_at: string;
1232
+ custom_fields: import("./db-types.js").Json;
1233
+ expires_at: string;
1234
+ file_id: string;
1235
+ file_name: string;
1236
+ file_path: string;
1237
+ id: string;
1238
+ idempotency_key: string | null;
1239
+ key: string;
1240
+ metadata: import("./db-types.js").Json;
1241
+ mime_type: string | null;
1242
+ multipart_upload_id: string;
1243
+ owner_id: string;
1244
+ parts: import("./db-types.js").Json;
1245
+ status: string;
1246
+ updated_at: string;
1247
+ upload_length: number;
1248
+ upload_offset: number;
1249
+ visibility: string;
1250
+ };
1251
+ Insert: {
1252
+ bucket: string;
1253
+ created_at?: string;
1254
+ custom_fields?: import("./db-types.js").Json;
1255
+ expires_at?: string;
1256
+ file_id: string;
1257
+ file_name: string;
1258
+ file_path: string;
1259
+ id?: string;
1260
+ idempotency_key?: string | null;
1261
+ key: string;
1262
+ metadata?: import("./db-types.js").Json;
1263
+ mime_type?: string | null;
1264
+ multipart_upload_id: string;
1265
+ owner_id: string;
1266
+ parts?: import("./db-types.js").Json;
1267
+ status?: string;
1268
+ updated_at?: string;
1269
+ upload_length: number;
1270
+ upload_offset?: number;
1271
+ visibility?: string;
1272
+ };
1273
+ Update: {
1274
+ bucket?: string;
1275
+ created_at?: string;
1276
+ custom_fields?: import("./db-types.js").Json;
1277
+ expires_at?: string;
1278
+ file_id?: string;
1279
+ file_name?: string;
1280
+ file_path?: string;
1281
+ id?: string;
1282
+ idempotency_key?: string | null;
1283
+ key?: string;
1284
+ metadata?: import("./db-types.js").Json;
1285
+ mime_type?: string | null;
1286
+ multipart_upload_id?: string;
1287
+ owner_id?: string;
1288
+ parts?: import("./db-types.js").Json;
1289
+ status?: string;
1290
+ updated_at?: string;
1291
+ upload_length?: number;
1292
+ upload_offset?: number;
1293
+ visibility?: string;
1294
+ };
1295
+ Relationships: [];
1296
+ };
1297
+ user_account: {
1298
+ Row: {
1299
+ blocked_reason: string | null;
1300
+ created_at: string;
1301
+ custom_fields: import("./db-types.js").Json;
1302
+ custom_limits: import("./db-types.js").Json;
1303
+ is_blocked: boolean;
1304
+ metadata: import("./db-types.js").Json;
1305
+ notes: string | null;
1306
+ tier_id: string;
1307
+ updated_at: string;
1308
+ user_id: string;
1309
+ };
1310
+ Insert: {
1311
+ blocked_reason?: string | null;
1312
+ created_at?: string;
1313
+ custom_fields?: import("./db-types.js").Json;
1314
+ custom_limits?: import("./db-types.js").Json;
1315
+ is_blocked?: boolean;
1316
+ metadata?: import("./db-types.js").Json;
1317
+ notes?: string | null;
1318
+ tier_id: string;
1319
+ updated_at?: string;
1320
+ user_id: string;
1321
+ };
1322
+ Update: {
1323
+ blocked_reason?: string | null;
1324
+ created_at?: string;
1325
+ custom_fields?: import("./db-types.js").Json;
1326
+ custom_limits?: import("./db-types.js").Json;
1327
+ is_blocked?: boolean;
1328
+ metadata?: import("./db-types.js").Json;
1329
+ notes?: string | null;
1330
+ tier_id?: string;
1331
+ updated_at?: string;
1332
+ user_id?: string;
1333
+ };
1334
+ Relationships: [{
1335
+ foreignKeyName: "cld_user_account_tier_id_fkey";
1336
+ columns: ["tier_id"];
1337
+ isOneToOne: false;
1338
+ referencedRelation: "account_tiers";
1339
+ referencedColumns: ["tier_key"];
1340
+ }];
1341
+ };
1342
+ user_storage_usage: {
1343
+ Row: {
1344
+ bytes_used: number;
1345
+ custom_fields: import("./db-types.js").Json;
1346
+ daily_reset_at: string;
1347
+ daily_upload_bytes: number;
1348
+ daily_upload_count: number;
1349
+ files_count: number;
1350
+ updated_at: string;
1351
+ user_id: string;
1352
+ };
1353
+ Insert: {
1354
+ bytes_used?: number;
1355
+ custom_fields?: import("./db-types.js").Json;
1356
+ daily_reset_at?: string;
1357
+ daily_upload_bytes?: number;
1358
+ daily_upload_count?: number;
1359
+ files_count?: number;
1360
+ updated_at?: string;
1361
+ user_id: string;
1362
+ };
1363
+ Update: {
1364
+ bytes_used?: number;
1365
+ custom_fields?: import("./db-types.js").Json;
1366
+ daily_reset_at?: string;
1367
+ daily_upload_bytes?: number;
1368
+ daily_upload_count?: number;
1369
+ files_count?: number;
1370
+ updated_at?: string;
1371
+ user_id?: string;
1372
+ };
1373
+ Relationships: [];
1374
+ };
1375
+ webhook_deliveries: {
1376
+ Row: {
1377
+ activity_log_id: number | null;
1378
+ attempt: number;
1379
+ completed_at: string | null;
1380
+ created_at: string;
1381
+ custom_fields: import("./db-types.js").Json;
1382
+ dispatched_at: string | null;
1383
+ error_message: string | null;
1384
+ http_status: number | null;
1385
+ id: string;
1386
+ latency_ms: number | null;
1387
+ metadata: import("./db-types.js").Json;
1388
+ net_request_id: number | null;
1389
+ next_attempt_at: string | null;
1390
+ organization_id: string;
1391
+ signature: string | null;
1392
+ status: string;
1393
+ webhook_id: string;
1394
+ };
1395
+ Insert: {
1396
+ activity_log_id?: number | null;
1397
+ attempt?: number;
1398
+ completed_at?: string | null;
1399
+ created_at?: string;
1400
+ custom_fields?: import("./db-types.js").Json;
1401
+ dispatched_at?: string | null;
1402
+ error_message?: string | null;
1403
+ http_status?: number | null;
1404
+ id?: string;
1405
+ latency_ms?: number | null;
1406
+ metadata?: import("./db-types.js").Json;
1407
+ net_request_id?: number | null;
1408
+ next_attempt_at?: string | null;
1409
+ organization_id: string;
1410
+ signature?: string | null;
1411
+ status?: string;
1412
+ webhook_id: string;
1413
+ };
1414
+ Update: {
1415
+ activity_log_id?: number | null;
1416
+ attempt?: number;
1417
+ completed_at?: string | null;
1418
+ created_at?: string;
1419
+ custom_fields?: import("./db-types.js").Json;
1420
+ dispatched_at?: string | null;
1421
+ error_message?: string | null;
1422
+ http_status?: number | null;
1423
+ id?: string;
1424
+ latency_ms?: number | null;
1425
+ metadata?: import("./db-types.js").Json;
1426
+ net_request_id?: number | null;
1427
+ next_attempt_at?: string | null;
1428
+ organization_id?: string;
1429
+ signature?: string | null;
1430
+ status?: string;
1431
+ webhook_id?: string;
1432
+ };
1433
+ Relationships: [{
1434
+ foreignKeyName: "cld_webhook_deliveries_webhook_id_fkey";
1435
+ columns: ["webhook_id"];
1436
+ isOneToOne: false;
1437
+ referencedRelation: "webhooks";
1438
+ referencedColumns: ["id"];
1439
+ }];
1440
+ };
1441
+ webhook_dispatch_state: {
1442
+ Row: {
1443
+ id: boolean;
1444
+ last_activity_log_id: number;
1445
+ updated_at: string;
1446
+ };
1447
+ Insert: {
1448
+ id?: boolean;
1449
+ last_activity_log_id?: number;
1450
+ updated_at?: string;
1451
+ };
1452
+ Update: {
1453
+ id?: boolean;
1454
+ last_activity_log_id?: number;
1455
+ updated_at?: string;
1456
+ };
1457
+ Relationships: [];
1458
+ };
1459
+ webhooks: {
1460
+ Row: {
1461
+ consecutive_failures: number;
1462
+ created_at: string;
1463
+ created_by: string | null;
1464
+ custom_fields: import("./db-types.js").Json;
1465
+ deleted_at: string | null;
1466
+ description: string | null;
1467
+ event_types: string[] | null;
1468
+ id: string;
1469
+ is_active: boolean;
1470
+ last_attempt_at: string | null;
1471
+ last_success_at: string | null;
1472
+ max_consecutive_failures: number;
1473
+ metadata: import("./db-types.js").Json;
1474
+ organization_id: string;
1475
+ resource_types: string[] | null;
1476
+ secret: string;
1477
+ target_url: string;
1478
+ updated_at: string;
1479
+ updated_by: string | null;
1480
+ version: number;
1481
+ };
1482
+ Insert: {
1483
+ consecutive_failures?: number;
1484
+ created_at?: string;
1485
+ created_by?: string | null;
1486
+ custom_fields?: import("./db-types.js").Json;
1487
+ deleted_at?: string | null;
1488
+ description?: string | null;
1489
+ event_types?: string[] | null;
1490
+ id?: string;
1491
+ is_active?: boolean;
1492
+ last_attempt_at?: string | null;
1493
+ last_success_at?: string | null;
1494
+ max_consecutive_failures?: number;
1495
+ metadata?: import("./db-types.js").Json;
1496
+ organization_id: string;
1497
+ resource_types?: string[] | null;
1498
+ secret: string;
1499
+ target_url: string;
1500
+ updated_at?: string;
1501
+ updated_by?: string | null;
1502
+ version?: number;
1503
+ };
1504
+ Update: {
1505
+ consecutive_failures?: number;
1506
+ created_at?: string;
1507
+ created_by?: string | null;
1508
+ custom_fields?: import("./db-types.js").Json;
1509
+ deleted_at?: string | null;
1510
+ description?: string | null;
1511
+ event_types?: string[] | null;
1512
+ id?: string;
1513
+ is_active?: boolean;
1514
+ last_attempt_at?: string | null;
1515
+ last_success_at?: string | null;
1516
+ max_consecutive_failures?: number;
1517
+ metadata?: import("./db-types.js").Json;
1518
+ organization_id?: string;
1519
+ resource_types?: string[] | null;
1520
+ secret?: string;
1521
+ target_url?: string;
1522
+ updated_at?: string;
1523
+ updated_by?: string | null;
1524
+ version?: number;
1525
+ };
1526
+ Relationships: [];
1527
+ };
1528
+ };
1529
+ Views: {
1530
+ sync_mapping_admin_status: {
1531
+ Row: {
1532
+ bytes_total: number | null;
1533
+ created_at: string | null;
1534
+ desired_state: string | null;
1535
+ device_id: string | null;
1536
+ direction: string | null;
1537
+ id: string | null;
1538
+ items_total: number | null;
1539
+ last_seen_at: string | null;
1540
+ last_synced_at: string | null;
1541
+ organization_id: string | null;
1542
+ state: string | null;
1543
+ state_changed_at: string | null;
1544
+ user_id: string | null;
1545
+ };
1546
+ Insert: {
1547
+ bytes_total?: number | null;
1548
+ created_at?: string | null;
1549
+ desired_state?: string | null;
1550
+ device_id?: string | null;
1551
+ direction?: string | null;
1552
+ id?: string | null;
1553
+ items_total?: number | null;
1554
+ last_seen_at?: string | null;
1555
+ last_synced_at?: string | null;
1556
+ organization_id?: string | null;
1557
+ state?: string | null;
1558
+ state_changed_at?: string | null;
1559
+ user_id?: string | null;
1560
+ };
1561
+ Update: {
1562
+ bytes_total?: number | null;
1563
+ created_at?: string | null;
1564
+ desired_state?: string | null;
1565
+ device_id?: string | null;
1566
+ direction?: string | null;
1567
+ id?: string | null;
1568
+ items_total?: number | null;
1569
+ last_seen_at?: string | null;
1570
+ last_synced_at?: string | null;
1571
+ organization_id?: string | null;
1572
+ state?: string | null;
1573
+ state_changed_at?: string | null;
1574
+ user_id?: string | null;
1575
+ };
1576
+ Relationships: [];
1577
+ };
1578
+ };
1579
+ Functions: {
1580
+ _adopt_chat_attachment_ids: {
1581
+ Args: {
1582
+ p_conversation_id: string;
1583
+ p_file_ids: string[];
1584
+ };
1585
+ Returns: number;
1586
+ };
1587
+ _adopt_chat_output_ids: {
1588
+ Args: {
1589
+ p_conversation_id: string;
1590
+ p_file_ids: string[];
1591
+ };
1592
+ Returns: number;
1593
+ };
1594
+ assert_safe_file_name: {
1595
+ Args: {
1596
+ p_max_segment?: number;
1597
+ p_raw: string;
1598
+ };
1599
+ Returns: string;
1600
+ };
1601
+ assert_storable_file_name: {
1602
+ Args: {
1603
+ p_max_segment?: number;
1604
+ p_raw: string;
1605
+ };
1606
+ Returns: string;
1607
+ };
1608
+ chat_file_ids_in: {
1609
+ Args: {
1610
+ p_text: string;
1611
+ };
1612
+ Returns: string[];
1613
+ };
1614
+ crawl_site_conveys: {
1615
+ Args: {
1616
+ p_file_id: string;
1617
+ p_user_id: string;
1618
+ };
1619
+ Returns: boolean;
1620
+ };
1621
+ crawl_variant_tagging_drift: {
1622
+ Args: never;
1623
+ Returns: {
1624
+ bad_visibility: boolean;
1625
+ master_id: string;
1626
+ missing_tags: boolean;
1627
+ org_mismatch: boolean;
1628
+ variant_id: string;
1629
+ }[];
1630
+ };
1631
+ file_path_matches_parent: {
1632
+ Args: {
1633
+ p_file_id: string;
1634
+ };
1635
+ Returns: boolean;
1636
+ };
1637
+ has_access_for: {
1638
+ Args: {
1639
+ p_file_id: string;
1640
+ p_required?: Database["public"]["Enums"]["permission_level"];
1641
+ p_user_id: string;
1642
+ };
1643
+ Returns: boolean;
1644
+ };
1645
+ is_crawl_artifact: {
1646
+ Args: {
1647
+ p_file_id: string;
1648
+ };
1649
+ Returns: boolean;
1650
+ };
1651
+ is_dictation_chunk: {
1652
+ Args: {
1653
+ p_file_name: string;
1654
+ p_file_path: string;
1655
+ p_metadata: import("./db-types.js").Json;
1656
+ };
1657
+ Returns: boolean;
1658
+ };
1659
+ is_discoverable_for: {
1660
+ Args: {
1661
+ p_file_id: string;
1662
+ p_required?: Database["public"]["Enums"]["permission_level"];
1663
+ p_user_id: string;
1664
+ };
1665
+ Returns: boolean;
1666
+ };
1667
+ is_listable_for: {
1668
+ Args: {
1669
+ p_file_id: string;
1670
+ p_user_id: string;
1671
+ };
1672
+ Returns: boolean;
1673
+ };
1674
+ is_recent_activity: {
1675
+ Args: {
1676
+ p_row: Database["files"]["Tables"]["files"]["Row"];
1677
+ };
1678
+ Returns: boolean;
1679
+ };
1680
+ is_recent_activity_path: {
1681
+ Args: {
1682
+ p_file_path: string;
1683
+ };
1684
+ Returns: boolean;
1685
+ };
1686
+ is_safe_webhook_url: {
1687
+ Args: {
1688
+ p_url: string;
1689
+ };
1690
+ Returns: boolean;
1691
+ };
1692
+ is_user_visible: {
1693
+ Args: {
1694
+ p_row: Database["files"]["Tables"]["files"]["Row"];
1695
+ };
1696
+ Returns: boolean;
1697
+ };
1698
+ is_user_visible_folder_path: {
1699
+ Args: {
1700
+ p_folder_path: string;
1701
+ };
1702
+ Returns: boolean;
1703
+ };
1704
+ is_user_visible_path: {
1705
+ Args: {
1706
+ p_file_path: string;
1707
+ };
1708
+ Returns: boolean;
1709
+ };
1710
+ is_user_visible_paths: {
1711
+ Args: {
1712
+ p_paths: string[];
1713
+ };
1714
+ Returns: import("./db-types.js").Json;
1715
+ };
1716
+ min_tombstone_retention_days: {
1717
+ Args: never;
1718
+ Returns: number;
1719
+ };
1720
+ my_rag_jobs: {
1721
+ Args: {
1722
+ p_status?: string;
1723
+ };
1724
+ Returns: {
1725
+ attempt_count: number;
1726
+ completed_at: string | null;
1727
+ created_at: string;
1728
+ custom_fields: import("./db-types.js").Json;
1729
+ error: import("./db-types.js").Json | null;
1730
+ file_id: string;
1731
+ id: string;
1732
+ metadata: import("./db-types.js").Json;
1733
+ organization_id: string;
1734
+ scheduled_for: string;
1735
+ skipped_reason: string | null;
1736
+ started_at: string | null;
1737
+ status: string;
1738
+ trigger_source: string;
1739
+ updated_at: string;
1740
+ user_id: string;
1741
+ }[];
1742
+ SetofOptions: {
1743
+ from: "*";
1744
+ to: "file_rag_jobs";
1745
+ isOneToOne: false;
1746
+ isSetofReturn: true;
1747
+ };
1748
+ };
1749
+ private_children_missing_parent: {
1750
+ Args: never;
1751
+ Returns: {
1752
+ check_name: string;
1753
+ file_id: string;
1754
+ parent_id: string;
1755
+ parent_type: string;
1756
+ }[];
1757
+ };
1758
+ ultimate_parent_record: {
1759
+ Args: {
1760
+ p_file_id: string;
1761
+ };
1762
+ Returns: Record<string, unknown>;
1763
+ };
1764
+ webhook_create: {
1765
+ Args: {
1766
+ p_description?: string;
1767
+ p_event_types?: string[];
1768
+ p_organization_id: string;
1769
+ p_resource_types?: string[];
1770
+ p_target_url: string;
1771
+ };
1772
+ Returns: {
1773
+ consecutive_failures: number;
1774
+ created_at: string;
1775
+ created_by: string | null;
1776
+ custom_fields: import("./db-types.js").Json;
1777
+ deleted_at: string | null;
1778
+ description: string | null;
1779
+ event_types: string[] | null;
1780
+ id: string;
1781
+ is_active: boolean;
1782
+ last_attempt_at: string | null;
1783
+ last_success_at: string | null;
1784
+ max_consecutive_failures: number;
1785
+ metadata: import("./db-types.js").Json;
1786
+ organization_id: string;
1787
+ resource_types: string[] | null;
1788
+ secret: string;
1789
+ target_url: string;
1790
+ updated_at: string;
1791
+ updated_by: string | null;
1792
+ version: number;
1793
+ };
1794
+ SetofOptions: {
1795
+ from: "*";
1796
+ to: "webhooks";
1797
+ isOneToOne: true;
1798
+ isSetofReturn: false;
1799
+ };
1800
+ };
1801
+ webhook_dispatch: {
1802
+ Args: {
1803
+ p_limit?: number;
1804
+ };
1805
+ Returns: number;
1806
+ };
1807
+ webhook_event_payload: {
1808
+ Args: {
1809
+ p_event_id: number;
1810
+ p_webhook_id: string;
1811
+ };
1812
+ Returns: import("./db-types.js").Json;
1813
+ };
1814
+ webhook_reconcile: {
1815
+ Args: never;
1816
+ Returns: number;
1817
+ };
1818
+ webhook_redeliver: {
1819
+ Args: {
1820
+ p_delivery_id: string;
1821
+ };
1822
+ Returns: string;
1823
+ };
1824
+ webhook_rotate_secret: {
1825
+ Args: {
1826
+ p_webhook_id: string;
1827
+ };
1828
+ Returns: string;
1829
+ };
1830
+ webhook_send_test: {
1831
+ Args: {
1832
+ p_webhook_id: string;
1833
+ };
1834
+ Returns: string;
1835
+ };
1836
+ webhook_sign: {
1837
+ Args: {
1838
+ p_payload: string;
1839
+ p_secret: string;
1840
+ };
1841
+ Returns: string;
1842
+ };
1843
+ webhook_tick: {
1844
+ Args: never;
1845
+ Returns: undefined;
1846
+ };
1847
+ };
1848
+ Enums: { [_ in never]: never; };
1849
+ CompositeTypes: { [_ in never]: never; };
1850
+ }>;
1851
+ /**
1852
+ * The ONLY legal column list for reading `files.files` from the client.
1853
+ *
1854
+ * `storage_uri` (the native S3 location) is server-only: the column grant is
1855
+ * REVOKEd from `authenticated`, so `select("*")` on `files.files` ERRORS with
1856
+ * "permission denied for column storage_uri". Never select `*` on this table
1857
+ * and never add `storage_uri` here. Renderable URLs come from the server's
1858
+ * FileRecord/FileRef URL contract (`url` / `cdn_url` / `download_url`),
1859
+ * never assembled client-side from a storage location.
1860
+ */
1861
+ export declare const FILES_TABLE_COLUMNS = "id, created_by, updated_by, version, file_path, file_name, mime_type, size_bytes, checksum, visibility, current_version, parent_folder_id, metadata, created_at, updated_at, deleted_at, organization_id, parent_file_id, derivation_kind, derivation_metadata, duplicate_of_file_id, canonical_processed_document_id, width, height, duration_ms, origin_device_id, artifact_kind";
1862
+ /**
1863
+ * Same rule for `files.file_versions` — its `storage_uri` is server-only.
1864
+ * Version bytes download via the server (`/files/{id}/versions/{n}/download`).
1865
+ */
1866
+ export declare const FILE_VERSIONS_TABLE_COLUMNS = "id, file_id, version_number, size_bytes, checksum, created_by, created_at, change_summary, organization_id, metadata";
1867
+ /**
1868
+ * Read one complete, RLS-authorized file row by durable identity.
1869
+ *
1870
+ * REST `FileRecord` is a render/navigation envelope and historically omitted
1871
+ * the owning organization. Mutation preparation must use this canonical DB
1872
+ * row so a path-targeted version write can preserve ownership exactly.
1873
+ */
1874
+ export declare function readFileRowById<C extends SupabaseClient<Database>>(client: C, fileId: string): Promise<{
1875
+ id: string;
1876
+ created_by: string;
1877
+ updated_by: string | null;
1878
+ version: number;
1879
+ file_path: string;
1880
+ file_name: string;
1881
+ mime_type: string | null;
1882
+ size_bytes: number | null;
1883
+ checksum: string | null;
1884
+ visibility: "personal" | "internal" | "link" | "public";
1885
+ current_version: number;
1886
+ parent_folder_id: string | null;
1887
+ metadata: unknown;
1888
+ created_at: string;
1889
+ updated_at: string;
1890
+ deleted_at: string | null;
1891
+ organization_id: string;
1892
+ parent_file_id: string | null;
1893
+ derivation_kind: string | null;
1894
+ derivation_metadata: unknown;
1895
+ duplicate_of_file_id: string | null;
1896
+ canonical_processed_document_id: string | null;
1897
+ width: number | null;
1898
+ height: number | null;
1899
+ duration_ms: number | null;
1900
+ origin_device_id: string | null;
1901
+ artifact_kind: string | null;
1902
+ } | null>;
1903
+ /**
1904
+ * Batch-read just the byte size for a set of file ids, RLS-authorized like
1905
+ * every other read here.
1906
+ *
1907
+ * Built for a source list that names files by id (a Rulebook's attached
1908
+ * sources, a resource pile) and needs to show — before any run touches
1909
+ * them — which of those files are genuinely empty. `size_bytes` alone (no
1910
+ * `storage_uri`, no need for the single-row reader's full column list) keeps
1911
+ * this cheap enough to call for a whole pile at once.
1912
+ */
1913
+ export declare function readFileSizesByIds<C extends SupabaseClient<Database>>(client: C, fileIds: string[]): Promise<Map<string, number | null>>;