/**
* run script preview
*
*/
export async function main(
workspace: string,
include_header: string | undefined,
invisible_to_owner: string | undefined,
job_id: string | undefined,
body: {
content?: string;
path?: string;
args: { [k: string]: unknown };
language?:
| "python3"
| "deno"
| "go"
| "bash"
| "powershell"
| "postgresql"
| "mysql"
| "bigquery"
| "snowflake"
| "mssql"
| "graphql"
| "nativets"
| "bun";
tag?: string;
kind?: "code" | "identity" | "http";
dedicated_worker?: boolean;
lock?: string;
[k: string]: unknown;
}
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/jobs/run/preview`);
for (const [k, v] of [
["include_header", include_header],
["invisible_to_owner", invisible_to_owner],
["job_id", job_id],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + WM_TOKEN,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 370 days ago
/**
* run script preview
*
*/
export async function main(
workspace: string,
include_header: string | undefined,
invisible_to_owner: string | undefined,
job_id: string | undefined,
body: {
content?: string;
path?: string;
args: { [k: string]: unknown };
language?:
| "python3"
| "deno"
| "go"
| "bash"
| "powershell"
| "postgresql"
| "mysql"
| "bigquery"
| "snowflake"
| "mssql"
| "graphql"
| "nativets"
| "bun";
tag?: string;
kind?: "code" | "identity" | "http";
dedicated_worker?: boolean;
lock?: string;
[k: string]: unknown;
}
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/jobs/run/preview`);
for (const [k, v] of [
["include_header", include_header],
["invisible_to_owner", invisible_to_owner],
["job_id", job_id],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + WM_TOKEN,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 797 days ago
/**
* run script preview
*
*/
export async function main(
workspace: string,
include_header: string | undefined,
invisible_to_owner: string | undefined,
job_id: string | undefined,
body: {
content?: string;
path?: string;
args: { [k: string]: unknown };
language?:
| "python3"
| "deno"
| "go"
| "bash"
| "powershell"
| "postgresql"
| "mysql"
| "bigquery"
| "snowflake"
| "graphql"
| "nativets"
| "bun";
tag?: string;
kind?: "code" | "identity" | "http";
[k: string]: unknown;
}
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/jobs/run/preview`);
for (const [k, v] of [
["include_header", include_header],
["invisible_to_owner", invisible_to_owner],
["job_id", job_id],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + WM_TOKEN,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 931 days ago
/**
* run script preview
*
*/
export async function main(
workspace: string,
include_header: string | undefined,
invisible_to_owner: string | undefined,
job_id: string | undefined,
body: {
content?: string;
path?: string;
args: { [k: string]: unknown };
language?:
| "python3"
| "deno"
| "go"
| "bash"
| "powershell"
| "postgresql"
| "mysql"
| "bigquery"
| "snowflake"
| "graphql"
| "nativets"
| "bun";
tag?: string;
kind?: "code" | "identity" | "http";
[k: string]: unknown;
}
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/jobs/run/preview`);
for (const [k, v] of [
["include_header", include_header],
["invisible_to_owner", invisible_to_owner],
["job_id", job_id],
]) {
if (v !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + WM_TOKEN,
},
body: JSON.stringify(body),
});
return await response.text();
}
Submitted by rubenfiszel 933 days ago
/**
* run script preview
*
*/
export async function main(
workspace: string,
include_header: string | undefined,
invisible_to_owner: string | undefined,
job_id: string | undefined,
body: {
content?: string;
path?: string;
args: { [k: string]: unknown };
language?:
| "python3"
| "deno"
| "go"
| "bash"
| "powershell"
| "postgresql"
| "mysql"
| "bigquery"
| "snowflake"
| "graphql"
| "nativets"
| "bun";
tag?: string;
kind?: "code" | "identity" | "http";
[k: string]: unknown;
},
) {
const url = new URL(`${BASE_URL}/api/w/${workspace}/jobs/run/preview`);
for (const [k, v] of [
["include_header", include_header],
["invisible_to_owner", invisible_to_owner],
["job_id", job_id],
]) {
if (v !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + WM_TOKEN,
},
body: JSON.stringify(body),
});
return await response.text();
}
Submitted by admin 1003 days ago