@fjell/registry 4.4.52 → 4.4.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/API.md +0 -62
- package/GETTING_STARTED.md +0 -69
- package/build.js +0 -38
- package/docs/README.md +0 -74
- package/docs/TIMING_NODE_OPTIMIZATION.md +0 -207
- package/docs/TIMING_README.md +0 -170
- package/docs/docs.config.ts +0 -114
- package/docs/index.html +0 -26
- package/docs/package-lock.json +0 -5129
- package/docs/package.json +0 -34
- package/docs/public/404.html +0 -53
- package/docs/public/GETTING_STARTED.md +0 -69
- package/docs/public/README.md +0 -623
- package/docs/public/TIMING_NODE_OPTIMIZATION.md +0 -207
- package/docs/public/api.md +0 -62
- package/docs/public/client-api-overview.md +0 -137
- package/docs/public/configuration.md +0 -759
- package/docs/public/error-handling/README.md +0 -356
- package/docs/public/error-handling/network-errors.md +0 -485
- package/docs/public/examples/coordinates-example.ts +0 -253
- package/docs/public/examples/multi-level-keys.ts +0 -374
- package/docs/public/examples/registry-hub-coordinates-example.ts +0 -370
- package/docs/public/examples/registry-hub-types.ts +0 -437
- package/docs/public/examples/simple-example.ts +0 -250
- package/docs/public/examples-README.md +0 -241
- package/docs/public/fjell-icon.svg +0 -1
- package/docs/public/icon.png +0 -0
- package/docs/public/icon2.png +0 -0
- package/docs/public/memory-overhead.svg +0 -120
- package/docs/public/memory.md +0 -430
- package/docs/public/operations/README.md +0 -121
- package/docs/public/operations/all.md +0 -325
- package/docs/public/operations/create.md +0 -415
- package/docs/public/operations/get.md +0 -389
- package/docs/public/package.json +0 -63
- package/docs/public/pano.png +0 -0
- package/docs/public/pano2.png +0 -0
- package/docs/public/timing-range.svg +0 -176
- package/docs/public/timing.md +0 -483
- package/docs/timing-range.svg +0 -174
- package/docs/vitest.config.ts +0 -14
- package/examples/README.md +0 -241
- package/examples/coordinates-example.ts +0 -253
- package/examples/multi-level-keys.ts +0 -382
- package/examples/registry-hub-coordinates-example.ts +0 -370
- package/examples/registry-hub-types.ts +0 -437
- package/examples/registry-statistics-example.ts +0 -264
- package/examples/simple-example.ts +0 -250
- package/tsconfig.docs.json +0 -28
- package/vitest.config.ts +0 -22
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
# `all` Operation
|
|
2
|
-
|
|
3
|
-
Retrieve multiple items with query support, filtering, sorting, and pagination.
|
|
4
|
-
|
|
5
|
-
## Syntax
|
|
6
|
-
|
|
7
|
-
### Primary Items (PItemApi)
|
|
8
|
-
```typescript
|
|
9
|
-
async all(query?: ItemQuery): Promise<V[]>
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
### Contained Items (CItemApi)
|
|
13
|
-
```typescript
|
|
14
|
-
async all(query?: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5>): Promise<V[]>
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Parameters
|
|
18
|
-
|
|
19
|
-
| Parameter | Type | Required | Description |
|
|
20
|
-
|-----------|------|----------|-------------|
|
|
21
|
-
| `query` | `ItemQuery` | No | Query parameters for filtering, sorting, and pagination |
|
|
22
|
-
| `locations` | `LocKeyArray` | No | Location context for contained items |
|
|
23
|
-
|
|
24
|
-
### Query Parameters
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
interface ItemQuery {
|
|
28
|
-
limit?: number; // Maximum number of items to return
|
|
29
|
-
offset?: number; // Number of items to skip
|
|
30
|
-
sort?: string; // Sort specification (e.g., 'name:asc', 'createdAt:desc')
|
|
31
|
-
filter?: string; // Filter criteria
|
|
32
|
-
search?: string; // Search terms
|
|
33
|
-
[key: string]: any; // Additional query parameters
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Examples
|
|
38
|
-
|
|
39
|
-
### Basic Usage
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
// Get all users
|
|
43
|
-
const users = await userApi.all();
|
|
44
|
-
|
|
45
|
-
// Get all tasks for a specific user (contained items)
|
|
46
|
-
const userTasks = await taskApi.all({}, [userId]);
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Pagination
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
// Get first 20 users
|
|
53
|
-
const firstPage = await userApi.all({
|
|
54
|
-
limit: 20,
|
|
55
|
-
offset: 0
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// Get next 20 users
|
|
59
|
-
const secondPage = await userApi.all({
|
|
60
|
-
limit: 20,
|
|
61
|
-
offset: 20
|
|
62
|
-
});
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Filtering
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
// Get active users only
|
|
69
|
-
const activeUsers = await userApi.all({
|
|
70
|
-
filter: 'active:true'
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// Get users created in the last week
|
|
74
|
-
const recentUsers = await userApi.all({
|
|
75
|
-
filter: 'createdAt:>:2024-01-01'
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Multiple filters
|
|
79
|
-
const filteredUsers = await userApi.all({
|
|
80
|
-
filter: 'active:true AND role:admin'
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Sorting
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
// Sort by name (ascending)
|
|
88
|
-
const sortedUsers = await userApi.all({
|
|
89
|
-
sort: 'name:asc'
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Sort by creation date (newest first)
|
|
93
|
-
const newestUsers = await userApi.all({
|
|
94
|
-
sort: 'createdAt:desc'
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Multiple sort criteria
|
|
98
|
-
const users = await userApi.all({
|
|
99
|
-
sort: 'role:asc,name:asc'
|
|
100
|
-
});
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Search
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
// Search users by name or email
|
|
107
|
-
const searchResults = await userApi.all({
|
|
108
|
-
search: 'john@example.com'
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// Combined search with filters
|
|
112
|
-
const results = await userApi.all({
|
|
113
|
-
search: 'developer',
|
|
114
|
-
filter: 'active:true',
|
|
115
|
-
sort: 'relevance:desc'
|
|
116
|
-
});
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Complex Queries
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
// Production-grade query with all parameters
|
|
123
|
-
const users = await userApi.all({
|
|
124
|
-
limit: 50,
|
|
125
|
-
offset: 0,
|
|
126
|
-
sort: 'lastLoginAt:desc',
|
|
127
|
-
filter: 'active:true AND role:in:[admin,moderator]',
|
|
128
|
-
search: 'john',
|
|
129
|
-
includeMetadata: true,
|
|
130
|
-
timezone: 'UTC'
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Contained Items with Location Context
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
// Get all orders for a specific customer
|
|
138
|
-
const customerOrders = await orderApi.all({
|
|
139
|
-
sort: 'createdAt:desc',
|
|
140
|
-
limit: 10
|
|
141
|
-
}, [customerId]);
|
|
142
|
-
|
|
143
|
-
// Get all comments for a specific post
|
|
144
|
-
const postComments = await commentApi.all({
|
|
145
|
-
filter: 'approved:true',
|
|
146
|
-
sort: 'createdAt:asc'
|
|
147
|
-
}, [postId]);
|
|
148
|
-
|
|
149
|
-
// Multi-level containment
|
|
150
|
-
const departmentEmployees = await employeeApi.all({
|
|
151
|
-
filter: 'active:true'
|
|
152
|
-
}, [organizationId, departmentId]);
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Error Handling
|
|
156
|
-
|
|
157
|
-
The `all` operation includes comprehensive error handling:
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
try {
|
|
161
|
-
const users = await userApi.all({
|
|
162
|
-
limit: 50,
|
|
163
|
-
filter: 'active:true'
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
console.log(`Retrieved ${users.length} users`);
|
|
167
|
-
} catch (error) {
|
|
168
|
-
if (error.code === 'VALIDATION_ERROR') {
|
|
169
|
-
console.error('Invalid query parameters:', error.validationErrors);
|
|
170
|
-
} else if (error.code === 'NETWORK_ERROR') {
|
|
171
|
-
console.error('Network issue, operation was retried automatically');
|
|
172
|
-
} else {
|
|
173
|
-
console.error('Unexpected error:', error.message);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Automatic Retry
|
|
179
|
-
|
|
180
|
-
Network errors and server errors are automatically retried:
|
|
181
|
-
|
|
182
|
-
```typescript
|
|
183
|
-
// This will automatically retry on network failures
|
|
184
|
-
const users = await userApi.all({ limit: 100 });
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Performance Optimization
|
|
188
|
-
|
|
189
|
-
### Pagination Best Practices
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
// Use appropriate page sizes
|
|
193
|
-
const OPTIMAL_PAGE_SIZE = 50;
|
|
194
|
-
|
|
195
|
-
async function getAllUsersWithPagination() {
|
|
196
|
-
let allUsers = [];
|
|
197
|
-
let offset = 0;
|
|
198
|
-
let hasMore = true;
|
|
199
|
-
|
|
200
|
-
while (hasMore) {
|
|
201
|
-
const batch = await userApi.all({
|
|
202
|
-
limit: OPTIMAL_PAGE_SIZE,
|
|
203
|
-
offset,
|
|
204
|
-
sort: 'id:asc' // Consistent ordering
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
allUsers.push(...batch);
|
|
208
|
-
hasMore = batch.length === OPTIMAL_PAGE_SIZE;
|
|
209
|
-
offset += OPTIMAL_PAGE_SIZE;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return allUsers;
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Efficient Filtering
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
// Server-side filtering is more efficient than client-side
|
|
220
|
-
const users = await userApi.all({
|
|
221
|
-
filter: 'role:admin AND active:true', // Server-side filter
|
|
222
|
-
limit: 20
|
|
223
|
-
});
|
|
224
|
-
// Instead of fetching all and filtering client-side
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### Caching Strategies
|
|
228
|
-
|
|
229
|
-
```typescript
|
|
230
|
-
// Cache frequently accessed data
|
|
231
|
-
const cacheKey = 'active-users';
|
|
232
|
-
let users = await cache.get(cacheKey);
|
|
233
|
-
|
|
234
|
-
if (!users) {
|
|
235
|
-
users = await userApi.all({ filter: 'active:true' });
|
|
236
|
-
await cache.set(cacheKey, users, { ttl: 300 }); // 5 minute cache
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
## Return Value
|
|
241
|
-
|
|
242
|
-
Returns a Promise that resolves to an array of items matching the query criteria.
|
|
243
|
-
|
|
244
|
-
```typescript
|
|
245
|
-
// Each item includes the full object with metadata
|
|
246
|
-
const users: User[] = await userApi.all();
|
|
247
|
-
|
|
248
|
-
// Example return structure
|
|
249
|
-
[
|
|
250
|
-
{
|
|
251
|
-
id: 'user-123',
|
|
252
|
-
name: 'John Doe',
|
|
253
|
-
email: 'john@example.com',
|
|
254
|
-
active: true,
|
|
255
|
-
createdAt: '2024-01-15T10:30:00Z',
|
|
256
|
-
updatedAt: '2024-01-20T14:22:00Z',
|
|
257
|
-
keyType: 'user'
|
|
258
|
-
},
|
|
259
|
-
// ... more users
|
|
260
|
-
]
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
## Common Patterns
|
|
264
|
-
|
|
265
|
-
### Load More Pattern
|
|
266
|
-
|
|
267
|
-
```typescript
|
|
268
|
-
class UserList {
|
|
269
|
-
private users: User[] = [];
|
|
270
|
-
private offset = 0;
|
|
271
|
-
private readonly limit = 20;
|
|
272
|
-
|
|
273
|
-
async loadMore(): Promise<User[]> {
|
|
274
|
-
const newUsers = await userApi.all({
|
|
275
|
-
limit: this.limit,
|
|
276
|
-
offset: this.offset,
|
|
277
|
-
sort: 'createdAt:desc'
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
this.users.push(...newUsers);
|
|
281
|
-
this.offset += newUsers.length;
|
|
282
|
-
|
|
283
|
-
return newUsers;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
hasMore(): boolean {
|
|
287
|
-
return this.users.length % this.limit === 0;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Real-time Updates
|
|
293
|
-
|
|
294
|
-
```typescript
|
|
295
|
-
// Combining with WebSocket updates
|
|
296
|
-
async function getLatestUsers() {
|
|
297
|
-
const users = await userApi.all({
|
|
298
|
-
sort: 'updatedAt:desc',
|
|
299
|
-
limit: 50
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
// Set up real-time updates
|
|
303
|
-
websocket.on('user-updated', (updatedUser) => {
|
|
304
|
-
const index = users.findIndex(u => u.id === updatedUser.id);
|
|
305
|
-
if (index >= 0) {
|
|
306
|
-
users[index] = updatedUser;
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
return users;
|
|
311
|
-
}
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## Related Operations
|
|
315
|
-
|
|
316
|
-
- [`one`](./one.md) - Get single item with query
|
|
317
|
-
- [`find`](./find.md) - Find items using custom finders
|
|
318
|
-
- [`get`](./get.md) - Get single item by key
|
|
319
|
-
- [`allFacet`](./allFacet.md) - Get analytics for collections
|
|
320
|
-
|
|
321
|
-
## Next Steps
|
|
322
|
-
|
|
323
|
-
- Learn about [Query Optimization](../guides/query-optimization.md)
|
|
324
|
-
- Explore [Pagination Patterns](../guides/pagination.md)
|
|
325
|
-
- Review [Error Handling](../error-handling/README.md) for resilience
|