supastash 0.2.14 → 0.2.15
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/desktop/utils/sync/pullFromRemote/updateLocalDb.js +2 -2
- package/dist/desktop/utils/sync/pushLocal/uploadChunk.js +1 -1
- package/dist/native/utils/sync/pullFromRemote/updateLocalDb.js +2 -2
- package/dist/native/utils/sync/pushLocal/uploadChunk.js +1 -1
- package/dist/shared/core/config/index.js +4 -4
- package/dist/shared/types/supastashConfig.types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -129,7 +129,7 @@ export async function upsertData({ tx, table, record, doesExist, }) {
|
|
|
129
129
|
try {
|
|
130
130
|
const db = tx ?? (await getSupastashDb());
|
|
131
131
|
const allColumns = await getTableSchema(table);
|
|
132
|
-
const pullFilterColumns = new Set(cfg.
|
|
132
|
+
const pullFilterColumns = new Set(cfg.ignoredColumns?.pull?.[table] ?? []);
|
|
133
133
|
const columns = pullFilterColumns.size
|
|
134
134
|
? allColumns.filter((c) => !pullFilterColumns.has(c))
|
|
135
135
|
: allColumns;
|
|
@@ -200,7 +200,7 @@ export async function upsertChunkData({ tx, table, records, }) {
|
|
|
200
200
|
return;
|
|
201
201
|
const db = tx ?? (await getSupastashDb());
|
|
202
202
|
const allColumns = await getTableSchema(table);
|
|
203
|
-
const pullFilterColumns = new Set(cfg.
|
|
203
|
+
const pullFilterColumns = new Set(cfg.ignoredColumns?.pull?.[table] ?? []);
|
|
204
204
|
const columns = pullFilterColumns.size
|
|
205
205
|
? allColumns.filter((c) => !pullFilterColumns.has(c))
|
|
206
206
|
: allColumns;
|
|
@@ -204,7 +204,7 @@ export async function uploadData(table, unsyncedRecords, onPushToRemote) {
|
|
|
204
204
|
const supabase = cfg.supabaseClient;
|
|
205
205
|
if (!supabase)
|
|
206
206
|
throw new Error("[Supastash] Supabase client not configured");
|
|
207
|
-
const pushFilterColumns = cfg.
|
|
207
|
+
const pushFilterColumns = cfg.ignoredColumns?.push?.[table] ?? [];
|
|
208
208
|
const cleaned = unsyncedRecords.map(({ synced_at, deleted_at, arrived_at, ...rest }) => {
|
|
209
209
|
const row = enforceTimestamps(normalizeForSupabase(rest));
|
|
210
210
|
for (const col of pushFilterColumns)
|
|
@@ -128,7 +128,7 @@ export async function upsertData({ tx, table, record, doesExist, }) {
|
|
|
128
128
|
try {
|
|
129
129
|
const db = tx ?? (await getSupastashDb());
|
|
130
130
|
const allColumns = await getTableSchema(table);
|
|
131
|
-
const pullFilterColumns = new Set(cfg.
|
|
131
|
+
const pullFilterColumns = new Set(cfg.ignoredColumns?.pull?.[table] ?? []);
|
|
132
132
|
const columns = pullFilterColumns.size
|
|
133
133
|
? allColumns.filter((c) => !pullFilterColumns.has(c))
|
|
134
134
|
: allColumns;
|
|
@@ -199,7 +199,7 @@ export async function upsertChunkData({ tx, table, records, }) {
|
|
|
199
199
|
return;
|
|
200
200
|
const db = tx ?? (await getSupastashDb());
|
|
201
201
|
const allColumns = await getTableSchema(table);
|
|
202
|
-
const pullFilterColumns = new Set(cfg.
|
|
202
|
+
const pullFilterColumns = new Set(cfg.ignoredColumns?.pull?.[table] ?? []);
|
|
203
203
|
const columns = pullFilterColumns.size
|
|
204
204
|
? allColumns.filter((c) => !pullFilterColumns.has(c))
|
|
205
205
|
: allColumns;
|
|
@@ -207,7 +207,7 @@ export async function uploadData(table, unsyncedRecords, onPushToRemote) {
|
|
|
207
207
|
const supabase = cfg.supabaseClient;
|
|
208
208
|
if (!supabase)
|
|
209
209
|
throw new Error("[Supastash] Supabase client not configured");
|
|
210
|
-
const pushFilterColumns = cfg.
|
|
210
|
+
const pushFilterColumns = cfg.ignoredColumns?.push?.[table] ?? [];
|
|
211
211
|
const cleaned = unsyncedRecords.map(({ synced_at, deleted_at, arrived_at, ...rest }) => {
|
|
212
212
|
const row = enforceTimestamps(normalizeForSupabase(rest));
|
|
213
213
|
for (const col of pushFilterColumns)
|
|
@@ -30,7 +30,7 @@ let _config = {
|
|
|
30
30
|
deleteConflictedRows: false,
|
|
31
31
|
pushRPCPath: undefined,
|
|
32
32
|
supastashMode: "live",
|
|
33
|
-
|
|
33
|
+
ignoredColumns: {
|
|
34
34
|
push: {},
|
|
35
35
|
pull: {},
|
|
36
36
|
},
|
|
@@ -118,9 +118,9 @@ export function configureSupastash(config) {
|
|
|
118
118
|
..._config.fieldEnforcement,
|
|
119
119
|
...config.fieldEnforcement,
|
|
120
120
|
},
|
|
121
|
-
|
|
122
|
-
push: config.
|
|
123
|
-
pull: config.
|
|
121
|
+
ignoredColumns: {
|
|
122
|
+
push: config.ignoredColumns?.push ?? _config.ignoredColumns?.push ?? {},
|
|
123
|
+
pull: config.ignoredColumns?.pull ?? _config.ignoredColumns?.pull ?? {},
|
|
124
124
|
},
|
|
125
125
|
};
|
|
126
126
|
_configured = true;
|
|
@@ -154,12 +154,12 @@ export type SupastashConfig<T extends SupastashSQLiteClientTypes> = {
|
|
|
154
154
|
* - `pull`: columns removed from each row before it is written to the local SQLite DB.
|
|
155
155
|
*
|
|
156
156
|
* @example
|
|
157
|
-
*
|
|
157
|
+
* ignoredColumns: {
|
|
158
158
|
* push: { orders: ["internal_notes", "cost_price"] },
|
|
159
159
|
* pull: { users: ["password_hash", "secret_token"] },
|
|
160
160
|
* }
|
|
161
161
|
*/
|
|
162
|
-
|
|
162
|
+
ignoredColumns?: {
|
|
163
163
|
push?: Record<string, string[]>;
|
|
164
164
|
pull?: Record<string, string[]>;
|
|
165
165
|
};
|