@vivlab/api-database
Advanced tools
Comparing version 1.0.28 to 1.0.29
@@ -7,3 +7,3 @@ import type { Collection } from "@vivlab/types"; | ||
} | ||
export declare function listFlat({ prefix }: Prefix): Promise<{ | ||
export declare function listFlat({ activeOnly, prefix }: Prefix): Promise<{ | ||
collection: string | null; | ||
@@ -17,3 +17,3 @@ items: never[]; | ||
}[]>; | ||
export declare function list({ prefix }: Prefix): Promise<ApiCollectionNestedData[]>; | ||
export declare function list({ activeOnly, prefix }: Prefix): Promise<ApiCollectionNestedData[]>; | ||
export declare function retrieve({ id, prefix }: IdPrefix): Promise<Collection.ApiCollectionData>; | ||
@@ -20,0 +20,0 @@ export declare function create({ data, prefix }: DataPrefix<ApiCollectionData>): Promise<{ |
@@ -43,4 +43,4 @@ "use strict"; | ||
}); | ||
async function listFlat({ prefix }) { | ||
const list = await hashCollection.list({ prefix }); | ||
async function listFlat({ activeOnly, prefix }) { | ||
const list = await hashCollection.list({ activeOnly, prefix }); | ||
const arr = list.map(e => ({ ...e, collection: e.collection || null, items: [] })); | ||
@@ -50,4 +50,4 @@ return arr; | ||
exports.listFlat = listFlat; | ||
async function list({ prefix }) { | ||
const list = await listFlat({ prefix }); | ||
async function list({ activeOnly, prefix }) { | ||
const list = await listFlat({ activeOnly, prefix }); | ||
const { nested } = findChildren(list, null); | ||
@@ -54,0 +54,0 @@ return nested; |
@@ -24,3 +24,4 @@ "use strict"; | ||
valid: stripeData.valid, | ||
times_redeemed: stripeData.times_redeemed | ||
// times_redeemed: stripeData.times_redeemed | ||
times_redeemed: transform_1.literalToData.int(stripeData.metadata?.times_redeemed) || 0 | ||
}; | ||
@@ -46,4 +47,3 @@ } | ||
valid_coupon_at: data.valid_coupon_at || null, | ||
collections: transform_1.dataToLiteral.array(data.collections) || null, | ||
generated: "vivlab:2:active" | ||
collections: transform_1.dataToLiteral.array(data.collections) || null | ||
}, | ||
@@ -65,3 +65,3 @@ max_redemptions: data.max_redemptions || undefined, | ||
active: transform_1.dataToLiteral.boolean(data.active) || null, | ||
generated: "vivlab:2:active" | ||
times_redeemed: data.times_redeemed ?? undefined | ||
} | ||
@@ -68,0 +68,0 @@ }; |
import type { Facet } from "@vivlab/types"; | ||
import type { Prefix, DataPrefix, IdPrefix, IdDataPrefix } from "../../index"; | ||
export declare function list({ prefix }: Prefix): Promise<{ | ||
export declare function list({ activeOnly, prefix }: Prefix): Promise<{ | ||
items: Facet.FacetItem[]; | ||
@@ -5,0 +5,0 @@ id: string; |
@@ -53,6 +53,6 @@ "use strict"; | ||
}); | ||
async function list({ prefix }) { | ||
async function list({ activeOnly, prefix }) { | ||
const [facets, facetitems] = await Promise.all([ | ||
hashFacet.list({ prefix }), | ||
hashFacetItem.list({ prefix }) | ||
hashFacet.list({ activeOnly, prefix }), | ||
hashFacetItem.list({ activeOnly, prefix }) | ||
]); | ||
@@ -59,0 +59,0 @@ const list = []; |
@@ -16,3 +16,3 @@ import type { Prefix, ParentIdPrefix, ReorderPrefix, ListPrefix } from "../../../index"; | ||
export declare function flush({ prefix }: Prefix): Promise<void>; | ||
export declare function listByParentId({ parentId, prefix }: ParentIdPrefix): Promise<Page.ApiElementData[]>; | ||
export declare function listByParentId({ parentId, activeOnly, prefix }: ParentIdPrefix): Promise<Page.ApiElementData[]>; | ||
export declare function commandReorder({ id, sub, refId, pivot, prefix }: ReorderPrefix): Promise<{ | ||
@@ -19,0 +19,0 @@ commands: string[][]; |
@@ -66,4 +66,8 @@ "use strict"; | ||
exports.flush = flush; | ||
async function listByParentId({ parentId, prefix }) { | ||
const result = await exports.hashElement.listByParentId({ parentId, prefix }); | ||
async function listByParentId({ parentId, activeOnly, prefix }) { | ||
const result = await exports.hashElement.listByParentId({ | ||
parentId, | ||
activeOnly, | ||
prefix | ||
}); | ||
return result; | ||
@@ -70,0 +74,0 @@ } |
@@ -20,3 +20,3 @@ import * as hashItem from "./items"; | ||
}>; | ||
export declare function list({ prefix }: Prefix): Promise<{ | ||
export declare function list({ activeOnly, prefix }: Prefix): Promise<{ | ||
active: boolean; | ||
@@ -23,0 +23,0 @@ id: string; |
@@ -47,4 +47,4 @@ "use strict"; | ||
exports.retrieve = retrieve; | ||
async function list({ prefix }) { | ||
const list = await hashPage.list({ prefix }); | ||
async function list({ activeOnly, prefix }) { | ||
const list = await hashPage.list({ activeOnly, prefix }); | ||
return list; | ||
@@ -51,0 +51,0 @@ } |
@@ -17,6 +17,6 @@ import * as transform from "./itemsTransform"; | ||
}>; | ||
export declare function list({ prefix }: Prefix): Promise<transform.ApiPageItemData[]>; | ||
export declare function listByParentId({ parentId, prefix }: ParentIdPrefix): Promise<transform.ApiPageItemData[]>; | ||
export declare function list({ activeOnly, prefix }: Prefix): Promise<transform.ApiPageItemData[]>; | ||
export declare function listByParentId({ parentId, activeOnly, prefix }: ParentIdPrefix): Promise<transform.ApiPageItemData[]>; | ||
export declare function commandListCreate({ list, prefix }: CommandListCreate): Promise<string[][]>; | ||
export declare function commandListUpdate({ list, prefix }: CommandListUpdate): Promise<string[][]>; | ||
export declare function commandListDel({ list, prefix }: ListPrefix): Promise<string[][]>; |
@@ -65,9 +65,9 @@ "use strict"; | ||
exports.commandDelByParentId = commandDelByParentId; | ||
async function list({ prefix }) { | ||
const list = await exports.hashItem.list({ prefix }); | ||
async function list({ activeOnly, prefix }) { | ||
const list = await exports.hashItem.list({ activeOnly, prefix }); | ||
return list.map(e => transform.redisToData(e)); | ||
} | ||
exports.list = list; | ||
async function listByParentId({ parentId, prefix }) { | ||
const list = await exports.hashItem.listByParentId({ parentId, prefix }); | ||
async function listByParentId({ parentId, activeOnly, prefix }) { | ||
const list = await exports.hashItem.listByParentId({ parentId, activeOnly, prefix }); | ||
return list.map(e => transform.redisToData(e)); | ||
@@ -74,0 +74,0 @@ } |
@@ -7,3 +7,3 @@ import type { Page } from "@vivlab/types"; | ||
export declare function retrieve({ id, prefix }: IdPrefix): Promise<ApiPageData>; | ||
export declare function list({ prefix }: Prefix): Promise<ApiPageData[]>; | ||
export declare function list({ activeOnly, prefix }: Prefix): Promise<ApiPageData[]>; | ||
export declare function commandCreate({ data, prefix }: DataPrefix<EditedPageData>): Promise<{ | ||
@@ -10,0 +10,0 @@ id: string; |
@@ -28,4 +28,4 @@ "use strict"; | ||
exports.retrieve = retrieve; | ||
async function list({ prefix }) { | ||
const list = await exports.hashPage.list({ prefix }); | ||
async function list({ activeOnly, prefix }) { | ||
const list = await exports.hashPage.list({ activeOnly, prefix }); | ||
return list; | ||
@@ -32,0 +32,0 @@ } |
{ | ||
"name": "@vivlab/api-database", | ||
"version": "1.0.28", | ||
"version": "1.0.29", | ||
"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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
275532
4406