@inkress/admin-sdk 1.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Inkress Admin SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2025-07-01
9
+
10
+ ### Added
11
+ - Initial release of the Inkress Admin SDK
12
+ - TypeScript support with comprehensive type definitions
13
+ - Public endpoints for accessing merchant information without authentication
14
+ - Full CRUD operations for merchants, products, categories, orders, and users
15
+ - Billing plans and subscriptions management
16
+ - Automatic retry logic and error handling
17
+ - Configurable API endpoints and authentication
18
+ - Support for Node.js, browsers, and React Native environments
19
+
20
+ ### Features
21
+ - **Public Resource**: Access merchant data, products, and fees without authentication
22
+ - **Merchants Resource**: Complete merchant management capabilities
23
+ - **Products Resource**: Full product lifecycle management with pagination and filtering
24
+ - **Categories Resource**: Category management with hierarchical support
25
+ - **Orders Resource**: Order creation, tracking, and status management
26
+ - **Users Resource**: User management and role-based access control
27
+ - **Billing Plans Resource**: Subscription and payment plan management
28
+ - **Subscriptions Resource**: Recurring billing and subscription management
29
+
30
+ ### Security
31
+ - JWT-based authentication
32
+ - Secure token management
33
+ - Support for custom headers and request configuration
34
+
35
+ ### Developer Experience
36
+ - Comprehensive TypeScript definitions
37
+ - Detailed JSDoc documentation
38
+ - Intuitive API design following REST conventions
39
+ - Built-in error handling with structured error responses
40
+ - Debug logging support for development
41
+
42
+ ## [Unreleased]
43
+
44
+ ### Planned
45
+ - Webhook management endpoints
46
+ - Enhanced filtering and search capabilities
47
+ - Rate limiting utilities
48
+ - SDK analytics and monitoring
49
+ - Advanced caching strategies
@@ -0,0 +1,266 @@
1
+ # Contributing to Inkress Admin SDK
2
+
3
+ We love contributions from the community! This guide will help you get started with contributing to the Inkress Admin SDK.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [Development Setup](#development-setup)
10
+ - [Making Changes](#making-changes)
11
+ - [Testing](#testing)
12
+ - [Submitting Changes](#submitting-changes)
13
+ - [Release Process](#release-process)
14
+
15
+ ## Code of Conduct
16
+
17
+ This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
18
+
19
+ ## Getting Started
20
+
21
+ 1. Fork the repository on GitHub
22
+ 2. Clone your fork locally
23
+ 3. Create a new branch for your feature or bugfix
24
+ 4. Make your changes
25
+ 5. Test your changes
26
+ 6. Submit a pull request
27
+
28
+ ## Development Setup
29
+
30
+ ### Prerequisites
31
+
32
+ - Node.js 18+ and npm/yarn/pnpm
33
+ - TypeScript knowledge
34
+ - Familiarity with REST APIs
35
+
36
+ ### Installation
37
+
38
+ ```bash
39
+ # Clone your fork
40
+ git clone https://github.com/YOUR_USERNAME/admin-sdk.git
41
+ cd admin-sdk
42
+
43
+ # Install dependencies
44
+ npm install
45
+
46
+ # Build the project
47
+ npm run build
48
+
49
+ # Run tests
50
+ npm test
51
+
52
+ # Start development mode with watch
53
+ npm run dev
54
+ ```
55
+
56
+ ### Project Structure
57
+
58
+ ```
59
+ src/
60
+ ├── client.ts # HTTP client and configuration
61
+ ├── index.ts # Main SDK export
62
+ ├── types.ts # TypeScript type definitions
63
+ └── resources/ # API resource implementations
64
+ ├── merchants.ts
65
+ ├── products.ts
66
+ ├── categories.ts
67
+ ├── orders.ts
68
+ ├── users.ts
69
+ ├── billing-plans.ts
70
+ ├── subscriptions.ts
71
+ └── public.ts
72
+ ```
73
+
74
+ ## Making Changes
75
+
76
+ ### Branching Strategy
77
+
78
+ - `main` - Production ready code
79
+ - `develop` - Integration branch for features
80
+ - `feature/feature-name` - New features
81
+ - `bugfix/bug-description` - Bug fixes
82
+ - `hotfix/critical-fix` - Critical production fixes
83
+
84
+ ### Coding Standards
85
+
86
+ - Use TypeScript for all new code
87
+ - Follow existing code style and conventions
88
+ - Use meaningful variable and function names
89
+ - Add JSDoc comments for public APIs
90
+ - Keep functions small and focused
91
+ - Write tests for new functionality
92
+
93
+ ### Adding New Endpoints
94
+
95
+ When adding a new API endpoint:
96
+
97
+ 1. Add the endpoint method to the appropriate resource class
98
+ 2. Define TypeScript types for request/response data
99
+ 3. Add JSDoc documentation with examples
100
+ 4. Write tests for the new endpoint
101
+ 5. Update the README with usage examples
102
+
103
+ Example:
104
+
105
+ ```typescript
106
+ // In src/resources/products.ts
107
+
108
+ /**
109
+ * Search products by text query
110
+ * @param query - Search query string
111
+ * @param options - Additional search options
112
+ */
113
+ async search(query: string, options?: SearchOptions): Promise<ApiResponse<Product[]>> {
114
+ return this.client.get<Product[]>('/products/search', { q: query, ...options });
115
+ }
116
+ ```
117
+
118
+ ### TypeScript Types
119
+
120
+ All new functionality should have proper TypeScript types:
121
+
122
+ ```typescript
123
+ // In src/types.ts
124
+
125
+ export interface SearchOptions {
126
+ category_id?: number;
127
+ price_min?: number;
128
+ price_max?: number;
129
+ limit?: number;
130
+ page?: number;
131
+ }
132
+ ```
133
+
134
+ ## Testing
135
+
136
+ ### Running Tests
137
+
138
+ ```bash
139
+ # Run all tests
140
+ npm test
141
+
142
+ # Run tests in watch mode
143
+ npm run test:watch
144
+
145
+ # Run specific test file
146
+ npm test -- products.test.ts
147
+ ```
148
+
149
+ ### Writing Tests
150
+
151
+ - Write unit tests for all new functionality
152
+ - Use descriptive test names
153
+ - Test both success and error cases
154
+ - Mock external dependencies
155
+
156
+ Example test:
157
+
158
+ ```typescript
159
+ // tests/resources/products.test.ts
160
+
161
+ describe('ProductsResource', () => {
162
+ it('should fetch product by ID', async () => {
163
+ const mockProduct = { id: 1, name: 'Test Product' };
164
+ const mockClient = createMockClient(mockProduct);
165
+ const products = new ProductsResource(mockClient);
166
+
167
+ const result = await products.get(1);
168
+
169
+ expect(result.data).toEqual(mockProduct);
170
+ expect(mockClient.get).toHaveBeenCalledWith('/products/1');
171
+ });
172
+ });
173
+ ```
174
+
175
+ ## Submitting Changes
176
+
177
+ ### Pull Request Process
178
+
179
+ 1. **Create a Pull Request**
180
+ - Use a clear and descriptive title
181
+ - Reference any related issues
182
+ - Provide a detailed description of changes
183
+
184
+ 2. **Pull Request Template**
185
+ ```markdown
186
+ ## Description
187
+ Brief description of what this PR does.
188
+
189
+ ## Type of Change
190
+ - [ ] Bug fix
191
+ - [ ] New feature
192
+ - [ ] Breaking change
193
+ - [ ] Documentation update
194
+
195
+ ## Testing
196
+ - [ ] Tests added/updated
197
+ - [ ] All tests passing
198
+ - [ ] Manual testing completed
199
+
200
+ ## Checklist
201
+ - [ ] Code follows project conventions
202
+ - [ ] Self-review completed
203
+ - [ ] Documentation updated
204
+ - [ ] CHANGELOG.md updated
205
+ ```
206
+
207
+ 3. **Review Process**
208
+ - All PRs require at least one review
209
+ - Address feedback promptly
210
+ - Keep PRs focused and reasonably sized
211
+
212
+ ### Commit Guidelines
213
+
214
+ Use conventional commits for clear history:
215
+
216
+ ```
217
+ type(scope): description
218
+
219
+ feat(products): add search endpoint
220
+ fix(auth): handle expired tokens properly
221
+ docs(readme): update installation instructions
222
+ test(orders): add unit tests for order creation
223
+ ```
224
+
225
+ Types:
226
+ - `feat`: New feature
227
+ - `fix`: Bug fix
228
+ - `docs`: Documentation changes
229
+ - `test`: Adding or updating tests
230
+ - `refactor`: Code refactoring
231
+ - `perf`: Performance improvements
232
+ - `chore`: Maintenance tasks
233
+
234
+ ## Release Process
235
+
236
+ ### Versioning
237
+
238
+ We follow [Semantic Versioning](https://semver.org/):
239
+
240
+ - **MAJOR** version for incompatible API changes
241
+ - **MINOR** version for backwards-compatible functionality
242
+ - **PATCH** version for backwards-compatible bug fixes
243
+
244
+ ### Release Steps
245
+
246
+ 1. Update version in `package.json`
247
+ 2. Update `CHANGELOG.md` with new version
248
+ 3. Create a git tag: `git tag v1.0.1`
249
+ 4. Push changes: `git push origin main --tags`
250
+ 5. GitHub Actions will automatically publish to npm
251
+
252
+ ## Getting Help
253
+
254
+ - 📚 [API Documentation](https://docs.inkress.com)
255
+ - 💬 [Discord Community](https://discord.gg/inkress)
256
+ - 🐛 [GitHub Issues](https://github.com/inkress/admin-sdk/issues)
257
+ - 📧 Email: [dev@inkress.com](mailto:dev@inkress.com)
258
+
259
+ ## Recognition
260
+
261
+ Contributors will be recognized in:
262
+ - GitHub contributors list
263
+ - Release notes
264
+ - Project documentation
265
+
266
+ Thank you for contributing to the Inkress Admin SDK! 🎉
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Inkress
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.