nitrostack 1.0.55 → 1.0.56

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 (222) hide show
  1. package/dist/cli/commands/init.d.ts.map +1 -1
  2. package/dist/cli/commands/init.js +14 -9
  3. package/dist/cli/commands/init.js.map +1 -1
  4. package/dist/widgets/hooks/index.d.ts +7 -0
  5. package/dist/widgets/hooks/index.d.ts.map +1 -0
  6. package/dist/widgets/hooks/index.js +7 -0
  7. package/dist/widgets/hooks/index.js.map +1 -0
  8. package/dist/widgets/hooks/use-display-mode.d.ts +11 -0
  9. package/dist/widgets/hooks/use-display-mode.d.ts.map +1 -0
  10. package/dist/widgets/hooks/use-display-mode.js +13 -0
  11. package/dist/widgets/hooks/use-display-mode.js.map +1 -0
  12. package/dist/widgets/hooks/use-max-height.d.ts +10 -0
  13. package/dist/widgets/hooks/use-max-height.d.ts.map +1 -0
  14. package/dist/widgets/hooks/use-max-height.js +13 -0
  15. package/dist/widgets/hooks/use-max-height.js.map +1 -0
  16. package/dist/widgets/hooks/use-openai-global.d.ts +12 -0
  17. package/dist/widgets/hooks/use-openai-global.d.ts.map +1 -0
  18. package/dist/widgets/hooks/use-openai-global.js +32 -0
  19. package/dist/widgets/hooks/use-openai-global.js.map +1 -0
  20. package/dist/widgets/hooks/use-theme.d.ts +10 -0
  21. package/dist/widgets/hooks/use-theme.d.ts.map +1 -0
  22. package/dist/widgets/hooks/use-theme.js +12 -0
  23. package/dist/widgets/hooks/use-theme.js.map +1 -0
  24. package/dist/widgets/hooks/use-widget-state.d.ts +18 -0
  25. package/dist/widgets/hooks/use-widget-state.d.ts.map +1 -0
  26. package/dist/widgets/hooks/use-widget-state.js +27 -0
  27. package/dist/widgets/hooks/use-widget-state.js.map +1 -0
  28. package/dist/widgets/hooks/useWidgetSDK.d.ts +47 -0
  29. package/dist/widgets/hooks/useWidgetSDK.d.ts.map +1 -0
  30. package/dist/widgets/hooks/useWidgetSDK.js +67 -0
  31. package/dist/widgets/hooks/useWidgetSDK.js.map +1 -0
  32. package/dist/widgets/index.d.ts +7 -1
  33. package/dist/widgets/index.d.ts.map +1 -1
  34. package/dist/widgets/index.js +11 -1
  35. package/dist/widgets/index.js.map +1 -1
  36. package/dist/widgets/runtime/WidgetLayout.d.ts +32 -0
  37. package/dist/widgets/runtime/WidgetLayout.d.ts.map +1 -0
  38. package/dist/widgets/runtime/WidgetLayout.js +143 -0
  39. package/dist/widgets/runtime/WidgetLayout.js.map +1 -0
  40. package/dist/widgets/runtime/widget-polyfill.d.ts +1 -0
  41. package/dist/widgets/runtime/widget-polyfill.d.ts.map +1 -0
  42. package/dist/widgets/runtime/widget-polyfill.js +28 -0
  43. package/dist/widgets/runtime/widget-polyfill.js.map +1 -0
  44. package/dist/widgets/sdk.d.ts +109 -0
  45. package/dist/widgets/sdk.d.ts.map +1 -0
  46. package/dist/widgets/sdk.js +221 -0
  47. package/dist/widgets/sdk.js.map +1 -0
  48. package/dist/widgets/types.d.ts +89 -0
  49. package/dist/widgets/types.d.ts.map +1 -0
  50. package/dist/widgets/types.js +8 -0
  51. package/dist/widgets/types.js.map +1 -0
  52. package/dist/widgets/utils/media-queries.d.ts +34 -0
  53. package/dist/widgets/utils/media-queries.d.ts.map +1 -0
  54. package/dist/widgets/utils/media-queries.js +42 -0
  55. package/dist/widgets/utils/media-queries.js.map +1 -0
  56. package/package.json +1 -1
  57. package/src/studio/app/chat/page.tsx +274 -137
  58. package/src/studio/app/globals.css +140 -64
  59. package/src/studio/branding.md +807 -0
  60. package/src/studio/components/WidgetRenderer.tsx +222 -16
  61. package/src/studio/lib/llm-service.ts +39 -39
  62. package/templates/typescript-oauth/{env.example → .env.example} +4 -10
  63. package/templates/typescript-oauth/README.md +226 -306
  64. package/templates/typescript-oauth/package-lock.json +4253 -0
  65. package/templates/typescript-oauth/package.json +10 -5
  66. package/templates/typescript-oauth/src/app.module.ts +39 -36
  67. package/templates/typescript-oauth/src/guards/oauth.guard.ts +0 -1
  68. package/templates/typescript-oauth/src/index.ts +22 -30
  69. package/templates/typescript-oauth/src/modules/flights/booking.tools.ts +323 -0
  70. package/templates/typescript-oauth/src/modules/flights/flights.module.ts +14 -0
  71. package/templates/typescript-oauth/src/modules/flights/flights.prompts.ts +231 -0
  72. package/templates/typescript-oauth/src/modules/flights/flights.resources.ts +215 -0
  73. package/templates/typescript-oauth/src/modules/flights/flights.tools.ts +457 -0
  74. package/templates/typescript-oauth/src/services/duffel.service.ts +285 -0
  75. package/templates/typescript-oauth/src/widgets/app/airport-search/page.tsx +270 -0
  76. package/templates/typescript-oauth/src/widgets/app/flight-details/page.tsx +261 -0
  77. package/templates/typescript-oauth/src/widgets/app/flight-search-results/page.tsx +378 -0
  78. package/templates/typescript-oauth/src/widgets/app/globals.css +167 -0
  79. package/templates/typescript-oauth/src/widgets/app/layout.tsx +6 -2
  80. package/templates/typescript-oauth/src/widgets/app/order-cancellation/page.tsx +207 -0
  81. package/templates/typescript-oauth/src/widgets/app/order-summary/page.tsx +245 -0
  82. package/templates/typescript-oauth/src/widgets/app/payment-confirmation/page.tsx +152 -0
  83. package/templates/typescript-oauth/src/widgets/app/seat-selection/page.tsx +486 -0
  84. package/templates/typescript-oauth/src/widgets/next-env.d.ts +5 -0
  85. package/templates/typescript-oauth/src/widgets/package-lock.json +155 -126
  86. package/templates/typescript-oauth/src/widgets/widget-manifest.json +374 -27
  87. package/templates/typescript-pizzaz/IMPLEMENTATION.md +98 -0
  88. package/templates/typescript-pizzaz/README.md +233 -0
  89. package/templates/typescript-pizzaz/package.json +31 -0
  90. package/templates/typescript-pizzaz/src/app.module.ts +28 -0
  91. package/templates/typescript-pizzaz/src/index.ts +30 -0
  92. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.data.ts +106 -0
  93. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.module.ts +11 -0
  94. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.service.ts +60 -0
  95. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.tools.ts +197 -0
  96. package/templates/typescript-pizzaz/src/widgets/app/layout.tsx +18 -0
  97. package/templates/typescript-pizzaz/src/widgets/app/pizza-list/page.tsx +272 -0
  98. package/templates/typescript-pizzaz/src/widgets/app/pizza-map/page.tsx +216 -0
  99. package/templates/typescript-pizzaz/src/widgets/app/pizza-shop/page.tsx +374 -0
  100. package/templates/typescript-pizzaz/src/widgets/components/CompactShopCard.tsx +144 -0
  101. package/templates/typescript-pizzaz/src/widgets/components/PizzaCard.tsx +191 -0
  102. package/templates/typescript-pizzaz/src/widgets/package.json +30 -0
  103. package/templates/typescript-pizzaz/src/widgets/widget-manifest.json +253 -0
  104. package/templates/typescript-pizzaz/tsconfig.json +30 -0
  105. package/templates/typescript-starter/src/modules/calculator/calculator.resources.ts +0 -1
  106. package/templates/typescript-starter/src/widgets/app/calculator-result/page.tsx +102 -56
  107. package/templates/typescript-starter/src/widgets/app/layout.tsx +6 -2
  108. package/templates/typescript-auth/AI_AGENT_CLI_REFERENCE.md +0 -702
  109. package/templates/typescript-auth/AI_AGENT_SDK_REFERENCE.md +0 -1260
  110. package/templates/typescript-auth/README.md +0 -402
  111. package/templates/typescript-auth/env.example +0 -25
  112. package/templates/typescript-auth/package.json +0 -36
  113. package/templates/typescript-auth/src/app.module.ts +0 -103
  114. package/templates/typescript-auth/src/db/database.ts +0 -160
  115. package/templates/typescript-auth/src/db/seed.ts +0 -374
  116. package/templates/typescript-auth/src/db/setup.ts +0 -87
  117. package/templates/typescript-auth/src/events/analytics.service.ts +0 -52
  118. package/templates/typescript-auth/src/events/notification.service.ts +0 -40
  119. package/templates/typescript-auth/src/filters/global-exception.filter.ts +0 -28
  120. package/templates/typescript-auth/src/guards/README.md +0 -75
  121. package/templates/typescript-auth/src/guards/jwt.guard.ts +0 -105
  122. package/templates/typescript-auth/src/health/database.health.ts +0 -41
  123. package/templates/typescript-auth/src/index.ts +0 -29
  124. package/templates/typescript-auth/src/interceptors/transform.interceptor.ts +0 -24
  125. package/templates/typescript-auth/src/middleware/logging.middleware.ts +0 -42
  126. package/templates/typescript-auth/src/modules/addresses/addresses.module.ts +0 -16
  127. package/templates/typescript-auth/src/modules/addresses/addresses.prompts.ts +0 -114
  128. package/templates/typescript-auth/src/modules/addresses/addresses.resources.ts +0 -40
  129. package/templates/typescript-auth/src/modules/addresses/addresses.tools.ts +0 -284
  130. package/templates/typescript-auth/src/modules/auth/auth.module.ts +0 -16
  131. package/templates/typescript-auth/src/modules/auth/auth.prompts.ts +0 -147
  132. package/templates/typescript-auth/src/modules/auth/auth.resources.ts +0 -84
  133. package/templates/typescript-auth/src/modules/auth/auth.tools.ts +0 -139
  134. package/templates/typescript-auth/src/modules/cart/cart.module.ts +0 -16
  135. package/templates/typescript-auth/src/modules/cart/cart.prompts.ts +0 -95
  136. package/templates/typescript-auth/src/modules/cart/cart.resources.ts +0 -44
  137. package/templates/typescript-auth/src/modules/cart/cart.tools.ts +0 -277
  138. package/templates/typescript-auth/src/modules/orders/orders.module.ts +0 -16
  139. package/templates/typescript-auth/src/modules/orders/orders.prompts.ts +0 -88
  140. package/templates/typescript-auth/src/modules/orders/orders.resources.ts +0 -48
  141. package/templates/typescript-auth/src/modules/orders/orders.tools.ts +0 -303
  142. package/templates/typescript-auth/src/modules/products/products.module.ts +0 -16
  143. package/templates/typescript-auth/src/modules/products/products.prompts.ts +0 -146
  144. package/templates/typescript-auth/src/modules/products/products.resources.ts +0 -98
  145. package/templates/typescript-auth/src/modules/products/products.tools.ts +0 -266
  146. package/templates/typescript-auth/src/pipes/validation.pipe.ts +0 -42
  147. package/templates/typescript-auth/src/services/database.service.ts +0 -90
  148. package/templates/typescript-auth/src/widgets/app/add-to-cart/page.tsx +0 -122
  149. package/templates/typescript-auth/src/widgets/app/address-added/page.tsx +0 -116
  150. package/templates/typescript-auth/src/widgets/app/address-deleted/page.tsx +0 -105
  151. package/templates/typescript-auth/src/widgets/app/address-list/page.tsx +0 -139
  152. package/templates/typescript-auth/src/widgets/app/address-updated/page.tsx +0 -153
  153. package/templates/typescript-auth/src/widgets/app/cart-cleared/page.tsx +0 -86
  154. package/templates/typescript-auth/src/widgets/app/cart-updated/page.tsx +0 -116
  155. package/templates/typescript-auth/src/widgets/app/categories/page.tsx +0 -134
  156. package/templates/typescript-auth/src/widgets/app/layout.tsx +0 -21
  157. package/templates/typescript-auth/src/widgets/app/login-result/page.tsx +0 -129
  158. package/templates/typescript-auth/src/widgets/app/order-confirmation/page.tsx +0 -231
  159. package/templates/typescript-auth/src/widgets/app/order-details/page.tsx +0 -225
  160. package/templates/typescript-auth/src/widgets/app/order-history/page.tsx +0 -218
  161. package/templates/typescript-auth/src/widgets/app/product-card/page.tsx +0 -121
  162. package/templates/typescript-auth/src/widgets/app/products-grid/page.tsx +0 -198
  163. package/templates/typescript-auth/src/widgets/app/shopping-cart/page.tsx +0 -187
  164. package/templates/typescript-auth/src/widgets/app/whoami/page.tsx +0 -165
  165. package/templates/typescript-auth/src/widgets/next.config.js +0 -38
  166. package/templates/typescript-auth/src/widgets/package.json +0 -18
  167. package/templates/typescript-auth/src/widgets/styles/ecommerce.ts +0 -169
  168. package/templates/typescript-auth/src/widgets/tsconfig.json +0 -28
  169. package/templates/typescript-auth/src/widgets/types/tool-data.ts +0 -141
  170. package/templates/typescript-auth/src/widgets/widget-manifest.json +0 -464
  171. package/templates/typescript-auth/tsconfig.json +0 -27
  172. package/templates/typescript-auth-api-key/AI_AGENT_CLI_REFERENCE.md +0 -701
  173. package/templates/typescript-auth-api-key/AI_AGENT_SDK_REFERENCE.md +0 -1260
  174. package/templates/typescript-auth-api-key/README.md +0 -485
  175. package/templates/typescript-auth-api-key/env.example +0 -17
  176. package/templates/typescript-auth-api-key/package.json +0 -21
  177. package/templates/typescript-auth-api-key/src/app.module.ts +0 -38
  178. package/templates/typescript-auth-api-key/src/guards/apikey.guard.ts +0 -47
  179. package/templates/typescript-auth-api-key/src/guards/multi-auth.guard.ts +0 -157
  180. package/templates/typescript-auth-api-key/src/index.ts +0 -47
  181. package/templates/typescript-auth-api-key/src/modules/calculator/calculator.module.ts +0 -12
  182. package/templates/typescript-auth-api-key/src/modules/calculator/calculator.prompts.ts +0 -73
  183. package/templates/typescript-auth-api-key/src/modules/calculator/calculator.resources.ts +0 -60
  184. package/templates/typescript-auth-api-key/src/modules/calculator/calculator.tools.ts +0 -71
  185. package/templates/typescript-auth-api-key/src/modules/demo/demo.module.ts +0 -18
  186. package/templates/typescript-auth-api-key/src/modules/demo/demo.tools.ts +0 -155
  187. package/templates/typescript-auth-api-key/src/modules/demo/multi-auth.tools.ts +0 -123
  188. package/templates/typescript-auth-api-key/src/widgets/app/calculator-operations/page.tsx +0 -133
  189. package/templates/typescript-auth-api-key/src/widgets/app/calculator-result/page.tsx +0 -134
  190. package/templates/typescript-auth-api-key/src/widgets/app/layout.tsx +0 -14
  191. package/templates/typescript-auth-api-key/src/widgets/package.json +0 -24
  192. package/templates/typescript-auth-api-key/src/widgets/widget-manifest.json +0 -48
  193. package/templates/typescript-auth-api-key/tsconfig.json +0 -23
  194. package/templates/typescript-oauth/OAUTH_SETUP.md +0 -592
  195. package/templates/typescript-oauth/src/modules/demo/demo.module.ts +0 -16
  196. package/templates/typescript-oauth/src/modules/demo/demo.tools.ts +0 -190
  197. package/templates/typescript-oauth/src/widgets/app/calculator-operations/page.tsx +0 -133
  198. package/templates/typescript-oauth/src/widgets/app/calculator-result/page.tsx +0 -134
  199. package/templates/typescript-oauth/src/widgets/out/404.html +0 -1
  200. package/templates/typescript-oauth/src/widgets/out/_next/static/WU9THacVqL52RZbrZOLS1/_buildManifest.js +0 -1
  201. package/templates/typescript-oauth/src/widgets/out/_next/static/WU9THacVqL52RZbrZOLS1/_ssgManifest.js +0 -1
  202. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/117-eb57c7ef86f964a4.js +0 -2
  203. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/_not-found/page-dcb83ba3e4d0aafd.js +0 -1
  204. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/calculator-operations/page-b8913a740073ea8a.js +0 -1
  205. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/calculator-result/page-ddaaab2fce95dea2.js +0 -1
  206. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/app/layout-cbd3ebdc4ecc5247.js +0 -1
  207. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/fd9d1056-749e5812300142af.js +0 -1
  208. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/framework-f66176bb897dc684.js +0 -1
  209. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/main-76df43fcef3db344.js +0 -1
  210. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/main-app-f9c40224d04023c5.js +0 -1
  211. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/pages/_app-72b849fbd24ac258.js +0 -1
  212. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/pages/_error-7ba65e1336b92748.js +0 -1
  213. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  214. package/templates/typescript-oauth/src/widgets/out/_next/static/chunks/webpack-100b9e646d9c912e.js +0 -1
  215. package/templates/typescript-oauth/src/widgets/out/calculator-operations.html +0 -1
  216. package/templates/typescript-oauth/src/widgets/out/calculator-operations.txt +0 -7
  217. package/templates/typescript-oauth/src/widgets/out/calculator-result.html +0 -1
  218. package/templates/typescript-oauth/src/widgets/out/calculator-result.txt +0 -7
  219. package/templates/typescript-starter/src/widgets/app/calculator-operations/page.tsx +0 -133
  220. /package/templates/{typescript-auth-api-key → typescript-oauth}/src/health/system.health.ts +0 -0
  221. /package/templates/{typescript-auth-api-key → typescript-pizzaz}/src/widgets/next.config.js +0 -0
  222. /package/templates/{typescript-auth-api-key → typescript-pizzaz}/src/widgets/tsconfig.json +0 -0
@@ -1,190 +0,0 @@
1
- import { Injectable, ToolDecorator as Tool, UseGuards, z, ExecutionContext } from 'nitrostack';
2
- import { OAuthGuard, createScopeGuard } from '../../guards/oauth.guard.js';
3
-
4
- /**
5
- * Demo Tools Module
6
- *
7
- * Demonstrates OAuth 2.1 authentication with:
8
- * 1. Public tools (no authentication)
9
- * 2. Protected tools (OAuth token required)
10
- * 3. Scoped tools (specific permissions required)
11
- */
12
-
13
- @Injectable()
14
- export class DemoTools {
15
-
16
- /**
17
- * PUBLIC TOOL - No authentication required
18
- * Anyone can call this tool without OAuth
19
- */
20
- @Tool({
21
- name: 'get_server_info',
22
- description: 'Get public server information (no authentication required)',
23
- inputSchema: z.object({}),
24
- })
25
- async getServerInfo() {
26
- return {
27
- name: 'OAuth 2.1 MCP Server',
28
- version: '1.0.0',
29
- description: 'Demonstrates OAuth 2.1 authentication for MCP',
30
- authentication: {
31
- type: 'OAuth 2.1',
32
- compliant: [
33
- 'OAuth 2.1 (draft-ietf-oauth-v2-1-13)',
34
- 'RFC 9728 - Protected Resource Metadata',
35
- 'RFC 8707 - Resource Indicators (Token Audience Binding)',
36
- 'RFC 7636 - PKCE',
37
- ],
38
- compatibleWith: ['OpenAI Apps SDK', 'Any RFC-compliant OAuth provider'],
39
- },
40
- availableTools: {
41
- public: ['get_server_info'],
42
- protected: ['get_user_profile', 'list_resources', 'create_resource'],
43
- },
44
- timestamp: new Date().toISOString(),
45
- };
46
- }
47
-
48
- /**
49
- * PROTECTED TOOL - OAuth token required
50
- * Basic authentication, no specific scopes needed
51
- */
52
- @Tool({
53
- name: 'get_user_profile',
54
- description: 'Get authenticated user profile (requires OAuth token)',
55
- inputSchema: z.object({}),
56
- })
57
- @UseGuards(OAuthGuard)
58
- async getUserProfile(args: {}, context?: ExecutionContext) {
59
- const userId = context?.auth?.subject;
60
- const scopes = context?.auth?.scopes || [];
61
- const clientId = context?.auth?.clientId;
62
-
63
- return {
64
- message: 'User profile retrieved successfully',
65
- user: {
66
- id: userId,
67
- authenticatedVia: 'OAuth 2.1',
68
- scopes: scopes,
69
- clientId: clientId,
70
- },
71
- timestamp: new Date().toISOString(),
72
- note: 'This is a demo. In production, you would fetch real user data from your database.',
73
- };
74
- }
75
-
76
- /**
77
- * SCOPED TOOL - Requires 'read' scope
78
- * Demonstrates fine-grained access control
79
- */
80
- @Tool({
81
- name: 'list_resources',
82
- description: 'List available resources (requires OAuth token with "read" scope)',
83
- inputSchema: z.object({
84
- category: z.enum(['documents', 'images', 'videos', 'all']).default('all').describe('Resource category'),
85
- limit: z.number().min(1).max(100).default(10).describe('Maximum number of resources to return'),
86
- }),
87
- })
88
- @UseGuards(OAuthGuard, createScopeGuard(['read']))
89
- async listResources(
90
- args: { category: string; limit: number },
91
- context?: ExecutionContext
92
- ) {
93
- const userId = context?.auth?.subject;
94
-
95
- // Generate demo resources
96
- const resources = Array.from({ length: args.limit }, (_, i) => ({
97
- id: `resource_${i + 1}`,
98
- name: `${args.category === 'all' ? 'Sample' : args.category} Resource ${i + 1}`,
99
- type: args.category === 'all' ? ['document', 'image', 'video'][i % 3] : args.category,
100
- owner: userId,
101
- createdAt: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
102
- }));
103
-
104
- return {
105
- message: 'Resources listed successfully',
106
- category: args.category,
107
- count: resources.length,
108
- resources: resources,
109
- requiredScope: 'read',
110
- authenticatedUser: userId,
111
- timestamp: new Date().toISOString(),
112
- };
113
- }
114
-
115
- /**
116
- * SCOPED TOOL - Requires 'write' scope
117
- * Demonstrates write operations with OAuth
118
- */
119
- @Tool({
120
- name: 'create_resource',
121
- description: 'Create a new resource (requires OAuth token with "write" scope)',
122
- inputSchema: z.object({
123
- name: z.string().describe('Resource name'),
124
- type: z.enum(['document', 'image', 'video']).describe('Resource type'),
125
- content: z.string().optional().describe('Resource content or description'),
126
- }),
127
- })
128
- @UseGuards(OAuthGuard, createScopeGuard(['write']))
129
- async createResource(
130
- args: { name: string; type: string; content?: string },
131
- context?: ExecutionContext
132
- ) {
133
- const userId = context?.auth?.subject;
134
- const resourceId = `resource_${Date.now()}_${Math.random().toString(36).substring(7)}`;
135
-
136
- return {
137
- message: 'Resource created successfully',
138
- resource: {
139
- id: resourceId,
140
- name: args.name,
141
- type: args.type,
142
- content: args.content || 'No content provided',
143
- owner: userId,
144
- createdAt: new Date().toISOString(),
145
- },
146
- requiredScope: 'write',
147
- authenticatedUser: userId,
148
- note: 'This is a demo. In production, this would persist to your database.',
149
- timestamp: new Date().toISOString(),
150
- };
151
- }
152
-
153
- /**
154
- * MULTI-SCOPE TOOL - Requires both 'read' and 'admin' scopes
155
- * Demonstrates multiple scope requirements
156
- */
157
- @Tool({
158
- name: 'admin_statistics',
159
- description: 'Get administrative statistics (requires OAuth token with "read" and "admin" scopes)',
160
- inputSchema: z.object({
161
- timeRange: z.enum(['24h', '7d', '30d', '90d']).default('7d').describe('Time range for statistics'),
162
- }),
163
- })
164
- @UseGuards(OAuthGuard, createScopeGuard(['read', 'admin']))
165
- async getAdminStatistics(
166
- args: { timeRange: string },
167
- context?: ExecutionContext
168
- ) {
169
- const userId = context?.auth?.subject;
170
- const scopes = context?.auth?.scopes || [];
171
-
172
- return {
173
- message: 'Admin statistics retrieved successfully',
174
- timeRange: args.timeRange,
175
- statistics: {
176
- totalUsers: Math.floor(Math.random() * 10000),
177
- totalResources: Math.floor(Math.random() * 50000),
178
- apiCalls: Math.floor(Math.random() * 1000000),
179
- activeTokens: Math.floor(Math.random() * 5000),
180
- },
181
- requiredScopes: ['read', 'admin'],
182
- authenticatedUser: userId,
183
- userScopes: scopes,
184
- timestamp: new Date().toISOString(),
185
- note: 'This tool requires elevated permissions. Only users with admin scope can access this data.',
186
- };
187
- }
188
- }
189
-
190
-
@@ -1,133 +0,0 @@
1
- 'use client';
2
-
3
- import { withToolData } from 'nitrostack/widgets';
4
-
5
- /**
6
- * Widget Metadata (stored in widget-manifest.json)
7
- *
8
- * This widget lists all available calculator operations.
9
- *
10
- * Example includes all four operations: add, subtract, multiply, divide
11
- *
12
- * Frontend developers: Edit widget-manifest.json to update examples
13
- */
14
-
15
- interface Operation {
16
- name: string;
17
- symbol: string;
18
- description: string;
19
- example: string;
20
- }
21
-
22
- interface OperationsData {
23
- operations: Operation[];
24
- }
25
-
26
- function CalculatorOperations({ data }: { data: OperationsData }) {
27
- const getOperationColor = (name: string) => {
28
- const colors: Record<string, string> = {
29
- add: '#10b981',
30
- subtract: '#f59e0b',
31
- multiply: '#3b82f6',
32
- divide: '#8b5cf6'
33
- };
34
- return colors[name] || '#6b7280';
35
- };
36
-
37
- return (
38
- <div style={{
39
- padding: '24px',
40
- background: 'linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%)',
41
- borderRadius: '16px',
42
- maxWidth: '500px'
43
- }}>
44
- <h3 style={{
45
- margin: '0 0 20px 0',
46
- fontSize: '24px',
47
- color: '#1f2937',
48
- display: 'flex',
49
- alignItems: 'center',
50
- gap: '12px'
51
- }}>
52
- <span style={{ fontSize: '32px' }}>🔢</span>
53
- Calculator Operations
54
- </h3>
55
-
56
- <div style={{ display: 'grid', gap: '12px' }}>
57
- {data.operations.map((op) => (
58
- <div
59
- key={op.name}
60
- style={{
61
- background: 'white',
62
- borderRadius: '12px',
63
- padding: '16px',
64
- boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
65
- borderLeft: `4px solid ${getOperationColor(op.name)}`
66
- }}
67
- >
68
- <div style={{
69
- display: 'flex',
70
- alignItems: 'center',
71
- gap: '12px',
72
- marginBottom: '8px'
73
- }}>
74
- <div style={{
75
- width: '40px',
76
- height: '40px',
77
- borderRadius: '10px',
78
- background: getOperationColor(op.name),
79
- display: 'flex',
80
- alignItems: 'center',
81
- justifyContent: 'center',
82
- color: 'white',
83
- fontSize: '24px',
84
- fontWeight: 'bold'
85
- }}>
86
- {op.symbol}
87
- </div>
88
- <div>
89
- <div style={{
90
- fontSize: '16px',
91
- fontWeight: 'bold',
92
- color: '#1f2937',
93
- textTransform: 'capitalize'
94
- }}>
95
- {op.name}
96
- </div>
97
- <div style={{
98
- fontSize: '14px',
99
- color: '#6b7280'
100
- }}>
101
- {op.description}
102
- </div>
103
- </div>
104
- </div>
105
- <div style={{
106
- marginTop: '12px',
107
- padding: '8px 12px',
108
- background: '#f9fafb',
109
- borderRadius: '8px',
110
- fontFamily: 'monospace',
111
- fontSize: '14px',
112
- color: '#374151'
113
- }}>
114
- {op.example}
115
- </div>
116
- </div>
117
- ))}
118
- </div>
119
-
120
- <div style={{
121
- marginTop: '16px',
122
- textAlign: 'center',
123
- fontSize: '12px',
124
- color: '#6b7280'
125
- }}>
126
- ✨ Use the 'calculate' tool to perform these operations
127
- </div>
128
- </div>
129
- );
130
- }
131
-
132
- export default withToolData(CalculatorOperations);
133
-
@@ -1,134 +0,0 @@
1
- 'use client';
2
-
3
- import { withToolData } from 'nitrostack/widgets';
4
-
5
- /**
6
- * Widget Metadata (stored in widget-manifest.json)
7
- *
8
- * This widget displays calculation results with operation details.
9
- *
10
- * Examples defined in manifest:
11
- * - Addition: 5 + 3 = 8
12
- * - Multiplication: 6 × 7 = 42
13
- * - Division: 20 ÷ 4 = 5
14
- *
15
- * Frontend developers: Edit widget-manifest.json to update examples
16
- */
17
-
18
- interface CalculatorData {
19
- operation: string;
20
- a: number;
21
- b: number;
22
- result: number;
23
- expression: string;
24
- }
25
-
26
- function CalculatorResult({ data }: { data: CalculatorData }) {
27
- const getOperationColor = (op: string) => {
28
- const colors: Record<string, string> = {
29
- add: '#10b981',
30
- subtract: '#f59e0b',
31
- multiply: '#3b82f6',
32
- divide: '#8b5cf6'
33
- };
34
- return colors[op] || '#6b7280';
35
- };
36
-
37
- const getOperationIcon = (op: string) => {
38
- const icons: Record<string, string> = {
39
- add: '➕',
40
- subtract: '➖',
41
- multiply: '✖️',
42
- divide: '➗'
43
- };
44
- return icons[op] || '🔢';
45
- };
46
-
47
- const color = getOperationColor(data.operation);
48
-
49
- return (
50
- <div style={{
51
- padding: '24px',
52
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
53
- borderRadius: '16px',
54
- color: 'white',
55
- maxWidth: '400px',
56
- boxShadow: '0 10px 30px rgba(0,0,0,0.2)'
57
- }}>
58
- <div style={{
59
- display: 'flex',
60
- alignItems: 'center',
61
- gap: '12px',
62
- marginBottom: '20px'
63
- }}>
64
- <span style={{ fontSize: '32px' }}>
65
- {getOperationIcon(data.operation)}
66
- </span>
67
- <div>
68
- <h3 style={{ margin: 0, fontSize: '18px', opacity: 0.9 }}>
69
- Calculator Result
70
- </h3>
71
- <p style={{ margin: '4px 0 0 0', fontSize: '14px', opacity: 0.7 }}>
72
- {data.operation.charAt(0).toUpperCase() + data.operation.slice(1)}
73
- </p>
74
- </div>
75
- </div>
76
-
77
- <div style={{
78
- background: 'rgba(255, 255, 255, 0.15)',
79
- borderRadius: '12px',
80
- padding: '20px',
81
- backdropFilter: 'blur(10px)',
82
- marginBottom: '16px'
83
- }}>
84
- <div style={{
85
- fontSize: '28px',
86
- fontWeight: 'bold',
87
- textAlign: 'center',
88
- marginBottom: '12px',
89
- fontFamily: 'monospace'
90
- }}>
91
- {data.expression}
92
- </div>
93
-
94
- <div style={{
95
- display: 'flex',
96
- justifyContent: 'space-around',
97
- fontSize: '14px',
98
- opacity: 0.9,
99
- marginTop: '16px'
100
- }}>
101
- <div style={{ textAlign: 'center' }}>
102
- <div style={{ fontSize: '12px', opacity: 0.7 }}>First</div>
103
- <div style={{ fontWeight: 'bold', fontSize: '20px' }}>{data.a}</div>
104
- </div>
105
- <div style={{ textAlign: 'center' }}>
106
- <div style={{ fontSize: '12px', opacity: 0.7 }}>Second</div>
107
- <div style={{ fontWeight: 'bold', fontSize: '20px' }}>{data.b}</div>
108
- </div>
109
- <div style={{ textAlign: 'center' }}>
110
- <div style={{ fontSize: '12px', opacity: 0.7 }}>Result</div>
111
- <div style={{
112
- fontWeight: 'bold',
113
- fontSize: '24px',
114
- color: '#fbbf24'
115
- }}>
116
- {data.result}
117
- </div>
118
- </div>
119
- </div>
120
- </div>
121
-
122
- <div style={{
123
- fontSize: '12px',
124
- textAlign: 'center',
125
- opacity: 0.7
126
- }}>
127
- ✨ NitroStack Calculator
128
- </div>
129
- </div>
130
- );
131
- }
132
-
133
- export default withToolData(CalculatorResult);
134
-
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-100b9e646d9c912e.js"/><script src="/_next/static/chunks/fd9d1056-749e5812300142af.js" async=""></script><script src="/_next/static/chunks/117-eb57c7ef86f964a4.js" async=""></script><script src="/_next/static/chunks/main-app-f9c40224d04023c5.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body style="margin:0;padding:0;font-family:system-ui, sans-serif"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-100b9e646d9c912e.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:I[2846,[],\"\"]\n3:I[4707,[],\"\"]\n4:I[6423,[],\"\"]\na:I[1060,[],\"\"]\n5:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n6:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\n7:{\"display\":\"inline-block\"}\n8:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\nb:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L1\",null,{\"buildId\":\"WU9THacVqL52RZbrZOLS1\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"_not-found\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L2\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"style\":{\"margin\":0,\"padding\":0,\"fontFamily\":\"system-ui, sans-serif\"},\"children\":[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$5\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$6\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$7\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$8\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$L9\"],\"globalErrorComponent\":\"$a\",\"missingSlots\":\"$Wb\"}]\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}]]\n2:null\n"])</script></body></html>
@@ -1 +0,0 @@
1
- self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-7ba65e1336b92748.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -1 +0,0 @@
1
- self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()