@pol-studios/db 1.0.10 → 1.0.12
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/DataLayerContext-CL6alnkb.d.ts +755 -0
- package/dist/UserMetadataContext-B8gVWGMl.d.ts +35 -0
- package/dist/UserMetadataContext-DntmpK41.d.ts +33 -0
- package/dist/auth/context.d.ts +3 -2
- package/dist/auth/context.js +5 -4
- package/dist/auth/guards.js +2 -2
- package/dist/auth/hooks.d.ts +3 -3
- package/dist/auth/hooks.js +6 -5
- package/dist/auth/index.d.ts +3 -2
- package/dist/auth/index.js +8 -6
- package/dist/{canvas-UVNDA54X.node → canvas-C4TBBDUL.node} +0 -0
- package/dist/{canvas-75Y7XMF3.js → canvas-ZQNCL7JL.js} +2 -2
- package/dist/chunk-5EFDS7SR.js +205 -0
- package/dist/chunk-5EFDS7SR.js.map +1 -0
- package/dist/{chunk-BRTW7CO5.js → chunk-7SCJNYTE.js} +1 -9
- package/dist/chunk-7SCJNYTE.js.map +1 -0
- package/dist/chunk-DJ6VLEAL.js +247 -0
- package/dist/chunk-DJ6VLEAL.js.map +1 -0
- package/dist/{chunk-Y3INY2CS.js → chunk-GC3TBUWE.js} +1 -1
- package/dist/chunk-GC3TBUWE.js.map +1 -0
- package/dist/{chunk-7HG6G25H.js → chunk-H3LNH2NT.js} +169 -268
- package/dist/chunk-H3LNH2NT.js.map +1 -0
- package/dist/{chunk-USJYMRUO.js → chunk-HAWJTZCK.js} +2 -2
- package/dist/chunk-HAWJTZCK.js.map +1 -0
- package/dist/chunk-JAATANS3.js +429 -0
- package/dist/chunk-JAATANS3.js.map +1 -0
- package/dist/chunk-LNJ3WF7V.js +470 -0
- package/dist/chunk-LNJ3WF7V.js.map +1 -0
- package/dist/chunk-N26IEHZT.js +79 -0
- package/dist/chunk-N26IEHZT.js.map +1 -0
- package/dist/chunk-NSIAAYW3.js +1 -0
- package/dist/chunk-NSIAAYW3.js.map +1 -0
- package/dist/chunk-NZON56CB.js +3864 -0
- package/dist/chunk-NZON56CB.js.map +1 -0
- package/dist/{chunk-O3K7R32P.js → chunk-OQ7U6EQ3.js} +118 -123
- package/dist/chunk-OQ7U6EQ3.js.map +1 -0
- package/dist/chunk-SM73S2DY.js +11 -0
- package/dist/chunk-SM73S2DY.js.map +1 -0
- package/dist/{chunk-JUVE3DWY.js → chunk-TKWR5AAY.js} +47 -65
- package/dist/chunk-TKWR5AAY.js.map +1 -0
- package/dist/{chunk-2IFGILT3.js → chunk-U5UNPBKB.js} +76 -107
- package/dist/chunk-U5UNPBKB.js.map +1 -0
- package/dist/chunk-WGDJ4IXR.js +921 -0
- package/dist/chunk-WGDJ4IXR.js.map +1 -0
- package/dist/chunk-WVF7RUW5.js +186 -0
- package/dist/chunk-WVF7RUW5.js.map +1 -0
- package/dist/{chunk-ZTSBF536.js → chunk-X3HZLNBV.js} +637 -435
- package/dist/chunk-X3HZLNBV.js.map +1 -0
- package/dist/{chunk-EL45Z26M.js → chunk-XU3SBFAG.js} +1219 -208
- package/dist/chunk-XU3SBFAG.js.map +1 -0
- package/dist/chunk-ZVBHWU7O.js +1412 -0
- package/dist/chunk-ZVBHWU7O.js.map +1 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +42 -23
- package/dist/client/index.js.map +1 -1
- package/dist/core/index.d.ts +19 -0
- package/dist/{index-BFu5_dS8.d.ts → database.types-ChFCG-4M.d.ts} +1 -177
- package/dist/gen/index.js +4 -2
- package/dist/hooks/index.d.ts +10 -3
- package/dist/hooks/index.js +8 -10
- package/dist/index-CQLyNG6A.d.ts +433 -0
- package/dist/index.d.ts +12 -8
- package/dist/index.js +92 -48
- package/dist/index.native.d.ts +373 -33
- package/dist/index.native.js +79 -47
- package/dist/index.web.d.ts +10 -7
- package/dist/index.web.js +83 -78
- package/dist/index.web.js.map +1 -1
- package/dist/mutation/index.d.ts +2 -2
- package/dist/mutation/index.js +307 -122
- package/dist/mutation/index.js.map +1 -1
- package/dist/parser/index.js +2 -2
- package/dist/{pdf-3TIGQRLA.js → pdf-PHXP7RHD.js} +2 -2
- package/dist/powersync-bridge/index.d.ts +284 -0
- package/dist/powersync-bridge/index.js +22 -0
- package/dist/powersync-bridge/index.js.map +1 -0
- package/dist/query/index.js +5 -5
- package/dist/realtime/index.js +252 -128
- package/dist/realtime/index.js.map +1 -1
- package/dist/{UserMetadataContext-BYYqA6LI.d.ts → setupAuthContext-Kv-THH-h.d.ts} +1 -29
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.js +10 -5
- package/dist/{useBatchUpsert-CSQVX7w8.d.ts → useBatchUpsert-9OYjibLh.d.ts} +1 -1
- package/dist/{useDbCount-RGCuHmHp.d.ts → useDbCount-BG356T9i.d.ts} +3 -719
- package/dist/{useReceiptAI-Bn0czE7C.d.ts → useReceiptAI-6HkRpRml.d.ts} +1 -1
- package/dist/{useResolveFeedback-CpZPP8Pw.d.ts → useResolveFeedback-BWmatBlE.d.ts} +26 -45
- package/dist/{useSupabase-pPhUZHcl.d.ts → useSupabase-DvWVuHHE.d.ts} +2 -1
- package/dist/with-auth/index.d.ts +704 -0
- package/dist/with-auth/index.js +1221 -0
- package/dist/with-auth/index.js.map +1 -0
- package/package.json +25 -10
- package/dist/chunk-2IFGILT3.js.map +0 -1
- package/dist/chunk-3M2U6TXH.js +0 -928
- package/dist/chunk-3M2U6TXH.js.map +0 -1
- package/dist/chunk-5ZYAEGCJ.js +0 -416
- package/dist/chunk-5ZYAEGCJ.js.map +0 -1
- package/dist/chunk-7HG6G25H.js.map +0 -1
- package/dist/chunk-7XT7K4QT.js +0 -2687
- package/dist/chunk-7XT7K4QT.js.map +0 -1
- package/dist/chunk-AWFMICFV.js +0 -158
- package/dist/chunk-AWFMICFV.js.map +0 -1
- package/dist/chunk-BRTW7CO5.js.map +0 -1
- package/dist/chunk-EL45Z26M.js.map +0 -1
- package/dist/chunk-ERGF2FCE.js +0 -903
- package/dist/chunk-ERGF2FCE.js.map +0 -1
- package/dist/chunk-GK7B66LY.js +0 -135
- package/dist/chunk-GK7B66LY.js.map +0 -1
- package/dist/chunk-GQI6WJGI.js +0 -172
- package/dist/chunk-GQI6WJGI.js.map +0 -1
- package/dist/chunk-JUVE3DWY.js.map +0 -1
- package/dist/chunk-O3K7R32P.js.map +0 -1
- package/dist/chunk-SEY5UO2T.js +0 -89
- package/dist/chunk-SEY5UO2T.js.map +0 -1
- package/dist/chunk-USJYMRUO.js.map +0 -1
- package/dist/chunk-XX3IWSPM.js +0 -189
- package/dist/chunk-XX3IWSPM.js.map +0 -1
- package/dist/chunk-Y3INY2CS.js.map +0 -1
- package/dist/chunk-ZTSBF536.js.map +0 -1
- /package/dist/{canvas-75Y7XMF3.js.map → canvas-ZQNCL7JL.js.map} +0 -0
- /package/dist/{pdf-3TIGQRLA.js.map → pdf-PHXP7RHD.js.map} +0 -0
package/dist/index.native.d.ts
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as CompositeTypes, c as Constants, D as Database, E as Enums, J as Json, T as Tables, a as TablesInsert, b as TablesUpdate } from './database.types-ChFCG-4M.js';
|
|
2
2
|
export { a as FilterConfig, F as FilterConfigOption, G as Group, P as PropertyType, S as SortConfig, T as TableInfo, V as ValueForPropertyType, W as WhereFilter } from './FilterConfig-Bt2Ek74z.js';
|
|
3
|
-
export {
|
|
3
|
+
export { r as BackendSelectionResult, B as BooleanOperator, l as ClarificationQuestion, k as ClarificationSuggestion, C as CombinedProviderStatus, j as ComputedSortConfig, n as DataLayerWithPowerSyncProps, D as DbChangeLog, a as EnhancedSyncControl, E as EnhancedSyncStatus, e as Filter, d as FilterConditionType, m as FilterContextType, f as FilterGroup, g as FilterInput, F as FilterOperator, h as FilterState, H as HasPowerSyncConfig, O as OrderColumn, i as Pagination, P as PowerSyncEnabledConfig, b as PowerSyncEnabledContextValue, q as PowerSyncTables, Q as QueryState, S as Sort, U as UseDataLayerWithPowerSync, p as UseSyncControlWithPowerSync, o as UseSyncStatusWithPowerSync, V as ValueOrArrayForPropertyType, c as createCombinedStatus, s as normalizeFilter, u as useDbAdvanceFilterQuery, u as useDbAdvanceQuery } from './index-CQLyNG6A.js';
|
|
4
|
+
export { A as AIOptions, B as AIResponse, P as AlertProps, K as BUCKETS, L as BucketName, I as CustomPageQueryResult, N as DEFAULT_QUERY_TIMEOUT, a9 as FeedbackListItem, aa as FeedbackListParams, Q as LiveChangeContext, R as LiveChangeContextProvider, D as ServerAvailabilityState, J as StorageObjectMetadata, ac as SubmitFeedbackParams, S as SupabaseAdapter, T as TIMEOUT_ERROR_MESSAGE, G as UpdateOptions, U as UseDbPartialAdvanceQueryResult, p as UseDbPartialQueryResult, r as UseDbRealtimeQueryResult, v as UseMutationSuccessOptions, t as convertFilterToRealtimeQuery, M as createInCondition, y as createSupabaseAdapter, H as executeAdvanceQuery, z as getErrorBody, k as getSupabaseUrl, O as isTimeoutError, n as newTimeActivity, s as setSupabaseUrl, C as useAI, ad as useApplyFeedback, g as useAutosaveState, a4 as useChangelogById, a5 as useChangelogBySlug, a6 as useChangelogEntries, a7 as useChangelogMedia, a2 as useChangelogs, c as useDbDelete, a as useDbInsert, l as useDbMultiDelete, m as useDbMultiUpsert, o as useDbPartialAdvanceQuery, q as useDbPartialQuery, u as useDbRealtime, d as useDbRealtimeQuery, b as useDbUpdate, c as useDelete, W as useDeleteChangelog, Z as useDeleteChangelogEntry, a0 as useDeleteChangelogMedia, a8 as useFeedbackList, a as useInsert, f as useLatestOperationLog, e as useLiveChangeTracking, _ as useMultiDeleteChangelogEntries, Y as useMultiUpsertChangelogEntries, w as useMutationSuccess, x as useMutationSuccessRN, a3 as usePublishedChangelogs, u as useRealtime, d as useRealtimeQuery, ae as useResolveFeedback, F as useSearchQuery, E as useServerAvailability, j as useStoragePath, i as useStorageUrl, ab as useSubmitFeedback, h as useToastError, b as useUpdate, a1 as useUploadChangelogMedia, V as useUpsertChangelog, X as useUpsertChangelogEntry, $ as useUpsertChangelogMedia } from './useResolveFeedback-BWmatBlE.js';
|
|
4
5
|
export { F as Fetch, i as GenericFunction, g as GenericNonUpdatableView, j as GenericSchema, G as GenericTable, f as GenericUpdatableView, h as GenericView, P as PostgrestError, d as PostgrestMaybeSingleResponse, e as PostgrestResponse, b as PostgrestResponseFailure, a as PostgrestResponseSuccess, c as PostgrestSingleResponse, k as Prettify } from './types-CYr9JiUE.js';
|
|
5
6
|
export { U as UseDbQuerySingleReturn, u as useDbQuery } from './useDbQuery-C-TL8jY1.js';
|
|
6
7
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
7
8
|
import { QueryClient } from '@tanstack/react-query';
|
|
8
9
|
import { FileOptions } from '@supabase/storage-js';
|
|
9
|
-
export {
|
|
10
|
+
export { D as DatabaseTypes, P as PublicTableNames, R as ResolveRowType, S as SchemaNames, j as SchemaTableNames, T as TableIdentifier, p as UseAdvanceQueryOptions, q as UseAdvanceQueryResult, l as UseDbCountOptions, m as UseDbCountResult, U as UseDbInfiniteQueryOptions, k as UseDbInfiniteQueryResult, o as UseDbQueryOptions, n as UseDbQueryResult, i as useAdvanceQuery, a as useDataLayer, h as useDbCount, h as useDbCountV3, b as useDbDeleteV3, g as useDbInfiniteQuery, g as useDbInfiniteQueryV3, c as useDbInsertV3, e as useDbQueryById, d as useDbQueryV3, f as useDbUpdateV3, u as useDbUpsert, u as useDbUpsertV3, u as useUpsert } from './useDbCount-BG356T9i.js';
|
|
11
|
+
export { useOnlineStatus, useSyncControl, useSyncStatus } from './hooks/index.js';
|
|
12
|
+
export { u as useBatchDelete, a as useBatchUpsert } from './useBatchUpsert-9OYjibLh.js';
|
|
10
13
|
import { DatabaseSchema, QueryOptions, DataLayerConfig } from './core/index.js';
|
|
11
14
|
export { AdapterRegistry as AdapterRegistryInterface, AutoStrategy, BuiltQuery, CachedStrategy, ColumnInfo, ColumnType, ConnectionConfig, DataAdapter, DataLayerHooks, DeleteMutationResult, ExtractInsert, ExtractRow, ExtractUpdate, HybridStrategy, MutationHookResult, MutationResult, OrderBy, ParsedSelect, PowerSyncStrategy, QueryResult, QuerySingleResult, RelationshipInfo, RelationshipType, ResolvedRelationship, ScopeDefinition, SelectColumn, SelectRelation, SupabaseStrategy, SyncControl, SyncMode, SyncScope, SyncStatus, TableNames, TableSchema, TableStrategy, UseDbMutationHook, UseDbQueryByIdHook, UseDbQueryHook, WhereClause, WhereOperators } from './core/index.js';
|
|
12
15
|
export { UsePartialAdvancedQueryResult, UsePartialQueryResult, UseQuerySingleReturn, extractColumnNames, extractRelationNames, getRelationSelect, hasRelation, parseSelect, stringifySelect, tokenizeTopLevel, useAdvancedFilterQuery, useAdvancedQuery, useInfiniteQuery, usePartialAdvancedQuery, usePartialQuery, useQuery } from './query/index.js';
|
|
13
16
|
import { Q as QueryExecutor, P as PowerSyncDatabase$1 } from './executor-CB4KHyYG.js';
|
|
14
17
|
export { e as RelationJoinData, R as RelationshipResolver, b as ResultJoiner, S as SQLBuilder, f as createQueryExecutor, c as createRelationshipResolver, d as createResultJoiner, a as createSQLBuilder } from './executor-CB4KHyYG.js';
|
|
15
|
-
import {
|
|
16
|
-
export {
|
|
18
|
+
import { T as TableDataAdapter, C as CapableDataAdapter, c as AdapterCapabilities, A as AdapterQueryResult, n as DataLayerContextValue, S as SyncStatusInfo } from './DataLayerContext-CL6alnkb.js';
|
|
19
|
+
export { f as ADAPTER_STRATEGIES, i as AdapterAutoDetector, a as AdapterConfig, d as AdapterDependencies, b as AdapterFactory, g as AdapterRegistry, e as AdapterStrategyType, k as AutoDetectionResult, l as AutoDetectorOptions, m as BackendChangeListener, B as BackendStatus, D as DataLayerContext, o as DataLayerStatus, j as createAdapterAutoDetector, h as createAdapterRegistry } from './DataLayerContext-CL6alnkb.js';
|
|
17
20
|
import * as react from 'react';
|
|
18
|
-
import { ReactNode, JSX } from 'react';
|
|
21
|
+
import react__default, { ReactNode, JSX } from 'react';
|
|
19
22
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
23
|
+
export { C as ClientInstanceId, S as SupabaseDatabaseTypes, a as SupabaseProvider, T as TypedSupabaseClient, U as UserSessionId, c as createNewSupabaseClient, u as default, o as onSupabaseInitialized, s as setDefaultOptions, t as typedSupabase, u as useSupabase } from './useSupabase-DvWVuHHE.js';
|
|
24
|
+
export { e as UserMetadataContextProvider, c as UserMetadataContextType, a as UserMetadataInsert, U as UserMetadataRow, b as UserMetadataUpdate, u as useLiveChangesIndicator, h as useSetUserMetadata, f as useUserMetadata, i as useUserMetadataState, g as useUserMetadataValue, d as userMetadataContext } from './UserMetadataContext-B8gVWGMl.js';
|
|
22
25
|
import * as react_dropzone from 'react-dropzone';
|
|
23
26
|
import { FileRejection, FileError } from 'react-dropzone';
|
|
24
27
|
export { AnyPostgrestResponse, FilterDefinition, FilterDefinitions, FilterFn, NestedPath, OPERATOR_MAP, OperatorFn, OrderDefinition, Path, PostgrestFilter, PostgrestFilterOperator, PostgrestHasMorePaginationCacheData, PostgrestHasMorePaginationResponse, PostgrestPaginationCacheData, PostgrestPaginationResponse, PostgrestParser, PostgrestQueryParser, PostgrestQueryParserOptions, SUPPORTED_OPERATORS, ValueType, binarySearch, buildSortedComparator, denormalize, encodeObject, extractPathsFromFilters, filterFilterDefinitionsByPaths, findFilters, findIndexOrdered, findLastIndex, get, getTable, groupPathsRecursive, ifDateGetTime, isAndFilter, isAnyPostgrestResponse, isFilterDefinition, isISODateString, isNestedPath, isNotNull, isObject, isOrFilter, isPostgrestBuilder, isPostgrestHasMorePaginationCacheData, isPostgrestHasMorePaginationResponse, isPostgrestPaginationCacheData, isPostgrestPaginationResponse, parseOrderByKey, parseSelectParam, parseValue, removeAliasFromDeclaration, removeFirstPathElement, setFilterValue, sortSearchParams } from './parser/index.js';
|
|
25
28
|
export { G as GetResult, S as SelectQueryError } from './select-query-parser-BwyHum1L.js';
|
|
26
29
|
export { Accessory, Address, AdvanceQuery, AdvanceQueryNotificationSetting, AdvancedQueryView, BillableService, BillingDetails, CachedEmbedding, Changelog, ChangelogEntry, ChangelogMedia, ChargeTable, Circuit, Client, Comment, CommentReaction, CommentRead, CommentSection, CommentTag, CommonNote, CommonNoteCategory, CommonNoteSubCategory, ControlComponent, ControlComponentDatasheet, Controller, CoreSavedQuery, CoreSavedQueryAccess, Currency, CurrencyUsdConversion, DataExchangeImport, Datasheet, Dimension, DimmerModule, DimmerRack, Embedding, EquipmentConfigurationGroup, EquipmentFixture, EquipmentFixtureConfiguration, EquipmentFixtureConfigurationAccessoryEntry, EquipmentFixtureConfigurationControlComponentEntry, EquipmentFixtureCost, EquipmentFixtureDatasheet, EquipmentFixtureDimension, EquipmentFixtureDocument, EquipmentFixtureLampConfiguration, EquipmentFixtureListing, EquipmentFixtureMode, EquipmentFixtureModeChannel, EquipmentFixturePreset, EquipmentFixtureUnit, EquipmentFixtureUnitControl, EquipmentFixtureUnitLocation, EquipmentFixtureUnitLocationTag, EquipmentFixtureUnitLocationTagValue, EquipmentFixtureUnitPatternEntry, EquipmentFixtureWeight, EquipmentType, EquipmentUnitMediaContent, Expense, ExpenseLineItem, ExpenseReport, Fixture, FixtureCatalog, FixtureCatalogItem, FixtureCategory, FixtureTag, GlobalExpenseReport, HighlightServer, HighlightServerInstance, HighlightServerInstanceLog, HighlightServerInstanceOptions, HighlightServerInstanceStatus, HighlightServerRequest, Invoice, InvoiceSummaryTable, InvoiceTerm, InvoiceTermCondition, Lamp, LampCategory, LampCurrentListing, LampType, LicenseAssignment, Logo, Manufacturer, ManufacturerTag, ManufacturerToTag, OperationLog, OrderHinted, Organization, OrganizationUser, OrganizationUserAccess, ParameterMappingProfile, ParameterMappingProfileAssignment, Pattern, PaymentCustomer, PaymentInvoice, PaymentPaymentIntents, PaymentPlan, PaymentProduct, PaymentProductFeature, PaymentSubscription, PaymentSubscriptionPlan, PhaseActivityBucket, ProfileConfig as Profile, ProfileConfig, ProfileTimeBank, Project, ProjectDatabase, ProjectDatabaseEquipmentConfigurationGroup, ProjectDatabaseExcelParameterAssignment, ProjectDatabaseGroup, ProjectDatabaseParameterMappingProfile, ProjectDefaultRateByTitle, ProjectDocument, ProjectDocumentLineItem, PunchList, PunchListAccess, PunchListItem, PunchListItemAssignment, PunchListItemAttachedEntity, PunchListItemAttachment, PunchListItemCheckListItem, PunchListPage, PunchListPageAccess, PunchListUserOrderHint, QrCode, RetainageItem, RevitEquipmentUnitChange, RevitImport, RevitValueChangedEvent, Role, Service, ServiceCosts, ServiceStorageHourly, SmartCode, SmartCodeTag, Subtask, SystemBroadcastChannel, SystemBroadcastChannelThrottle, SystemConfiguration, SystemEmailNotification, SystemEvent, SystemEventListener, SystemEventWorker, SystemGlobalVariables, SystemHealthCheck, SystemInAppNotification, SystemLog, SystemMutedTopic, SystemNotification, SystemPushNotification, SystemSubscriber, SystemSupportAccess, SystemSupportTeam, SystemTask, SystemTaskAttempt, SystemTaskAttemptAccess, SystemTemp, SystemTicket, SystemTicketAttachment, SystemTicketComment, SystemTicketCommentAttachment, SystemUserPushTokens, Tag, Task, TaxCategory, Ticket, TicketAttachment, TicketComment, TicketCommentAttachment, TimeActivity, TimeBankTransaction, UserMetadata, UserTimesheet, WeeklyTimesheet, WorkEstimation, WorkEstimationLineItem, WorkingPhase, WorkingPhaseBillingItemDailySummary, WorkingPhaseBillingItemLatestSummary, WorkingPhaseCategory, WorkingPhaseDailySummary, WorkingPhaseRoleRate, WorkingPhaseSummary } from './gen/index.js';
|
|
30
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
27
31
|
import 'moment';
|
|
28
32
|
import '@supabase-cache-helpers/postgrest-react-query';
|
|
29
33
|
import '@pol-studios/utils';
|
|
30
34
|
import '@supabase/functions-js';
|
|
31
35
|
import '@supabase/postgrest-js';
|
|
32
|
-
import 'react/jsx-runtime';
|
|
33
36
|
import '@supabase/supabase-js/dist/module/lib/types.js';
|
|
34
37
|
|
|
35
38
|
type RequestOptions = {
|
|
@@ -273,7 +276,32 @@ interface DataLayerProviderProps {
|
|
|
273
276
|
config: DataLayerConfig;
|
|
274
277
|
/** Children to render */
|
|
275
278
|
children: ReactNode;
|
|
276
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Optional PowerSync database instance.
|
|
281
|
+
*
|
|
282
|
+
* This accepts any object that implements the PowerSyncDatabase interface,
|
|
283
|
+
* including the AbstractPowerSyncDatabase from @pol-studios/powersync.
|
|
284
|
+
*
|
|
285
|
+
* When using with @pol-studios/powersync, pass the `db` value from usePowerSync():
|
|
286
|
+
* @example
|
|
287
|
+
* ```tsx
|
|
288
|
+
* // With @pol-studios/powersync
|
|
289
|
+
* const { db, isReady } = usePowerSync();
|
|
290
|
+
*
|
|
291
|
+
* if (!isReady) return <Loading />;
|
|
292
|
+
*
|
|
293
|
+
* return (
|
|
294
|
+
* <DataLayerProvider
|
|
295
|
+
* config={config}
|
|
296
|
+
* powerSyncInstance={db}
|
|
297
|
+
* supabaseClient={supabase}
|
|
298
|
+
* queryClient={queryClient}
|
|
299
|
+
* >
|
|
300
|
+
* {children}
|
|
301
|
+
* </DataLayerProvider>
|
|
302
|
+
* );
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
277
305
|
powerSyncInstance?: PowerSyncDatabase$1 | null;
|
|
278
306
|
/** Supabase client (required) */
|
|
279
307
|
supabaseClient: SupabaseClient;
|
|
@@ -283,6 +311,13 @@ interface DataLayerProviderProps {
|
|
|
283
311
|
onInitialized?: (context: DataLayerContextValue) => void;
|
|
284
312
|
/** Callback when error occurs */
|
|
285
313
|
onError?: (error: Error) => void;
|
|
314
|
+
/**
|
|
315
|
+
* Current sync status from @pol-studios/powersync.
|
|
316
|
+
* Pass the status object from useSyncStatus() hook.
|
|
317
|
+
* When hasSynced is false and useOnlineUntilSynced is true (default),
|
|
318
|
+
* queries will use Supabase until initial sync completes.
|
|
319
|
+
*/
|
|
320
|
+
powerSyncSyncStatus?: SyncStatusInfo;
|
|
286
321
|
}
|
|
287
322
|
/**
|
|
288
323
|
* Provider component for the V3 data layer.
|
|
@@ -312,7 +347,7 @@ interface DataLayerProviderProps {
|
|
|
312
347
|
* }
|
|
313
348
|
* ```
|
|
314
349
|
*/
|
|
315
|
-
declare function DataLayerProvider({ config, children, powerSyncInstance, supabaseClient, queryClient, onInitialized, onError, }: DataLayerProviderProps): JSX.Element;
|
|
350
|
+
declare function DataLayerProvider({ config, children, powerSyncInstance, supabaseClient, queryClient, onInitialized, onError, powerSyncSyncStatus, }: DataLayerProviderProps): JSX.Element;
|
|
316
351
|
|
|
317
352
|
interface FileWithPreview extends File {
|
|
318
353
|
preview?: string;
|
|
@@ -392,42 +427,347 @@ declare const useSupabaseUpload: (options: UseSupabaseUploadOptions) => {
|
|
|
392
427
|
};
|
|
393
428
|
|
|
394
429
|
/**
|
|
395
|
-
*
|
|
430
|
+
* Conflict Types for @pol-studios/db
|
|
431
|
+
*
|
|
432
|
+
* Canonical type definitions for conflict detection and resolution.
|
|
433
|
+
* These types are shared between @pol-studios/db and @pol-studios/powersync.
|
|
434
|
+
*/
|
|
435
|
+
/**
|
|
436
|
+
* Represents a field-level conflict where both local and server changed the same field.
|
|
437
|
+
*/
|
|
438
|
+
interface FieldConflict {
|
|
439
|
+
/** The field name that has conflicting changes */
|
|
440
|
+
field: string;
|
|
441
|
+
/** The local (pending) value */
|
|
442
|
+
localValue: unknown;
|
|
443
|
+
/** The current server value */
|
|
444
|
+
serverValue: unknown;
|
|
445
|
+
/** User who made the server change (from AuditLog.changeBy) */
|
|
446
|
+
changedBy: string | null;
|
|
447
|
+
/** When the server change occurred (from AuditLog.changeAt) */
|
|
448
|
+
changedAt: Date;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Result of checking for conflicts between local changes and server state.
|
|
452
|
+
*/
|
|
453
|
+
interface ConflictCheckResult {
|
|
454
|
+
/** Whether any field conflicts were detected */
|
|
455
|
+
hasConflict: boolean;
|
|
456
|
+
/** List of field-level conflicts */
|
|
457
|
+
conflicts: FieldConflict[];
|
|
458
|
+
/** Fields that can safely sync (no server changes) */
|
|
459
|
+
nonConflictingChanges: string[];
|
|
460
|
+
/** The table name */
|
|
461
|
+
table: string;
|
|
462
|
+
/** The record ID */
|
|
463
|
+
recordId: string;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* User's resolution choice for a conflict.
|
|
467
|
+
*/
|
|
468
|
+
type ConflictResolution = {
|
|
469
|
+
action: 'overwrite';
|
|
470
|
+
} | {
|
|
471
|
+
action: 'keep-server';
|
|
472
|
+
} | {
|
|
473
|
+
action: 'partial';
|
|
474
|
+
fields: string[];
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Interface for ConflictBus from @pol-studios/powersync.
|
|
479
|
+
* Defined here to avoid circular dependency between packages.
|
|
480
|
+
*/
|
|
481
|
+
interface ConflictBusInterface {
|
|
482
|
+
onConflict: (listener: (conflict: ConflictCheckResult) => void) => () => void;
|
|
483
|
+
onResolution: (listener: (table: string, recordId: string, resolution: ConflictResolution) => void) => () => void;
|
|
484
|
+
emitConflict: (conflict: ConflictCheckResult) => void;
|
|
485
|
+
emitResolution: (table: string, recordId: string, resolution: ConflictResolution) => void;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Context value provided to consumers.
|
|
489
|
+
*/
|
|
490
|
+
interface ConflictContextValue {
|
|
491
|
+
/** Current conflict state */
|
|
492
|
+
pendingConflicts: ConflictCheckResult[];
|
|
493
|
+
/** Add a conflict (called by connector) */
|
|
494
|
+
addConflict: (conflict: ConflictCheckResult) => void;
|
|
495
|
+
/** Resolve a single conflict by table and record ID */
|
|
496
|
+
resolveConflict: (table: string, recordId: string, resolution: ConflictResolution) => void;
|
|
497
|
+
/** Resolve all pending conflicts with the same resolution */
|
|
498
|
+
resolveAll: (resolution: ConflictResolution) => void;
|
|
499
|
+
/** Remove a conflict by table and record ID (after sync completes) */
|
|
500
|
+
removeConflict: (table: string, recordId: string) => void;
|
|
501
|
+
/** Get resolution for a specific table and record */
|
|
502
|
+
getResolution: (table: string, recordId: string) => ConflictResolution | undefined;
|
|
503
|
+
/** Clear all resolved conflicts from the resolutions map */
|
|
504
|
+
clearResolved: () => void;
|
|
505
|
+
/** Clear all conflicts (resolved and pending) */
|
|
506
|
+
clearAll: () => void;
|
|
507
|
+
/** Whether there are any pending conflicts */
|
|
508
|
+
hasConflicts: boolean;
|
|
509
|
+
}
|
|
510
|
+
declare const ConflictContext: react__default.Context<ConflictContextValue>;
|
|
511
|
+
interface ConflictProviderProps {
|
|
512
|
+
children: react__default.ReactNode;
|
|
513
|
+
/**
|
|
514
|
+
* Optional: Event bus for receiving conflicts from the connector.
|
|
515
|
+
* When provided, the provider will:
|
|
516
|
+
* - Subscribe to conflict events and add them to state
|
|
517
|
+
* - Emit resolution events when conflicts are resolved
|
|
518
|
+
*/
|
|
519
|
+
conflictBus?: ConflictBusInterface;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Provider component for conflict state management.
|
|
396
523
|
*
|
|
397
|
-
*
|
|
398
|
-
* and React Native environments.
|
|
524
|
+
* Wrap your app with this provider to enable conflict detection and resolution.
|
|
399
525
|
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```tsx
|
|
528
|
+
* <PowerSyncProvider connector={connector}>
|
|
529
|
+
* <ConflictProvider>
|
|
530
|
+
* <App />
|
|
531
|
+
* </ConflictProvider>
|
|
532
|
+
* </PowerSyncProvider>
|
|
533
|
+
* ```
|
|
402
534
|
*/
|
|
535
|
+
declare function ConflictProvider({ children, conflictBus }: ConflictProviderProps): react_jsx_runtime.JSX.Element;
|
|
536
|
+
|
|
403
537
|
/**
|
|
404
|
-
*
|
|
538
|
+
* Conflict State Hooks for @pol-studios/db
|
|
539
|
+
*
|
|
540
|
+
* Provides hooks for accessing and filtering conflict state.
|
|
405
541
|
*/
|
|
406
|
-
|
|
542
|
+
|
|
407
543
|
/**
|
|
408
|
-
*
|
|
544
|
+
* Hook to access the full conflict state and actions.
|
|
545
|
+
*
|
|
546
|
+
* @throws Error if used outside of ConflictProvider
|
|
547
|
+
* @returns Full conflict context value
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```tsx
|
|
551
|
+
* function ConflictManager() {
|
|
552
|
+
* const { pendingConflicts, resolveAll, clearResolved } = useConflictState();
|
|
409
553
|
*
|
|
410
|
-
*
|
|
554
|
+
* return (
|
|
555
|
+
* <View>
|
|
556
|
+
* <Text>{pendingConflicts.length} conflicts pending</Text>
|
|
557
|
+
* <Button onPress={() => resolveAll({ action: 'keep-server' })}>
|
|
558
|
+
* Accept All Server Changes
|
|
559
|
+
* </Button>
|
|
560
|
+
* </View>
|
|
561
|
+
* );
|
|
562
|
+
* }
|
|
563
|
+
* ```
|
|
411
564
|
*/
|
|
412
|
-
declare function
|
|
565
|
+
declare function useConflictState(): ConflictContextValue;
|
|
413
566
|
/**
|
|
414
|
-
*
|
|
415
|
-
*
|
|
567
|
+
* Hook to get only pending conflicts (read-only).
|
|
568
|
+
*
|
|
569
|
+
* Use this when you only need to display conflicts without resolution actions.
|
|
570
|
+
*
|
|
571
|
+
* @returns Array of pending conflicts
|
|
416
572
|
*
|
|
417
|
-
* @
|
|
573
|
+
* @example
|
|
574
|
+
* ```tsx
|
|
575
|
+
* function ConflictBadge() {
|
|
576
|
+
* const conflicts = usePendingConflicts();
|
|
577
|
+
* if (conflicts.length === 0) return null;
|
|
578
|
+
* return <Badge count={conflicts.length} />;
|
|
579
|
+
* }
|
|
580
|
+
* ```
|
|
418
581
|
*/
|
|
419
|
-
declare function
|
|
582
|
+
declare function usePendingConflicts(): ConflictCheckResult[];
|
|
420
583
|
/**
|
|
421
|
-
*
|
|
584
|
+
* Hook to check if there are any pending conflicts.
|
|
422
585
|
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
586
|
+
* Optimized for conditional rendering - only triggers re-render on boolean change.
|
|
587
|
+
*
|
|
588
|
+
* @returns True if there are pending conflicts
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```tsx
|
|
592
|
+
* function App() {
|
|
593
|
+
* const hasConflicts = useHasConflicts();
|
|
594
|
+
* return (
|
|
595
|
+
* <>
|
|
596
|
+
* {hasConflicts && <ConflictBanner />}
|
|
597
|
+
* <MainContent />
|
|
598
|
+
* </>
|
|
599
|
+
* );
|
|
600
|
+
* }
|
|
601
|
+
* ```
|
|
425
602
|
*/
|
|
426
|
-
declare function
|
|
603
|
+
declare function useHasConflicts(): boolean;
|
|
427
604
|
/**
|
|
428
|
-
*
|
|
429
|
-
*
|
|
605
|
+
* Hook to get a specific conflict by table and record ID.
|
|
606
|
+
*
|
|
607
|
+
* Returns null if no conflict exists for the record.
|
|
608
|
+
*
|
|
609
|
+
* @param table - The table name
|
|
610
|
+
* @param recordId - The record ID to look up
|
|
611
|
+
* @returns The conflict for this record, or null
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* ```tsx
|
|
615
|
+
* function RecordEditor({ table, recordId }: { table: string; recordId: string }) {
|
|
616
|
+
* const conflict = useConflictForRecord(table, recordId);
|
|
617
|
+
*
|
|
618
|
+
* if (conflict) {
|
|
619
|
+
* return <ConflictWarning conflict={conflict} />;
|
|
620
|
+
* }
|
|
621
|
+
*
|
|
622
|
+
* return <EditForm recordId={recordId} />;
|
|
623
|
+
* }
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
declare function useConflictForRecord(table: string, recordId: string): ConflictCheckResult | null;
|
|
627
|
+
/**
|
|
628
|
+
* Hook to get conflicts filtered by table name.
|
|
629
|
+
*
|
|
630
|
+
* Useful for showing conflicts scoped to a specific entity type.
|
|
631
|
+
*
|
|
632
|
+
* @param table - The table name to filter by
|
|
633
|
+
* @returns Conflicts for the specified table
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* ```tsx
|
|
637
|
+
* function EquipmentConflicts() {
|
|
638
|
+
* const conflicts = useConflictsForTable('EquipmentFixtureUnit');
|
|
639
|
+
* return (
|
|
640
|
+
* <FlatList
|
|
641
|
+
* data={conflicts}
|
|
642
|
+
* renderItem={({ item }) => <ConflictCard conflict={item} />}
|
|
643
|
+
* />
|
|
644
|
+
* );
|
|
645
|
+
* }
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
declare function useConflictsForTable(table: string): ConflictCheckResult[];
|
|
649
|
+
/**
|
|
650
|
+
* Hook to get conflict count by table.
|
|
651
|
+
*
|
|
652
|
+
* Returns a map of table names to conflict counts for summary display.
|
|
653
|
+
*
|
|
654
|
+
* @returns Map of table name to conflict count
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```tsx
|
|
658
|
+
* function ConflictSummary() {
|
|
659
|
+
* const countByTable = useConflictCountByTable();
|
|
660
|
+
* return (
|
|
661
|
+
* <View>
|
|
662
|
+
* {Array.from(countByTable.entries()).map(([table, count]) => (
|
|
663
|
+
* <Text key={table}>{table}: {count} conflicts</Text>
|
|
664
|
+
* ))}
|
|
665
|
+
* </View>
|
|
666
|
+
* );
|
|
667
|
+
* }
|
|
668
|
+
* ```
|
|
669
|
+
*/
|
|
670
|
+
declare function useConflictCountByTable(): Map<string, number>;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Conflict Resolution Hook for @pol-studios/db
|
|
674
|
+
*
|
|
675
|
+
* Provides methods for resolving individual conflicts.
|
|
676
|
+
*/
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Return type for useConflictResolution hook.
|
|
430
680
|
*/
|
|
431
|
-
|
|
681
|
+
interface UseConflictResolutionReturn {
|
|
682
|
+
/** The conflict being resolved */
|
|
683
|
+
conflict: ConflictCheckResult;
|
|
684
|
+
/** Resolve with a specific resolution */
|
|
685
|
+
resolve: (resolution: ConflictResolution) => void;
|
|
686
|
+
/** Accept server changes, discard local */
|
|
687
|
+
keepServer: () => void;
|
|
688
|
+
/** Overwrite server with local changes */
|
|
689
|
+
overwrite: () => void;
|
|
690
|
+
/** Only sync fields that don't conflict */
|
|
691
|
+
syncNonConflicting: () => void;
|
|
692
|
+
/** Sync specific fields only */
|
|
693
|
+
syncFields: (fields: string[]) => void;
|
|
694
|
+
/** Check if a specific field has a conflict */
|
|
695
|
+
hasFieldConflict: (field: string) => boolean;
|
|
696
|
+
/** Get conflict info for a specific field */
|
|
697
|
+
getFieldConflict: (field: string) => {
|
|
698
|
+
localValue: unknown;
|
|
699
|
+
serverValue: unknown;
|
|
700
|
+
changedBy: string | null;
|
|
701
|
+
changedAt: Date;
|
|
702
|
+
} | null;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Hook for resolving a specific conflict.
|
|
706
|
+
*
|
|
707
|
+
* Provides convenience methods for common resolution patterns.
|
|
708
|
+
*
|
|
709
|
+
* @param conflict - The conflict to resolve
|
|
710
|
+
* @returns Resolution methods and utilities
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```tsx
|
|
714
|
+
* function ConflictCard({ conflict }: { conflict: ConflictCheckResult }) {
|
|
715
|
+
* const {
|
|
716
|
+
* keepServer,
|
|
717
|
+
* overwrite,
|
|
718
|
+
* syncNonConflicting,
|
|
719
|
+
* hasFieldConflict,
|
|
720
|
+
* getFieldConflict,
|
|
721
|
+
* } = useConflictResolution(conflict);
|
|
722
|
+
*
|
|
723
|
+
* return (
|
|
724
|
+
* <Card>
|
|
725
|
+
* <Text>Conflict on {conflict.table}</Text>
|
|
726
|
+
* {conflict.conflicts.map(fc => (
|
|
727
|
+
* <View key={fc.field}>
|
|
728
|
+
* <Text>{fc.field}</Text>
|
|
729
|
+
* <Text>Yours: {String(fc.localValue)}</Text>
|
|
730
|
+
* <Text>Theirs: {String(fc.serverValue)} by {fc.changedBy}</Text>
|
|
731
|
+
* </View>
|
|
732
|
+
* ))}
|
|
733
|
+
* <Button onPress={keepServer}>Keep Theirs</Button>
|
|
734
|
+
* <Button onPress={overwrite}>Use Mine</Button>
|
|
735
|
+
* <Button onPress={syncNonConflicting}>Sync Safe Fields Only</Button>
|
|
736
|
+
* </Card>
|
|
737
|
+
* );
|
|
738
|
+
* }
|
|
739
|
+
* ```
|
|
740
|
+
*/
|
|
741
|
+
declare function useConflictResolution(conflict: ConflictCheckResult): UseConflictResolutionReturn;
|
|
742
|
+
/**
|
|
743
|
+
* Hook for bulk conflict resolution.
|
|
744
|
+
*
|
|
745
|
+
* Provides methods for resolving multiple conflicts at once.
|
|
746
|
+
*
|
|
747
|
+
* @returns Bulk resolution methods
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* ```tsx
|
|
751
|
+
* function ConflictSummary() {
|
|
752
|
+
* const conflicts = usePendingConflicts();
|
|
753
|
+
* const { resolveAllKeepServer, resolveAllOverwrite } = useBulkConflictResolution();
|
|
754
|
+
*
|
|
755
|
+
* return (
|
|
756
|
+
* <View>
|
|
757
|
+
* <Text>{conflicts.length} conflicts</Text>
|
|
758
|
+
* <Button onPress={resolveAllKeepServer}>Accept All Server Changes</Button>
|
|
759
|
+
* <Button onPress={resolveAllOverwrite}>Overwrite All with Mine</Button>
|
|
760
|
+
* </View>
|
|
761
|
+
* );
|
|
762
|
+
* }
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
declare function useBulkConflictResolution(): {
|
|
766
|
+
resolveAllKeepServer: () => void;
|
|
767
|
+
resolveAllOverwrite: () => void;
|
|
768
|
+
resolveAllSyncNonConflicting: () => void;
|
|
769
|
+
clearResolved: () => void;
|
|
770
|
+
conflictCount: number;
|
|
771
|
+
};
|
|
432
772
|
|
|
433
|
-
export { AdapterCapabilities, AdapterQueryResult, CapableDataAdapter, DataLayerConfig, DataLayerContextValue, DataLayerProvider, type DataLayerProviderProps, DatabaseSchema, PowerSyncAdapter, PowerSyncDatabase$1 as PowerSyncDatabase, QueryExecutor, QueryOptions, TableDataAdapter, type UseSupabaseUploadOptions, type UseSupabaseUploadReturn, createPowerSyncAdapter,
|
|
773
|
+
export { AdapterCapabilities, AdapterQueryResult, CapableDataAdapter, type ConflictCheckResult, ConflictContext, type ConflictContextValue, ConflictProvider, type ConflictProviderProps, type ConflictResolution, DataLayerConfig, DataLayerContextValue, DataLayerProvider, type DataLayerProviderProps, DatabaseSchema, type FieldConflict, PowerSyncAdapter, PowerSyncDatabase$1 as PowerSyncDatabase, QueryExecutor, QueryOptions, SyncStatusInfo, TableDataAdapter, type UseConflictResolutionReturn, type UseSupabaseUploadOptions, type UseSupabaseUploadReturn, createPowerSyncAdapter, sanitizeStorageKey, useBulkConflictResolution, useConflictCountByTable, useConflictForRecord, useConflictResolution, useConflictState, useConflictsForTable, useDbAttachmentUpload as useDbUpload, useHasConflicts, usePendingConflicts, useSupabaseUpload };
|