@taruvi/refine-providers 1.3.4-beta.2 → 1.3.4-beta.3

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/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
- import { DataProvider, AuthProvider, AccessControlProvider, MetaQuery, CrudFilter, CrudSort, Pagination } from '@refinedev/core';
1
+ import { DataProvider, AuthProvider, AccessControlProvider, CrudFilter, MetaQuery, CrudSort, Pagination } from '@refinedev/core';
2
2
  import { Client, GraphFormat, GraphInclude, Database, BackendFilterTreeRoot } from '@taruvi/sdk';
3
+ export { UserData as TaruviUser } from '@taruvi/sdk';
3
4
 
4
5
  /**
5
6
  * Creates a Refine DataProvider for Taruvi database operations.
@@ -151,6 +152,96 @@ declare function accessControlProvider(client: Client, options?: {
151
152
  batchDelayMs?: number;
152
153
  }): AccessControlProvider;
153
154
 
155
+ /**
156
+ * Maps Refine / Taruvi filter operators to Taruvi DRF-style query parameter suffixes.
157
+ * Example: { field: "age", operator: "gte", value: 18 } → "age__gte=18"
158
+ */
159
+ declare const REFINE_OPERATOR_MAP: {
160
+ readonly eq: "";
161
+ readonly ne: "ne";
162
+ readonly lt: "lt";
163
+ readonly gt: "gt";
164
+ readonly lte: "lte";
165
+ readonly gte: "gte";
166
+ readonly contains: "contains";
167
+ readonly ncontains: "ncontains";
168
+ readonly containss: "containss";
169
+ readonly ncontainss: "ncontainss";
170
+ readonly startswith: "startswith";
171
+ readonly nstartswith: "nstartswith";
172
+ readonly endswith: "endswith";
173
+ readonly nendswith: "nendswith";
174
+ readonly startswiths: "startswiths";
175
+ readonly nstartswiths: "nstartswiths";
176
+ readonly endswiths: "endswiths";
177
+ readonly nendswiths: "nendswiths";
178
+ readonly icontains: "contains";
179
+ readonly nicontains: "ncontains";
180
+ readonly istartswith: "startswith";
181
+ readonly nistartswith: "nstartswith";
182
+ readonly iendswith: "endswith";
183
+ readonly niendswith: "nendswith";
184
+ readonly in: "in";
185
+ readonly nin: "nin";
186
+ readonly ina: "ina";
187
+ readonly nina: "nina";
188
+ readonly null: "null";
189
+ readonly nnull: "nnull";
190
+ readonly between: "between";
191
+ readonly nbetween: "nbetween";
192
+ readonly acontains: "acontains";
193
+ readonly nacontains: "nacontains";
194
+ readonly acontainedby: "acontainedby";
195
+ readonly nacontainedby: "nacontainedby";
196
+ readonly aoverlap: "aoverlap";
197
+ readonly naoverlap: "naoverlap";
198
+ readonly aelement: "aelement";
199
+ readonly naelement: "naelement";
200
+ readonly rcontains: "rcontains";
201
+ readonly rcontainedby: "rcontainedby";
202
+ readonly roverlaps: "roverlaps";
203
+ readonly radjacent: "radjacent";
204
+ readonly rstrictleft: "rstrictleft";
205
+ readonly rstrictright: "rstrictright";
206
+ readonly like: "like";
207
+ readonly ilike: "ilike";
208
+ readonly search: "search";
209
+ };
210
+ /** All filter operators supported by the Taruvi database provider at runtime. */
211
+ type TaruviCrudOperator = keyof typeof REFINE_OPERATOR_MAP;
212
+ /** True when `operator` is in {@link REFINE_OPERATOR_MAP}. */
213
+ declare function hasTaruviOperator(operator: string): operator is TaruviCrudOperator;
214
+ /** Taruvi query suffix for an operator, or `undefined` if unsupported. */
215
+ declare function taruviOperatorSuffix(operator: string): string | undefined;
216
+ /** Field leaf filter with a Taruvi-supported operator. */
217
+ type TaruviFieldFilter = {
218
+ field: string;
219
+ operator: TaruviCrudOperator;
220
+ value: unknown;
221
+ };
222
+ /** Nested AND / OR group using Taruvi operators on leaves. */
223
+ type TaruviConditionalFilter = {
224
+ operator: "and" | "or";
225
+ value: (TaruviFieldFilter | TaruviConditionalFilter)[];
226
+ };
227
+ /** Taruvi filter tree (field leaf or logical group). */
228
+ type TaruviCrudFilter = TaruviFieldFilter | TaruviConditionalFilter;
229
+ /** One leaf filter ready for flat `field__op=value` query encoding. */
230
+ type FlatFilterLeaf = TaruviFieldFilter;
231
+ /** Root logical filter for JSON `filters` query param (not wrapped in an array). */
232
+ type LogicalCrudFilter = TaruviConditionalFilter;
233
+ /**
234
+ * Taruvi list filter payload: leaf array → flat query params; logical object → JSON tree.
235
+ */
236
+ type TaruviListFilters = FlatFilterLeaf[] | LogicalCrudFilter;
237
+ /**
238
+ * Pass Taruvi-typed filters into Refine hooks (`useList`, etc.) that expect `CrudFilter[]`.
239
+ *
240
+ * Refine v5 `CrudOperators` omits Taruvi-only operators (range, array, `search`, aliases).
241
+ * Runtime mapping is unchanged; this helper centralizes the type boundary.
242
+ */
243
+ declare function toRefineFilters(filters: TaruviListFilters | TaruviCrudFilter[]): CrudFilter[];
244
+
154
245
  /**
155
246
  * Supported aggregate functions for the aggregate parameter.
156
247
  *
@@ -196,16 +287,16 @@ interface TaruviMeta extends MetaQuery {
196
287
  aggregate?: AggregateExpression[];
197
288
  /** Fields to group by (e.g., ["category", "status"]) */
