@vivlab/api-database
Advanced tools
Comparing version 1.1.10 to 1.1.11
@@ -25,9 +25,7 @@ import type { Checkout, Tax } from "@vivlab/types"; | ||
export declare function calculate({ data, stripeAccount }: CalculateAccount): Promise<{ | ||
products: (Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
})[]; | ||
products: any; | ||
coupon: Checkout.Coupon | null; | ||
shipping: Checkout.Shipping | null; | ||
checkout: { | ||
subtotal: number; | ||
subtotal: any; | ||
discount: number; | ||
@@ -39,6 +37,4 @@ shipping: number; | ||
}>; | ||
export declare function getProducts({ articles, taxDefault, stripeAccount }: ArticlesAccount): Promise<(Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
})[]>; | ||
export declare function getProducts({ articles, taxDefault, stripeAccount }: ArticlesAccount): Promise<any>; | ||
export declare function getShipping({ id, products, stripeAccount }: IdProductsAccount): Promise<Checkout.Shipping>; | ||
export declare function getCoupon({ id, products, stripeAccount }: IdProductsAccount): Promise<Checkout.Coupon>; |
@@ -23,9 +23,7 @@ import type { Checkout } from "@vivlab/types"; | ||
shippings: Checkout.Shipping[]; | ||
products: (Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
})[]; | ||
products: any; | ||
coupon: Checkout.Coupon | null; | ||
shipping: Checkout.Shipping | null; | ||
checkout: { | ||
subtotal: number; | ||
subtotal: any; | ||
discount: number; | ||
@@ -32,0 +30,0 @@ shipping: number; |
@@ -18,3 +18,26 @@ import type { Prefix, ParentIdPrefix, ReorderPrefix, ParentActiveOnlyPrefix } from "../../../index"; | ||
export declare function flush({ prefix }: Prefix): Promise<void>; | ||
export declare function listByParentId({ parentId, activeOnly, prefix }: ParentActiveOnlyPrefix): Promise<Page.ApiElementData[]>; | ||
export declare function listByParentId({ parentId, activeOnly, prefix }: ParentActiveOnlyPrefix): Promise<{ | ||
id: any; | ||
page: any; | ||
type: any; | ||
active: any; | ||
nb_item: any; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]>; | ||
export declare function commandReorder({ id, sub, refId, pivot, prefix }: ReorderPrefix): Promise<{ | ||
@@ -21,0 +44,0 @@ commands: string[][]; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -8,2 +27,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const redis_1 = __importDefault(require("../../../libraries/redis")); | ||
const util_1 = require("../util"); | ||
const transform = __importStar(require("./transform")); | ||
exports.hashElement = redis_1.default.createStoreHash({ | ||
@@ -54,3 +75,5 @@ lastmod: true, | ||
active: { type: ["boolean", "null"] }, | ||
nb_item: { type: ["integer", "null"], minimum: 1 } | ||
nb_item: { type: ["integer", "null"], minimum: 1 }, | ||
...(0, util_1.generateTemplateSchema)("element"), | ||
...(0, util_1.generateLayoutSchema)("element") | ||
} | ||
@@ -74,3 +97,3 @@ } | ||
}); | ||
return result; | ||
return result.map(e => transform.redisToData(e)); | ||
} | ||
@@ -93,5 +116,5 @@ exports.listByParentId = listByParentId; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { items, _order, ...element } = elementList; | ||
const { items, _order, ...payload } = elementList; | ||
const { id, commands } = await exports.hashElement.commandCreate({ | ||
data: { ...element, page: pageId }, | ||
data: { ...transform.dataToRedis(payload), page: pageId }, | ||
order: _order, | ||
@@ -124,8 +147,3 @@ prefix | ||
id, | ||
data: { | ||
active: payload.active, | ||
nb_item: payload.nb_item, | ||
page: payload.page, | ||
type: payload.type | ||
}, | ||
data: transform.dataToRedis(payload), | ||
prefix | ||
@@ -132,0 +150,0 @@ }); |
import type { Page } from "@vivlab/types"; | ||
export declare function redisToData(data: any): Page.ApiElementData; | ||
export declare function redisToData(data: any): { | ||
id: any; | ||
page: any; | ||
type: any; | ||
active: any; | ||
nb_item: any; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}; | ||
export declare function dataToRedis(data: Page.ApiElementData): { | ||
@@ -4,0 +27,0 @@ id: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dataToRedis = exports.redisToData = void 0; | ||
const util_1 = require("../util"); | ||
function redisToData(data) { | ||
@@ -10,3 +11,5 @@ return { | ||
active: data.active, | ||
nb_item: data.nb_item | ||
nb_item: data.nb_item, | ||
template: (0, util_1.templateRedisToData)("element", data), | ||
layout: (0, util_1.layoutRedisToData)("element", data) | ||
}; | ||
@@ -21,3 +24,5 @@ } | ||
active: data.active, | ||
nb_item: data.nb_item | ||
nb_item: data.nb_item, | ||
...(0, util_1.templateDataToRedis)("element", data.template), | ||
...(0, util_1.layoutDataToRedis)("element", data.layout) | ||
}; | ||
@@ -24,0 +29,0 @@ } |
@@ -12,8 +12,119 @@ import * as hashItem from "./items"; | ||
elements: { | ||
items: import("./items/transform").ApiPageItemData[]; | ||
id: string; | ||
page: string; | ||
active: boolean; | ||
type: string; | ||
nb_item: number; | ||
items: { | ||
id: string; | ||
page: string; | ||
pagel: string; | ||
media: { | ||
type: "image" | "youtube" | "vimeo" | null; | ||
ratio: "1/1" | "4/3" | "3/2" | "8/5" | "16/10" | "16/9" | "21/9" | null; | ||
src: string | null; | ||
contain: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
style: { | ||
textAlign: "center" | "left" | "right" | "justify"; | ||
backgroundColor: string | null; | ||
}; | ||
inner: { | ||
text: { | ||
subtitle: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
title: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
paragraph: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
button: { | ||
type: "button" | "email" | "calendly" | null; | ||
link: string | null; | ||
text: string | null; | ||
color: string | null; | ||
dark: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]; | ||
id: any; | ||
page: any; | ||
type: any; | ||
active: any; | ||
nb_item: any; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]; | ||
@@ -35,8 +146,119 @@ id: string; | ||
elements: { | ||
items: import("./items/transform").ApiPageItemData[]; | ||
id: string; | ||
page: string; | ||
active: boolean; | ||
type: string; | ||
nb_item: number; | ||
items: { | ||
id: string; | ||
page: string; | ||
pagel: string; | ||
media: { | ||
type: "image" | "youtube" | "vimeo" | null; | ||
ratio: "1/1" | "4/3" | "3/2" | "8/5" | "16/10" | "16/9" | "21/9" | null; | ||
src: string | null; | ||
contain: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
style: { | ||
textAlign: "center" | "left" | "right" | "justify"; | ||
backgroundColor: string | null; | ||
}; | ||
inner: { | ||
text: { | ||
subtitle: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
title: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
paragraph: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
button: { | ||
type: "button" | "email" | "calendly" | null; | ||
link: string | null; | ||
text: string | null; | ||
color: string | null; | ||
dark: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]; | ||
id: any; | ||
page: any; | ||
type: any; | ||
active: any; | ||
nb_item: any; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]; | ||
@@ -51,8 +273,119 @@ id: string; | ||
elements: { | ||
items: import("./items/transform").ApiPageItemData[]; | ||
id: string; | ||
page: string; | ||
active: boolean; | ||
type: string; | ||
nb_item: number; | ||
items: { | ||
id: string; | ||
page: string; | ||
pagel: string; | ||
media: { | ||
type: "image" | "youtube" | "vimeo" | null; | ||
ratio: "1/1" | "4/3" | "3/2" | "8/5" | "16/10" | "16/9" | "21/9" | null; | ||
src: string | null; | ||
contain: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
style: { | ||
textAlign: "center" | "left" | "right" | "justify"; | ||
backgroundColor: string | null; | ||
}; | ||
inner: { | ||
text: { | ||
subtitle: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
title: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
paragraph: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
button: { | ||
type: "button" | "email" | "calendly" | null; | ||
link: string | null; | ||
text: string | null; | ||
color: string | null; | ||
dark: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]; | ||
id: any; | ||
page: any; | ||
type: any; | ||
active: any; | ||
nb_item: any; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]; | ||
@@ -59,0 +392,0 @@ id: string; |
@@ -1,2 +0,1 @@ | ||
import * as transform from "./transform"; | ||
import type { Page } from "@vivlab/types"; | ||
@@ -17,4 +16,192 @@ import type { Prefix, ActiveOnlyPrefix, ParentActiveOnlyPrefix, ParentIdPrefix } from "../../../index"; | ||
}>; | ||
export declare function list({ activeOnly, prefix }: ActiveOnlyPrefix): Promise<transform.ApiPageItemData[]>; | ||
export declare function listByParentId({ parentId, activeOnly, prefix }: ParentActiveOnlyPrefix): Promise<transform.ApiPageItemData[]>; | ||
export declare function list({ activeOnly, prefix }: ActiveOnlyPrefix): Promise<{ | ||
id: string; | ||
page: string; | ||
pagel: string; | ||
media: { | ||
type: "image" | "youtube" | "vimeo" | null; | ||
ratio: "1/1" | "4/3" | "3/2" | "8/5" | "16/10" | "16/9" | "21/9" | null; | ||
src: string | null; | ||
contain: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
style: { | ||
textAlign: "center" | "left" | "right" | "justify"; | ||
backgroundColor: string | null; | ||
}; | ||
inner: { | ||
text: { | ||
subtitle: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
title: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
paragraph: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
button: { | ||
type: "button" | "email" | "calendly" | null; | ||
link: string | null; | ||
text: string | null; | ||
color: string | null; | ||
dark: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]>; | ||
export declare function listByParentId({ parentId, activeOnly, prefix }: ParentActiveOnlyPrefix): Promise<{ | ||
id: string; | ||
page: string; | ||
pagel: string; | ||
media: { | ||
type: "image" | "youtube" | "vimeo" | null; | ||
ratio: "1/1" | "4/3" | "3/2" | "8/5" | "16/10" | "16/9" | "21/9" | null; | ||
src: string | null; | ||
contain: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
style: { | ||
textAlign: "center" | "left" | "right" | "justify"; | ||
backgroundColor: string | null; | ||
}; | ||
inner: { | ||
text: { | ||
subtitle: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
title: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
paragraph: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
button: { | ||
type: "button" | "email" | "calendly" | null; | ||
link: string | null; | ||
text: string | null; | ||
color: string | null; | ||
dark: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}[]>; | ||
export declare function commandListCreate({ list, prefix }: CommandListCreate): Promise<string[][]>; | ||
@@ -21,0 +208,0 @@ export declare function commandListUpdate({ list, prefix }: CommandListUpdate): Promise<string[][]>; |
@@ -28,2 +28,3 @@ "use strict"; | ||
const transform = __importStar(require("./transform")); | ||
const util_1 = require("../util"); | ||
exports.hashItem = redis_1.default.createStoreHash({ | ||
@@ -57,3 +58,9 @@ lastmod: true, | ||
button_color: { type: ["string", "null"], maxLength: 500 }, | ||
button_dark: { type: ["boolean", "null"] } | ||
button_dark: { type: ["boolean", "null"] }, | ||
...(0, util_1.generateLayoutSchema)("item"), | ||
...(0, util_1.generateTemplateSchema)("item"), | ||
...(0, util_1.generateTemplateSchema)("button"), | ||
...(0, util_1.generateTemplateSchema)("text"), | ||
...(0, util_1.generateTemplateSchema)("media"), | ||
...(0, util_1.generateTemplateSchema)("inner") | ||
} | ||
@@ -60,0 +67,0 @@ } |
@@ -6,3 +6,3 @@ import type { Page } from "@vivlab/types"; | ||
}; | ||
export interface RedisDataItem { | ||
export declare type RedisDataItem = { | ||
id: ApiPageItemData["id"]; | ||
@@ -28,4 +28,98 @@ page: ApiPageItemData["page"]; | ||
button_dark: Page.Button["dark"]; | ||
} | ||
export declare function redisToData(data: RedisDataItem): ApiPageItemData; | ||
}; | ||
export declare function redisToData(data: RedisDataItem): { | ||
id: string; | ||
page: string; | ||
pagel: string; | ||
media: { | ||
type: "image" | "youtube" | "vimeo" | null; | ||
ratio: "1/1" | "4/3" | "3/2" | "8/5" | "16/10" | "16/9" | "21/9" | null; | ||
src: string | null; | ||
contain: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
style: { | ||
textAlign: "center" | "left" | "right" | "justify"; | ||
backgroundColor: string | null; | ||
}; | ||
inner: { | ||
text: { | ||
subtitle: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
title: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
paragraph: { | ||
text: string | null; | ||
color: string | null; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
button: { | ||
type: "button" | "email" | "calendly" | null; | ||
link: string | null; | ||
text: string | null; | ||
color: string | null; | ||
dark: boolean; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
}; | ||
template: { | ||
rounded: unknown; | ||
shadow: unknown; | ||
order: unknown; | ||
padding: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
textAlign: unknown; | ||
w: unknown; | ||
} | undefined; | ||
layout: { | ||
grid: unknown; | ||
gap: unknown; | ||
justify: unknown; | ||
align: unknown; | ||
mode: unknown; | ||
} | undefined; | ||
}; | ||
export declare function dataToRedis(payload: Partial<ApiPageItemData>): Partial<RedisDataItem>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dataToRedis = exports.redisToData = void 0; | ||
const util_1 = require("../util"); | ||
function redisToData(data) { | ||
@@ -13,3 +14,4 @@ return { | ||
src: data.media_src, | ||
contain: data.media_contain | ||
contain: data.media_contain, | ||
template: (0, util_1.templateRedisToData)("media", data) | ||
}, | ||
@@ -20,21 +22,30 @@ style: { | ||
}, | ||
subtitle: { | ||
text: data.subtitle_text, | ||
color: data.subtitle_color | ||
inner: { | ||
text: { | ||
subtitle: { | ||
text: data.subtitle_text, | ||
color: data.subtitle_color | ||
}, | ||
title: { | ||
text: data.title_text, | ||
color: data.title_color | ||
}, | ||
paragraph: { | ||
text: data.paragraph_text, | ||
color: data.paragraph_color | ||
}, | ||
template: (0, util_1.templateRedisToData)("text", data) | ||
}, | ||
button: { | ||
type: data.button_type, | ||
link: data.button_link, | ||
text: data.button_text, | ||
color: data.button_color, | ||
dark: data.button_dark, | ||
template: (0, util_1.templateRedisToData)("button", data) | ||
}, | ||
template: (0, util_1.templateRedisToData)("inner", data) | ||
}, | ||
title: { | ||
text: data.title_text, | ||
color: data.title_color | ||
}, | ||
paragraph: { | ||
text: data.paragraph_text, | ||
color: data.paragraph_color | ||
}, | ||
button: { | ||
type: data.button_type, | ||
link: data.button_link, | ||
text: data.button_text, | ||
color: data.button_color, | ||
dark: data.button_dark | ||
} | ||
template: (0, util_1.templateRedisToData)("item", data), | ||
layout: (0, util_1.layoutRedisToData)("item", data) | ||
}; | ||
@@ -47,7 +58,7 @@ } | ||
pagel: payload.pagel, | ||
button_type: payload.button?.type, | ||
button_link: payload.button?.link, | ||
button_text: payload.button?.text, | ||
button_color: payload.button?.color, | ||
button_dark: payload.button?.dark, | ||
button_type: payload.inner?.button?.type, | ||
button_link: payload.inner?.button?.link, | ||
button_text: payload.inner?.button?.text, | ||
button_color: payload.inner?.button?.color, | ||
button_dark: payload.inner?.button?.dark, | ||
media_type: payload.media?.type, | ||
@@ -57,10 +68,16 @@ media_ratio: payload.media?.ratio, | ||
media_contain: payload.media?.contain, | ||
paragraph_text: payload.paragraph?.text, | ||
paragraph_color: payload.paragraph?.color, | ||
paragraph_text: payload.inner?.text?.paragraph?.text, | ||
paragraph_color: payload.inner?.text?.paragraph?.color, | ||
style_textAlign: payload.style?.textAlign, | ||
style_backgroundColor: payload.style?.backgroundColor, | ||
subtitle_text: payload.subtitle?.text, | ||
subtitle_color: payload.subtitle?.color, | ||
title_text: payload.title?.text, | ||
title_color: payload.title?.color | ||
subtitle_text: payload.inner?.text?.subtitle?.text, | ||
subtitle_color: payload.inner?.text?.subtitle?.color, | ||
title_text: payload.inner?.text?.title?.text, | ||
title_color: payload.inner?.text?.title?.color, | ||
...(0, util_1.templateDataToRedis)("item", payload.template), | ||
...(0, util_1.layoutDataToRedis)("item", payload.layout), | ||
...(0, util_1.templateDataToRedis)("media", payload.media?.template), | ||
...(0, util_1.templateDataToRedis)("inner", payload.inner?.template), | ||
...(0, util_1.templateDataToRedis)("button", payload.inner?.button?.template), | ||
...(0, util_1.templateDataToRedis)("text", payload.inner?.text?.template) | ||
}; | ||
@@ -67,0 +84,0 @@ } |
import * as transform from "./transform"; | ||
import ProductPrice from "../../functional/ProductPrice"; | ||
import type { Product } from "@vivlab/types"; | ||
export declare const hashProducts: import("@vivlab/redis-queries/dist/StoreHash").default; | ||
declare const products: ProductPrice<Omit<Product.ApiProductData, "prices">, Product.ApiPriceData>; | ||
export { transform }; | ||
export default products; |
@@ -56,3 +56,40 @@ "use strict"; | ||
}); | ||
exports.default = products; | ||
const redisToData = data => { | ||
return { options: data.options ?? [] }; | ||
}; | ||
const dataToRedis = data => { | ||
return { options: data.options }; | ||
}; | ||
const productCrud = { | ||
...products, | ||
retrieve: async ({ id, stripeAccount }) => { | ||
const product = await products.retrieve({ id, stripeAccount }); | ||
const productRedis = await exports.hashProducts.retrieve({ id, prefix: stripeAccount }); | ||
return { ...product, ...redisToData(productRedis) }; | ||
}, | ||
create: async ({ id, data, stripeAccount }) => { | ||
const product = await products.create({ data, stripeAccount }); | ||
const productRedis = await exports.hashProducts.create({ | ||
id, | ||
data: dataToRedis(data), | ||
prefix: stripeAccount | ||
}); | ||
return { ...product, ...redisToData(productRedis) }; | ||
}, | ||
update: async ({ id, data, stripeAccount }) => { | ||
const product = await products.update({ id, data, stripeAccount }); | ||
const productRedis = await exports.hashProducts.update({ | ||
id, | ||
data: dataToRedis(data), | ||
prefix: stripeAccount | ||
}); | ||
return { ...product, ...redisToData(productRedis) }; | ||
}, | ||
del: async ({ id, stripeAccount }) => { | ||
const product = await products.del({ id, stripeAccount }); | ||
await exports.hashProducts.del({ id, prefix: stripeAccount }); | ||
return product; | ||
} | ||
}; | ||
exports.default = productCrud; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@vivlab/api-database", | ||
"version": "1.1.10", | ||
"version": "1.1.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
424079
166
7112