@nextplus/js-sdk 0.0.3 → 0.0.5

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 ADDED
@@ -0,0 +1,228 @@
1
+ # @nextplus/js-sdk
2
+
3
+ A TypeScript SDK for interacting with the NextPlus API, automatically generated from OpenAPI specifications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @nextplus/js-sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Basic Configuration
14
+
15
+ ```typescript
16
+ import { configure } from '@nextplus/js-sdk';
17
+
18
+ // Configure with email authentication
19
+ const sdk = configure({
20
+ baseURL: 'https://your-nextplus-instance.com/api',
21
+ email: 'your-email@example.com',
22
+ password: 'your-password',
23
+ returnType: 'data', // 'data' | 'raw'
24
+ });
25
+
26
+ // Or configure with username authentication
27
+ const sdk = configure({
28
+ baseURL: 'https://your-nextplus-instance.com/api',
29
+ username: 'your-username',
30
+ password: 'your-password',
31
+ returnType: 'data',
32
+ });
33
+ ```
34
+
35
+ ### Return Types
36
+
37
+ - **`'data'`**: Returns only the response data (default behavior)
38
+ - **`'raw'`**: Returns the full response object with `{ data, request, response }`
39
+
40
+ ### API Usage Examples
41
+
42
+ ```typescript
43
+ // Find tables with filters
44
+ const tables = await sdk.TableService.find({
45
+ filter: {
46
+ name: {
47
+ eq: 'my-table'
48
+ }
49
+ }
50
+ });
51
+
52
+ // Create a new table
53
+ const newTable = await sdk.TableService.create({
54
+ body: {
55
+ name: 'New Table',
56
+ // ... other table properties
57
+ }
58
+ });
59
+
60
+ // With raw response type
61
+ const sdk = configure({
62
+ baseURL: 'https://api.example.com',
63
+ email: 'user@example.com',
64
+ password: 'password',
65
+ returnType: 'raw'
66
+ });
67
+
68
+ const response = await sdk.TableService.find({});
69
+ console.log(response.data); // Response data
70
+ console.log(response.request); // Request object
71
+ console.log(response.response); // Full HTTP response
72
+ ```
73
+
74
+ ## Development
75
+
76
+ ### Prerequisites
77
+
78
+ - Node.js (v18 or higher)
79
+ - npm
80
+
81
+ ### Setup
82
+
83
+ ```bash
84
+ # Install dependencies
85
+ npm install
86
+
87
+ # Generate SDK from OpenAPI spec and build
88
+ npm run generate
89
+ ```
90
+
91
+ ### Available Scripts
92
+
93
+ - **`npm run generate`**: Clean, generate from OpenAPI spec, and build
94
+ - **`npm run build`**: Build TypeScript to JavaScript with type declarations
95
+ - **`npm run clean`**: Remove the `dist` folder
96
+ - **`npm run openapi-ts`**: Generate SDK from OpenAPI specification
97
+ - **`npm run lint`**: Run ESLint
98
+
99
+ ### Development Workflow
100
+
101
+ 1. **Make changes** to the source code in `src/`
102
+ 2. **Generate and build**: `npm run generate`
103
+ 3. **Test changes**: `npm run test` (run smoke tests)
104
+ 4. **Publish**: `npm publish` (see Publishing section)
105
+
106
+ ### Code Generation
107
+
108
+ The SDK is automatically generated from OpenAPI specifications using `@hey-api/openapi-ts`. The generated code includes:
109
+
110
+ - Type-safe API clients
111
+ - Request/response type definitions
112
+ - Authentication handling
113
+ - Error handling
114
+
115
+ Generated files are located in `src/sdk/` and should not be manually edited.
116
+
117
+ ## Testing
118
+
119
+ ### Smoke Tests
120
+
121
+ Run the smoke test to verify the SDK works correctly:
122
+
123
+ ```bash
124
+ # Make sure your NextPlus instance is running on localhost:3000
125
+ npm run test
126
+ ```
127
+
128
+ The smoke test (`src/smoke.ts`) demonstrates:
129
+ - Email and username authentication
130
+ - Different return types (`data` vs `raw`)
131
+ - API calls to the TableService
132
+ - Error handling
133
+
134
+ ### Manual Testing
135
+
136
+ ```typescript
137
+ // Create a test file
138
+ import { configure } from '@nextplus/js-sdk';
139
+
140
+ const sdk = configure({
141
+ baseURL: 'http://localhost:3000/api',
142
+ email: 'test@example.com',
143
+ password: 'password',
144
+ });
145
+
146
+ // Test your API calls
147
+ const result = await sdk.TableService.find({});
148
+ console.log(result);
149
+ ```
150
+
151
+ ## Publishing
152
+
153
+ ### Version Management
154
+
155
+ Update the version in `package.json` and publish:
156
+
157
+ ```bash
158
+ # Bump version (patch, minor, or major)
159
+ npm version patch # 0.0.3 -> 0.0.4
160
+ npm version minor # 0.0.3 -> 0.1.0
161
+ npm version major # 0.0.3 -> 1.0.0
162
+
163
+ # Publish to npm
164
+ npm publish
165
+ ```
166
+
167
+ The `prepublishOnly` script automatically cleans and builds before publishing.
168
+
169
+ ### Publishing Steps
170
+
171
+ 1. **Ensure you're logged in**: `npm whoami`
172
+ 2. **Build**: `npm run build` (optional, done automatically)
173
+ 3. **Publish**: `npm publish`
174
+
175
+ ## Project Structure
176
+
177
+ ```
178
+ ├── src/
179
+ │ ├── index.ts # Main SDK entry point
180
+ │ ├── smoke.ts # Smoke test file
181
+ │ └── sdk/ # Generated SDK code (do not edit)
182
+ │ ├── client/ # API client implementations
183
+ │ ├── core/ # Core utilities and types
184
+ │ └── *.gen.ts # Generated files
185
+ ├── dist/ # Built JavaScript and declarations
186
+ ├── package.json
187
+ ├── tsconfig.json
188
+ └── README.md
189
+ ```
190
+
191
+ ## Configuration
192
+
193
+ ### OpenAPI Generation
194
+
195
+ Configure OpenAPI generation in `openapi-ts.config.ts`:
196
+
197
+ ```typescript
198
+ export default {
199
+ input: 'path/to/openapi.json',
200
+ output: './src/sdk',
201
+ // ... other options
202
+ };
203
+ ```
204
+
205
+ ### TypeScript
206
+
207
+ The project uses modern TypeScript with:
208
+ - ES2020 target
209
+ - ESNext modules
210
+ - Strict type checking
211
+ - Declaration file generation
212
+
213
+ ## License
214
+
215
+ MIT
216
+
217
+ ## Contributing
218
+
219
+ 1. Fork the repository
220
+ 2. Create a feature branch
221
+ 3. Make your changes
222
+ 4. Run tests: `npm run test`
223
+ 5. Build: `npm run build`
224
+ 6. Submit a pull request
225
+
226
+ ## Support
227
+
228
+ For issues and questions, please create an issue in the repository or contact the NextPlus team.
@@ -0,0 +1,222 @@
1
+ import {
2
+ AclService,
3
+ AiPromptService,
4
+ AiService,
5
+ ApiMethodLogService,
6
+ ApiMethodService,
7
+ BomService,
8
+ BreakService,
9
+ BreakTypeService,
10
+ CatalogService,
11
+ CategoryService,
12
+ CertificateMappingService,
13
+ CertificateService,
14
+ ChapterService,
15
+ CommentService,
16
+ ConfigurationService,
17
+ ConnectionService,
18
+ ConnectorFunctionService,
19
+ ConnectorService,
20
+ ContainerService,
21
+ ContentPackageService,
22
+ ContentPackageSessionService,
23
+ ContentPackageViewService,
24
+ CustomFieldService,
25
+ DeviceFamilyService,
26
+ DeviceService,
27
+ DigestEmailService,
28
+ DocumentService,
29
+ EventService,
30
+ FieldService,
31
+ FileParserJobService,
32
+ FileParserService,
33
+ FileParserStrategyJobService,
34
+ FolderService,
35
+ FormDataCommentService,
36
+ FormDataService,
37
+ FormService,
38
+ ForumService,
39
+ GatewayService,
40
+ GroupService,
41
+ IntegrationBuilderService,
42
+ InventoryTransactionService,
43
+ LastSeenResourceService,
44
+ ListItemService,
45
+ ListService,
46
+ LocationService,
47
+ MenusService,
48
+ NodeService,
49
+ NpsService,
50
+ OpcUaServerService,
51
+ OperationService,
52
+ PagesService,
53
+ PartAssemblyDocumentService,
54
+ PartAssemblyService,
55
+ PartService,
56
+ PostService,
57
+ PrintPresetService,
58
+ PriorityLabelService,
59
+ PriorityService,
60
+ ProductionEntityEventService,
61
+ ProductionEntityMappingService,
62
+ ProductionEntityService,
63
+ ProductionEntityTransactionService,
64
+ ProductionEntityTypeService,
65
+ ProjectService,
66
+ PythonResultService,
67
+ ResourceMappingService,
68
+ ResourceService,
69
+ RevisionService,
70
+ RoleMappingService,
71
+ RoleService,
72
+ RuleService,
73
+ ScromSessionService,
74
+ SettingService,
75
+ ShiftService,
76
+ ShiftTypeService,
77
+ StationService,
78
+ StockService,
79
+ SyncClientsService,
80
+ SyncHistoryService,
81
+ SyncService,
82
+ TableService,
83
+ TableSetupService,
84
+ TimeLogReportService,
85
+ TimelineService,
86
+ ToolService,
87
+ TranslationService,
88
+ UnitService,
89
+ UpdateInfoService,
90
+ UserModelService,
91
+ VariantService,
92
+ VoteMappingService,
93
+ WarehouseService,
94
+ WebhookService,
95
+ WireService,
96
+ WiringlistService,
97
+ WorkflowDetailsService,
98
+ WorkflowNoteService,
99
+ WorkflowService,
100
+ WorkflowSessionItemRecordService,
101
+ WorkflowSessionItemService,
102
+ WorkflowTypeService,
103
+ WorkorderService,
104
+ WorkorderStatusService,
105
+ WorkorderTemplateService
106
+ } from "./chunk-DNVJS7WW.js";
107
+ import {
108
+ __export
109
+ } from "./chunk-FXXZNC42.js";
110
+
111
+ // src/sdk/index.ts
112
+ var sdk_exports = {};
113
+ __export(sdk_exports, {
114
+ AclService: () => AclService,
115
+ AiPromptService: () => AiPromptService,
116
+ AiService: () => AiService,
117
+ ApiMethodLogService: () => ApiMethodLogService,
118
+ ApiMethodService: () => ApiMethodService,
119
+ BomService: () => BomService,
120
+ BreakService: () => BreakService,
121
+ BreakTypeService: () => BreakTypeService,
122
+ CatalogService: () => CatalogService,
123
+ CategoryService: () => CategoryService,
124
+ CertificateMappingService: () => CertificateMappingService,
125
+ CertificateService: () => CertificateService,
126
+ ChapterService: () => ChapterService,
127
+ CommentService: () => CommentService,
128
+ ConfigurationService: () => ConfigurationService,
129
+ ConnectionService: () => ConnectionService,
130
+ ConnectorFunctionService: () => ConnectorFunctionService,
131
+ ConnectorService: () => ConnectorService,
132
+ ContainerService: () => ContainerService,
133
+ ContentPackageService: () => ContentPackageService,
134
+ ContentPackageSessionService: () => ContentPackageSessionService,
135
+ ContentPackageViewService: () => ContentPackageViewService,
136
+ CustomFieldService: () => CustomFieldService,
137
+ DeviceFamilyService: () => DeviceFamilyService,
138
+ DeviceService: () => DeviceService,
139
+ DigestEmailService: () => DigestEmailService,
140
+ DocumentService: () => DocumentService,
141
+ EventService: () => EventService,
142
+ FieldService: () => FieldService,
143
+ FileParserJobService: () => FileParserJobService,
144
+ FileParserService: () => FileParserService,
145
+ FileParserStrategyJobService: () => FileParserStrategyJobService,
146
+ FolderService: () => FolderService,
147
+ FormDataCommentService: () => FormDataCommentService,
148
+ FormDataService: () => FormDataService,
149
+ FormService: () => FormService,
150
+ ForumService: () => ForumService,
151
+ GatewayService: () => GatewayService,
152
+ GroupService: () => GroupService,
153
+ IntegrationBuilderService: () => IntegrationBuilderService,
154
+ InventoryTransactionService: () => InventoryTransactionService,
155
+ LastSeenResourceService: () => LastSeenResourceService,
156
+ ListItemService: () => ListItemService,
157
+ ListService: () => ListService,
158
+ LocationService: () => LocationService,
159
+ MenusService: () => MenusService,
160
+ NodeService: () => NodeService,
161
+ NpsService: () => NpsService,
162
+ OpcUaServerService: () => OpcUaServerService,
163
+ OperationService: () => OperationService,
164
+ PagesService: () => PagesService,
165
+ PartAssemblyDocumentService: () => PartAssemblyDocumentService,
166
+ PartAssemblyService: () => PartAssemblyService,
167
+ PartService: () => PartService,
168
+ PostService: () => PostService,
169
+ PrintPresetService: () => PrintPresetService,
170
+ PriorityLabelService: () => PriorityLabelService,
171
+ PriorityService: () => PriorityService,
172
+ ProductionEntityEventService: () => ProductionEntityEventService,
173
+ ProductionEntityMappingService: () => ProductionEntityMappingService,
174
+ ProductionEntityService: () => ProductionEntityService,
175
+ ProductionEntityTransactionService: () => ProductionEntityTransactionService,
176
+ ProductionEntityTypeService: () => ProductionEntityTypeService,
177
+ ProjectService: () => ProjectService,
178
+ PythonResultService: () => PythonResultService,
179
+ ResourceMappingService: () => ResourceMappingService,
180
+ ResourceService: () => ResourceService,
181
+ RevisionService: () => RevisionService,
182
+ RoleMappingService: () => RoleMappingService,
183
+ RoleService: () => RoleService,
184
+ RuleService: () => RuleService,
185
+ ScromSessionService: () => ScromSessionService,
186
+ SettingService: () => SettingService,
187
+ ShiftService: () => ShiftService,
188
+ ShiftTypeService: () => ShiftTypeService,
189
+ StationService: () => StationService,
190
+ StockService: () => StockService,
191
+ SyncClientsService: () => SyncClientsService,
192
+ SyncHistoryService: () => SyncHistoryService,
193
+ SyncService: () => SyncService,
194
+ TableService: () => TableService,
195
+ TableSetupService: () => TableSetupService,
196
+ TimeLogReportService: () => TimeLogReportService,
197
+ TimelineService: () => TimelineService,
198
+ ToolService: () => ToolService,
199
+ TranslationService: () => TranslationService,
200
+ UnitService: () => UnitService,
201
+ UpdateInfoService: () => UpdateInfoService,
202
+ UserModelService: () => UserModelService,
203
+ VariantService: () => VariantService,
204
+ VoteMappingService: () => VoteMappingService,
205
+ WarehouseService: () => WarehouseService,
206
+ WebhookService: () => WebhookService,
207
+ WireService: () => WireService,
208
+ WiringlistService: () => WiringlistService,
209
+ WorkflowDetailsService: () => WorkflowDetailsService,
210
+ WorkflowNoteService: () => WorkflowNoteService,
211
+ WorkflowService: () => WorkflowService,
212
+ WorkflowSessionItemRecordService: () => WorkflowSessionItemRecordService,
213
+ WorkflowSessionItemService: () => WorkflowSessionItemService,
214
+ WorkflowTypeService: () => WorkflowTypeService,
215
+ WorkorderService: () => WorkorderService,
216
+ WorkorderStatusService: () => WorkorderStatusService,
217
+ WorkorderTemplateService: () => WorkorderTemplateService
218
+ });
219
+
220
+ export {
221
+ sdk_exports
222
+ };