198
289
  groupBy?: string[];
199
- /** Filters for aggregate results (same format as regular filters) */
200
- having?: CrudFilter[];
290
+ /** Filters for aggregate results (Taruvi operator set). */
291
+ having?: TaruviCrudFilter[];
201
292
  /** Graph format: 'tree' or 'graph' */
202
293
  format?: GraphFormat;
203
294
  /** Graph traversal direction */
204
295
  include?: GraphInclude;
205
296
  /** Graph traversal depth */
206
297
  depth?: number;
207
- /** Graph edge types to filter */
208
- graph_types?: string[];
298
+ /** Relationship types for graph traversal */
299
+ relationship_type?: string[];
209
300
  /** Use upsert instead of create (insert or update on conflict) */
210
301
  upsert?: boolean;
211
302
  /** Delete records by filter instead of by IDs */
@@ -232,11 +323,6 @@ interface TaruviListResponse<T> {
232
323
  };
233
324
  }
234
325
 
235
- /**
236
- * Maps Refine operators to Taruvi DRF-style query parameter suffixes.
237
- * Example: { field: "age", operator: "gte", value: 18 } → "age__gte=18"
238
- */
239
- declare const REFINE_OPERATOR_MAP: Record<string, string>;
240
326
  type ConvertRefineFiltersOptions = {
241
327
  /**
242
328
  * `bracket` (default): logical `and` / `or` use Taruvi CrudFilters bracket query keys.
@@ -244,21 +330,6 @@ type ConvertRefineFiltersOptions = {
244
330
  */
245
331
  logicalEncoding?: "bracket" | "flatten";
246
332
  };
247
- /** One leaf filter ready for flat `field__op=value` query encoding. */
248
- type FlatFilterLeaf = {
249
- field: string;
250
- operator: string;
251
- value: unknown;
252
- };
253
- /** Root logical filter for JSON `filters` query param (not wrapped in an array). */
254
- type LogicalCrudFilter = {
255
- operator: "and" | "or";
256
- value: CrudFilter[];
257
- };
258
- /**
259
- * Taruvi list filter payload: leaf array → flat query params; logical object → JSON tree.
260
- */
261
- type TaruviListFilters = FlatFilterLeaf[] | LogicalCrudFilter;
262
333
  /** True when `filters` is a non-logical array of field leaves (may be empty). */
