import { refreshAndRetryIfExpired } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param token Supabase `access_token` and `refresh_token`. `expires_at` (optional) is a UNIX
* timestamp in seconds.
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
type Supabase = {
url: string;
key: string;
};
export async function main(
auth: Supabase,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
token?: {
access: string;
refresh: string;
expires_at?: number;
},
count?: "exact" | "planned" | "estimated",
) {
return await refreshAndRetryIfExpired(auth, token, async (client) => {
let query: any = client
.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select();
}
return query;
});
}
Submitted by admin 496 days ago
import { refreshAndRetryIfExpired } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param token Supabase `access_token` and `refresh_token`. `expires_at` (optional) is a UNIX
* timestamp in seconds.
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
type Supabase = {
url: string;
key: string;
};
export async function main(
auth: Supabase,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
token?: {
access: string;
refresh: string;
expires_at?: number;
},
count?: "exact" | "planned" | "estimated",
) {
return await refreshAndRetryIfExpired(auth, token, async (client) => {
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select()
}
return query;
})
}
Submitted by admin 500 days ago
import { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts";
import { refreshAndRetryIfExpired } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param token Supabase `access_token` and `refresh_token`. `expires_at` (optional) is a UNIX
* timestamp in seconds.
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
token?: {
access: string;
refresh: string;
expires_at?: number;
},
count?: "exact" | "planned" | "estimated",
) {
return await refreshAndRetryIfExpired(auth, token, async (client) => {
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select()
}
return query;
})
}
Submitted by adam186 626 days ago
import { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts";
import { refreshAndRetryIfExpired } from "https://deno.land/x/windmill_helpers@v1.1.0/mod.ts";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param token Supabase `access_token` and `refresh_token`. `expires_at` (optional) is a UNIX
* timestamp in seconds.
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
token?: {
access: string;
refresh: string;
expires_at?: number;
},
count?: "exact" | "planned" | "estimated",
) {
return await refreshAndRetryIfExpired(auth, token, async (client) => {
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select()
}
return query;
})
}
Submitted by adam186 626 days ago
import { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts";
import { refreshAndRetryIfExpired } from "https://deno.land/x/windmill_helpers@v1.1.0/mod.ts";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param access_token It is only needed if you have an affecting RLS policy enabled
* on the table that you want to access.
* Learn more about RLS here: https://supabase.com/docs/guides/auth/row-level-security
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
token?: {
access: string;
refresh: string;
expires_at?: number;
},
count?: "exact" | "planned" | "estimated",
) {
return await refreshAndRetryIfExpired(auth, token, async (client) => {
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select()
}
return query;
})
}
Submitted by adam186 626 days ago
import { Resource } from "https://deno.land/x/windmill@v1.85.0/mod.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param access_token It is only needed if you have an affecting RLS policy enabled
* on the table that you want to access.
* Learn more about RLS here: https://supabase.com/docs/guides/auth/row-level-security
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
access_token?: string,
count?: "exact" | "planned" | "estimated",
) {
const headers = access_token ? {
global: { headers: { Authorization: `bearer ${access_token}` } },
} : undefined
const client = createClient(auth.url, auth.key, headers);
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select()
}
return await query;
}
Submitted by adam186 628 days ago
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param access_token It is only needed if you have an affecting RLS policy enabled
* on the table that you want to access.
* Learn more about RLS here: https://supabase.com/docs/guides/auth/row-level-security
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
access_token?: string,
count?: "exact" | "planned" | "estimated",
) {
const headers = access_token ? {
global: { headers: { Authorization: `bearer ${access_token}` } },
} : undefined
const client = createClient(auth.url, auth.key, headers);
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select()
}
return await query;
}
Submitted by adam186 636 days ago
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
return_updated: boolean = false,
count?: "exact" | "planned" | "estimated",
) {
const client = createClient(auth.url, auth.key);
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (return_updated) {
query = query.select()
}
return await query;
}
Submitted by adam186 636 days ago
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
returnUpdated: boolean = false,
count?: "exact" | "planned" | "estimated",
) {
const client = createClient(auth.url, auth.key);
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (returnUpdated) {
query = query.select()
}
return await query;
}
Submitted by admin 652 days ago
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
returnUpdated: boolean = false,
count?: "exact" | "planned" | "estimated",
) {
const client = createClient(auth.supabaseUrl, auth.supabaseKey);
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (returnUpdated) {
query = query.select()
}
return await query;
}
Submitted by adam186 663 days ago
import { Resource } from "https://deno.land/x/windmill@v1.60.0/mod.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
/**
* @param filter Learn more at https://supabase.com/docs/reference/javascript/filter
*
* @param count Count algorithm to use to count rows in the table or view.
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the hood.
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres statistics under the hood.
* `"estimated"`: Uses exact count for low numbers and planned count for high numbers.
*/
export async function main(
auth: Resource<"supabase">,
table: string,
values: any,
filter: {
column: string;
operator: string;
value: any;
},
returnUpdated: boolean = false,
count?: "exact" | "planned" | "estimated",
) {
const client = createClient(auth.supabaseUrl, auth.supabaseKey);
let query: any = client.from(table)
.update(values, { count })
.filter(filter.column, filter.operator, filter.value);
if (returnUpdated) {
query = query.select()
}
return await query;
}
Submitted by adam186 702 days ago