nitrostack 1.0.50 → 1.0.51

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.
Files changed (115) hide show
  1. package/dist/cli/commands/build.d.ts.map +1 -1
  2. package/dist/cli/commands/build.js +7 -33
  3. package/dist/cli/commands/build.js.map +1 -1
  4. package/dist/cli/commands/dev.d.ts.map +1 -1
  5. package/dist/cli/commands/dev.js +0 -3
  6. package/dist/cli/commands/dev.js.map +1 -1
  7. package/dist/core/component.d.ts +1 -7
  8. package/dist/core/component.d.ts.map +1 -1
  9. package/dist/core/component.js +4 -49
  10. package/dist/core/component.js.map +1 -1
  11. package/dist/core/server.d.ts.map +1 -1
  12. package/dist/core/server.js +3 -9
  13. package/dist/core/server.js.map +1 -1
  14. package/dist/core/tool.d.ts.map +1 -1
  15. package/dist/core/tool.js +1 -16
  16. package/dist/core/tool.js.map +1 -1
  17. package/dist/ui-next/index.d.ts +0 -1
  18. package/dist/ui-next/index.d.ts.map +1 -1
  19. package/dist/ui-next/index.js +125 -126
  20. package/dist/ui-next/index.js.map +1 -1
  21. package/package.json +2 -3
  22. package/src/studio/components/WidgetRenderer.tsx +15 -24
  23. package/src/studio/middleware.ts +1 -6
  24. package/src/studio/next.config.js +0 -5
  25. package/templates/typescript-auth/src/modules/products/products.tools.ts +29 -29
  26. package/templates/typescript-oauth/src/widgets/package-lock.json +4464 -0
  27. package/package/src/studio/middleware.ts +0 -28
  28. package/package/src/studio/next.config.js +0 -40
  29. package/templates/typescript-auth/.env.example +0 -23
  30. package/templates/typescript-auth-api-key/.env.example +0 -4
  31. package/templates/typescript-oauth/.env.example +0 -102
  32. package/templates/typescript-oauth/src/widgets/.next/BUILD_ID +0 -1
  33. package/templates/typescript-oauth/src/widgets/.next/app-build-manifest.json +0 -32
  34. package/templates/typescript-oauth/src/widgets/.next/app-path-routes-manifest.json +0 -1
  35. package/templates/typescript-oauth/src/widgets/.next/build-manifest.json +0 -32
  36. package/templates/typescript-oauth/src/widgets/.next/cache/webpack/client-production/0.pack +0 -0
  37. package/templates/typescript-oauth/src/widgets/.next/cache/webpack/client-production/index.pack +0 -0
  38. package/templates/typescript-oauth/src/widgets/.next/cache/webpack/edge-server-production/0.pack +0 -0
  39. package/templates/typescript-oauth/src/widgets/.next/cache/webpack/edge-server-production/index.pack +0 -0
  40. package/templates/typescript-oauth/src/widgets/.next/cache/webpack/server-production/0.pack +0 -0
  41. package/templates/typescript-oauth/src/widgets/.next/cache/webpack/server-production/index.pack +0 -0
  42. package/templates/typescript-oauth/src/widgets/.next/export-detail.json +0 -1
  43. package/templates/typescript-oauth/src/widgets/.next/export-marker.json +0 -1
  44. package/templates/typescript-oauth/src/widgets/.next/images-manifest.json +0 -1
  45. package/templates/typescript-oauth/src/widgets/.next/next-minimal-server.js.nft.json +0 -1
  46. package/templates/typescript-oauth/src/widgets/.next/next-server.js.nft.json +0 -1
  47. package/templates/typescript-oauth/src/widgets/.next/package.json +0 -1
  48. package/templates/typescript-oauth/src/widgets/.next/prerender-manifest.json +0 -1
  49. package/templates/typescript-oauth/src/widgets/.next/react-loadable-manifest.json +0 -1
  50. package/templates/typescript-oauth/src/widgets/.next/required-server-files.json +0 -1
  51. package/templates/typescript-oauth/src/widgets/.next/routes-manifest.json +0 -1
  52. package/templates/typescript-oauth/src/widgets/.next/server/app/_not-found/page.js +0 -1
  53. package/templates/typescript-oauth/src/widgets/.next/server/app/_not-found/page.js.nft.json +0 -1
  54. package/templates/typescript-oauth/src/widgets/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
  55. package/templates/typescript-oauth/src/widgets/.next/server/app/_not-found.html +0 -1
  56. package/templates/typescript-oauth/src/widgets/.next/server/app/_not-found.meta +0 -6
  57. package/templates/typescript-oauth/src/widgets/.next/server/app/_not-found.rsc +0 -9
  58. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-operations/page.js +0 -6
  59. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-operations/page.js.nft.json +0 -1
  60. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-operations/page_client-reference-manifest.js +0 -1
  61. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-operations.html +0 -1
  62. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-operations.meta +0 -5
  63. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-operations.rsc +0 -7
  64. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-result/page.js +0 -6
  65. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-result/page.js.nft.json +0 -1
  66. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-result/page_client-reference-manifest.js +0 -1
  67. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-result.html +0 -1
  68. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-result.meta +0 -5
  69. package/templates/typescript-oauth/src/widgets/.next/server/app/calculator-result.rsc +0 -7
  70. package/templates/typescript-oauth/src/widgets/.next/server/app-paths-manifest.json +0 -5
  71. package/templates/typescript-oauth/src/widgets/.next/server/chunks/682.js +0 -6
  72. package/templates/typescript-oauth/src/widgets/.next/server/chunks/819.js +0 -3
  73. package/templates/typescript-oauth/src/widgets/.next/server/chunks/font-manifest.json +0 -1
  74. package/templates/typescript-oauth/src/widgets/.next/server/font-manifest.json +0 -1
  75. package/templates/typescript-oauth/src/widgets/.next/server/functions-config-manifest.json +0 -1
  76. package/templates/typescript-oauth/src/widgets/.next/server/interception-route-rewrite-manifest.js +0 -1
  77. package/templates/typescript-oauth/src/widgets/.next/server/middleware-build-manifest.js +0 -1
  78. package/templates/typescript-oauth/src/widgets/.next/server/middleware-manifest.json +0 -6
  79. package/templates/typescript-oauth/src/widgets/.next/server/middleware-react-loadable-manifest.js +0 -1
  80. package/templates/typescript-oauth/src/widgets/.next/server/next-font-manifest.js +0 -1
  81. package/templates/typescript-oauth/src/widgets/.next/server/next-font-manifest.json +0 -1
  82. package/templates/typescript-oauth/src/widgets/.next/server/pages/404.html +0 -1
  83. package/templates/typescript-oauth/src/widgets/.next/server/pages/500.html +0 -1
  84. package/templates/typescript-oauth/src/widgets/.next/server/pages/_app.js +0 -1
  85. package/templates/typescript-oauth/src/widgets/.next/server/pages/_app.js.nft.json +0 -1
  86. package/templates/typescript-oauth/src/widgets/.next/server/pages/_document.js +0 -1
  87. package/templates/typescript-oauth/src/widgets/.next/server/pages/_document.js.nft.json +0 -1
  88. package/templates/typescript-oauth/src/widgets/.next/server/pages/_error.js +0 -1
  89. package/templates/typescript-oauth/src/widgets/.next/server/pages/_error.js.nft.json +0 -1
  90. package/templates/typescript-oauth/src/widgets/.next/server/pages-manifest.json +0 -1
  91. package/templates/typescript-oauth/src/widgets/.next/server/server-reference-manifest.js +0 -1
  92. package/templates/typescript-oauth/src/widgets/.next/server/server-reference-manifest.json +0 -1
  93. package/templates/typescript-oauth/src/widgets/.next/server/webpack-runtime.js +0 -1
  94. package/templates/typescript-oauth/src/widgets/.next/static/WU9THacVqL52RZbrZOLS1/_buildManifest.js +0 -1
  95. package/templates/typescript-oauth/src/widgets/.next/static/WU9THacVqL52RZbrZOLS1/_ssgManifest.js +0 -1
  96. package/templates/typescript-oauth/src/widgets/.next/static/chunks/117-eb57c7ef86f964a4.js +0 -2
  97. package/templates/typescript-oauth/src/widgets/.next/static/chunks/app/_not-found/page-dcb83ba3e4d0aafd.js +0 -1
  98. package/templates/typescript-oauth/src/widgets/.next/static/chunks/app/calculator-operations/page-b8913a740073ea8a.js +0 -1
  99. package/templates/typescript-oauth/src/widgets/.next/static/chunks/app/calculator-result/page-ddaaab2fce95dea2.js +0 -1
  100. package/templates/typescript-oauth/src/widgets/.next/static/chunks/app/layout-cbd3ebdc4ecc5247.js +0 -1
  101. package/templates/typescript-oauth/src/widgets/.next/static/chunks/fd9d1056-749e5812300142af.js +0 -1
  102. package/templates/typescript-oauth/src/widgets/.next/static/chunks/framework-f66176bb897dc684.js +0 -1
  103. package/templates/typescript-oauth/src/widgets/.next/static/chunks/main-76df43fcef3db344.js +0 -1
  104. package/templates/typescript-oauth/src/widgets/.next/static/chunks/main-app-f9c40224d04023c5.js +0 -1
  105. package/templates/typescript-oauth/src/widgets/.next/static/chunks/pages/_app-72b849fbd24ac258.js +0 -1
  106. package/templates/typescript-oauth/src/widgets/.next/static/chunks/pages/_error-7ba65e1336b92748.js +0 -1
  107. package/templates/typescript-oauth/src/widgets/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  108. package/templates/typescript-oauth/src/widgets/.next/static/chunks/webpack-100b9e646d9c912e.js +0 -1
  109. package/templates/typescript-oauth/src/widgets/.next/trace +0 -14
  110. package/templates/typescript-oauth/src/widgets/.next/types/app/calculator-operations/page.ts +0 -79
  111. package/templates/typescript-oauth/src/widgets/.next/types/app/calculator-result/page.ts +0 -79
  112. package/templates/typescript-oauth/src/widgets/.next/types/app/layout.ts +0 -79
  113. package/templates/typescript-oauth/src/widgets/.next/types/package.json +0 -1
  114. package/templates/typescript-oauth/src/widgets/next-env.d.ts +0 -5
  115. package/templates/typescript-starter/.env.example +0 -4
