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

@leoantares/phiv-core

v0.16.85

Published

Core package for Pharmactiv projects

Downloads

631

Readme

Pharmactiv code package

This package intend to publish common code regarding the Pharmactiv projets


Apis

To use an API simply instanciate it const apiCategory = new ApiCategory(config).

The Configuration object:

interface IConfiguration {
  baseURL: string;
  headers: Object;
  timeout: number;
}
const configuration: IConfiguration = {
  baseURL: "https://www.api.com",
  fileMaxSize: 15000000,
  headers: {},
  timeout: 60000
};

Constants

The exported variable API_CONSTANTS exposes the following set of constants: ACCOUNTS, DISCOUNTS, HIGHLIGHTS, PAGES.

Assistance

List of endpoints: get, getById, post, patch, delete.

Category

List of endpoints: get, getPostsById, getByType, post, patch, positionByType, delete.

Drugstore

interface IDrugstoreSearch {
    nw: string<lat, lng>;
    se: string<lat, lng>;
    assistances: string<uuid>[];
    specializations: string<uuid>[];
}

List of endpoints: get, getBy, getById, search(query: IDrugstoreSearch, config?: IConfiguration), register(), patch.

Drugstore Membership

List of endpoints: get, getById, patch.

File

List of endpoints: upload(isMultiple: boolean, isBase64: boolean), getFile.

const query = {
    url: '<file_url>',
}

const { data } = await apiFile.getFile(query);

Highlight

List of endpoints: get(contextType?: string, contextId?: string, config?: IConfiguration), getById, getByType(type: integer, contextType?: string, contextId?: string, config?: IConfiguration), getByTypeWithQuery, post, patch, delete.

If necessary, you can send queries from Frontend to filter results like example below :

Method getByTypeWithQuery :

const query = { 
    env: '<env>' // Integer - Available values : API_CONSTANTS.PHREF_ENVS (For now env parameter works only with Highlight's type API_CONSTANTS.HIGHLIGHTS.HOMEPAGE_CATALOG)
};

const { data } = await apiHighlight.getByTypeWithQuery(
    '<highlight_type>', // Integer - Available values : API_CONSTANTS.HIGHLIGHTS.HOMEPAGE_CATALOG
    query
);

Highlightable

List of endpoints: patch, delete.

Page

List of endpoints: get, post, patch, delete.

Partoo

List of endpoints: auth, businesses, organizations, users, categories.

Patient

List of endpoints: version, verify, login, register, resendCode, requestResetPassword, resetPassword, me, verifyPhone, verifyPinCode, patch, patchLink, patchPassword, patchPinCode, delete, adelyaGet, adelyaPut, adelyaDelete, epsilonGet, epsilonPut, epsilonDelete, apiCoreGet, apiCorePost, apiCorePatch, apiCorePut, apiCoreDelete, linkGet, linkPost, linkPatch, linkPut, linkDelete.

Pharmanity

List of endpoints: categories, ranges.

Post

List of endpoints: get, getById, getBySlug, post, patch, delete.

If necessary, you can send queries from Frontend to filter results like example below :

const query = {
    categories: '<category_id>,<category_id>,...', // uuid,uuid,...
    level_id: '<level_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    min_date: '<min_date>', // Y-m-d H:i:s
    max_date: '<max_date>', // Y-m-d H:i:s
    search: '<search>', // String
}

const { data } = await apiPost.get(query);

Product

List of endpoints: get, getById, getByCategoryId(categoryId: integer, type: string<(medi|para)>, page?: integer, pharmanityId?: string, config?: IConfiguration), getPostsById, getStock, post, patch, delete.

Search

The endpoint is apiSearch.get(model: string, query: string, type?: number, config?: IConfiguration).

Models: product, drugstore, post.

Service

List of endpoints: get, getById, post, patch, delete.

Specialisation

List of endpoints: get, getById, post, patch, delete.

Universe

List of endpoints: get, getBySlug, post, patch, delete.

Popin

List of endpoints: get, post, delete.

Level

List of endpoints: get, getById, post, patch, delete.

Pack

List of endpoints: get, getById, post, patch, delete.

Zone

List of endpoints: get, getById, post, patch, delete.

Right

List of endpoints: get, getById, post, patch, delete.

Help

List of endpoints: get, getById, post, patch, position, delete.

Event

List of endpoints: get, getById, exportCsv, post, patch, delete, search, searchAdmin.

If necessary, you can send queries from Frontend to filter results like example below :

