npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@1amageek/tradestore

v0.4.3

Published

Cloud Firestore model framework for TypeScript - Google

Downloads

105

Readme

tradestore.ts

Usage

Inventory

SKU

/version/1/any_product/:product_id/skus/:sku_id/
export interface SKUProtocol<Stock extends StockProtocol> extends DocumentType {
    selledBy: string
    createdBy: string
    product?: firebase.firestore.DocumentReference
    currency: Currency
    amount: number
    inventory: Inventory
    isAvailable: boolean

    /// Maximum number of fetches to acquire at one time
    numberOfFetch: number
    stocks: Collection<Stock>
}

Stock

/version/1/any_product/:product_id/skus/:sku_id/stocks/:stock_id
export interface StockProtocol extends DocumentType {
    isAvailable: boolean
    SKU: string
    order?: string
    item?: firebase.firestore.DocumentReference
}

Trade

User

/version/1/user/:user_id/
export interface UserProtocol
    <
    Order extends OrderProtocol<OrderItem>,
    OrderItem extends OrderItemProtocol,
    TradeTransaction extends TradeTransactionProtocol
    > extends DocumentType {
    isAvailable: boolean
    country: string
    orders: Collection<Order>
    receivedOrders: Collection<Order>
    tradeTransactions: Collection<TradeTransaction>
}

Order

/version/1/user/:user_id/orders/:order_id
/version/1/user/:user_id/receivedOrders/:order_id
export interface OrderProtocol<OrderItem extends OrderItemProtocol> extends DocumentType {
    parentID?: string
    purchasedBy: string
    selledBy: string
    shippingTo: { [key: string]: string }
    transferredTo: { [key: string]: true }
    paidAt?: firebase.firestore.Timestamp
    cancelableDate?: firebase.firestore.Timestamp
    expirationDate?: firebase.firestore.Timestamp
    currency: Currency
    amount: number
    items: OrderItem[]
    paymentStatus: OrderPaymentStatus
    transferStatus: OrderTransferStatus
    transactionResults: TransactionResult[]
    isCancelled: boolean
}

TradeTransaction

/version/1/user/:user_id/tradeTransactions/:tradeTransaction_id
export interface TradeTransactionProtocol extends DocumentType {
    type: TradeTransactionType
    selledBy: string
    purchasedBy: string
    order: string
    product?: firebase.firestore.DocumentReference
    sku: string
    stock?: string
    item: firebase.firestore.DocumentReference
}

Balance

Account

/version/1/account/:account_id/
export interface AccountProtocol<Transaction extends BalanceTransactionProtocol, Payout extends PayoutProtocol> extends DocumentType {
    country: string
    isRejected: boolean
    isSigned: boolean
    balance: Balance
    balanceTransactions: Collection<Transaction>
    payoutRequests: Collection<Payout>
    accountInformation: { [key: string]: any }
}

Payout

/version/1/account/:account_id/payoutRequests/:payoutRequest_id
export interface PayoutProtocol extends DocumentType {
    account: string
    currency: Currency
    amount: number
    status: PayoutStatus
    transactionResults: TransactionResult[]
    isCancelled: boolean
}

BalanceTransaction

/version/1/account/:account_id/balanceTransactions/:balanceTransaction_id
export interface BalanceTransactionProtocol extends DocumentType {
    type: BalanceTransactionType
    currency: Currency
    amount: number
    from: AccountOrDestination
    to: AccountOrDestination
    order?: string
    transfer?: string
    payout?: string
    transactionResults: TransactionResult[]
}

Payment Delegate


export interface PaymentDelegate {

    authorize<U extends OrderItemProtocol, T extends OrderProtocol<U>>(currency: Currency, amount: number, order: T, options: PaymentOptions): Promise<any>

    authorizeCancel<U extends OrderItemProtocol, T extends OrderProtocol<U>>(currency: Currency, amount: number, order: T, options: PaymentOptions): Promise<any>

    pay<U extends OrderItemProtocol, T extends OrderProtocol<U>>(currency: Currency, amount: number, order: T, options: PaymentOptions): Promise<any>

    refund<U extends OrderItemProtocol, T extends OrderProtocol<U>>(currency: Currency, amount: number, order: T, options: PaymentOptions, reason?: string): Promise<any>

    partRefund<U extends OrderItemProtocol, T extends OrderProtocol<U>>(currency: Currency, amount: number, order: T, orderItem: U, options: PaymentOptions, reason?: string): Promise<any>

    transfer<OrderItem extends OrderItemProtocol, Order extends OrderProtocol<OrderItem>,
        BalanceTransaction extends BalanceTransactionProtocol,
        Payout extends PayoutProtocol,
        Account extends AccountProtocol<BalanceTransaction, Payout>>(currency: Currency, amount: number, order: Order, toAccount: Account, options: TransferOptions): Promise<any>

    transferCancel<U extends OrderItemProtocol, T extends OrderProtocol<U>>(currency: Currency, amount: number, order: T, options: TransferOptions, reason?: string): Promise<any>

    payout(currency: Currency, amount: number, accountID: string, options: PayoutOptions): Promise<any>

    payoutCancel(currency: Currency, amount: number, accountID: string, options: PayoutOptions): Promise<any>

}