Highly ambitious ATProtocol AppView service and sdks

bump and update readme for lexicon rust library

+1 -1
packages/lexicon-rs/Cargo.lock
··· 347 347 348 348 [[package]] 349 349 name = "slices-lexicon" 350 - version = "0.1.4" 350 + version = "0.2.1" 351 351 dependencies = [ 352 352 "base64", 353 353 "chrono",
+1 -1
packages/lexicon-rs/Cargo.toml
··· 1 1 [package] 2 2 name = "slices-lexicon" 3 - version = "0.1.4" 3 + version = "0.2.1" 4 4 edition = "2021" 5 5 description = "AT Protocol lexicon validation library for Slices" 6 6 license = "MIT"
+21 -15
packages/lexicon-rs/README.md
··· 4 4 5 5 ## Overview 6 6 7 - This validation engine can be used in any project that needs AT Protocol lexicon validation. It provides high-performance, spec-compliant validation of AT Protocol lexicon documents and data records. It can also be compiled to WebAssembly for use in JavaScript/TypeScript environments. 7 + This validation engine can be used in any project that needs AT Protocol lexicon 8 + validation. It provides high-performance, spec-compliant validation of AT 9 + Protocol lexicon documents and data records. It can also be compiled to 10 + WebAssembly for use in JavaScript/TypeScript environments. 8 11 9 12 ## Architecture 10 13 11 - This package serves as the core validation engine and is typically consumed by higher-level packages: 14 + This package serves as the core validation engine and is typically consumed by 15 + higher-level packages: 12 16 13 17 - **`@slices/lexicon`** - TypeScript/Deno package with ergonomic APIs 18 + - **`@slices/cli`** - Deno command-line tool for lexicon/appview management 14 19 - **`lexicon-intellisense`** - VS Code extension for lexicon development 15 - - **Slices CLI** - Command-line tooling for lexicon management 16 20 17 21 ## Features 18 22 ··· 31 35 32 36 ```toml 33 37 [dependencies] 34 - slices-lexicon = "0.1" 38 + slices-lexicon = "0.2" 35 39 ``` 36 40 37 41 Basic validation: ··· 92 96 93 97 ```javascript 94 98 import init, { 95 - WasmLexiconValidator, 96 - validate_lexicons_and_get_errors, 97 - is_valid_nsid 98 - } from './pkg/slices_lexicon.js'; 99 + is_valid_nsid, 100 + validate_lexicons_and_get_errors, 101 + WasmLexiconValidator, 102 + } from "./pkg/slices_lexicon.js"; 99 103 100 104 await init(); 101 105 102 106 // Validate lexicons 103 107 const lexicons = [{ 104 - id: "com.example.post", 105 - lexicon: 1, 106 - defs: { /* ... */ } 108 + id: "com.example.post", 109 + lexicon: 1, 110 + defs: {/* ... */}, 107 111 }]; 108 112 109 113 const errors = validate_lexicons_and_get_errors(JSON.stringify(lexicons)); 110 - console.log('Validation errors:', JSON.parse(errors)); 114 + console.log("Validation errors:", JSON.parse(errors)); 111 115 112 116 // Validate NSID format 113 117 const isValid = is_valid_nsid("com.example.post"); ··· 115 119 116 120 ## JavaScript/TypeScript Usage 117 121 118 - If you're using JavaScript or TypeScript, use the higher-level packages instead of consuming this library directly: 122 + If you're using JavaScript or TypeScript, use the higher-level packages instead 123 + of consuming this library directly: 119 124 120 - - **TypeScript/JavaScript**: Use `@slices/lexicon` for ergonomic APIs with automatic resource management 125 + - **TypeScript/JavaScript**: Use `@slices/lexicon` for ergonomic APIs with 126 + automatic resource management 121 127 - **VS Code Development**: Install the `lexicon-intellisense` extension 122 128 - **CLI Tools**: Use the Slices CLI for lexicon management tasks 123 129 ··· 151 157 152 158 ## License 153 159 154 - MIT 160 + MIT
packages/lexicon-rs/test_ref_validation

This is a binary file and will not be displayed.

-52
packages/lexicon-rs/test_ref_validation.rs
··· 1 - use serde_json::json; 2 - use slices_lexicon::validate; 3 - 4 - fn main() { 5 - let broken_lexicon = json!({ 6 - "lexicon": 1, 7 - "id": "network.slices.slice.getSyncSummary", 8 - "defs": { 9 - "main": { 10 - "type": "query", 11 - "description": "Get a summary", 12 - "output": { 13 - "encoding": "application/json", 14 - "schema": { 15 - "type": "object", 16 - "required": ["collectionsSummary"], 17 - "properties": { 18 - "collectionsSummary": { 19 - "type": "array", 20 - "items": { 21 - "type": "ref", 22 - "ref": "#collectionSummar" 23 - } 24 - } 25 - } 26 - } 27 - } 28 - }, 29 - "collectionSummary": { 30 - "type": "object", 31 - "required": ["collection"], 32 - "properties": { 33 - "collection": { 34 - "type": "string" 35 - } 36 - } 37 - } 38 - } 39 - }); 40 - 41 - let lexicons = vec![broken_lexicon]; 42 - 43 - match validate(lexicons) { 44 - Ok(()) => println!("✅ Validation passed (should NOT happen with broken ref)"), 45 - Err(errors) => { 46 - println!("❌ Validation failed (expected):"); 47 - for (lexicon_id, error_list) in errors { 48 - println!(" {}: {:?}", lexicon_id, error_list); 49 - } 50 - } 51 - } 52 - }