Method get (GET method) :

const query = {
    category_id: '<category_id>', // uuid
    level_id: '<level_id>', // uuid
    zone_id: '<zone_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    min_date: '<min_date>', // Y-m-d H:i:s
    max_date: '<max_date>', // Y-m-d H:i:s
    group: '<group>', // Integer - Available values : API_CONSTANTS.PHREF_GROUPS
    drugstore_id: '<drugstore_id>', // uuid
}

const { data } = await apiEvent.get(query);

Method search (POST method) :

const query = {
    category_id: '<category_id>', // uuid
    level_id: '<level_id>', // uuid
    zone_id: '<zone_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    min_date: '<min_date>', // Y-m-d H:i:s
    max_date: '<max_date>', // Y-m-d H:i:s
    group: '<group>', // Integer - Available values : API_CONSTANTS.PHREF_GROUPS
    drugstore_id: '<drugstore_id>', // uuid
}

const { data } = await apiEvent.search(query);

Registration

List of endpoints: get, getById, getPositionsList, post, patch, delete.

Docutheque

List of endpoints: get, getAdmin, post, patch, delete.

If necessary, you can send queries from Frontend to filter results like example below :

const query = {
    category_id: '<category_id>', // uuid
    level_id: '<level_id>', // uuid
    right_id: '<right_id>', // uuid
    packs: '<pack_id>,<pack_id>,...', // uuid,uuid,...
    type: '<type>', // Integer
    search: '<search>', // String
}

const { data } = await apiDocument.get(query);

Advancedpage

List of endpoints: get, getByCategory, getBySlug, post, patch, positionByCategory, delete.

Warning

List of endpoints: get, getAdmin, post, patch, import, delete.

Mydata

List of endpoints: get, getAdmin, getMyData, post, patch, import, delete.

If necessary, you can send queries from Frontend to filter results like example below :

const query = {
    min_date: '<min_date>', // Y-m-d
    max_date: '<max_date>', // Y-m-d
}

const { data } = await apiMydata.get(query);
const query = {
    history: '<bool>',
}

const { data } = await apiMydata.getMyData(
    '<mydata_id>', // uuid
    '<cip>', // String
    '<type>', // String - Available types values inside record returned by apiMydata.get()
    query
);

TransactionType (Opérations BRI)

List of endpoints: get, getAdmin, getByCategoryId, post, patch, delete.

User

interface ILog {
    email: string;
    password: string;
}

interface IResetPassword {
    password: string;
    confirmation_password: string;
    token: string;
}

List of User endpoints: login(logs: ILog, config?: IConfiguration), loginAsAdmin(logs: ILog, config?: IConfiguration), register(), registerPharmacist(), getById, post, patch, sendResetPasswordToken(email: string, config?: IConfiguration), resetPassword(data: IResetPassword, config?: IConfiguration), logout().

List of Account endpoints: logAccount(account: Account, config: IConfiguration), patchAccount.

List of Notifications endpoints: getUnreadNotifications, getReadNotifications, setNotificationAsRead.

apiUser.getUnreadNotifications(
    '<user_id>', // uuid
    '<type>', // String - Allowed values : 'post', 'document'
);
apiUser.getReadNotifications(
    '<user_id>', // uuid
    '<type>', // String - Allowed values : 'post', 'document'
);
apiUser.setNotificationAsRead(
    '<notification_id>', // uuid
);

Functions

Accounts

  • AccountsTypeLabel(type: integer)

Currency

  • FormatCurrency

Dates

  • DateFormat(date: Date, format: string)
  • DateFormatDistance(date1: Date, date2: Date)
  • DateFormatRelative(date1: Date, date2: Date)

For the moment, all dates are set in French.

Events

  • EventsDebounce(cb: Function): Function

Highlights

  • HighlightsFilter(highlights: Highlightable[], type: integer)
  • HighlightsFilterOne(highlights: Highlightable[], type: integer)
  • HihglightsGroup(Highlightable[])
  • HighlightsGetDiscountsLabel(discountType: integer)
  • HighlightsGetDiscountLabels(discountType: integer)
  • HighlightsGetPriceDescription(highlightable: IHighlightable)
  • HighlightsConvertCentsToEuro(price: string)

Notifications

interface INotification {
  content: string;
  timeout?: integer; // default 5000
}

List of notifications: custom, error, info, success.


How to publish on npm

  • Change package.json version and push it npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
  • npm publish --access public