263
334
  declare function isFlatFilterList(filters: unknown): filters is FlatFilterLeaf[];
264
335
  /** True when `filters` is a single logical object (and / or), not an array. */
@@ -330,9 +401,5 @@ declare function buildRefineQueryParams(options: {
330
401
  * Builds a query string from an object of parameters.
331
402
  */
332
403
  declare function buildQueryString(params?: Record<string, unknown>): string;
333
- /**
334
- * Handles and transforms Taruvi API errors.
335
- */
336
- declare function handleError(error: unknown): never;
337
404
 
338
- export { type AllowedAction, type AnalyticsMeta, type AppCustomMeta, type ConvertRefineFiltersOptions, type FlatFilterLeaf, type FunctionMeta, type LogicalCrudFilter, type LoginParams, type LogoutParams, REFINE_OPERATOR_MAP, type RegisterParams, type StorageDownloadResponse, type StorageUploadVariables, type TaruviListFilters, type TaruviListResponse, type TaruviMeta, _cachedUser, accessControlProvider, analyticsDataProvider, appDataProvider, applyRefineQueryParamsToDatabase, authProvider, buildQueryString, buildRefineQueryParams, collectFlatLeaves, convertLogicalFilterToBackendTree, convertRefineFilters, convertRefineFiltersToBackendTree, convertRefinePagination, convertRefineSorters, dataProvider, encodeCrudFilterBracket, encodeFlatFilterListToParams, formatRefineLeafValue, functionsDataProvider, handleError, isFlatFilterList, isLogicalCrudFilter, normalizeTaruviListFilters, refineOperatorToBackendKey, storageDataProvider, userDataProvider };
405
+ export { type AllowedAction, type AnalyticsMeta, type AppCustomMeta, type ConvertRefineFiltersOptions, type FlatFilterLeaf, type FunctionMeta, type LogicalCrudFilter, type LoginParams, type LogoutParams, REFINE_OPERATOR_MAP, type RegisterParams, type StorageDownloadResponse, type StorageUploadVariables, type TaruviConditionalFilter, type TaruviCrudFilter, type TaruviCrudOperator, type TaruviFieldFilter, type TaruviListFilters, type TaruviListResponse, type TaruviMeta, _cachedUser, accessControlProvider, analyticsDataProvider, appDataProvider, applyRefineQueryParamsToDatabase, authProvider, buildQueryString, buildRefineQueryParams, collectFlatLeaves, convertLogicalFilterToBackendTree, convertRefineFilters, convertRefineFiltersToBackendTree, convertRefinePagination, convertRefineSorters, dataProvider, encodeCrudFilterBracket, encodeFlatFilterListToParams, formatRefineLeafValue, functionsDataProvider, hasTaruviOperator, isFlatFilterList, isLogicalCrudFilter, normalizeTaruviListFilters, refineOperatorToBackendKey, storageDataProvider, taruviOperatorSuffix, toRefineFilters, userDataProvider };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { DataProvider, AuthProvider, AccessControlProvider, MetaQuery, CrudFilter, CrudSort, Pagination } from '@refinedev/core';
1
+ import { DataProvider, AuthProvider, AccessControlProvider, CrudFilter, MetaQuery, CrudSort, Pagination } from '@refinedev/core';
2
2
  import { Client, GraphFormat, GraphInclude, Database, BackendFilterTreeRoot } from '@taruvi/sdk';
3
+ export { UserData as TaruviUser } from '@taruvi/sdk';
3
4
 
4
5
  /**
5
6
  * Creates a Refine DataProvider for Taruvi database operations.
@@ -151,6 +152,96 @@ declare function accessControlProvider(client: Client, options?: {
151
152
  batchDelayMs?: number;
152
153
  }): AccessControlProvider;
153
154
 
155
+ /**
156
+ * Maps Refine / Taruvi filter operators to Taruvi DRF-style query parameter suffixes.
157
+ * Example: { field: "age", operator: "gte", value: 18 } → "age__gte=18"
158
+ */
159
+ declare const REFINE_OPERATOR_MAP: {
160
+ readonly eq: "";
161
+ readonly ne: "ne";
162
+ readonly lt: "lt";
163
+ readonly gt: "gt";
164
+ readonly lte: "lte";
165
+ readonly gte: "gte";
166
+ readonly contains: "contains";
167
+ readonly ncontains: "ncontains";
168
+ readonly containss: "containss";
169
+ readonly ncontainss: "ncontainss";
170
+ readonly startswith: "startswith";
171
+ readonly nstartswith: "nstartswith";
172
+ readonly endswith: "endswith";
173
+ readonly nendswith: "nendswith";
174
+ readonly startswiths: "startswiths";
175
+ readonly nstartswiths: "nstartswiths";
176
+ readonly endswiths: "endswiths";
177
+ readonly nendswiths: "nendswiths";
178
+ readonly icontains: "contains";
179
+ readonly nicontains: "ncontains";
180
+ readonly istartswith: "startswith";
181
+ readonly nistartswith: "nstartswith";
182
+ readonly iendswith: "endswith";
183
+ readonly niendswith: "nendswith";
184
+ readonly in: "in";
185
+ readonly nin: "nin";
186
+ readonly ina: "ina";
187
+ readonly nina: "nina";
188
+ readonly null: "null";
189
+ readonly nnull: "nnull";
190
+ readonly between: "between";
191
+ readonly nbetween: "nbetween";
192
+ readonly acontains: "acontains";
193
+ readonly nacontains: "nacontains";
194
+ readonly acontainedby: "acontainedby";
195
+ readonly nacontainedby: "nacontainedby";
196
+ readonly aoverlap: "aoverlap";
197
+ readonly naoverlap: "naoverlap";
198
+ readonly aelement: "aelement";
199
+ readonly naelement: "naelement";
200
+ readonly rcontains: "rcontains";
201
+ readonly rcontainedby: "rcontainedby";
202
+ readonly roverlaps: "roverlaps";
203
+ readonly radjacent: "radjacent";
204
+ readonly rstrictleft: "rstrictleft";
205
+ readonly rstrictright: "rstrictright";
206
+ readonly like: "like";
207
+ readonly ilike: "ilike";
208
+ readonly search: "search";
209
+ };
210
+ /** All filter operators supported by the Taruvi database provider at runtime. */
211
+ type TaruviCrudOperator = keyof typeof REFINE_OPERATOR_MAP;
212
+ /** True when `operator` is in {@link REFINE_OPERATOR_MAP}. */
213
+ declare function hasTaruviOperator(operator: string): operator is TaruviCrudOperator;
214
+ /** Taruvi query suffix for an operator, or `undefined` if unsupported. */
215
+ declare function taruviOperatorSuffix(operator: string): string | undefined;
216
+ /** Field leaf filter with a Taruvi-supported operator. */
217
+ type TaruviFieldFilter = {
218
+ field: string;
219
+ operator: TaruviCrudOperator;
220
+ value: unknown;
221
+ };
222
+ /** Nested AND / OR group using Taruvi operators on leaves. */
223
+ type TaruviConditionalFilter = {
224
+ operator: "and" | "or";
225
+ value: (TaruviFieldFilter | TaruviConditionalFilter)[];
226
+ };
227
+ /** Taruvi filter tree (field leaf or logical group). */
228
+ type TaruviCrudFilter = TaruviFieldFilter | TaruviConditionalFilter;
229
+ /** One leaf filter ready for flat `field__op=value` query encoding. */
230
+ type FlatFilterLeaf = TaruviFieldFilter;
231
+ /** Root logical filter for JSON `filters` query param (not wrapped in an array). */
232
+ type LogicalCrudFilter = TaruviConditionalFilter;
233
+ /**
234
+ * Taruvi list filter payload: leaf array → flat query params; logical object → JSON tree.
235
+ */
236
+ type TaruviListFilters = FlatFilterLeaf[] | LogicalCrudFilter;
237
+ /**
238
+ * Pass Taruvi-typed filters into Refine hooks (`useList`, etc.) that expect `CrudFilter[]`.
239
+ *
240
+ * Refine v5 `CrudOperators` omits Taruvi-only operators (range, array, `search`, aliases).
241
+ * Runtime mapping is unchanged; this helper centralizes the type boundary.
242
+ */
243
+ declare function toRefineFilters(filters: TaruviListFilters | TaruviCrudFilter[]): CrudFilter[];
244
+
154
245
  /**
155
246
  * Supported aggregate functions for the aggregate parameter.
156
247
  *
@@ -196,16 +287,16 @@ interface TaruviMeta extends MetaQuery {
196
287
  aggregate?: AggregateExpression[];
197
288
  /** Fields to group by (e.g., ["category", "status"]) */
198
289
  groupBy?: string[];
199
- /** Filters for aggregate results (same format as regular filters) */
200
- having?: CrudFilter[];
290
+ /** Filters for aggregate results (Taruvi operator set). */
291
+ having?: TaruviCrudFilter[];
201
292
  /** Graph format: 'tree' or 'graph' */
202
293
  format?: GraphFormat;
203
294
  /** Graph traversal direction */
204
295
  include?: GraphInclude;
205
296
  /** Graph traversal depth */
206
297
  depth?: number;
207
- /** Graph edge types to filter */
208
- graph_types?: string[];
298
+ /** Relationship types for graph traversal */
299
+ relationship_type?: string[];
209
300
  /** Use upsert instead of create (insert or update on conflict) */
210
301
  upsert?: boolean;
211
302
  /** Delete records by filter instead of by IDs */
@@ -232,11 +323,6 @@ interface TaruviListResponse<T> {
232
323
  };
233
324
  }
234
325
 
235
- /**
236
- * Maps Refine operators to Taruvi DRF-style query parameter suffixes.
237
- * Example: { field: "age", operator: "gte", value: 18 } → "age__gte=18"
238
- */
239
- declare const REFINE_OPERATOR_MAP: Record<string, string>;
240
326
  type ConvertRefineFiltersOptions = {
241
327
  /**
242
328
  * `bracket` (default): logical `and` / `or` use Taruvi CrudFilters bracket query keys.
@@ -244,21 +330,6 @@ type ConvertRefineFiltersOptions = {
244
330
  */
245
331
  logicalEncoding?: "bracket" | "flatten";
246
332
  };
247
- /** One leaf filter ready for flat `field__op=value` query encoding. */
248
- type FlatFilterLeaf = {
249
- field: string;
250
- operator: string;
251
- value: unknown;
252
- };
253
- /** Root logical filter for JSON `filters` query param (not wrapped in an array). */
254
- type LogicalCrudFilter = {
255
- operator: "and" | "or";
256
- value: CrudFilter[];
257
- };
258
- /**
259
- * Taruvi list filter payload: leaf array → flat query params; logical object → JSON tree.
260
- */
261
- type TaruviListFilters = FlatFilterLeaf[] | LogicalCrudFilter;
262
333
  /** True when `filters` is a non-logical array of field leaves (may be empty). */
263
334
  declare function isFlatFilterList(filters: unknown): filters is FlatFilterLeaf[];
264
335
  /** True when `filters` is a single logical object (and / or), not an array. */
@@ -330,9 +401,5 @@ declare function buildRefineQueryParams(options: {
330
401
  * Builds a query string from an object of parameters.
331
402
  */
332
403
  declare function buildQueryString(params?: Record<string, unknown>): string;
333
- /**
334
- * Handles and transforms Taruvi API errors.
335
- */
336
- declare function handleError(error: unknown): never;
337
404
 
338
- export { type AllowedAction, type AnalyticsMeta, type AppCustomMeta, type ConvertRefineFiltersOptions, type FlatFilterLeaf, type FunctionMeta, type LogicalCrudFilter, type LoginParams, type LogoutParams, REFINE_OPERATOR_MAP, type RegisterParams, type StorageDownloadResponse, type StorageUploadVariables, type TaruviListFilters, type TaruviListResponse, type TaruviMeta, _cachedUser, accessControlProvider, analyticsDataProvider, appDataProvider, applyRefineQueryParamsToDatabase, authProvider, buildQueryString, buildRefineQueryParams, collectFlatLeaves, convertLogicalFilterToBackendTree, convertRefineFilters, convertRefineFiltersToBackendTree, convertRefinePagination, convertRefineSorters, dataProvider, encodeCrudFilterBracket, encodeFlatFilterListToParams, formatRefineLeafValue, functionsDataProvider, handleError, isFlatFilterList, isLogicalCrudFilter, normalizeTaruviListFilters, refineOperatorToBackendKey, storageDataProvider, userDataProvider };
405
+ export { type AllowedAction, type AnalyticsMeta, type AppCustomMeta, type ConvertRefineFiltersOptions, type FlatFilterLeaf, type FunctionMeta, type LogicalCrudFilter, type LoginParams, type LogoutParams, REFINE_OPERATOR_MAP, type RegisterParams, type StorageDownloadResponse, type StorageUploadVariables, type TaruviConditionalFilter, type TaruviCrudFilter, type TaruviCrudOperator, type TaruviFieldFilter, type TaruviListFilters, type TaruviListResponse, type TaruviMeta, _cachedUser, accessControlProvider, analyticsDataProvider, appDataProvider, applyRefineQueryParamsToDatabase, authProvider, buildQueryString, buildRefineQueryParams, collectFlatLeaves, convertLogicalFilterToBackendTree, convertRefineFilters, convertRefineFiltersToBackendTree, convertRefinePagination, convertRefineSorters, dataProvider, encodeCrudFilterBracket, encodeFlatFilterListToParams, formatRefineLeafValue, functionsDataProvider, hasTaruviOperator, isFlatFilterList, isLogicalCrudFilter, normalizeTaruviListFilters, refineOperatorToBackendKey, storageDataProvider, taruviOperatorSuffix, toRefineFilters, userDataProvider };
package/dist/index.js CHANGED
@@ -5,9 +5,9 @@ import DataLoader from 'dataloader';
5
5
 
6
6
  // package.json
7
7
  var package_default = {
8
- version: "1.3.4-beta.2"};
8
+ version: "1.3.4-beta.3"};
9
9
 
10
- // src/utils.ts
10
+ // src/filterTypes.ts
11
11
  var REFINE_OPERATOR_MAP = {
12
12
  // Equality
13
13
  eq: "",
@@ -70,6 +70,18 @@ var REFINE_OPERATOR_MAP = {
70
70
  ilike: "ilike",
71
71
  search: "search"
72
72
  };
73
+ function hasTaruviOperator(operator) {
74
+ return operator in REFINE_OPERATOR_MAP;
75
+ }
76
+ function taruviOperatorSuffix(operator) {
77
+ if (!hasTaruviOperator(operator)) return void 0;
78
+ return REFINE_OPERATOR_MAP[operator];
79
+ }
80
+ function toRefineFilters(filters) {
81
+ return filters;
82
+ }
83
+
84
+ // src/utils.ts
73
85
  var COMMA_VALUE_OPERATORS = /* @__PURE__ */ new Set([
74
86
  "in",
75
87
  "nin",
@@ -106,7 +118,7 @@ function isFlatFilterList(filters) {
106
118
  if (leaf.value === void 0 || leaf.value === null && leaf.operator !== "null") {
107
119
  return false;
108
120
  }
109
- if (REFINE_OPERATOR_MAP[leaf.operator] === void 0) {
121
+ if (!hasTaruviOperator(leaf.operator)) {
110
122
  return false;
111
123
  }
112
124
  return true;
@@ -143,7 +155,7 @@ function collectFlatLeaves(filters) {
143
155
  if (leaf.value === void 0 || leaf.value === null && leaf.operator !== "null") {
144
156
  continue;
145
157
  }
146
- if (REFINE_OPERATOR_MAP[leaf.operator] === void 0) {
158
+ if (!hasTaruviOperator(leaf.operator)) {
147
159
  console.warn(`Unknown Refine operator: ${leaf.operator}`);
148
160
  return false;
149
161
  }
@@ -159,7 +171,7 @@ function collectFlatLeaves(filters) {
159
171
  return leaves;
160
172
  }
161
173
  function refineOperatorToBackendKey(operator) {
162
- const suffix = REFINE_OPERATOR_MAP[operator];
174
+ const suffix = taruviOperatorSuffix(operator);
163
175
  if (suffix === void 0) return operator;
164
176
  return suffix === "" ? "eq" : suffix;
165
177
  }
@@ -176,7 +188,7 @@ function encodeLeafFlat(field, operator, value, params) {
176
188
  if (value === void 0 || value === null && operator !== "null") {
177
189
  return;
178
190
  }
179
- const suffix = REFINE_OPERATOR_MAP[operator];
191
+ const suffix = taruviOperatorSuffix(operator);
180
192
  if (suffix === void 0) {
181
193
  console.warn(`Unknown Refine operator: ${operator}`);
182
194
  return;
@@ -202,7 +214,7 @@ function encodeCrudFilterBracket(filter, path, out) {
202
214
  if (value === void 0 || value === null && operator !== "null") {
203
215
  return;
204
216
  }
205
- const suffix = REFINE_OPERATOR_MAP[operator];
217
+ const suffix = taruviOperatorSuffix(operator);
206
218
  if (suffix === void 0) {
207
219
  console.warn(`Unknown Refine operator: ${operator}`);
208
220
  return;
@@ -229,7 +241,7 @@ function crudFilterToBackendNodeOrNull(filter) {
229
241
  if (leaf.value === void 0 || leaf.value === null && leaf.operator !== "null") {
230
242
  return null;
231
243
  }
232
- if (REFINE_OPERATOR_MAP[leaf.operator] === void 0) {
244
+ if (!hasTaruviOperator(leaf.operator)) {
233
245
  console.warn(`Unknown Refine operator: ${leaf.operator}`);
234
246
  return null;
235
247
  }
@@ -367,7 +379,7 @@ function formatHaving(having) {
367
379
  if (value === void 0 || value === null && operator !== "null") {
368
380
  continue;
369
381
  }
370
- const suffix = REFINE_OPERATOR_MAP[operator];
382
+ const suffix = taruviOperatorSuffix(operator);
371
383
  if (suffix === void 0) {
372
384
  console.warn(`Unknown operator in having clause: ${operator}`);
373
385
  continue;
@@ -379,15 +391,6 @@ function formatHaving(having) {
379
391
  }
380
392
  return params.length > 0 ? params.join(",") : void 0;
381
393
  }
382
- function handleError(error) {
383
- if (error instanceof Error) {
384
- throw error;
385
- }
386
- if (typeof error === "object" && error !== null && "message" in error) {
387
- throw new Error(String(error.message));
388
- }
389
- throw new Error("Unknown error occurred");
390
- }
391
394
 
392
395
  // src/dataProvider.ts
393
396
  function applyAggregations(query, meta) {
@@ -469,7 +472,7 @@ function applySearchAndFields(query, meta) {
469
472
  return result;
470
473
  }
471
474
  function isGraphQuery(meta) {
472
- return !!(meta?.format || meta?.graph_types || meta?.include || meta?.depth);
475
+ return !!(meta?.format || meta?.relationship_type || meta?.include || meta?.depth);
473
476
  }
474
477
  function buildGraphQuery(client, tableName, meta, recordId) {
475
478
  let query = new Database(client).from(tableName);
@@ -477,7 +480,7 @@ function buildGraphQuery(client, tableName, meta, recordId) {
477
480
  if (meta?.format) query = query.format(meta.format);
478
481
  if (meta?.include) query = query.include(meta.include);
479
482
  if (meta?.depth) query = query.depth(meta.depth);
480
- if (meta?.graph_types) query = query.types(meta.graph_types);
483
+ if (meta?.relationship_type) query = query.types(meta.relationship_type);
481
484
  return query;
482
485
  }
483
486
  function dataProvider(client) {
@@ -709,7 +712,9 @@ function storageDataProvider(client) {
709
712
  return { data: { id: path } };
710
713
  },
711
714
  getApiUrl: () => baseApiUrl,
712
- getMany: async () => ({ data: [] }),
715
+ getMany: async () => {
716
+ throw new Error("getMany is not supported for storage resources");
717
+ },
713
718
  createMany: async (params) => {
714
719
  const { resource, variables, meta } = params;
715
720
  const taruviMeta = meta;
@@ -719,7 +724,7 @@ function storageDataProvider(client) {
719
724
  const fileMetadatas = files.map((_, i) => metadatas[i] || {});
720
725
  const response = await new Storage(client).from(bucket).upload({ files, paths: filePaths, metadatas: fileMetadatas }).execute();
721
726
  const uploaded = response.data?.successful?.map((s) => s.object) ?? [];
722
- return { data: uploaded.length > 0 ? uploaded[0] : response.data };
727
+ return { data: uploaded.length > 0 ? uploaded : [response.data] };
723
728
  },
724
729
  deleteMany: async (params) => {
725
730
  const { resource, ids, meta } = params;
@@ -1161,6 +1166,7 @@ function analyticsDataProvider(client) {
1161
1166
  }
1162
1167
  };
1163
1168
  }
1169
+ var isBrowser = typeof window !== "undefined";
1164
1170
  var _cachedUser = null;
1165
1171
  function authProvider(client) {
1166
1172
  const auth = new Auth(client);
@@ -1230,11 +1236,15 @@ function authProvider(client) {
1230
1236
  return null;
1231
1237
  }
1232
1238
  const user = response.data ?? response;
1233
- _cachedUser = user;
1239
+ if (isBrowser) _cachedUser = user;
1234
1240
  return user;
1235
1241
  },
1236
1242
  getPermissions: async () => {
1237
- const user = _cachedUser;
1243
+ let user = isBrowser ? _cachedUser : null;
1244
+ if (!user) {
1245
+ const response = await auth.getCurrentUser();
1246
+ user = response ? response.data ?? response : null;
1247
+ }
1238
1248
  if (!user) {
1239
1249
  return null;
1240
1250
  }
@@ -1248,13 +1258,14 @@ function authProvider(client) {
1248
1258
  }
1249
1259
  };
1250
1260
  }
1261
+ var isBrowser2 = typeof window !== "undefined";
1251
1262
  function accessControlProvider(client, options) {
1252
1263
  const policy = new Policy(client);
1253
1264
  const auth = new Auth(client);
1254
1265
  const { batchDelayMs = 50 } = options ?? {};
1255
1266
  const permissionLoader = new DataLoader(
1256
1267
  async (checks) => {
1257
- let currentUser = _cachedUser;
1268
+ let currentUser = isBrowser2 ? _cachedUser : null;
1258
1269
  if (!currentUser) {
1259
1270
  try {
1260
1271
  const response = await auth.getCurrentUser();
@@ -1348,6 +1359,6 @@ function accessControlProvider(client, options) {
1348
1359
  };
1349
1360
  }
1350
1361
 
1351
- export { REFINE_OPERATOR_MAP, _cachedUser, accessControlProvider, analyticsDataProvider, appDataProvider, applyRefineQueryParamsToDatabase, authProvider, buildQueryString, buildRefineQueryParams, collectFlatLeaves, convertLogicalFilterToBackendTree, convertRefineFilters, convertRefineFiltersToBackendTree, convertRefinePagination, convertRefineSorters, dataProvider, encodeCrudFilterBracket, encodeFlatFilterListToParams, formatRefineLeafValue, functionsDataProvider, handleError, isFlatFilterList, isLogicalCrudFilter, normalizeTaruviListFilters, refineOperatorToBackendKey, storageDataProvider, userDataProvider };
1362
+ export { REFINE_OPERATOR_MAP, _cachedUser, accessControlProvider, analyticsDataProvider, appDataProvider, applyRefineQueryParamsToDatabase, authProvider, buildQueryString, buildRefineQueryParams, collectFlatLeaves, convertLogicalFilterToBackendTree, convertRefineFilters, convertRefineFiltersToBackendTree, convertRefinePagination, convertRefineSorters, dataProvider, encodeCrudFilterBracket, encodeFlatFilterListToParams, formatRefineLeafValue, functionsDataProvider, hasTaruviOperator, isFlatFilterList, isLogicalCrudFilter, normalizeTaruviListFilters, refineOperatorToBackendKey, storageDataProvider, taruviOperatorSuffix, toRefineFilters, userDataProvider };
1352
1363
  //# sourceMappingURL=index.js.map
1353
1364
  //# sourceMappingURL=index.js.map