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

solidocity

v1.2.10

Published

* compatible with NodeJS * Typescript decorators metadata definitions

Downloads

21

Readme

Data access library for Solid PODs. Simple and clear.

  • compatible with NodeJS
  • Typescript decorators metadata definitions

Before usage you should provide authenticated fetch from your auth library, solid-auth-fetcher for example:

import {useFetch} from "solidocity";
useFetch(fetch);

Really simple:

const profile = new Profile(session.webId);
await profile.Init();
console.log(profile.Me.FullName);

profile.Me.Role = 'God of development';
profile.Me.Save();
await profile.Save();

Define your predicate schema:

const schema = {
   Person: '<person type definition URI>`,
   children: '<children predicate  URI>`
}

Define your models:

export class Profile extends Document {

    @entityField(Person)
    public Me: Person;

    @entitySet(ContextEntity, {isArray: true})
    public OtherPeople: EntitySet<Person>;

}


@entity(schema.Person)
export class Person extends Entity{
    @field(vcard.fn)
    public FullName: string;

    @field(vcard.role)
    public Role: string;

    @field(schema.children, {type: "ref", isArray: true, isOrdered: true})
    public Children: ValuesSet<string>;

}
  • supports multiple values and ordered arrays

  • supports ACL-files for reading and writing permissions

  • auth functions

    • useFetch(fetch) - registers fetch function
  • Document base class representing file in POD.

    • constructor(uri) - file uri
    • async Init() - loads file, on error creates it, on error throws it. All fields of Document will be available after Init.
    • async Save() - saves document ot file on POD; on error throws it.
    • Acl: AclDocument - control document permissions.
    • Subscribe() - reloads document on external changes
    • on('update'|'delete', listener) - subscribe for changes
  • Entity base class representing all triplets with same Subject in POD file

    • constructor(uri) for internal use only
    • Save() saves entity changes into document but not to a server
    • Assign(data) same as Object.assign
    • Remove() deletes entity from document
    • Id entity URI
    • Documententity owner
  • EntitySet used for unordered array of entities

    • Items: ReadonlyArray<TEntity> should not be changed by push, pop, unshift etc.
    • Add(): TEntity creates new item and adds it to Document
  • ValuesSet used for ordered array of items (string | References | Date | number)

  • AclDocument

    • async InitACL(owner: ownerURI, ...modes: Reference[]) creates new .acl file that grants control,read,write to owner and choosed rights to everybody
@field(predicate, {
    type: 'string' | 'ref' | 'Date' | 'decimal', // string by default
    isArray: boolean, // false by default
    isOrdered: boolean, // false by default
})

Decorated field should has type

  • string | Reference | Date | number
  • Array<string | Reference | Date | number>
  • ValuesSet<string | Reference | Date | number>

It will be initialized after Document.Init(); or Document.Save()