@pol-studios/db 1.0.10 → 1.0.11

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 (120) hide show
  1. package/dist/DataLayerContext-CL6alnkb.d.ts +755 -0
  2. package/dist/UserMetadataContext-B8gVWGMl.d.ts +35 -0
  3. package/dist/UserMetadataContext-DntmpK41.d.ts +33 -0
  4. package/dist/auth/context.d.ts +3 -2
  5. package/dist/auth/context.js +5 -4
  6. package/dist/auth/guards.js +2 -2
  7. package/dist/auth/hooks.d.ts +3 -3
  8. package/dist/auth/hooks.js +6 -5
  9. package/dist/auth/index.d.ts +3 -2
  10. package/dist/auth/index.js +8 -6
  11. package/dist/{canvas-UVNDA54X.node → canvas-C4TBBDUL.node} +0 -0
  12. package/dist/{canvas-75Y7XMF3.js → canvas-ZQNCL7JL.js} +2 -2
  13. package/dist/chunk-5EFDS7SR.js +205 -0
  14. package/dist/chunk-5EFDS7SR.js.map +1 -0
  15. package/dist/{chunk-BRTW7CO5.js → chunk-7SCJNYTE.js} +1 -9
  16. package/dist/chunk-7SCJNYTE.js.map +1 -0
  17. package/dist/chunk-DJ6VLEAL.js +247 -0
  18. package/dist/chunk-DJ6VLEAL.js.map +1 -0
  19. package/dist/{chunk-Y3INY2CS.js → chunk-GC3TBUWE.js} +1 -1
  20. package/dist/chunk-GC3TBUWE.js.map +1 -0
  21. package/dist/{chunk-7HG6G25H.js → chunk-H3LNH2NT.js} +169 -268
  22. package/dist/chunk-H3LNH2NT.js.map +1 -0
  23. package/dist/{chunk-USJYMRUO.js → chunk-HAWJTZCK.js} +2 -2
  24. package/dist/chunk-HAWJTZCK.js.map +1 -0
  25. package/dist/chunk-JAATANS3.js +429 -0
  26. package/dist/chunk-JAATANS3.js.map +1 -0
  27. package/dist/chunk-LNJ3WF7V.js +470 -0
  28. package/dist/chunk-LNJ3WF7V.js.map +1 -0
  29. package/dist/chunk-N26IEHZT.js +79 -0
  30. package/dist/chunk-N26IEHZT.js.map +1 -0
  31. package/dist/chunk-NSIAAYW3.js +1 -0
  32. package/dist/chunk-NSIAAYW3.js.map +1 -0
  33. package/dist/chunk-NZON56CB.js +3864 -0
  34. package/dist/chunk-NZON56CB.js.map +1 -0
  35. package/dist/{chunk-O3K7R32P.js → chunk-OQ7U6EQ3.js} +118 -123
  36. package/dist/chunk-OQ7U6EQ3.js.map +1 -0
  37. package/dist/chunk-SM73S2DY.js +11 -0
  38. package/dist/chunk-SM73S2DY.js.map +1 -0
  39. package/dist/{chunk-JUVE3DWY.js → chunk-TKWR5AAY.js} +47 -65
  40. package/dist/chunk-TKWR5AAY.js.map +1 -0
  41. package/dist/{chunk-2IFGILT3.js → chunk-U5UNPBKB.js} +76 -107
  42. package/dist/chunk-U5UNPBKB.js.map +1 -0
  43. package/dist/chunk-WGDJ4IXR.js +921 -0
  44. package/dist/chunk-WGDJ4IXR.js.map +1 -0
  45. package/dist/chunk-WVF7RUW5.js +186 -0
  46. package/dist/chunk-WVF7RUW5.js.map +1 -0
  47. package/dist/{chunk-ZTSBF536.js → chunk-X3HZLNBV.js} +637 -435
  48. package/dist/chunk-X3HZLNBV.js.map +1 -0
  49. package/dist/{chunk-EL45Z26M.js → chunk-XU3SBFAG.js} +1219 -208
  50. package/dist/chunk-XU3SBFAG.js.map +1 -0
  51. package/dist/chunk-ZVBHWU7O.js +1412 -0
  52. package/dist/chunk-ZVBHWU7O.js.map +1 -0
  53. package/dist/client/index.d.ts +1 -1
  54. package/dist/client/index.js +42 -23
  55. package/dist/client/index.js.map +1 -1
  56. package/dist/core/index.d.ts +19 -0
  57. package/dist/{index-BFu5_dS8.d.ts → database.types-ChFCG-4M.d.ts} +1 -177
  58. package/dist/gen/index.js +4 -2
  59. package/dist/hooks/index.d.ts +10 -3
  60. package/dist/hooks/index.js +8 -10
  61. package/dist/index-CQLyNG6A.d.ts +433 -0
  62. package/dist/index.d.ts +12 -8
  63. package/dist/index.js +92 -48
  64. package/dist/index.native.d.ts +373 -33
  65. package/dist/index.native.js +79 -47
  66. package/dist/index.web.d.ts +10 -7
  67. package/dist/index.web.js +83 -78
  68. package/dist/index.web.js.map +1 -1
  69. package/dist/mutation/index.d.ts +2 -2
  70. package/dist/mutation/index.js +307 -122
  71. package/dist/mutation/index.js.map +1 -1
  72. package/dist/parser/index.js +2 -2
  73. package/dist/{pdf-3TIGQRLA.js → pdf-PHXP7RHD.js} +2 -2
  74. package/dist/powersync-bridge/index.d.ts +284 -0
  75. package/dist/powersync-bridge/index.js +22 -0
  76. package/dist/powersync-bridge/index.js.map +1 -0
  77. package/dist/query/index.js +5 -5
  78. package/dist/realtime/index.js +252 -128
  79. package/dist/realtime/index.js.map +1 -1
  80. package/dist/{UserMetadataContext-BYYqA6LI.d.ts → setupAuthContext-Kv-THH-h.d.ts} +1 -29
  81. package/dist/types/index.d.ts +5 -1
  82. package/dist/types/index.js +10 -5
  83. package/dist/{useBatchUpsert-CSQVX7w8.d.ts → useBatchUpsert-9OYjibLh.d.ts} +1 -1
  84. package/dist/{useDbCount-RGCuHmHp.d.ts → useDbCount-BG356T9i.d.ts} +3 -719
  85. package/dist/{useReceiptAI-Bn0czE7C.d.ts → useReceiptAI-6HkRpRml.d.ts} +1 -1
  86. package/dist/{useResolveFeedback-CpZPP8Pw.d.ts → useResolveFeedback-BWmatBlE.d.ts} +26 -45
  87. package/dist/{useSupabase-pPhUZHcl.d.ts → useSupabase-DvWVuHHE.d.ts} +2 -1
  88. package/dist/with-auth/index.d.ts +704 -0
  89. package/dist/with-auth/index.js +1221 -0
  90. package/dist/with-auth/index.js.map +1 -0
  91. package/package.json +25 -10
  92. package/dist/chunk-2IFGILT3.js.map +0 -1
  93. package/dist/chunk-3M2U6TXH.js +0 -928
  94. package/dist/chunk-3M2U6TXH.js.map +0 -1
  95. package/dist/chunk-5ZYAEGCJ.js +0 -416
  96. package/dist/chunk-5ZYAEGCJ.js.map +0 -1
  97. package/dist/chunk-7HG6G25H.js.map +0 -1
  98. package/dist/chunk-7XT7K4QT.js +0 -2687
  99. package/dist/chunk-7XT7K4QT.js.map +0 -1
  100. package/dist/chunk-AWFMICFV.js +0 -158
  101. package/dist/chunk-AWFMICFV.js.map +0 -1
  102. package/dist/chunk-BRTW7CO5.js.map +0 -1
  103. package/dist/chunk-EL45Z26M.js.map +0 -1
  104. package/dist/chunk-ERGF2FCE.js +0 -903
  105. package/dist/chunk-ERGF2FCE.js.map +0 -1
  106. package/dist/chunk-GK7B66LY.js +0 -135
  107. package/dist/chunk-GK7B66LY.js.map +0 -1
  108. package/dist/chunk-GQI6WJGI.js +0 -172
  109. package/dist/chunk-GQI6WJGI.js.map +0 -1
  110. package/dist/chunk-JUVE3DWY.js.map +0 -1
  111. package/dist/chunk-O3K7R32P.js.map +0 -1
  112. package/dist/chunk-SEY5UO2T.js +0 -89
  113. package/dist/chunk-SEY5UO2T.js.map +0 -1
  114. package/dist/chunk-USJYMRUO.js.map +0 -1
  115. package/dist/chunk-XX3IWSPM.js +0 -189
  116. package/dist/chunk-XX3IWSPM.js.map +0 -1
  117. package/dist/chunk-Y3INY2CS.js.map +0 -1
  118. package/dist/chunk-ZTSBF536.js.map +0 -1
  119. /package/dist/{canvas-75Y7XMF3.js.map → canvas-ZQNCL7JL.js.map} +0 -0
  120. /package/dist/{pdf-3TIGQRLA.js.map → pdf-PHXP7RHD.js.map} +0 -0
