lua-cli 2.2.8-alpha.2 → 2.3.0-alpha.2

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 (195) hide show
  1. package/API_REFERENCE.md +1408 -0
  2. package/CLI_REFERENCE.md +818 -0
  3. package/GETTING_STARTED.md +1040 -0
  4. package/README.md +738 -424
  5. package/TEMPLATE_GUIDE.md +1398 -0
  6. package/dist/api/agent.api.service.d.ts +33 -6
  7. package/dist/api/agent.api.service.js +27 -0
  8. package/dist/api/auth.api.service.d.ts +31 -2
  9. package/dist/api/auth.api.service.js +29 -0
  10. package/dist/api/basket.api.service.d.ts +53 -11
  11. package/dist/api/basket.api.service.js +63 -14
  12. package/dist/api/chat.api.service.d.ts +15 -3
  13. package/dist/api/chat.api.service.js +12 -0
  14. package/dist/api/credentials.d.ts +24 -0
  15. package/dist/api/credentials.js +46 -0
  16. package/dist/api/custom.data.api.service.d.ts +45 -9
  17. package/dist/api/custom.data.api.service.js +43 -9
  18. package/dist/api/lazy-instances.d.ts +49 -0
  19. package/dist/api/lazy-instances.js +95 -0
  20. package/dist/api/order.api.service.d.ts +34 -4
  21. package/dist/api/order.api.service.js +41 -3
  22. package/dist/api/products.api.service.d.ts +39 -9
  23. package/dist/api/products.api.service.js +43 -5
  24. package/dist/api/skills.api.service.d.ts +49 -2
  25. package/dist/api/skills.api.service.js +47 -1
  26. package/dist/api/tool.api.service.d.ts +39 -1
  27. package/dist/api/tool.api.service.js +38 -0
  28. package/dist/api/user.data.api.service.d.ts +23 -1
  29. package/dist/api/user.data.api.service.js +22 -0
  30. package/dist/api-exports.d.ts +236 -5
  31. package/dist/api-exports.js +264 -81
  32. package/dist/cli/command-definitions.d.ts +30 -0
  33. package/dist/cli/command-definitions.js +71 -0
  34. package/dist/commands/agents.d.ts +20 -0
  35. package/dist/commands/agents.js +24 -2
  36. package/dist/commands/apiKey.d.ts +23 -0
  37. package/dist/commands/apiKey.js +23 -0
  38. package/dist/commands/compile.d.ts +24 -0
  39. package/dist/commands/compile.js +67 -759
  40. package/dist/commands/configure.d.ts +24 -0
  41. package/dist/commands/configure.js +31 -96
  42. package/dist/commands/deploy.d.ts +31 -19
  43. package/dist/commands/deploy.js +45 -74
  44. package/dist/commands/destroy.d.ts +27 -0
  45. package/dist/commands/destroy.js +27 -1
  46. package/dist/commands/dev.d.ts +25 -62
  47. package/dist/commands/dev.js +58 -878
  48. package/dist/commands/init.d.ts +27 -0
  49. package/dist/commands/init.js +98 -260
  50. package/dist/commands/push.d.ts +24 -21
  51. package/dist/commands/push.js +39 -92
  52. package/dist/commands/test.d.ts +26 -0
  53. package/dist/commands/test.js +41 -188
  54. package/dist/common/basket.instance.d.ts +54 -3
  55. package/dist/common/basket.instance.js +56 -3
  56. package/dist/common/data.entry.instance.d.ts +25 -2
  57. package/dist/common/data.entry.instance.js +24 -0
  58. package/dist/common/http.client.d.ts +51 -1
  59. package/dist/common/http.client.js +50 -0
  60. package/dist/common/order.instance.d.ts +22 -0
  61. package/dist/common/order.instance.js +31 -4
  62. package/dist/common/product.instance.d.ts +22 -1
  63. package/dist/common/product.instance.js +24 -6
  64. package/dist/common/product.pagination.instance.d.ts +22 -2
  65. package/dist/common/product.pagination.instance.js +22 -1
  66. package/dist/common/product.search.instance.d.ts +13 -3
  67. package/dist/common/product.search.instance.js +12 -1
  68. package/dist/common/user.instance.d.ts +27 -3
  69. package/dist/common/user.instance.js +28 -7
  70. package/dist/config/auth.constants.d.ts +11 -0
  71. package/dist/config/auth.constants.js +11 -0
  72. package/dist/config/compile.constants.d.ts +67 -0
  73. package/dist/config/compile.constants.js +99 -0
  74. package/dist/config/constants.d.ts +5 -0
  75. package/dist/config/constants.js +5 -0
  76. package/dist/config/dev.constants.d.ts +65 -0
  77. package/dist/config/dev.constants.js +79 -0
  78. package/dist/config/init.constants.d.ts +23 -0
  79. package/dist/config/init.constants.js +41 -0
  80. package/dist/index.d.ts +19 -3
  81. package/dist/index.js +28 -44
  82. package/dist/interfaces/admin.d.ts +56 -50
  83. package/dist/interfaces/admin.js +4 -0
  84. package/dist/interfaces/agent.d.ts +21 -0
  85. package/dist/interfaces/agent.js +4 -0
  86. package/dist/interfaces/baskets.d.ts +60 -0
  87. package/dist/interfaces/baskets.js +12 -0
  88. package/dist/interfaces/chat.d.ts +48 -4
  89. package/dist/interfaces/chat.js +4 -0
  90. package/dist/interfaces/common.d.ts +62 -0
  91. package/dist/interfaces/common.js +8 -0
  92. package/dist/interfaces/compile.d.ts +11 -0
  93. package/dist/interfaces/compile.js +4 -0
  94. package/dist/interfaces/custom.data.d.ts +49 -19
  95. package/dist/interfaces/custom.data.js +4 -0
  96. package/dist/interfaces/deploy.d.ts +29 -0
  97. package/dist/interfaces/deploy.js +4 -0
  98. package/dist/interfaces/dev.d.ts +53 -0
  99. package/dist/interfaces/dev.js +5 -0
  100. package/dist/interfaces/init.d.ts +60 -0
  101. package/dist/interfaces/init.js +4 -0
  102. package/dist/interfaces/orders.d.ts +37 -0
  103. package/dist/interfaces/orders.js +12 -0
  104. package/dist/interfaces/product.d.ts +38 -10
  105. package/dist/interfaces/product.js +4 -0
  106. package/dist/interfaces/push.d.ts +26 -0
  107. package/dist/interfaces/push.js +4 -0
  108. package/dist/interfaces/test.d.ts +36 -0
  109. package/dist/interfaces/test.js +4 -0
  110. package/dist/services/auth.d.ts +54 -99
  111. package/dist/services/auth.js +76 -12
  112. package/dist/types/api-contracts.d.ts +211 -0
  113. package/dist/types/api-contracts.js +8 -0
  114. package/dist/types/compile.types.d.ts +76 -0
  115. package/dist/types/compile.types.js +4 -0
  116. package/dist/types/index.d.ts +23 -121
  117. package/dist/types/index.js +25 -14
  118. package/dist/types/skill.d.ts +142 -0
  119. package/dist/{skill.js → types/skill.js} +66 -17
  120. package/dist/types/tool-validation.d.ts +34 -0
  121. package/dist/types/tool-validation.js +42 -0
  122. package/dist/utils/auth-flows.d.ts +26 -0
  123. package/dist/utils/auth-flows.js +141 -0
  124. package/dist/utils/bundling.d.ts +36 -0
  125. package/dist/utils/bundling.js +137 -0
  126. package/dist/utils/compile.d.ts +37 -0
  127. package/dist/utils/compile.js +242 -0
  128. package/dist/utils/deploy-api.d.ts +26 -0
  129. package/dist/utils/deploy-api.js +53 -0
  130. package/dist/utils/deploy-helpers.d.ts +46 -0
  131. package/dist/utils/deploy-helpers.js +86 -0
  132. package/dist/utils/deployment.d.ts +25 -0
  133. package/dist/utils/deployment.js +161 -0
  134. package/dist/utils/dev-api.d.ts +61 -0
  135. package/dist/utils/dev-api.js +262 -0
  136. package/dist/utils/dev-helpers.d.ts +46 -0
  137. package/dist/utils/dev-helpers.js +83 -0
  138. package/dist/utils/dev-server.d.ts +24 -0
  139. package/dist/utils/dev-server.js +555 -0
  140. package/dist/utils/dev-watcher.d.ts +31 -0
  141. package/dist/utils/dev-watcher.js +110 -0
  142. package/dist/utils/files.js +0 -5
  143. package/dist/utils/init-agent.d.ts +34 -0
  144. package/dist/utils/init-agent.js +129 -0
  145. package/dist/utils/init-helpers.d.ts +41 -0
  146. package/dist/utils/init-helpers.js +73 -0
  147. package/dist/utils/init-prompts.d.ts +47 -0
  148. package/dist/utils/init-prompts.js +168 -0
  149. package/dist/utils/push-api.d.ts +15 -0
  150. package/dist/utils/push-api.js +48 -0
  151. package/dist/utils/push-helpers.d.ts +38 -0
  152. package/dist/utils/push-helpers.js +84 -0
  153. package/dist/utils/sandbox-storage.d.ts +27 -0
  154. package/dist/utils/sandbox-storage.js +71 -0
  155. package/dist/utils/sandbox.js +78 -114
  156. package/dist/utils/skill-management.d.ts +14 -0
  157. package/dist/utils/skill-management.js +148 -0
  158. package/dist/utils/test-helpers.d.ts +40 -0
  159. package/dist/utils/test-helpers.js +92 -0
  160. package/dist/utils/test-prompts.d.ts +23 -0
  161. package/dist/utils/test-prompts.js +186 -0
  162. package/dist/utils/tool-detection.d.ts +18 -0
  163. package/dist/utils/tool-detection.js +110 -0
  164. package/dist/web/app.css +941 -17
  165. package/dist/web/app.js +174 -22
  166. package/dist/web/index.html +7 -1
  167. package/package.json +13 -4
  168. package/template/QUICKSTART.md +299 -144
  169. package/template/README.md +928 -349
  170. package/template/TOOL_EXAMPLES.md +655 -0
  171. package/template/package-lock.json +5 -5
  172. package/template/package.json +1 -1
  173. package/template/src/index.ts +147 -207
  174. package/template/src/tools/BasketTool.ts +128 -0
  175. package/template/src/tools/CustomDataTool.ts +7 -13
  176. package/template/src/tools/OrderTool.ts +54 -0
  177. package/template/src/tools/PaymentTool.ts +1 -1
  178. package/template/src/tools/ProductsTool.ts +56 -118
  179. package/template/src/tools/UserDataTool.ts +4 -26
  180. package/dist/common/config.d.ts +0 -5
  181. package/dist/common/config.js +0 -5
  182. package/dist/custom-data-api.d.ts +0 -72
  183. package/dist/custom-data-api.js +0 -174
  184. package/dist/product-api.d.ts +0 -189
  185. package/dist/product-api.js +0 -141
  186. package/dist/services/api.d.ts +0 -549
  187. package/dist/services/api.js +0 -596
  188. package/dist/skill.d.ts +0 -50
  189. package/dist/types.d.ts +0 -1
  190. package/dist/types.js +0 -2
  191. package/dist/user-data-api.d.ts +0 -39
  192. package/dist/user-data-api.js +0 -50
  193. package/template/API.md +0 -604
  194. package/template/DEVELOPER.md +0 -771
  195. package/template/lua.skill.yaml +0 -7
