@gpt-core/admin 0.1.0-alpha.2 → 0.3.0

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/README.md CHANGED
@@ -2,12 +2,32 @@
2
2
 
3
3
  The official TypeScript Admin SDK for the GPT Core Platform - platform administration, webhook management, and system monitoring.
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/@gpt-core/admin.svg)](https://www.npmjs.com/package/@gpt-core/admin)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue)](https://www.typescriptlang.org/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
5
9
  ⚠️ **This SDK requires admin privileges and should only be used in secure server environments.**
6
10
 
11
+ ## Features
12
+
13
+ ✅ **Fully Typed** - Complete TypeScript support with auto-generated types from OpenAPI specs
14
+ ✅ **Runtime Validation** - Zod schemas for request validation
15
+ ✅ **Bulk Operations** - Efficient batch processing for documents and webhooks
16
+ ✅ **Webhook Management** - Configure, monitor, and test webhook configurations
17
+ ✅ **Storage Administration** - Monitor storage usage across workspaces and buckets
18
+ ✅ **Account Operations** - Credit/debit account balances with audit trails
19
+ ✅ **Document Management** - Bulk delete and reprocess documents
20
+ ✅ **API Key Management** - Allocate, revoke, and rotate API keys
21
+ ✅ **Error Handling** - Comprehensive error handling with detailed context
22
+
7
23
  ## Installation
8
24
 
9
25
  ```bash
10
26
  npm install @gpt-core/admin
27
+ # or
28
+ yarn add @gpt-core/admin
29
+ # or
30
+ pnpm add @gpt-core/admin
11
31
  ```
12
32
 
13
33
  ## Quick Start
@@ -15,26 +35,57 @@ npm install @gpt-core/admin
15
35
  ```typescript
16
36
  import { GptAdmin } from '@gpt-core/admin';
17
37
 
38
+ // Initialize admin client
18
39
  const admin = new GptAdmin({
19
40
  baseUrl: 'https://api.gpt-core.com',
20
- token: 'admin-jwt-token', // Must be admin user
21
- applicationId: 'your-app-id',
41
+ token: process.env.ADMIN_JWT_TOKEN, // Admin JWT token
42
+ applicationId: process.env.APPLICATION_ID, // Your application ID
22
43
  });
23
44
 
24
45
  // Get storage statistics
25
46
  const stats = await admin.storage.stats();
26
- console.log(`Total storage: ${stats.total_size} bytes`);
47
+ console.log(`Total storage: ${(stats.total_size / 1024 / 1024).toFixed(2)} MB`);
48
+ console.log(`Total files: ${stats.file_count}`);
49
+
50
+ // List webhook configurations
51
+ const webhooks = await admin.webhooks.configs.list();
52
+ console.log(`Active webhooks: ${webhooks.filter(w => w.attributes.enabled).length}`);
27
53
  ```
28
54
 
29
- ## Features
55
+ ## Configuration
30
56
 
31
- ✅ **Webhook Management** - Configure and monitor webhooks
32
- **Storage Administration** - Monitor storage usage across workspaces
33
- **Account Operations** - Credit/debit account balances
34
- **Document Bulk Operations** - Bulk delete and reprocess documents
35
- ✅ **API Key Management** - Allocate, revoke, rotate API keys
36
- **Fully Typed** - Complete TypeScript support
37
- **Runtime Validation** - Zod schemas for request validation
57
+ ```typescript
58
+ const admin = new GptAdmin({
59
+ // Required: API base URL
60
+ baseUrl: 'https://api.gpt-core.com',
61
+
62
+ // Required: Admin JWT token
63
+ token: 'admin-jwt-token',
64
+
65
+ // Required: Application ID
66
+ applicationId: 'your-app-id',
67
+ });
68
+ ```
69
+
70
+ ### Environment Variables (Recommended)
71
+
72
+ ```bash
73
+ # .env or .env.local
74
+ ADMIN_API_URL=https://api.gpt-core.com
75
+ ADMIN_JWT_TOKEN=your-admin-jwt-token
76
+ APPLICATION_ID=your-application-id
77
+ ```
78
+
79
+ ```typescript
80
+ // lib/admin-client.ts
81
+ import { GptAdmin } from '@gpt-core/admin';
82
+
83
+ export const admin = new GptAdmin({
84
+ baseUrl: process.env.ADMIN_API_URL!,
85
+ token: process.env.ADMIN_JWT_TOKEN!,
86
+ applicationId: process.env.APPLICATION_ID!,
87
+ });
88
+ ```
38
89
 
39
90
  ## API Reference
40
91
 
@@ -248,6 +299,58 @@ import type {
248
299
  } from '@gpt-core/admin';
249
300
  ```
250
301
 
302
+ ## Documentation
303
+
304
+ ### For ISV Developers
305
+
306
+ - **[ISV Integration Guide](docs/ISV_GUIDE.md)** - Complete production-ready integration guide
307
+ - Environment setup and authentication
308
+ - Common workflows (webhooks, storage, billing, bulk ops)
309
+ - Production best practices and security
310
+ - Monitoring, observability, error handling
311
+ - Rate limiting and troubleshooting
312
+
313
+ - **[AI-Assisted Integration](docs/AI_INTEGRATION_GUIDE.md)** - Quick-start for AI coding assistants
314
+ - Copy-paste integration patterns
315
+ - Ready-to-use code snippets for common use cases
316
+ - AI prompt templates for Cursor/Copilot/Claude
317
+
318
+ ### Topic Guides
319
+
320
+ - **[Authentication](docs/AUTHENTICATION.md)** - Admin token management and security
321
+ - JWT token authentication
322
+ - Token refresh strategies
323
+ - Secret management integration (AWS, Vault, GCP)
324
+ - Multi-environment configuration
325
+
326
+ - **[Error Handling](docs/ERROR_HANDLING.md)** - Comprehensive error handling strategies
327
+ - Validation errors (Zod)
328
+ - HTTP errors (401, 403, 404, 429, 500)
329
+ - Retry strategies (exponential backoff, jitter)
330
+ - Circuit breaker pattern
331
+ - Graceful degradation
332
+
333
+ - **[Bulk Operations](docs/BULK_OPERATIONS.md)** - Efficient batch processing guide
334
+ - Document bulk delete and reprocess
335
+ - Webhook bulk enable/disable
336
+ - Batching strategies and performance optimization
337
+ - Progress tracking and monitoring
338
+ - Error handling for partial failures
339
+
340
+ - **[Webhook Management](docs/WEBHOOKS.md)** - Webhook configuration and monitoring
341
+ - Creating and configuring webhooks
342
+ - Signature verification
343
+ - Event handling
344
+ - Monitoring deliveries
345
+ - Troubleshooting
346
+
347
+ ### For SDK Contributors
348
+
349
+ - **[llms.txt](llms.txt)** - AI agent context for SDK maintenance
350
+ - SDK architecture and patterns
351
+ - Generated vs handwritten code
352
+ - Development workflows
353
+
251
354
  ## Testing
252
355
 
253
356
  ```bash