@@ -1,9 +1,3 @@
1
- import { V as ValueForPropertyType, P as PropertyType, a as FilterConfig } from './FilterConfig-Bt2Ek74z.js';
2
- import { Moment } from 'moment';
3
- import { PostgrestSingleResponse } from '@supabase/supabase-js';
4
- import { Dispatch, SetStateAction } from 'react';
5
- import { UseQueryOptions, DefinedUseQueryResult } from '@tanstack/react-query';
6
-
7
1
  type Json = string | number | boolean | null | {
8
2
  [key: string]: Json | undefined;
9
3
  } | Json[];
@@ -8607,174 +8601,4 @@ declare const Constants: {
8607
8601
  };
8608
8602
  };
8609
8603
 
8610
- /**
8611
- * Represents a change log entry for database records.
8612
- * Used for tracking live changes to entities.
8613
- */
8614
- interface DbChangeLog {
8615
- modifiedByUserId: string;
8616
- changedOn: Moment;
8617
- changes: Record<string, unknown>;
8618
- }
8619
-
8620
- declare const normalizeFilter: (filter: FilterInput) => Filter | FilterGroup | null;
8621
- /**
8622
- * Filter state for the UI - extends Filter with UI-specific metadata.
8623
- * FilterState can always be assigned where Filter is expected since it
8624
- * contains all Filter properties. The omitted properties (similarity, where, options)
8625
- * are AI search-specific and not typically needed in the UI filter state.
8626
- */
8627
- interface FilterState extends Omit<Filter, 'similarity' | 'where' | 'options'> {
8628
- }
8629
- type ValueOrArrayForPropertyType<T extends PropertyType> = ValueForPropertyType<T> | ValueForPropertyType<T>[];
8630
- type BooleanOperator = "AND" | "OR";
8631
- /**
8632
- * Filter operators supported by the edge function.
8633
- * This is the single source of truth - matches /supabase/functions/_shared/query-sdk/types.ts
8634
- *
8635
- * Note: The following operators are normalized by normalizeFilter() before sending to the server:
8636
- * - "like" -> "contains"
8637
- * - "regex", "regex_i", "similar_to" -> "contains"
8638
- * - "!=" and "<>" are NOT supported - use "=" with not: true instead
8639
- */
8640
- type FilterOperator = "=" | ">" | ">=" | "<" | "<=" | "contains" | "ilike" | "is" | "in" | "ai_search";
8641
- type FilterConditionType = FilterOperator;
8642
- /**
8643
- * Filter interface - matches edge function API
8644
- */
8645
- interface Filter {
8646
- /** Unique identifier */
8647
- id: string;
8648
- /** Field to filter on */
8649
- field: string;
8650
- /** Operator */
8651
- op: FilterOperator;
8652
- /** Value to compare */
8653
- value: string | number | string[] | number[] | boolean | null;
8654
- /** Negate the condition */
8655
- not?: boolean;
8656
- /** AI search options (when op = "ai_search") */
8657
- similarity?: number;
8658
- where?: string;
8659
- display?: string;
8660
- options?: {
8661
- display: string;
8662
- value: ValueForPropertyType<PropertyType>;
8663
- }[];
8664
- /** Filter configuration (UI metadata) */
8665
- info?: FilterConfig<any>;
8666
- }
8667
- /**
8668
- * Filter group - combine multiple filters
8669
- */
8670
- interface FilterGroup {
8671
- /** Unique identifier */
8672
- id: string;
8673
- /** How to combine filters */
8674
- op: "AND" | "OR";
8675
- /** Filters in this group */
8676
- filters: Array<Filter | FilterGroup>;
8677
- /** Negate the entire group (NOT (A AND B)) */
8678
- not?: boolean;
8679
- }
8680
- /**
8681
- * Input type for normalizeFilter - accepts both legacy and new filter formats.
8682
- * The normalizeFilter function handles legacy operators (like, regex, etc.) for data migration,
8683
- * but the type only exposes the supported FilterOperator values.
8684
- */
8685
- type FilterInput = {
8686
- id?: string;
8687
- field?: string;
8688
- value?: string | number | string[] | number[] | boolean | null;
8689
- not?: boolean;
8690
- similarity?: number;
8691
- where?: string;
8692
- display?: string;
8693
- options?: {
8694
- display: string;
8695
- value: ValueForPropertyType<PropertyType>;
8696
- }[];
8697
- filters?: Array<Filter | FilterGroup | FilterInput>;
8698
- op?: FilterOperator | "AND" | "OR";
8699
- propertyName?: string;
8700
- condition?: string;
8701
- operator?: "AND" | "OR";
8702
- inverted?: boolean;
8703
- };
8704
- /**
8705
- * Pagination settings
8706
- */
8707
- interface Pagination {
8708
- offset?: number;
8709
- limit?: number;
8710
- }
8711
- /**
8712
- * Configuration for computed/aggregated field sorting
8713
- */
8714
- interface ComputedSortConfig {
8715
- /** Aggregation function to apply */
8716
- fn: "SUM" | "COUNT" | "AVG" | "MIN" | "MAX";
8717
- /** Field to aggregate */
8718
- field: string;
8719
- /** Relationship path for related table aggregation (e.g., "OrderItem" or "Order.OrderItem") */
8720
- relationship?: string;
8721
- }
8722
- /**
8723
- * Sort order
8724
- */
8725
- interface Sort {
8726
- field: string;
8727
- direction: "asc" | "desc";
8728
- /** Optional computed/aggregated sort configuration for sorting by aggregate values */
8729
- computed?: ComputedSortConfig;
8730
- }
8731
- /**
8732
- * Query state that includes FilterGroup plus pagination, sort, and isReady
8733
- * Used by useDbAdvanceFilterQuery for managing filter state with query metadata
8734
- */
8735
- interface QueryState extends FilterGroup {
8736
- /** Pagination settings */
8737
- pagination?: Pagination;
8738
- /** Sort order */
8739
- sort?: Sort[];
8740
- /** Distinct ON expressions - returns one record per unique combination */
8741
- distinctOn?: string[];
8742
- /** Natural language query - converts to filters automatically */
8743
- naturalLanguageQuery?: string;
8744
- /** Whether the query is ready to execute */
8745
- isReady: boolean;
8746
- }
8747
- interface ClarificationSuggestion {
8748
- interpretation: string;
8749
- field_path: string;
8750
- example: string;
8751
- confidence: number;
8752
- }
8753
- interface ClarificationQuestion {
8754
- question: string;
8755
- suggestions: ClarificationSuggestion[];
8756
- }
8757
- interface FilterContextType<T> {
8758
- filters: FilterGroup;
8759
- setFilters: Dispatch<SetStateAction<FilterGroup>>;
8760
- }
8761
- interface OrderColumn {
8762
- field: string;
8763
- direction: "asc" | "desc";
8764
- }
8765
- declare function useDbAdvanceFilterQuery<Result>(query: PromiseLike<PostgrestSingleResponse<Result>>, config?: Omit<UseQueryOptions<PostgrestSingleResponse<Result>>, "queryKey" | "queryFn"> & {
8766
- key?: string;
8767
- filterKey?: string;
8768
- searchByDefault?: boolean;
8769
- timeout?: number;
8770
- count?: "exact" | "estimated" | "";
8771
- }): [
8772
- DefinedUseQueryResult<Result, Error> & {
8773
- count: number;
8774
- clarification?: ClarificationQuestion;
8775
- },
8776
- QueryState,
8777
- Dispatch<SetStateAction<QueryState>>
8778
- ];
8779
-
8780
- export { type BooleanOperator as B, type CompositeTypes as C, type Database as D, type Enums as E, type FilterOperator as F, type Json as J, type OrderColumn as O, type Pagination as P, type QueryState as Q, type Sort as S, type Tables as T, type ValueOrArrayForPropertyType as V, type TablesInsert as a, type TablesUpdate as b, Constants as c, type DbChangeLog as d, type FilterConditionType as e, type Filter as f, type FilterGroup as g, type FilterInput as h, type FilterState as i, type ComputedSortConfig as j, type ClarificationSuggestion as k, type ClarificationQuestion as l, type FilterContextType as m, normalizeFilter as n, useDbAdvanceFilterQuery as u };
8604
+ export { type CompositeTypes as C, type Database as D, type Enums as E, type Json as J, type Tables as T, type TablesInsert as a, type TablesUpdate as b, Constants as c };
package/dist/gen/index.js CHANGED
@@ -170,7 +170,6 @@ import {
170
170
  TicketCommentAttachment,
171
171
  TimeActivity,
172
172
  TimeBankTransaction,
173
- UserMetadata,
174
173
  UserTimesheet,
175
174
  WeeklyTimesheet,
176
175
  WorkEstimation,
@@ -182,7 +181,10 @@ import {
182
181
  WorkingPhaseDailySummary,
183
182
  WorkingPhaseRoleRate,
184
183
  WorkingPhaseSummary
185
- } from "../chunk-BRTW7CO5.js";
184
+ } from "../chunk-7SCJNYTE.js";
185
+ import {
186
+ UserMetadata
187
+ } from "../chunk-SM73S2DY.js";
186
188
  import "../chunk-P4UZ7IXC.js";