@@ -1,7 +1,7 @@
1
- import {
2
- ToolDecorator as Tool,
3
- Widget,
4
- z,
1
+ import {
2
+ ToolDecorator as Tool,
3
+ Widget,
4
+ z,
5
5
  ExecutionContext,
6
6
  Injectable,
7
7
  UseMiddleware,
@@ -13,7 +13,7 @@ import {
13
13
  } from 'nitrostack';
14
14
  import { DatabaseService } from '../../services/database.service.js';
15
15
  import { LoggingMiddleware } from '../../middleware/logging.middleware.js';
16
-
16
+ import { TransformInterceptor } from '../../interceptors/transform.interceptor.js';
17
17
  import { ValidationPipe } from '../../pipes/validation.pipe.js';
18
18
  import { GlobalExceptionFilter } from '../../filters/global-exception.filter.js';
19
19
 
@@ -31,7 +31,7 @@ import { GlobalExceptionFilter } from '../../filters/global-exception.filter.js'
31
31
  */
32
32
  @Injectable()
33
33
  export class ProductsTools {
34
- constructor(private database: DatabaseService) { }
34
+ constructor(private database: DatabaseService) {}
35
35
 
36
36
  /**
37
37
  * Browse products - No authentication required
@@ -102,7 +102,7 @@ export class ProductsTools {
102
102
  })
103
103
  @Widget('products-grid')
104
104
  @UseMiddleware(LoggingMiddleware)
105
-
105
+ @UseInterceptors(TransformInterceptor)
106
106
  @UsePipes(ValidationPipe)
107
107
  @UseFilters(GlobalExceptionFilter)
108
108
  @Cache({ ttl: 60, key: (input) => `products:${input.category}:${input.search}:${input.page}` })
@@ -112,50 +112,50 @@ export class ProductsTools {
112
112
  const page = input.page || 1;
113
113
  const limit = input.limit || 10;
114
114
  const search = input.search || '';
115
-
115
+
116
116
  const offset = (page - 1) * limit;
117
-
117
+
118
118
  let query = 'SELECT * FROM products WHERE 1=1';
119
119
  const params: any[] = [];
120
-
120
+
121
121
  // Filter by category
122
122
  if (category && category !== 'All') {
123
123
  query += ' AND category = ?';
124
124
  params.push(category);
125
125
  }
126
-
126
+
127
127
  // Search by name
128
128
  if (search) {
129
129
  query += ' AND name LIKE ?';
130
130
  params.push(`%${search}%`);
131
131
  }
132
-
132
+
133
133
  // Add pagination
134
134
  query += ' ORDER BY name LIMIT ? OFFSET ?';
135
135
  params.push(limit, offset);
136
-
136
+
137
137
  const products = this.database.query(query, params);
138
-
138
+
139
139
  // Get total count
140
140
  let countQuery = 'SELECT COUNT(*) as count FROM products WHERE 1=1';
141
141
  const countParams: any[] = [];
142
-
142
+
143
143
  if (category && category !== 'All') {
144
144
  countQuery += ' AND category = ?';
145
145
  countParams.push(category);
146
146
  }
147
-
147
+
148
148
  if (search) {
149
149
  countQuery += ' AND name LIKE ?';
150
150
  countParams.push(`%${search}%`);
151
151
  }
152
-
152
+
153
153
  const result = this.database.queryOne<{ count: number }>(countQuery, countParams);
154
154
  const count = result?.count || 0;
155
155
  const totalPages = Math.ceil(count / limit);
156
-
156
+
157
157
  context.logger.info(`Browsing products: category=${category}, search=${search}, page=${page}, found=${products.length} products`);
158
-
158
+
159
159
  return {
160
160
  products,
161
161
  pagination: {
@@ -199,27 +199,27 @@ export class ProductsTools {
199
199
  })
200
200
  @Widget('product-card')
201
201
  @UseMiddleware(LoggingMiddleware)
202
-
202
+ @UseInterceptors(TransformInterceptor)
203
203
  @UsePipes(ValidationPipe)
204
204
  @UseFilters(GlobalExceptionFilter)
205
205
  @Cache({ ttl: 300, key: (input) => `product:${input.product_id}` }) // Cache for 5 minutes
206
206
  @RateLimit({ requests: 100, window: '1m' }) // 100 requests per minute
207
207
  async getProductDetails(input: any, context: ExecutionContext) {
208
208
  const product = this.database.queryOne(`SELECT * FROM products WHERE id = ?`, [input.product_id]);
209
-
209
+
210
210
  if (!product) {
211
211
  throw new Error(`Product with ID ${input.product_id} not found`);
212
212
  }
213
-
213
+
214
214
  context.logger.info(`Retrieved details for product: ${(product as any).name}`);
215
-
215
+
216
216
  return {
217
217
  product,
218
218
  availability: (product as any).stock > 0 ? 'In Stock' : 'Out of Stock',
219
- stockMessage: (product as any).stock > 10
220
- ? 'Available'
221
- : (product as any).stock > 0
222
- ? `Only ${(product as any).stock} left!`
219
+ stockMessage: (product as any).stock > 10
220
+ ? 'Available'
221
+ : (product as any).stock > 0
222
+ ? `Only ${(product as any).stock} left!`
223
223
  : 'Currently unavailable',
224
224
  };
225
225
  }
@@ -246,7 +246,7 @@ export class ProductsTools {
246
246
  })
247
247
  @Widget('categories')
248
248
  @UseMiddleware(LoggingMiddleware)
249
-
249
+ @UseInterceptors(TransformInterceptor)
250
250
  @Cache({ ttl: 300 }) // Cache for 5 minutes
251
251
  async getCategories(input: any, context: ExecutionContext) {
252
252
  const categories = this.database.query(`
@@ -255,7 +255,7 @@ export class ProductsTools {
255
255
  GROUP BY category
256
256
  ORDER BY category
257
257
  `);
258
-
258
+
259
259
  return {
260
260
  categories: categories.map((c: any) => ({
261
261
  name: c.category,