{"library":"one-framework","title":"One Framework","description":"One Framework, currently at version 1.4.6, is a structured web application framework built upon RxJS, Lodash, and React. It provides an opinionated architecture for managing application state through reactive `Model` and `Collection` classes, designed to seamlessly integrate with RESTful JSON APIs and, with future updates, WebSockets. Models and collections leverage RxJS observables (specifically Subjects), allowing any data changes to automatically propagate to subscribed React components, thereby keeping the view synchronized with the underlying state. The framework differentiates itself by tightly coupling these popular libraries into a cohesive, reactive data management layer, offering a clear pattern for data persistence, validation, and real-time updates within a client-side application. While the exact release cadence is not explicitly stated, the version number suggests active, ongoing development.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install one-framework"],"cli":null},"imports":["import { Model } from 'one-framework';","import { Collection } from 'one-framework';","import type { ISetOptions } from 'one-framework';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Model } from 'one-framework';\nimport { Subject } from 'rxjs';\n\ninterface IUserAttributes {\n  id?: string;\n  name: string;\n  email: string;\n  isActive?: boolean;\n}\n\nclass User extends Model<IUserAttributes> {\n  resource = '/users';\n  defaults = { isActive: true };\n  idAttribute = 'id';\n\n  validate(attributes: IUserAttributes) {\n    if (!attributes.name) return { name: 'Name is required.' };\n    if (!attributes.email || !attributes.email.includes('@')) return { email: 'Valid email is required.' };\n    return {};\n  }\n}\n\nconst user = new User({ name: 'John Doe', email: 'john.doe@example.com' });\n\n// Subscribe to changes on the model\nuser.updateStream.subscribe(change => {\n  console.log('Model changed:', change.type, change.payload);\n  console.log('Current user state:', user.toJSON());\n});\n\nconsole.log('Initial user:', user.toJSON());\n\n// Set properties, triggering an update\nuser.set({ isActive: false });\nuser.set({ name: 'Jane Doe', id: 'uuid-123' });\nuser.unset('email');\n\n// Attempt to save (requires a mock or actual backend)\n// user.save().subscribe({\n//   next: (response) => console.log('User saved:', response),\n//   error: (err) => console.error('Save error:', err)\n// });","lang":"typescript","description":"This quickstart demonstrates creating a reactive `Model`, defining its schema and validation, subscribing to its `updateStream` for real-time changes, and modifying its properties.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}