187
189
  export {
188
190
  Accessory,
@@ -1,5 +1,6 @@
1
- export { $ as ClarificationQuestion, D as DatabaseTypes, V as Filter, W as FilterGroup, X as FilterOperator, Y as Pagination, P as PublicTableNames, _ as QueryState, R as ResolveRowType, S as SchemaNames, j as SchemaTableNames, Z as Sort, T as TableIdentifier, p as UseAdvanceQueryOptions, q as UseAdvanceQueryResult, l as UseDbCountOptions, m as UseDbCountResult, a6 as UseDbDeleteOptions, a7 as UseDbDeleteResult, U as UseDbInfiniteQueryOptions, k as UseDbInfiniteQueryResult, a0 as UseDbInsertOptions, a1 as UseDbInsertResult, O as UseDbQueryByIdOptions, Q as UseDbQueryByIdResult, o as UseDbQueryOptions, n as UseDbQueryResult, a2 as UseDbUpdateOptions, a3 as UseDbUpdateResult, a4 as UseDbUpsertOptions, a5 as UseDbUpsertResult, i as useAdvanceQuery, u as useDataLayer, N as useDataLayerOptional, h as useDbCount, a as useDbDelete, g as useDbInfiniteQuery, b as useDbInsert, c as useDbQuery, d as useDbQueryById, e as useDbUpdate, f as useDbUpsert } from '../useDbCount-RGCuHmHp.js';
1
+ export { C as ClarificationQuestion, D as DatabaseTypes, F as Filter, v as FilterGroup, w as FilterOperator, x as Pagination, P as PublicTableNames, Q as QueryState, R as ResolveRowType, S as SchemaNames, j as SchemaTableNames, y as Sort, T as TableIdentifier, p as UseAdvanceQueryOptions, q as UseAdvanceQueryResult, l as UseDbCountOptions, m as UseDbCountResult, I as UseDbDeleteOptions, J as UseDbDeleteResult, U as UseDbInfiniteQueryOptions, k as UseDbInfiniteQueryResult, z as UseDbInsertOptions, A as UseDbInsertResult, s as UseDbQueryByIdOptions, t as UseDbQueryByIdResult, o as UseDbQueryOptions, n as UseDbQueryResult, B as UseDbUpdateOptions, E as UseDbUpdateResult, G as UseDbUpsertOptions, H as UseDbUpsertResult, i as useAdvanceQuery, a as useDataLayer, r as useDataLayerOptional, h as useDbCount, b as useDbDelete, g as useDbInfiniteQuery, c as useDbInsert, d as useDbQuery, e as useDbQueryById, f as useDbUpdate, u as useDbUpsert } from '../useDbCount-BG356T9i.js';
2
2
  import { SyncStatus, SyncControl } from '../core/index.js';
3
+ import '../DataLayerContext-CL6alnkb.js';
3
4
  import 'react';
4
5
  import '@supabase/supabase-js';
5
6
  import '@tanstack/react-query';
@@ -54,8 +55,10 @@ declare function useSyncControl(): SyncControl;
54
55
  * V3 useOnlineStatus Hook
55
56
  *
56
57
  * Provides online/connection status information.
57
- * Combines data layer status with platform-specific online/offline events.
58
- * Works on both web (browser events) and React Native (NetInfo).
58
+ * Uses DataLayerProvider's status as the SINGLE source of truth.
59
+ *
60
+ * On React Native: status.isOnline comes from PowerSync platform adapter (NetInfo)
61
+ * On Web: status.isOnline comes from browser navigator.onLine
59
62
  */
60
63
  /**
61
64
  * Online status information
@@ -71,6 +74,10 @@ interface OnlineStatus {
71
74
  /**
72
75
  * Hook to get online/connection status
73
76
  *
77
+ * Uses DataLayerProvider's status as the single source of truth:
78
+ * - On React Native: isOnline comes from PowerSync platform adapter (NetInfo)
79
+ * - On Web: isOnline comes from browser navigator.onLine
80
+ *
74
81
  * @example
75
82
  * const { isOnline, isConnected, backend } = useOnlineStatus();
76
83
  *
@@ -1,8 +1,3 @@
1
- import {
2
- useOnlineStatus,
3
- useSyncControl,
4
- useSyncStatus
5
- } from "../chunk-XX3IWSPM.js";
6
1
  import {
7
2
  useAdvanceQuery,
8
3
  useDataLayer,
@@ -14,12 +9,15 @@ import {
14
9
  useDbQuery,
15
10
  useDbQueryById,
16
11
  useDbUpdate,
17
- useDbUpsert
18
- } from "../chunk-3M2U6TXH.js";
19
- import "../chunk-Y3INY2CS.js";
12
+ useDbUpsert,
13
+ useOnlineStatus,
14
+ useSyncControl,
15
+ useSyncStatus
16
+ } from "../chunk-ZVBHWU7O.js";
17
+ import "../chunk-GC3TBUWE.js";
20
18
  import "../chunk-J4ZVCXZ4.js";
21
- import "../chunk-O3K7R32P.js";
22
- import "../chunk-AWFMICFV.js";
19
+ import "../chunk-OQ7U6EQ3.js";
20
+ import "../chunk-5EFDS7SR.js";
23
21
  import "../chunk-P4UZ7IXC.js";
24
22
  export {
25
23
  useAdvanceQuery,