@@ -1,10 +1,22 @@
1
1
  /**
2
2
  * Generic HTTP client with common error handling
3
+ * Provides a base class for all API service classes with standardized HTTP methods
3
4
  */
4
5
  export class HttpClient {
6
+ /**
7
+ * Creates an instance of HttpClient
8
+ * @param baseUrl - The base URL for all API requests
9
+ */
5
10
  constructor(baseUrl) {
6
11
  this.baseUrl = baseUrl;
7
12
  }
13
+ /**
14
+ * Makes an HTTP request with standardized error handling
15
+ * @param url - The full URL to request
16
+ * @param options - Fetch API request options
17
+ * @returns Promise resolving to an ApiResponse with typed data
18
+ * @private
19
+ */
8
20
  async request(url, options = {}) {
9
21
  try {
10
22
  const response = await fetch(url, {
@@ -53,9 +65,24 @@ export class HttpClient {
53
65
  };
54
66
  }
55
67
  }
68
+ /**
69
+ * Performs an HTTP GET request
70
+ * @param url - The relative URL path to request (will be appended to baseUrl)
71
+ * @param headers - Optional HTTP headers to include in the request
72
+ * @returns Promise resolving to an ApiResponse with typed data
73
+ * @protected
74
+ */
56
75
  async httpGet(url, headers) {
57
76
  return this.request(this.baseUrl + url, { method: 'GET', headers });
58
77
  }
78
+ /**
79
+ * Performs an HTTP POST request
80
+ * @param url - The relative URL path to request (will be appended to baseUrl)
81
+ * @param data - Optional request body data (will be JSON stringified)
82
+ * @param headers - Optional HTTP headers to include in the request
83
+ * @returns Promise resolving to an ApiResponse with typed data
84
+ * @protected
85
+ */
59
86
  async httpPost(url, data, headers) {
60
87
  return this.request(this.baseUrl + url, {
61
88
  method: 'POST',
@@ -63,6 +90,14 @@ export class HttpClient {
63
90
  headers,
64
91
  });
65
92
  }
93
+ /**
94
+ * Performs an HTTP PUT request
95
+ * @param url - The relative URL path to request (will be appended to baseUrl)
96
+ * @param data - Optional request body data (will be JSON stringified)
97
+ * @param headers - Optional HTTP headers to include in the request
98
+ * @returns Promise resolving to an ApiResponse with typed data
99
+ * @protected
100
+ */
66
101
  async httpPut(url, data, headers) {
67
102
  return this.request(this.baseUrl + url, {
68
103
  method: 'PUT',
@@ -70,9 +105,24 @@ export class HttpClient {
70
105
  headers,
71
106
  });
72
107
  }
108
+ /**
109
+ * Performs an HTTP DELETE request
110
+ * @param url - The relative URL path to request (will be appended to baseUrl)
111
+ * @param headers - Optional HTTP headers to include in the request
112
+ * @returns Promise resolving to an ApiResponse with typed data
113
+ * @protected
114
+ */
73
115
  async httpDelete(url, headers) {
74
116
  return this.request(this.baseUrl + url, { method: 'DELETE', headers });
75
117
  }
118
+ /**
119
+ * Performs an HTTP PATCH request
120
+ * @param url - The relative URL path to request (will be appended to baseUrl)
121
+ * @param data - Optional request body data (will be JSON stringified)
122
+ * @param headers - Optional HTTP headers to include in the request
123
+ * @returns Promise resolving to an ApiResponse with typed data
124
+ * @protected
125
+ */
76
126
  async httpPatch(url, data, headers) {
77
127
  return this.request(this.baseUrl + url, {
78
128
  method: 'PATCH',
@@ -1,5 +1,9 @@
1
1
  import OrderApi from "../api/order.api.service.js";
2
2
  import { OrderResponse, OrderStatus } from "../interfaces/orders.js";
3
+ /**
4
+ * Order instance class providing a fluent API for managing orders
5
+ * Provides methods for updating order status and order data
6
+ */
3
7
  export default class OrderInstance {
4
8
  private data;
5
9
  private common;
@@ -8,11 +12,29 @@ export default class OrderInstance {
8
12
  private agentId;
9
13
  private orderId;
10
14
  private orderAPI;
15
+ /**
16
+ * Creates a new OrderInstance
17
+ * @param api - The OrderApi instance for making API calls
18
+ * @param order - The order response data from the API
19
+ */
11
20
  constructor(api: OrderApi, order: OrderResponse);
12
21
  /**
13
22
  * Custom toJSON method to control what gets serialized when logging
23
+ * @returns Serialized order data combining data and common fields
14
24
  */
15
25
  toJSON(): Record<string, any>;
26
+ /**
27
+ * Updates the order's status
28
+ * @param status - The new order status (e.g., 'pending', 'processing', 'shipped', 'delivered', 'cancelled')
29
+ * @returns Promise resolving to the updated order data
30
+ * @throws Error if the status update fails
31
+ */
16
32
  updateStatus(status: OrderStatus): Promise<any>;
33
+ /**
34
+ * Updates the order's data
35
+ * @param data - The data fields to update (e.g., shipping info, notes, metadata)
36
+ * @returns Promise resolving to the updated order data
37
+ * @throws Error if the data update fails
38
+ */
17
39
  update(data: Record<string, any>): Promise<any>;
18
40
  }
@@ -1,4 +1,13 @@
1
+ /**
2
+ * Order instance class providing a fluent API for managing orders
3
+ * Provides methods for updating order status and order data
4
+ */
1
5
  export default class OrderInstance {
6
+ /**
7
+ * Creates a new OrderInstance
8
+ * @param api - The OrderApi instance for making API calls
9
+ * @param order - The order response data from the API
10
+ */
2
11
  constructor(api, order) {
3
12
  this.data = order.data;
4
13
  this.common = order.common;
@@ -16,37 +25,55 @@ export default class OrderInstance {
16
25
  }
17
26
  /**
18
27
  * Custom toJSON method to control what gets serialized when logging
28
+ * @returns Serialized order data combining data and common fields
19
29
  */
20
30
  toJSON() {
21
31
  return {
22
32
  ...this.data,
23
- ...this.common
33
+ ...this.common,
34
+ id: this.id
24
35
  };
25
36
  }
26
37
  /**
27
38
  * Custom inspect method for Node.js console.log
39
+ * @returns Formatted order data for console output
28
40
  */
29
41
  [Symbol.for('nodejs.util.inspect.custom')]() {
30
42
  return {
31
43
  ...this.data,
32
- ...this.common
44
+ ...this.common,
45
+ id: this.id
33
46
  };
34
47
  }
48
+ /**
49
+ * Updates the order's status
50
+ * @param status - The new order status (e.g., 'pending', 'processing', 'shipped', 'delivered', 'cancelled')
51
+ * @returns Promise resolving to the updated order data
52
+ * @throws Error if the status update fails
53
+ */
35
54
  async updateStatus(status) {
36
55
  const response = await this.orderAPI.updateStatus(status, this.id);
37
56
  this.common = response.common;
38
57
  return {
39
58
  ...this.data,
40
- ...this.common
59
+ ...this.common,
60
+ id: this.id
41
61
  };
42
62
  }
63
+ /**
64
+ * Updates the order's data
65
+ * @param data - The data fields to update (e.g., shipping info, notes, metadata)
66
+ * @returns Promise resolving to the updated order data
67
+ * @throws Error if the data update fails
68
+ */
43
69
  async update(data) {
44
70
  const response = await this.orderAPI.updateData(data, this.id);
45
71
  this.data = response.data;
46
72
  this.common = response.common;
47
73
  return {
48
74
  ...this.data,
49
- ...this.common
75
+ ...this.common,
76
+ id: this.id
50
77
  };
51
78
  }
52
79
  }
@@ -1,12 +1,33 @@
1
- import { Product } from "../interfaces/product";
1
+ import { Product } from "../interfaces/product.js";
2
+ /**
3
+ * Product instance class providing a fluent API for managing individual products
4
+ * Provides methods for updating and deleting products
5
+ */
2
6
  export default class ProductInstance {
3
7
  data: Product;
4
8
  private productAPI;
9
+ /**
10
+ * Creates a new ProductInstance
11
+ * @param api - The ProductAPI instance for making API calls
12
+ * @param product - The product data from the API
13
+ */
5
14
  constructor(api: any, product: Product);
6
15
  /**
7
16
  * Custom toJSON method to control what gets serialized when logging
17
+ * @returns Serialized product data
8
18
  */
9
19
  toJSON(): Record<string, any>;
20
+ /**
21
+ * Updates the product's data
22
+ * @param data - The product fields to update (partial update supported)
23
+ * @returns Promise resolving to the updated Product
24
+ * @throws Error if the update fails or the product is not found
25
+ */
10
26
  update(data: Record<string, any>): Promise<Product>;
27
+ /**
28
+ * Deletes the product from the catalog
29
+ * @returns Promise resolving to an empty Product object if deletion was successful
30
+ * @throws Error if the deletion fails or the product is not found
31
+ */
11
32
  delete(): Promise<Product>;
12
33
  }
@@ -1,4 +1,13 @@
1
+ /**
2
+ * Product instance class providing a fluent API for managing individual products
3
+ * Provides methods for updating and deleting products
4
+ */
1
5
  export default class ProductInstance {
6
+ /**
7
+ * Creates a new ProductInstance
8
+ * @param api - The ProductAPI instance for making API calls
9
+ * @param product - The product data from the API
10
+ */
2
11
  constructor(api, product) {
3
12
  this.data = product;
4
13
  // Make productAPI non-enumerable so it doesn't show up in console.log
@@ -11,20 +20,24 @@ export default class ProductInstance {
11
20
  }
12
21
  /**
13
22
  * Custom toJSON method to control what gets serialized when logging
23
+ * @returns Serialized product data
14
24
  */
15
25
  toJSON() {
16
- return {
17
- data: this.data
18
- };
26
+ return this.data;
19
27
  }
20
28
  /**
21
29
  * Custom inspect method for Node.js console.log
30
+ * @returns Formatted product data for console output
22
31
  */
23
32
  [Symbol.for('nodejs.util.inspect.custom')]() {
24
- return {
25
- data: this.data
26
- };
33
+ return this.data;
27
34
  }
35
+ /**
36
+ * Updates the product's data
37
+ * @param data - The product fields to update (partial update supported)
38
+ * @returns Promise resolving to the updated Product
39
+ * @throws Error if the update fails or the product is not found
40
+ */
28
41
  async update(data) {
29
42
  const response = await this.productAPI.update(data, this.data.id);
30
43
  if (response.updated) {
@@ -35,6 +48,11 @@ export default class ProductInstance {
35
48
  throw new Error('Failed to update product');
36
49
  }
37
50
  }
51
+ /**
52
+ * Deletes the product from the catalog
53
+ * @returns Promise resolving to an empty Product object if deletion was successful
54
+ * @throws Error if the deletion fails or the product is not found
55
+ */
38
56
  async delete() {
39
57
  const response = await this.productAPI.delete(this.data.id);
40
58
  if (response.deleted) {
@@ -1,5 +1,9 @@
1
- import { ProductsResponse } from "../interfaces/product";
2
- import ProductInstance from "./product.instance";
1
+ import { ProductsResponse } from "../interfaces/product.js";
2
+ import ProductInstance from "./product.instance.js";
3
+ /**
4
+ * Product pagination instance class providing a fluent API for paginated product results
5
+ * Provides methods for navigating through pages of products
6
+ */
3
7
  export default class ProductPaginationInstance {
4
8
  products: ProductInstance[];
5
9
  pagination: {
@@ -13,11 +17,27 @@ export default class ProductPaginationInstance {
13
17
  prevPage: number | null;
14
18
  };
15
19
  private productAPI;
20
+ /**
21
+ * Creates a new ProductPaginationInstance
22
+ * @param api - The ProductAPI instance for making API calls
23
+ * @param results - The paginated product results from the API
24
+ */
16
25
  constructor(api: any, results: ProductsResponse);
17
26
  /**
18
27
  * Custom toJSON method to control what gets serialized when logging
28
+ * @returns Serialized products and pagination data
19
29
  */
20
30
  toJSON(): Record<string, any>;
31
+ /**
32
+ * Fetches the next page of products
33
+ * @returns Promise resolving to a new ProductPaginationInstance for the next page
34
+ * @throws Error if there is no next page available
35
+ */
21
36
  nextPage(): Promise<ProductPaginationInstance>;
37
+ /**
38
+ * Fetches the previous page of products
39
+ * @returns Promise resolving to a new ProductPaginationInstance for the previous page
40
+ * @throws Error if there is no previous page available
41
+ */
22
42
  prevPage(): Promise<ProductPaginationInstance>;
23
43
  }
@@ -1,5 +1,14 @@
1
- import ProductInstance from "./product.instance";
1
+ import ProductInstance from "./product.instance.js";
2
+ /**
3
+ * Product pagination instance class providing a fluent API for paginated product results
4
+ * Provides methods for navigating through pages of products
5
+ */
2
6
  export default class ProductPaginationInstance {
7
+ /**
8
+ * Creates a new ProductPaginationInstance
9
+ * @param api - The ProductAPI instance for making API calls
10
+ * @param results - The paginated product results from the API
11
+ */
3
12
  constructor(api, results) {
4
13
  this.products = results.data?.map(product => new ProductInstance(api, product)) || [];
5
14
  this.pagination = results.pagination || {
@@ -22,6 +31,7 @@ export default class ProductPaginationInstance {
22
31
  }
23
32
  /**
24
33
  * Custom toJSON method to control what gets serialized when logging
34
+ * @returns Serialized products and pagination data
25
35
  */
26
36
  toJSON() {
27
37
  return {
@@ -31,6 +41,7 @@ export default class ProductPaginationInstance {
31
41
  }
32
42
  /**
33
43
  * Custom inspect method for Node.js console.log
44
+ * @returns Formatted products and pagination data for console output
34
45
  */
35
46
  [Symbol.for('nodejs.util.inspect.custom')]() {
36
47
  return {
@@ -38,12 +49,22 @@ export default class ProductPaginationInstance {
38
49
  pagination: this.pagination
39
50
  };
40
51
  }
52
+ /**
53
+ * Fetches the next page of products
54
+ * @returns Promise resolving to a new ProductPaginationInstance for the next page
55
+ * @throws Error if there is no next page available
56
+ */
41
57
  async nextPage() {
42
58
  if (!this.pagination.nextPage) {
43
59
  throw new Error('No next page');
44
60
  }
45
61
  return await this.productAPI.get(this.pagination.nextPage, this.pagination.limit);
46
62
  }
63
+ /**
64
+ * Fetches the previous page of products
65
+ * @returns Promise resolving to a new ProductPaginationInstance for the previous page
66
+ * @throws Error if there is no previous page available
67
+ */
47
68
  async prevPage() {
48
69
  if (!this.pagination.prevPage) {
49
70
  throw new Error('No previous page');
@@ -1,12 +1,22 @@
1
- import { SearchProductsResponse } from "../interfaces/product";
2
- import { ProductAPI } from "../types";
3
- import ProductInstance from "./product.instance";
1
+ import { SearchProductsResponse } from "../interfaces/product.js";
2
+ import { ProductAPI } from "../types/index.js";
3
+ import ProductInstance from "./product.instance.js";
4
+ /**
5
+ * Product search instance class providing a fluent API for product search results
6
+ * Contains an array of ProductInstance objects matching the search query
7
+ */
4
8
  export default class ProductSearchInstance {
5
9
  products: ProductInstance[];
6
10
  private productAPI;
11
+ /**
12
+ * Creates a new ProductSearchInstance
13
+ * @param api - The ProductAPI instance for making API calls
14
+ * @param results - The product search results from the API
15
+ */
7
16
  constructor(api: ProductAPI, results: SearchProductsResponse);
8
17
  /**
9
18
  * Custom toJSON method to control what gets serialized when logging
19
+ * @returns Serialized search results with product data
10
20
  */
11
21
  toJSON(): Record<string, any>;
12
22
  }
@@ -1,5 +1,14 @@
1
- import ProductInstance from "./product.instance";
1
+ import ProductInstance from "./product.instance.js";
2
+ /**
3
+ * Product search instance class providing a fluent API for product search results
4
+ * Contains an array of ProductInstance objects matching the search query
5
+ */
2
6
  export default class ProductSearchInstance {
7
+ /**
8
+ * Creates a new ProductSearchInstance
9
+ * @param api - The ProductAPI instance for making API calls
10
+ * @param results - The product search results from the API
11
+ */
3
12
  constructor(api, results) {
4
13
  this.products = results.data?.map(product => new ProductInstance(api, product)) || [];
5
14
  // Make productAPI non-enumerable so it doesn't show up in console.log
@@ -12,6 +21,7 @@ export default class ProductSearchInstance {
12
21
  }
13
22
  /**
14
23
  * Custom toJSON method to control what gets serialized when logging
24
+ * @returns Serialized search results with product data
15
25
  */
16
26
  toJSON() {
17
27
  return {
@@ -20,6 +30,7 @@ export default class ProductSearchInstance {
20
30
  }
21
31
  /**
22
32
  * Custom inspect method for Node.js console.log
33
+ * @returns Formatted search results for console output
23
34
  */
24
35
  [Symbol.for('nodejs.util.inspect.custom')]() {
25
36
  return {
@@ -1,17 +1,41 @@
1
- import { UserData } from "../interfaces/admin";
2
- import { UserDataAPI } from "../types";
1
+ import { UserData } from "../interfaces/admin.js";
2
+ import { UserDataAPI } from "../types/index.js";
3
+ /**
4
+ * User data instance class providing a fluent API for managing user data
5
+ * Automatically sanitizes sensitive fields and provides methods for updating and clearing data
6
+ */
3
7
  export default class UserDataInstance {
4
8
  data: Record<string, any>;
5
9
  private userAPI;
10
+ /**
11
+ * Creates a new UserDataInstance
12
+ * @param api - The UserDataAPI instance for making API calls
13
+ * @param data - The user data from the API (will be sanitized automatically)
14
+ */
6
15
  constructor(api: UserDataAPI, data: UserData);
7
16
  /**
8
- * Remove sensitive fields from the data before storing
17
+ * Removes sensitive fields from the data before storing
18
+ * @param data - The raw user data to sanitize
19
+ * @returns Sanitized data with sensitive fields removed
20
+ * @private
9
21
  */
10
22
  private sanitizeData;
11
23
  /**
12
24
  * Custom toJSON method to control what gets serialized when logging
25
+ * @returns Serialized user data
13
26
  */
14
27
  toJSON(): Record<string, any>;
28
+ /**
29
+ * Updates the user's data
30
+ * @param data - The data fields to update or add to user data
31
+ * @returns Promise resolving to the updated sanitized user data
32
+ * @throws Error if the update fails
33
+ */
15
34
  update(data: Record<string, any>): Promise<any>;
35
+ /**
36
+ * Clears all user data for the current user
37
+ * @returns Promise resolving to true if clearing was successful
38
+ * @throws Error if the clear operation fails
39
+ */
16
40
  clear(): Promise<boolean>;
17
41
  }
@@ -1,4 +1,13 @@
1
+ /**
2
+ * User data instance class providing a fluent API for managing user data
3
+ * Automatically sanitizes sensitive fields and provides methods for updating and clearing data
4
+ */
1
5
  export default class UserDataInstance {
6
+ /**
7
+ * Creates a new UserDataInstance
8
+ * @param api - The UserDataAPI instance for making API calls
9
+ * @param data - The user data from the API (will be sanitized automatically)
10
+ */
2
11
  constructor(api, data) {
3
12
  this.data = this.sanitizeData(data);
4
13
  // Make userAPI non-enumerable so it doesn't show up in console.log
@@ -10,7 +19,10 @@ export default class UserDataInstance {
10
19
  });
11
20
  }
12
21
  /**
13
- * Remove sensitive fields from the data before storing
22
+ * Removes sensitive fields from the data before storing
23
+ * @param data - The raw user data to sanitize
24
+ * @returns Sanitized data with sensitive fields removed
25
+ * @private
14
26
  */
15
27
  sanitizeData(data) {
16
28
  if (!data || typeof data !== 'object') {
@@ -27,20 +39,24 @@ export default class UserDataInstance {
27
39
  }
28
40
  /**
29
41
  * Custom toJSON method to control what gets serialized when logging
42
+ * @returns Serialized user data
30
43
  */
31
44
  toJSON() {
32
- return {
33
- data: this.data
34
- };
45
+ return this.data;
35
46
  }
36
47
  /**
37
48
  * Custom inspect method for Node.js console.log
49
+ * @returns Formatted user data for console output
38
50
  */
39
51
  [Symbol.for('nodejs.util.inspect.custom')]() {
40
- return {
41
- data: this.data
42
- };
52
+ return this.data;
43
53
  }
54
+ /**
55
+ * Updates the user's data
56
+ * @param data - The data fields to update or add to user data
57
+ * @returns Promise resolving to the updated sanitized user data
58
+ * @throws Error if the update fails
59
+ */
44
60
  async update(data) {
45
61
  try {
46
62
  const response = await this.userAPI.update(data);
@@ -51,6 +67,11 @@ export default class UserDataInstance {
51
67
  throw new Error('Failed to update user data');
52
68
  }
53
69
  }
70
+ /**
71
+ * Clears all user data for the current user
72
+ * @returns Promise resolving to true if clearing was successful
73
+ * @throws Error if the clear operation fails
74
+ */
54
75
  async clear() {
55
76
  try {
56
77
  await this.userAPI.clear();
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Constants for authentication service
3
+ */
4
+ /**
5
+ * Keytar service name for secure credential storage
6
+ */
7
+ export declare const KEYTAR_SERVICE = "lua-cli";
8
+ /**
9
+ * Keytar account name for API key storage
10
+ */
11
+ export declare const KEYTAR_ACCOUNT = "api-key";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Constants for authentication service
3
+ */
4
+ /**
5
+ * Keytar service name for secure credential storage
6
+ */
7
+ export const KEYTAR_SERVICE = "lua-cli";
8
+ /**
9
+ * Keytar account name for API key storage
10
+ */
11
+ export const KEYTAR_ACCOUNT = "api-key";
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Constants for the compile command
3
+ */
4
+ import { BuildOptions } from "esbuild";
5
+ /**
6
+ * Directory names used during compilation
7
+ */
8
+ export declare const COMPILE_DIRS: {
9
+ readonly DIST: "dist";
10
+ readonly LUA: ".lua";
11
+ readonly TOOLS: "tools";
12
+ };
13
+ /**
14
+ * File names used during compilation
15
+ */
16
+ export declare const COMPILE_FILES: {
17
+ readonly DEPLOYMENT_JSON: "deployment.json";
18
+ readonly DEPLOY_JSON: "deploy.json";
19
+ readonly INDEX_TS: "index.ts";
20
+ readonly INDEX_JS: "index.js";
21
+ readonly PACKAGE_JSON: "package.json";
22
+ readonly TSCONFIG_JSON: "tsconfig.json";
23
+ readonly LUA_SKILL_YAML: "lua.skill.yaml";
24
+ };
25
+ /**
26
+ * Default values for skill metadata
27
+ */
28
+ export declare const SKILL_DEFAULTS: {
29
+ readonly NAME: "lua-skill";
30
+ readonly VERSION: "1.0.0";
31
+ readonly DESCRIPTION: "";
32
+ readonly CONTEXT: "";
33
+ };
34
+ /**
35
+ * External packages that should not be bundled with tools
36
+ * These are either lua-cli modules, native modules, or modules
37
+ * that should be provided by the runtime environment
38
+ */
39
+ export declare const EXTERNAL_PACKAGES: readonly ["lua-cli/skill", "lua-cli", "lua-cli/user-data-api", "lua-cli/product-api", "lua-cli/custom-data-api", "zod", "keytar", "esbuild", "commander", "inquirer", "node-fetch", "ws", "socket.io-client", "ts-morph"];
40
+ /**
41
+ * Common esbuild configuration for tool bundling
42
+ */
43
+ export declare const ESBUILD_TOOL_CONFIG: Partial<BuildOptions>;
44
+ /**
45
+ * Common esbuild configuration for main index bundling
46
+ */
47
+ export declare const ESBUILD_INDEX_CONFIG: Partial<BuildOptions>;
48
+ /**
49
+ * Default input schema for tools without explicit schema
50
+ */
51
+ export declare const DEFAULT_INPUT_SCHEMA: {
52
+ readonly type: "object";
53
+ };
54
+ /**
55
+ * JSON formatting options
56
+ */
57
+ export declare const JSON_FORMAT: {
58
+ readonly INDENT: 2;
59
+ };
60
+ /**
61
+ * YAML formatting options
62
+ */
63
+ export declare const YAML_FORMAT: {
64
+ readonly INDENT: 2;
65
+ readonly LINE_WIDTH: -1;
66
+ readonly NO_REFS: true;
67
+ };