🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

appschema

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appschema

ODM for AppWrite DB

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
8
300%
Maintainers
1
Weekly downloads
 
Created
Source

AppSchema: ODM for AppWrite DB

Directory Structure

src/
  ├── index.ts         # Entry point
  ├── connection.ts    # Appwrite connection handling
  ├── model.ts         # Model definition and schema validation
  ├── query.ts         # Fluent query builder
  └── repository.ts    # CRUD operations
  └── schema.ts        # Schema validation logic

Usage

Connection Handling

AppwriteConnection.initialize('<https://appwrite.io>', 'projectId');

Model definition

import { Model } from './model';

type Book = {
    title: string;
    author: string;
    pages: number;
};

const bookSchema: JSONSchemaType<Book> = {
    type: 'object',
    properties: {
        title: { type: 'string' },
        author: { type: 'string' },
        pages: { type: 'number' },
    },
    required: ['title', 'author', 'pages'],
    additionalProperties: false,
};

const BookModel = new Model<Book>(bookSchema, 'collectionId', 'databaseId');

FAQs

Package last updated on 02 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts