Skip to content

wikoci/payload-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payload CMS SDK + Plugin

✨ Features

  • Restful Method
  • Plugin Permission

Installation

npm i @wikoci/payloadjs
yarn @wikoci/payloadjs

SDK JS

import {Payload} from "@wikoci/payloadjs"

var payload =new Payload({
    key:'',
    apiURL:'',
    mediaURL:'',
    debug:true
})

find()

payload.find("slug",params,options);

findOne()

payload.findOne("slug",ID);

create()

payload.find("slug",data,options);

update()

payload.find("slug",ID,data,options);

deleteOne()

payload.find("slug",ID);

setToken()

payload.setToken();

clearToken()

payload.clearToken();

raw() Comming soon....

payload.raw(pipeline);

aggregate() Comming soon....

payload.aggregate("slug",pipeline);

Plugin

Permission plugin

This plugin active all feature : createdBy , updatedBy , and Permission utility.

** Notice: **

1- All slug contains users are allowed to use permission plugins and authentication execpt default payload users.

Ex: customer-users , public-users , doa-users

//payload.config.js

import {setPermission ,setConfigPermission} from "@wikoci/payloadjs/plugin/permission"

const config ={
    defaultPermission:{
    slug: {
        auth: ["create", "readAny"], // default permissions for Auth User :  create | readAny | readOwn | deleteAny | deleteOwn | updateOwn | updateAny
        public: ["readAny"],  // No auth user readAny | createAny | deleteAny | updateAny,
        readOnlyCreatedBy: true, // Admin UI
        readOnlyUpdatedBy: true, // Admin UI
  },
}
}

setConfigPermission(config) // Load permissions config before init plugin

plugins:[
    setPermission
]

About

Payload CMS Kit

Resources

Stars

Watchers

Forks

Packages

No packages published