@airplane/views
Version:
A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.
61 lines (60 loc) • 1.39 kB
JavaScript
function getFullQuery(q) {
var _a, _b;
if (typeof q === "string") {
return {
slug: q
};
}
if (typeof q === "function") {
if (!((_b = (_a = q == null ? void 0 : q.__airplane) == null ? void 0 : _a.config) == null ? void 0 : _b.slug)) {
throw new Error("function is not an Airplane task function");
}
return {
fn: q
};
}
return q;
}
function getFullMutation(m) {
var _a, _b;
if (typeof m === "string") {
return {
slug: m
};
}
if (typeof m === "function") {
if (!((_b = (_a = m == null ? void 0 : m.__airplane) == null ? void 0 : _a.config) == null ? void 0 : _b.slug)) {
throw new Error("function is not an Airplane task function");
}
return {
fn: m
};
}
return m;
}
function getSlug(fullQuery) {
var _a, _b;
if ("slug" in fullQuery && fullQuery.slug != null) {
return fullQuery.slug;
}
const fn = fullQuery.fn;
if (!((_b = (_a = fn == null ? void 0 : fn.__airplane) == null ? void 0 : _a.config) == null ? void 0 : _b.slug)) {
throw new Error("function is not an Airplane task function");
}
return fn.__airplane.config.slug;
}
function getRunbookFullMutation(m) {
if (typeof m === "string") {
return {
slug: m
};
}
return m;
}
export {
getFullMutation,
getFullQuery,
getRunbookFullMutation,
getSlug
};
//# sourceMappingURL=query.js.map