@happyvertical/smrt-products 0.69.0 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/chunks/{__smrt-register__-DP-qqu2e.js → __smrt-register__-CTlLYz_l.js} +2 -2
- package/dist/lib/chunks/{__smrt-register__-DP-qqu2e.js.map → __smrt-register__-CTlLYz_l.js.map} +1 -1
- package/dist/lib/chunks/{collections-DTN6EqRX.js → collections-D34NSTff.js} +2 -2
- package/dist/lib/chunks/{collections-DTN6EqRX.js.map → collections-D34NSTff.js.map} +1 -1
- package/dist/lib/chunks/{generated-CuLT5yCy.js → generated-7K9tnInS.js} +2 -2
- package/dist/lib/chunks/{generated-CuLT5yCy.js.map → generated-7K9tnInS.js.map} +1 -1
- package/dist/lib/chunks/models-CcLXIOn7.js +2 -0
- package/dist/lib/collections.js +1 -1
- package/dist/lib/generated.js +1 -1
- package/dist/lib/index.js +32 -31
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/manifest.json +1 -1
- package/dist/lib/models.js +1 -1
- package/dist/lib/server.d.ts.map +1 -1
- package/dist/lib/smrt-knowledge.json +3 -3
- package/package.json +9 -9
- package/dist/lib/chunks/models-CwtUmNKJ.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./__smrt-register__-
|
|
1
|
+
import "./__smrt-register__-CTlLYz_l.js";
|
|
2
2
|
import { i as Material, n as ProductVariant, s as Category, t as Sku } from "./Sku-tt-MO6g6.js";
|
|
3
3
|
import { t as ProductCollection } from "./ProductCollection-CuBxPHR8.js";
|
|
4
4
|
import "./ProductAssetCollection-DUALSyz8.js";
|
|
@@ -159,4 +159,4 @@ var SkuCollection = class extends SmrtCollection {
|
|
|
159
159
|
//#endregion
|
|
160
160
|
export { CategoryCollection as i, ProductVariantCollection as n, MaterialCollection as r, SkuCollection as t };
|
|
161
161
|
|
|
162
|
-
//# sourceMappingURL=collections-
|
|
162
|
+
//# sourceMappingURL=collections-D34NSTff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections-
|
|
1
|
+
{"version":3,"file":"collections-D34NSTff.js","names":[],"sources":["../../../src/lib/collections/CategoryCollection.ts","../../../src/lib/collections/MaterialCollection.ts","../../../src/lib/collections/ProductVariantCollection.ts","../../../src/lib/collections/SkuCollection.ts"],"sourcesContent":["/**\n * CategoryCollection — Collection manager for {@link Category} objects.\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { Category } from '../models/Category';\n\nexport class CategoryCollection extends SmrtCollection<Category> {\n static readonly _itemClass = Category;\n\n /**\n * Return every top-level category. `parentId` on `Category` is typed\n * `string | undefined`; SMRT serializes undefined string fields as `''`\n * rather than `NULL`, so a category created without an explicit\n * `parentId` lands in the DB with `parent_id = ''`, not `parent_id IS NULL`.\n *\n * We accept both shapes — historical data, migrations, and direct DB\n * imports can produce either — so consumers don't have to normalize\n * `parentId` on write to be discoverable as a root. SQL's `IN` operator\n * does NOT match `NULL` (NULL is not equal to anything, including itself\n * inside an IN list), so the empty-string and NULL cases must run as\n * separate queries and merge.\n */\n async getRootCategories(): Promise<Category[]> {\n const [emptyParents, nullParents] = await Promise.all([\n this.list({ where: { parentId: '' } }),\n this.list({ where: { parentId: null } }),\n ]);\n\n if (emptyParents.length === 0) return nullParents;\n if (nullParents.length === 0) return emptyParents;\n\n // De-dupe by id in case a row somehow shows up in both lists.\n const seen = new Set<string>();\n const merged: Category[] = [];\n for (const row of [...emptyParents, ...nullParents]) {\n const id = row.id ?? '';\n if (!id || seen.has(id)) continue;\n seen.add(id);\n merged.push(row);\n }\n return merged;\n }\n}\n","/**\n * MaterialCollection — Collection manager for {@link Material} objects.\n *\n * STI framework auto-filters by `_meta_type` to return only Material rows\n * from the shared `products` table.\n */\n\nimport { Material } from '../models/Material';\nimport type { MaterialKind } from '../models/types';\nimport { ProductCollection } from './ProductCollection';\n\nexport class MaterialCollection extends ProductCollection {\n static override readonly _itemClass = Material;\n\n /**\n * Find every {@link Material} with the given kind.\n *\n * `materialKind` is an `@meta()` field — it lives inside the shared\n * `_meta_data` JSON column on `products`, not as its own SQL column.\n * That means a naive `list({ where: { materialKind } })` would generate\n * a WHERE on a non-existent column. We list every Material STI row and\n * filter the hydrated instances in JS.\n *\n * For very large catalogs, consumers should add a generated column or\n * an expression index over the JSON path and override this helper.\n */\n async findByKind(materialKind: MaterialKind): Promise<Material[]> {\n const items = (await this.list({})) as Material[];\n return items.filter((m) => m.materialKind === materialKind);\n }\n}\n","/**\n * ProductVariantCollection — read helpers for {@link ProductVariant} rows.\n *\n * {@link ProductVariant} is a standalone model (not a Product STI subtype),\n * so this collection drives its own table (`product_variants`). Helper\n * methods cover the two common query patterns: \"what axes does this\n * product vary along?\" and \"tell me about the size axis specifically.\"\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { ProductVariant } from '../models/ProductVariant';\n\nexport class ProductVariantCollection extends SmrtCollection<ProductVariant> {\n static readonly _itemClass = ProductVariant;\n\n /** Every axis declaration for a given product, in display order. */\n async findForProduct(productId: string): Promise<ProductVariant[]> {\n return this.list({\n where: { productId },\n orderBy: 'sortOrder ASC',\n });\n }\n\n /** The axis declaration for a `(productId, axisName)` pair, or null. */\n async findAxis(\n productId: string,\n axisName: string,\n ): Promise<ProductVariant | null> {\n const matches = await this.list({\n where: { productId, axisName },\n limit: 1,\n });\n return matches[0] ?? null;\n }\n}\n","/**\n * SkuCollection — query helpers for {@link Sku} rows.\n *\n * @packageDocumentation\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { Sku } from '../models/Sku';\n\nexport class SkuCollection extends SmrtCollection<Sku> {\n static readonly _itemClass = Sku;\n\n /**\n * Look up a SKU by its tenant-scoped `code` (UPC, internal part\n * number, etc.). Returns `null` when no row matches.\n */\n async findByCode(code: string): Promise<Sku | null> {\n const matches = await this.list({ where: { code }, limit: 1 });\n return matches[0] ?? null;\n }\n\n /**\n * Look up a SKU by its scannable barcode. Returns `null` when no row\n * matches; pass `''` to skip the query early.\n */\n async findByBarcode(barcode: string): Promise<Sku | null> {\n if (!barcode) return null;\n const matches = await this.list({ where: { barcode }, limit: 1 });\n return matches[0] ?? null;\n }\n\n /**\n * Find every SKU pointing at the given `Product` id (or any Product\n * STI subtype id — `Material` upstream, vertical subtypes defined in\n * templates). Useful for listing the SKUs that back a single product\n * card.\n */\n async findByProduct(productId: string): Promise<Sku[]> {\n return this.list({ where: { productId }, orderBy: 'code ASC' });\n }\n\n /**\n * Find every SKU that is a component of the given parent SKU (for\n * bundles / kits). Returns an empty array when the parent has no\n * children.\n */\n async findByParent(parentSkuId: string): Promise<Sku[]> {\n return this.list({ where: { parentSkuId }, orderBy: 'code ASC' });\n }\n\n /** Find every active SKU, optionally narrowed by parent product id. */\n async findActive(productId?: string): Promise<Sku[]> {\n const where: Record<string, unknown> = { active: true };\n if (productId) where.productId = productId;\n return this.list({ where, orderBy: 'code ASC' });\n }\n}\n"],"mappings":";;;;;;;;;AAOA,IAAa,qBAAb,cAAwC,eAAyB;CAC/D,OAAgB,aAAa;;;;;;;;;;;;;;CAe7B,MAAM,oBAAyC;EAC7C,MAAM,CAAC,cAAc,eAAe,MAAM,QAAQ,IAAI,CACpD,KAAK,KAAK,EAAE,OAAO,EAAE,UAAU,GAAG,EAAE,CAAC,GACrC,KAAK,KAAK,EAAE,OAAO,EAAE,UAAU,KAAK,EAAE,CAAC,CACzC,CAAC;EAED,IAAI,aAAa,WAAW,GAAG,OAAO;EACtC,IAAI,YAAY,WAAW,GAAG,OAAO;EAGrC,MAAM,uBAAO,IAAI,IAAY;EAC7B,MAAM,SAAqB,CAAC;EAC5B,KAAK,MAAM,OAAO,CAAC,GAAG,cAAc,GAAG,WAAW,GAAG;GACnD,MAAM,KAAK,IAAI,MAAM;GACrB,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,GAAG;GACzB,KAAK,IAAI,EAAE;GACX,OAAO,KAAK,GAAG;EACjB;EACA,OAAO;CACT;AAC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;EAAW,CAAC;CACjD;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./__smrt-register__-
|
|
1
|
+
import "./__smrt-register__-CTlLYz_l.js";
|
|
2
2
|
//#region src/lib/generated/index.ts
|
|
3
3
|
var autoGeneratedComponents = {};
|
|
4
4
|
//#endregion
|
|
5
5
|
export { autoGeneratedComponents as t };
|
|
6
6
|
|
|
7
|
-
//# sourceMappingURL=generated-
|
|
7
|
+
//# sourceMappingURL=generated-7K9tnInS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated-
|
|
1
|
+
{"version":3,"file":"generated-7K9tnInS.js","names":[],"sources":["../../../src/lib/generated/index.ts"],"sourcesContent":["/**\n * Auto-generated SMRT Components\n *\n * This file is automatically generated by the SMRT Vite plugin.\n * It exports UI components that are auto-generated from @smrt() decorated classes.\n *\n * DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.\n */\n\n// Self-register this package's manifest for consumers that import via this\n// subpath without the main entry. See src/__smrt-register__.ts (issue #1132).\nimport '../../__smrt-register__.js';\n\n// Auto-generated components will be exported here by the SMRT Vite plugin\n// Examples:\n// export { default as SmrtProductForm } from './SmrtProductForm.svelte';\n// export { default as SmrtProductTable } from './SmrtProductTable.svelte';\n// export { default as SmrtCategoryForm } from './SmrtCategoryForm.svelte';\n\n// For now, export an empty object to prevent import errors\nexport const autoGeneratedComponents = {};\n"],"mappings":";;AAoBA,IAAa,0BAA0B,CAAC"}
|
package/dist/lib/collections.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as CategoryCollection, n as ProductVariantCollection, r as MaterialCollection, t as SkuCollection } from "./chunks/collections-
|
|
1
|
+
import { i as CategoryCollection, n as ProductVariantCollection, r as MaterialCollection, t as SkuCollection } from "./chunks/collections-D34NSTff.js";
|
|
2
2
|
import { t as ProductCollection } from "./chunks/ProductCollection-CuBxPHR8.js";
|
|
3
3
|
import { t as ProductAssetCollection } from "./chunks/ProductAssetCollection-DUALSyz8.js";
|
|
4
4
|
export { CategoryCollection, MaterialCollection, ProductAssetCollection, ProductCollection, ProductVariantCollection, SkuCollection };
|
package/dist/lib/generated.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as autoGeneratedComponents } from "./chunks/generated-
|
|
1
|
+
import { t as autoGeneratedComponents } from "./chunks/generated-7K9tnInS.js";
|
|
2
2
|
export { autoGeneratedComponents };
|
package/dist/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunks/rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import "./chunks/__smrt-register__-
|
|
2
|
+
import "./chunks/__smrt-register__-CTlLYz_l.js";
|
|
3
3
|
import { a as Product, i as Material, n as ProductVariant, o as ProductType, r as ProductAsset, s as Category, t as Sku } from "./chunks/Sku-tt-MO6g6.js";
|
|
4
|
-
import { i as CategoryCollection, n as ProductVariantCollection, r as MaterialCollection, t as SkuCollection } from "./chunks/collections-
|
|
4
|
+
import { i as CategoryCollection, n as ProductVariantCollection, r as MaterialCollection, t as SkuCollection } from "./chunks/collections-D34NSTff.js";
|
|
5
5
|
import { t as ProductCollection } from "./chunks/ProductCollection-CuBxPHR8.js";
|
|
6
6
|
import { t as ProductAssetCollection } from "./chunks/ProductAssetCollection-DUALSyz8.js";
|
|
7
7
|
import { n as ProductCard, t as ProductForm } from "./chunks/components-j1pkLwKV.js";
|
|
8
|
-
import { t as autoGeneratedComponents } from "./chunks/generated-
|
|
9
|
-
import "./chunks/models-
|
|
8
|
+
import { t as autoGeneratedComponents } from "./chunks/generated-7K9tnInS.js";
|
|
9
|
+
import "./chunks/models-CcLXIOn7.js";
|
|
10
10
|
import { n as productStore, t as ProductStoreClass } from "./chunks/stores-CB0SI1c5.js";
|
|
11
11
|
import { i as slugify, n as formatPrice, r as generateId, t as formatDate } from "./chunks/utils-BgTqlQoH.js";
|
|
12
12
|
import { SmrtRecipe, startRestServer } from "@happyvertical/smrt-core";
|
|
@@ -279,34 +279,36 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
279
279
|
*/
|
|
280
280
|
var server_exports = /* @__PURE__ */ __exportAll({ startServer: () => startServer });
|
|
281
281
|
/**
|
|
282
|
-
* Reference
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
282
|
+
* Reference principal resolver (#1540, #5195). Generated routes are
|
|
283
|
+
* FAIL-CLOSED: a route that is not `@smrt({ api: { public } })` answers 401
|
|
284
|
+
* to a caller who is not signed in, and every write needs the
|
|
285
|
+
* `<collection>.<action>` permission (`products.create`, `categories.update`,
|
|
286
|
+
* ...). The server enforces both from the principal returned here, once per
|
|
287
|
+
* request, and nothing in the request can change it.
|
|
286
288
|
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
return async (req) => {
|
|
292
|
-
if (!req.headers.get("authorization")) return new Response(JSON.stringify({ error: "Authentication required" }), {
|
|
293
|
-
status: 401,
|
|
294
|
-
headers: { "Content-Type": "application/json" }
|
|
295
|
-
});
|
|
296
|
-
return req;
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Reference tenant resolver. Tenant-scoped models (`Product` is
|
|
301
|
-
* `@TenantScoped`) run inside the tenant of the request: when tenancy is
|
|
302
|
-
* enabled, a request with no tenant reads global rows only and cannot write.
|
|
289
|
+
* Tenant-scoped models (`Product` is `@TenantScoped`) run inside the
|
|
290
|
+
* principal's tenant: when tenancy is enabled, a principal with no tenant
|
|
291
|
+
* reads global rows only and cannot write, and a write body that names
|
|
292
|
+
* another tenant is refused with 403.
|
|
303
293
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
294
|
+
* Replace the stub with your real authentication: verify the session cookie
|
|
295
|
+
* or bearer token and return the tenant, user and permission slugs of the
|
|
296
|
+
* verified principal, never values from a header or parameter the caller
|
|
297
|
+
* controls. Return `null` for an anonymous caller.
|
|
307
298
|
*/
|
|
308
|
-
function
|
|
309
|
-
return
|
|
299
|
+
function demoResolvePrincipal(req) {
|
|
300
|
+
if (!req.headers.get("authorization")) return null;
|
|
301
|
+
return {
|
|
302
|
+
tenantId: null,
|
|
303
|
+
allowCrossTenant: false,
|
|
304
|
+
authenticated: true,
|
|
305
|
+
permissions: [
|
|
306
|
+
"products.create",
|
|
307
|
+
"products.update",
|
|
308
|
+
"categories.create",
|
|
309
|
+
"categories.update"
|
|
310
|
+
]
|
|
311
|
+
};
|
|
310
312
|
}
|
|
311
313
|
async function startServer() {
|
|
312
314
|
console.log("🚀 Starting SMRT Template Server...");
|
|
@@ -316,8 +318,7 @@ async function startServer() {
|
|
|
316
318
|
basePath: "/api/v1",
|
|
317
319
|
enableCors: true,
|
|
318
320
|
allowedOrigins: ["http://localhost:3000"],
|
|
319
|
-
|
|
320
|
-
resolveTenant: demoResolveTenant
|
|
321
|
+
resolvePrincipal: demoResolvePrincipal
|
|
321
322
|
});
|
|
322
323
|
console.log("✅ Server ready!");
|
|
323
324
|
console.log("📡 REST API: http://localhost:3000/api/v1");
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/client.ts","../../src/lib/recipes.ts","../../src/mcp.ts","../../src/server.ts","../../src/index.ts"],"sourcesContent":["/**\n * SMRT Template Client\n *\n * Demonstrates auto-generated TypeScript client from SMRT objects.\n * No manual client code needed - everything is generated from @smrt() decorated classes.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport createClient from '@happyvertical/smrt-virt-client'; // Virtual module from Vite plugin\nimport type { CategoryData, ProductData } from '@happyvertical/smrt-virt-types'; // Virtual module from Vite plugin\n\nasync function demonstrateClient() {\n console.log('🔌 Creating auto-generated API client...');\n\n // Create client pointing to local server\n const api = createClient('http://localhost:3000/api/v1');\n\n try {\n console.log('\\n📦 Testing Product operations:');\n\n // Create a product\n const newProduct: Partial<ProductData> = {\n name: 'Demo Product',\n description: 'A product created by the auto-generated client',\n price: 29.99,\n inStock: true,\n tags: ['demo', 'auto-generated'],\n };\n\n console.log('Creating product:', newProduct);\n const createdProduct = await api.products.create(newProduct);\n console.log('✅ Created:', createdProduct);\n\n // List products\n console.log('\\n📋 Listing all products:');\n const products = await api.products.list();\n console.log('Products:', products);\n\n // Get specific product\n if (createdProduct?.id) {\n console.log(`\\n🔍 Getting product ${createdProduct.id}:`);\n const product = await api.products.get(createdProduct.id);\n console.log('Product:', product);\n\n // Update product\n console.log('\\n✏️ Updating product:');\n const updatedProduct = await api.products.update(createdProduct.id, {\n price: 39.99,\n description: 'Updated description',\n });\n console.log('Updated:', updatedProduct);\n }\n\n console.log('\\n🏷️ Testing Category operations:');\n\n // Create a category\n const newCategory: Partial<CategoryData> = {\n name: 'Demo Category',\n description: 'A category created by the auto-generated client',\n active: true,\n };\n\n console.log('Creating category:', newCategory);\n const createdCategory = await api.categories.create(newCategory);\n console.log('✅ Created:', createdCategory);\n\n // List categories\n console.log('\\n📋 Listing all categories:');\n const categories = await api.categories.list();\n console.log('Categories:', categories);\n } catch (error) {\n console.error('❌ Client error:', error);\n }\n}\n\n// Run demonstration if called directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n demonstrateClient().catch(console.error);\n}\n\nexport { demonstrateClient };\n","/**\n * Declared recipes for smrt-products (#3590, #3604): user-facing units of\n * functionality an app or agent can pick instead of the whole package.\n * The scanner reads these statics into the `recipes` array of `manifest.json`\n * and `smrt-knowledge.json`; nothing here runs at that point.\n *\n * @packageDocumentation\n */\n\nimport { SmrtRecipe } from '@happyvertical/smrt-core';\nimport { Product } from './models/Product.js';\nimport { ProductVariant } from './models/ProductVariant.js';\nimport { Sku } from './models/Sku.js';\n\n/** Simple products: Items with a name, a price and a description. */\nexport class SimpleProductsRecipe extends SmrtRecipe {\n static id = 'products.simple';\n static help = './simple.recipe.md';\n static label = 'Simple products';\n static summary = 'Items with a name, a price and a description.';\n static synonyms = ['items', 'goods', 'catalog'];\n static group = {\n id: 'products',\n label: 'Products',\n summary:\n 'Sell goods: simple items, or clothing that comes in sizes and colors.',\n };\n static section = {\n id: 'catalog',\n label: 'Catalog',\n icon: 'package',\n description: 'Products, ingredients and the stock you hold.',\n };\n static models = [Product];\n static nav = [\n {\n label: 'Products',\n model: Product,\n icon: 'package',\n description: 'What you sell, with prices and details.',\n },\n ];\n static options = {\n Product: {\n fields: {\n productType: { visibility: 'hidden' },\n category: { visibility: 'hidden' },\n manufacturer: { visibility: 'hidden' },\n model: { visibility: 'hidden' },\n inStock: { visibility: 'hidden' },\n specifications: { visibility: 'hidden' },\n tags: { visibility: 'hidden' },\n },\n },\n } as const;\n}\n\n/** Clothing: Products that come in sizes and colors, with a stock-keeping unit for each combination. */\nexport class ClothingProductsRecipe extends SmrtRecipe {\n static id = 'products.clothing';\n static help = './clothing.recipe.md';\n static label = 'Clothing';\n static summary =\n 'Products that come in sizes and colors, with a stock-keeping unit for each combination.';\n static synonyms = ['apparel', 'garments', 'sizes', 'variants'];\n static group = {\n id: 'products',\n label: 'Products',\n summary:\n 'Sell goods: simple items, or clothing that comes in sizes and colors.',\n };\n static section = {\n id: 'catalog',\n label: 'Catalog',\n icon: 'package',\n description: 'Products, ingredients and the stock you hold.',\n };\n static models = [Product, ProductVariant, Sku];\n static nav = [\n {\n label: 'Products',\n model: Product,\n icon: 'package',\n description: 'What you sell, with prices and details.',\n },\n ];\n static options = {\n Product: {\n fields: {\n productType: { visibility: 'hidden' },\n category: { visibility: 'hidden' },\n manufacturer: { visibility: 'hidden' },\n model: { visibility: 'hidden' },\n inStock: { visibility: 'hidden' },\n specifications: { visibility: 'hidden' },\n tags: { visibility: 'hidden' },\n description: { visibility: 'hidden' },\n },\n },\n ProductVariant: {\n fields: {\n label: { visibility: 'hidden' },\n sortOrder: { visibility: 'hidden' },\n },\n },\n Sku: {\n fields: {\n barcode: { visibility: 'hidden' },\n name: { visibility: 'hidden' },\n weightGrams: { visibility: 'hidden' },\n parentSkuId: { visibility: 'hidden' },\n active: { visibility: 'hidden' },\n },\n },\n } as const;\n}\n\n/** Ingredients: Things you buy in to make what you sell, kept as products of the material kind with their own list. */\nexport class IngredientsRecipe extends SmrtRecipe {\n static id = 'products.ingredients';\n static help = './ingredients.recipe.md';\n static label = 'Ingredients';\n static summary =\n 'Things you buy in to make what you sell, kept as products of the material kind with their own list.';\n static synonyms = ['materials', 'raw materials', 'supplies', 'stock items'];\n static group = {\n id: 'products',\n label: 'Products',\n summary:\n 'Sell goods: simple items, or clothing that comes in sizes and colors.',\n };\n static section = {\n id: 'catalog',\n label: 'Catalog',\n icon: 'package',\n description: 'Products, ingredients and the stock you hold.',\n };\n static models = [Product];\n static nav = [\n {\n label: 'Ingredients',\n model: Product,\n icon: 'package',\n description: 'What you buy to make what you sell, with what each costs.',\n key: 'ingredients',\n noun: 'ingredient',\n filter: { field: 'productType', value: 'material' },\n },\n ];\n static requires = ['products.simple'];\n static options = {\n Product: {\n fields: {\n productType: { visibility: 'hidden' },\n category: { visibility: 'hidden' },\n manufacturer: { visibility: 'hidden' },\n model: { visibility: 'hidden' },\n inStock: { visibility: 'hidden' },\n specifications: { visibility: 'hidden' },\n tags: { visibility: 'hidden' },\n },\n },\n } as const;\n}\n","/**\n * MCP Server Generator Script for @have/products\n *\n * This script generates a complete MCP server with stdio transport\n * from the Product and Category SMRT objects.\n *\n * Run with: npm run generate:mcp\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { MCPGenerator } from '@happyvertical/smrt-core/generators/mcp';\n\n/**\n * Generate MCP server for products package\n */\nasync function generateMCPServer() {\n console.log('🤖 Generating MCP Server for @have/products...\\n');\n\n // Create generator instance\n const generator = new MCPGenerator(\n {\n name: 'products-mcp-server',\n version: '1.0.0',\n description: 'MCP server exposing Product and Category SMRT objects',\n },\n {\n // Database and AI context will be configured via environment variables in generated server\n // DATABASE_URL - for database connection\n // OPENAI_API_KEY or ANTHROPIC_API_KEY - for AI client\n },\n );\n\n // Generate tools to preview what will be available\n const tools = await generator.generateTools();\n console.log(`📝 Discovered ${tools.length} tools from SMRT objects:`);\n tools.forEach((tool) => {\n console.log(` - ${tool.name}: ${tool.description}`);\n });\n console.log();\n\n // Generate complete MCP server with stdio transport\n await generator.generateServer({\n outputPath: 'dist/mcp-server.js',\n serverName: 'products-mcp',\n debug: false, // Set to true for debug logging\n generateClaudeConfigFile: true,\n generateReadme: true,\n });\n\n console.log('\\n✅ MCP Server generation complete!');\n console.log('\\n📚 Next steps:');\n console.log(' 1. Build the server: npm run build');\n console.log(\n ' 2. Add to Claude Desktop config (see dist/claude-config.example.json)',\n );\n console.log(' 3. Restart Claude Desktop');\n console.log(' 4. Use the tools in Claude Code!\\n');\n}\n\n// Run if executed directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n generateMCPServer().catch((error) => {\n console.error('❌ MCP server generation failed:', error);\n process.exit(1);\n });\n}\n\nexport { generateMCPServer };\n","/**\n * SMRT Template Server\n *\n * Demonstrates auto-generated REST API from SMRT objects.\n * No manual route definitions needed - everything is generated from @smrt() decorated classes.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { startRestServer } from '@happyvertical/smrt-core';\nimport { Category } from './lib/models/Category';\nimport { Product } from './lib/models/Product';\n\n/**\n * Reference auth stub (#1540). Generated routes are FAIL-CLOSED: without an\n * `authMiddleware` (or `@smrt({ api: { public: true } })` on the model) every\n * route returns 401. This stub demonstrates the contract — replace it with your\n * real auth (verify a session cookie / bearer token, attach the principal).\n *\n * Returning the (optionally augmented) request allows the call; returning a\n * `Response` rejects it.\n */\nfunction demoAuthMiddleware(_objectName: string, _action: string) {\n return async (req: Request): Promise<Request | Response> => {\n const token = req.headers.get('authorization');\n if (!token) {\n return new Response(\n JSON.stringify({ error: 'Authentication required' }),\n {\n status: 401,\n headers: { 'Content-Type': 'application/json' },\n },\n );\n }\n // TODO: verify `token` and attach the resolved principal to the request.\n return req;\n };\n}\n\n/**\n * Reference tenant resolver. Tenant-scoped models (`Product` is\n * `@TenantScoped`) run inside the tenant of the request: when tenancy is\n * enabled, a request with no tenant reads global rows only and cannot write.\n *\n * Return the tenant of the principal `demoAuthMiddleware` verified — from the\n * verified token or session, never from a header or parameter the caller\n * controls. This stub verifies nothing, so it knows no tenant.\n */\nfunction demoResolveTenant(_req: Request): { tenantId?: string } {\n // TODO: return { tenantId: <tenant of the verified principal> }.\n return {};\n}\n\nasync function startServer() {\n console.log('🚀 Starting SMRT Template Server...');\n\n // Start server with registered SMRT objects. Secure defaults (#1540): bind to\n // loopback, an explicit CORS origin allowlist (never `*`), and a fail-closed\n // auth middleware.\n const shutdown = await startRestServer(\n [Product, Category], // SMRT objects to generate API for\n {}, // context\n {\n port: 3000,\n hostname: '127.0.0.1',\n basePath: '/api/v1',\n enableCors: true,\n allowedOrigins: ['http://localhost:3000'],\n authMiddleware: demoAuthMiddleware,\n resolveTenant: demoResolveTenant,\n },\n );\n\n console.log('✅ Server ready!');\n console.log('📡 REST API: http://localhost:3000/api/v1');\n console.log('📚 Endpoints:');\n console.log(' GET /api/v1/products - List products');\n console.log(' POST /api/v1/products - Create product');\n console.log(' GET /api/v1/products/:id - Get product');\n console.log(' PUT /api/v1/products/:id - Update product');\n console.log(' GET /api/v1/categories - List categories');\n console.log(' POST /api/v1/categories - Create category');\n\n console.log('\\n💡 Try these endpoints (auth required — send a token):');\n console.log(\n ' curl http://localhost:3000/api/v1/products -H \"Authorization: Bearer <token>\"',\n );\n console.log(\n ' curl http://localhost:3000/api/v1/categories -H \"Authorization: Bearer <token>\"',\n );\n console.log(\n ' curl -X POST http://localhost:3000/api/v1/products -H \"Authorization: Bearer <token>\" -H \"Content-Type: application/json\" -d \\'{\"name\":\"Test Product\",\"price\":29.99}\\'',\n );\n\n return { shutdown };\n}\n\n// Start if running directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n startServer().catch(console.error);\n}\n\nexport { startServer };\n","/**\n * SMRT Template: Triple-Purpose Export\n *\n * This is the main entry point when this template is used as an NPM library.\n * It re-exports everything from the lib directory for easy consumption.\n *\n * Usage examples:\n *\n * // Import models\n * import { Product, Category } from '@happyvertical/core-template';\n *\n * // Import UI components\n * import { ProductCard, ProductForm } from '@happyvertical/core-template/components';\n *\n * // Import stores\n * import { ProductStoreClass } from '@happyvertical/core-template/stores';\n */\n\n// Self-register this package's manifest before any @smrt() decorator fires\n// downstream. Must come first so the side effect runs ahead of the class\n// module loads below. See __smrt-register__.ts for issue #1132 context.\nimport './__smrt-register__.js';\nimport { pathToFileURL } from 'node:url';\n\nexport { demonstrateClient } from './client';\n// Re-export everything from the lib directory\nexport * from './lib/index';\nexport { generateMCPServer } from './mcp';\n// Legacy exports for backward compatibility\nexport { startServer } from './server';\n\n/**\n * Start all services for demonstration (legacy function)\n */\nexport async function startAll() {\n const { startServer } = await import('./server');\n const { generateMCPServer } = await import('./mcp');\n\n console.log('🚀 Starting SMRT Template - Full Demo\\n');\n\n // Start REST API server\n console.log('1️⃣ Starting REST API...');\n const server = await startServer();\n\n // Start MCP server\n console.log('\\n2️⃣ Starting MCP Server...');\n const mcp = await generateMCPServer();\n\n console.log('\\n✨ All services running!');\n console.log('\\n🎯 What was auto-generated:');\n console.log(' • REST endpoints for Product and Category');\n console.log(' • TypeScript client with full type safety');\n console.log(' • MCP tools for AI model integration');\n console.log(' • OpenAPI/Swagger documentation');\n console.log(' • Live reloading during development');\n\n console.log('\\n📝 Next steps:');\n console.log(' • Modify src/lib/models/ to add new fields');\n console.log(' • Add new @smrt() classes to auto-generate more APIs');\n console.log(' • Run bun run dev to see live updates');\n\n return { server, mcp };\n}\n\n// Auto-start if running directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n startAll().catch(console.error);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,eAAe,oBAAoB;CACjC,QAAQ,IAAI,0CAA0C;CAGtD,MAAM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A,IACE,QAAQ,KAAK,MACb,OAAO,KAAK,QAAQ,cAAc,QAAQ,KAAK,EAAE,CAAC,CAAC,MAEnD,SAAS,CAAC,CAAC,MAAM,QAAQ,KAAK"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/client.ts","../../src/lib/recipes.ts","../../src/mcp.ts","../../src/server.ts","../../src/index.ts"],"sourcesContent":["/**\n * SMRT Template Client\n *\n * Demonstrates auto-generated TypeScript client from SMRT objects.\n * No manual client code needed - everything is generated from @smrt() decorated classes.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport createClient from '@happyvertical/smrt-virt-client'; // Virtual module from Vite plugin\nimport type { CategoryData, ProductData } from '@happyvertical/smrt-virt-types'; // Virtual module from Vite plugin\n\nasync function demonstrateClient() {\n console.log('🔌 Creating auto-generated API client...');\n\n // Create client pointing to local server\n const api = createClient('http://localhost:3000/api/v1');\n\n try {\n console.log('\\n📦 Testing Product operations:');\n\n // Create a product\n const newProduct: Partial<ProductData> = {\n name: 'Demo Product',\n description: 'A product created by the auto-generated client',\n price: 29.99,\n inStock: true,\n tags: ['demo', 'auto-generated'],\n };\n\n console.log('Creating product:', newProduct);\n const createdProduct = await api.products.create(newProduct);\n console.log('✅ Created:', createdProduct);\n\n // List products\n console.log('\\n📋 Listing all products:');\n const products = await api.products.list();\n console.log('Products:', products);\n\n // Get specific product\n if (createdProduct?.id) {\n console.log(`\\n🔍 Getting product ${createdProduct.id}:`);\n const product = await api.products.get(createdProduct.id);\n console.log('Product:', product);\n\n // Update product\n console.log('\\n✏️ Updating product:');\n const updatedProduct = await api.products.update(createdProduct.id, {\n price: 39.99,\n description: 'Updated description',\n });\n console.log('Updated:', updatedProduct);\n }\n\n console.log('\\n🏷️ Testing Category operations:');\n\n // Create a category\n const newCategory: Partial<CategoryData> = {\n name: 'Demo Category',\n description: 'A category created by the auto-generated client',\n active: true,\n };\n\n console.log('Creating category:', newCategory);\n const createdCategory = await api.categories.create(newCategory);\n console.log('✅ Created:', createdCategory);\n\n // List categories\n console.log('\\n📋 Listing all categories:');\n const categories = await api.categories.list();\n console.log('Categories:', categories);\n } catch (error) {\n console.error('❌ Client error:', error);\n }\n}\n\n// Run demonstration if called directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n demonstrateClient().catch(console.error);\n}\n\nexport { demonstrateClient };\n","/**\n * Declared recipes for smrt-products (#3590, #3604): user-facing units of\n * functionality an app or agent can pick instead of the whole package.\n * The scanner reads these statics into the `recipes` array of `manifest.json`\n * and `smrt-knowledge.json`; nothing here runs at that point.\n *\n * @packageDocumentation\n */\n\nimport { SmrtRecipe } from '@happyvertical/smrt-core';\nimport { Product } from './models/Product.js';\nimport { ProductVariant } from './models/ProductVariant.js';\nimport { Sku } from './models/Sku.js';\n\n/** Simple products: Items with a name, a price and a description. */\nexport class SimpleProductsRecipe extends SmrtRecipe {\n static id = 'products.simple';\n static help = './simple.recipe.md';\n static label = 'Simple products';\n static summary = 'Items with a name, a price and a description.';\n static synonyms = ['items', 'goods', 'catalog'];\n static group = {\n id: 'products',\n label: 'Products',\n summary:\n 'Sell goods: simple items, or clothing that comes in sizes and colors.',\n };\n static section = {\n id: 'catalog',\n label: 'Catalog',\n icon: 'package',\n description: 'Products, ingredients and the stock you hold.',\n };\n static models = [Product];\n static nav = [\n {\n label: 'Products',\n model: Product,\n icon: 'package',\n description: 'What you sell, with prices and details.',\n },\n ];\n static options = {\n Product: {\n fields: {\n productType: { visibility: 'hidden' },\n category: { visibility: 'hidden' },\n manufacturer: { visibility: 'hidden' },\n model: { visibility: 'hidden' },\n inStock: { visibility: 'hidden' },\n specifications: { visibility: 'hidden' },\n tags: { visibility: 'hidden' },\n },\n },\n } as const;\n}\n\n/** Clothing: Products that come in sizes and colors, with a stock-keeping unit for each combination. */\nexport class ClothingProductsRecipe extends SmrtRecipe {\n static id = 'products.clothing';\n static help = './clothing.recipe.md';\n static label = 'Clothing';\n static summary =\n 'Products that come in sizes and colors, with a stock-keeping unit for each combination.';\n static synonyms = ['apparel', 'garments', 'sizes', 'variants'];\n static group = {\n id: 'products',\n label: 'Products',\n summary:\n 'Sell goods: simple items, or clothing that comes in sizes and colors.',\n };\n static section = {\n id: 'catalog',\n label: 'Catalog',\n icon: 'package',\n description: 'Products, ingredients and the stock you hold.',\n };\n static models = [Product, ProductVariant, Sku];\n static nav = [\n {\n label: 'Products',\n model: Product,\n icon: 'package',\n description: 'What you sell, with prices and details.',\n },\n ];\n static options = {\n Product: {\n fields: {\n productType: { visibility: 'hidden' },\n category: { visibility: 'hidden' },\n manufacturer: { visibility: 'hidden' },\n model: { visibility: 'hidden' },\n inStock: { visibility: 'hidden' },\n specifications: { visibility: 'hidden' },\n tags: { visibility: 'hidden' },\n description: { visibility: 'hidden' },\n },\n },\n ProductVariant: {\n fields: {\n label: { visibility: 'hidden' },\n sortOrder: { visibility: 'hidden' },\n },\n },\n Sku: {\n fields: {\n barcode: { visibility: 'hidden' },\n name: { visibility: 'hidden' },\n weightGrams: { visibility: 'hidden' },\n parentSkuId: { visibility: 'hidden' },\n active: { visibility: 'hidden' },\n },\n },\n } as const;\n}\n\n/** Ingredients: Things you buy in to make what you sell, kept as products of the material kind with their own list. */\nexport class IngredientsRecipe extends SmrtRecipe {\n static id = 'products.ingredients';\n static help = './ingredients.recipe.md';\n static label = 'Ingredients';\n static summary =\n 'Things you buy in to make what you sell, kept as products of the material kind with their own list.';\n static synonyms = ['materials', 'raw materials', 'supplies', 'stock items'];\n static group = {\n id: 'products',\n label: 'Products',\n summary:\n 'Sell goods: simple items, or clothing that comes in sizes and colors.',\n };\n static section = {\n id: 'catalog',\n label: 'Catalog',\n icon: 'package',\n description: 'Products, ingredients and the stock you hold.',\n };\n static models = [Product];\n static nav = [\n {\n label: 'Ingredients',\n model: Product,\n icon: 'package',\n description: 'What you buy to make what you sell, with what each costs.',\n key: 'ingredients',\n noun: 'ingredient',\n filter: { field: 'productType', value: 'material' },\n },\n ];\n static requires = ['products.simple'];\n static options = {\n Product: {\n fields: {\n productType: { visibility: 'hidden' },\n category: { visibility: 'hidden' },\n manufacturer: { visibility: 'hidden' },\n model: { visibility: 'hidden' },\n inStock: { visibility: 'hidden' },\n specifications: { visibility: 'hidden' },\n tags: { visibility: 'hidden' },\n },\n },\n } as const;\n}\n","/**\n * MCP Server Generator Script for @have/products\n *\n * This script generates a complete MCP server with stdio transport\n * from the Product and Category SMRT objects.\n *\n * Run with: npm run generate:mcp\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { MCPGenerator } from '@happyvertical/smrt-core/generators/mcp';\n\n/**\n * Generate MCP server for products package\n */\nasync function generateMCPServer() {\n console.log('🤖 Generating MCP Server for @have/products...\\n');\n\n // Create generator instance\n const generator = new MCPGenerator(\n {\n name: 'products-mcp-server',\n version: '1.0.0',\n description: 'MCP server exposing Product and Category SMRT objects',\n },\n {\n // Database and AI context will be configured via environment variables in generated server\n // DATABASE_URL - for database connection\n // OPENAI_API_KEY or ANTHROPIC_API_KEY - for AI client\n },\n );\n\n // Generate tools to preview what will be available\n const tools = await generator.generateTools();\n console.log(`📝 Discovered ${tools.length} tools from SMRT objects:`);\n tools.forEach((tool) => {\n console.log(` - ${tool.name}: ${tool.description}`);\n });\n console.log();\n\n // Generate complete MCP server with stdio transport\n await generator.generateServer({\n outputPath: 'dist/mcp-server.js',\n serverName: 'products-mcp',\n debug: false, // Set to true for debug logging\n generateClaudeConfigFile: true,\n generateReadme: true,\n });\n\n console.log('\\n✅ MCP Server generation complete!');\n console.log('\\n📚 Next steps:');\n console.log(' 1. Build the server: npm run build');\n console.log(\n ' 2. Add to Claude Desktop config (see dist/claude-config.example.json)',\n );\n console.log(' 3. Restart Claude Desktop');\n console.log(' 4. Use the tools in Claude Code!\\n');\n}\n\n// Run if executed directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n generateMCPServer().catch((error) => {\n console.error('❌ MCP server generation failed:', error);\n process.exit(1);\n });\n}\n\nexport { generateMCPServer };\n","/**\n * SMRT Template Server\n *\n * Demonstrates auto-generated REST API from SMRT objects.\n * No manual route definitions needed - everything is generated from @smrt() decorated classes.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport {\n type APIRequestPrincipal,\n startRestServer,\n} from '@happyvertical/smrt-core';\nimport { Category } from './lib/models/Category';\nimport { Product } from './lib/models/Product';\n\n/**\n * Reference principal resolver (#1540, #5195). Generated routes are\n * FAIL-CLOSED: a route that is not `@smrt({ api: { public } })` answers 401\n * to a caller who is not signed in, and every write needs the\n * `<collection>.<action>` permission (`products.create`, `categories.update`,\n * ...). The server enforces both from the principal returned here, once per\n * request, and nothing in the request can change it.\n *\n * Tenant-scoped models (`Product` is `@TenantScoped`) run inside the\n * principal's tenant: when tenancy is enabled, a principal with no tenant\n * reads global rows only and cannot write, and a write body that names\n * another tenant is refused with 403.\n *\n * Replace the stub with your real authentication: verify the session cookie\n * or bearer token and return the tenant, user and permission slugs of the\n * verified principal, never values from a header or parameter the caller\n * controls. Return `null` for an anonymous caller.\n */\nfunction demoResolvePrincipal(req: Request): APIRequestPrincipal | null {\n const token = req.headers.get('authorization');\n if (!token) return null;\n // TODO: verify `token` and return its principal. This stub verifies\n // nothing, so it knows no tenant and grants only what the demo needs.\n return {\n tenantId: null,\n allowCrossTenant: false,\n authenticated: true,\n permissions: [\n 'products.create',\n 'products.update',\n 'categories.create',\n 'categories.update',\n ],\n };\n}\n\nasync function startServer() {\n console.log('🚀 Starting SMRT Template Server...');\n\n // Start server with registered SMRT objects. Secure defaults (#1540): bind to\n // loopback, an explicit CORS origin allowlist (never `*`), and a fail-closed\n // principal resolver.\n const shutdown = await startRestServer(\n [Product, Category], // SMRT objects to generate API for\n {}, // context\n {\n port: 3000,\n hostname: '127.0.0.1',\n basePath: '/api/v1',\n enableCors: true,\n allowedOrigins: ['http://localhost:3000'],\n resolvePrincipal: demoResolvePrincipal,\n },\n );\n\n console.log('✅ Server ready!');\n console.log('📡 REST API: http://localhost:3000/api/v1');\n console.log('📚 Endpoints:');\n console.log(' GET /api/v1/products - List products');\n console.log(' POST /api/v1/products - Create product');\n console.log(' GET /api/v1/products/:id - Get product');\n console.log(' PUT /api/v1/products/:id - Update product');\n console.log(' GET /api/v1/categories - List categories');\n console.log(' POST /api/v1/categories - Create category');\n\n console.log('\\n💡 Try these endpoints (auth required — send a token):');\n console.log(\n ' curl http://localhost:3000/api/v1/products -H \"Authorization: Bearer <token>\"',\n );\n console.log(\n ' curl http://localhost:3000/api/v1/categories -H \"Authorization: Bearer <token>\"',\n );\n console.log(\n ' curl -X POST http://localhost:3000/api/v1/products -H \"Authorization: Bearer <token>\" -H \"Content-Type: application/json\" -d \\'{\"name\":\"Test Product\",\"price\":29.99}\\'',\n );\n\n return { shutdown };\n}\n\n// Start if running directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n startServer().catch(console.error);\n}\n\nexport { startServer };\n","/**\n * SMRT Template: Triple-Purpose Export\n *\n * This is the main entry point when this template is used as an NPM library.\n * It re-exports everything from the lib directory for easy consumption.\n *\n * Usage examples:\n *\n * // Import models\n * import { Product, Category } from '@happyvertical/core-template';\n *\n * // Import UI components\n * import { ProductCard, ProductForm } from '@happyvertical/core-template/components';\n *\n * // Import stores\n * import { ProductStoreClass } from '@happyvertical/core-template/stores';\n */\n\n// Self-register this package's manifest before any @smrt() decorator fires\n// downstream. Must come first so the side effect runs ahead of the class\n// module loads below. See __smrt-register__.ts for issue #1132 context.\nimport './__smrt-register__.js';\nimport { pathToFileURL } from 'node:url';\n\nexport { demonstrateClient } from './client';\n// Re-export everything from the lib directory\nexport * from './lib/index';\nexport { generateMCPServer } from './mcp';\n// Legacy exports for backward compatibility\nexport { startServer } from './server';\n\n/**\n * Start all services for demonstration (legacy function)\n */\nexport async function startAll() {\n const { startServer } = await import('./server');\n const { generateMCPServer } = await import('./mcp');\n\n console.log('🚀 Starting SMRT Template - Full Demo\\n');\n\n // Start REST API server\n console.log('1️⃣ Starting REST API...');\n const server = await startServer();\n\n // Start MCP server\n console.log('\\n2️⃣ Starting MCP Server...');\n const mcp = await generateMCPServer();\n\n console.log('\\n✨ All services running!');\n console.log('\\n🎯 What was auto-generated:');\n console.log(' • REST endpoints for Product and Category');\n console.log(' • TypeScript client with full type safety');\n console.log(' • MCP tools for AI model integration');\n console.log(' • OpenAPI/Swagger documentation');\n console.log(' • Live reloading during development');\n\n console.log('\\n📝 Next steps:');\n console.log(' • Modify src/lib/models/ to add new fields');\n console.log(' • Add new @smrt() classes to auto-generate more APIs');\n console.log(' • Run bun run dev to see live updates');\n\n return { server, mcp };\n}\n\n// Auto-start if running directly\nif (\n process.argv[1] &&\n import.meta.url === pathToFileURL(process.argv[1]).href\n) {\n startAll().catch(console.error);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,eAAe,oBAAoB;CACjC,QAAQ,IAAI,0CAA0C;CAGtD,MAAM,MAAM,eAAa,8BAA8B;CAEvD,IAAI;EACF,QAAQ,IAAI,kCAAkC;EAG9C,MAAM,aAAmC;GACvC,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM,CAAC,QAAQ,gBAAgB;EACjC;EAEA,QAAQ,IAAI,qBAAqB,UAAU;EAC3C,MAAM,iBAAiB,MAAM,IAAI,SAAS,OAAO,UAAU;EAC3D,QAAQ,IAAI,cAAc,cAAc;EAGxC,QAAQ,IAAI,4BAA4B;EACxC,MAAM,WAAW,MAAM,IAAI,SAAS,KAAK;EACzC,QAAQ,IAAI,aAAa,QAAQ;EAGjC,IAAI,gBAAgB,IAAI;GACtB,QAAQ,IAAI,wBAAwB,eAAe,GAAG,EAAE;GACxD,MAAM,UAAU,MAAM,IAAI,SAAS,IAAI,eAAe,EAAE;GACxD,QAAQ,IAAI,YAAY,OAAO;GAG/B,QAAQ,IAAI,wBAAwB;GACpC,MAAM,iBAAiB,MAAM,IAAI,SAAS,OAAO,eAAe,IAAI;IAClE,OAAO;IACP,aAAa;GACf,CAAC;G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,MAAM,YAAY;CAGjC,QAAQ,IAAI,8BAA8B;CAC1C,MAAM,MAAM,MAAM,kBAAkB;CAEpC,QAAQ,IAAI,2BAA2B;CACvC,QAAQ,IAAI,+BAA+B;CAC3C,QAAQ,IAAI,8CAA8C;CAC1D,QAAQ,IAAI,8CAA8C;CAC1D,QAAQ,IAAI,yCAAyC;CACrD,QAAQ,IAAI,oCAAoC;CAChD,QAAQ,IAAI,wCAAwC;CAEpD,QAAQ,IAAI,kBAAkB;CAC9B,QAAQ,IAAI,+CAA+C;CAC3D,QAAQ,IAAI,yDAAyD;CACrE,QAAQ,IAAI,0CAA0C;CAEtD,OAAO;EAAE;EAAQ;CAAI;AACvB;AAGA,IACE,QAAQ,KAAK,MACb,OAAO,KAAK,QAAQ,cAAc,QAAQ,KAAK,EAAE,CAAC,CAAC,MAEnD,SAAS,CAAC,CAAC,MAAM,QAAQ,KAAK"}
|
package/dist/lib/manifest.json
CHANGED
package/dist/lib/models.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as Product, i as Material, n as ProductVariant, o as ProductType, r as ProductAsset, s as Category, t as Sku } from "./chunks/Sku-tt-MO6g6.js";
|
|
2
|
-
import "./chunks/models-
|
|
2
|
+
import "./chunks/models-CcLXIOn7.js";
|
|
3
3
|
export { Category, Material, Product, ProductAsset, ProductType, ProductVariant, Sku };
|
package/dist/lib/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8CH,iBAAe,WAAW;;GAyCzB;AAUD,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-products",
|
|
6
|
-
"packageVersion": "0.
|
|
6
|
+
"packageVersion": "0.70.0",
|
|
7
7
|
"sourceManifestPath": "dist/lib/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "504f4a75361942a09553169aeeda1837ac6f640bf91451dac0d67ae8c5a0ffe8",
|
|
11
|
+
"packageJson": "a4d76734960e73f894484b63831290a6bbe53b0ed7c7b4c16be5ae7b213bd013",
|
|
12
12
|
"agents": "39bae43f14d7f80933a11fc1087d5bf376d8e0d6f4eae3a9a658185bf54508cf",
|
|
13
13
|
"moduleDoc:agents/install-lifecycle.md": "0b9b63732ff27f7435e68a04f481d4d4f03974065a39e46f0960964d4fac49df"
|
|
14
14
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-products",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.0",
|
|
4
4
|
"smrtJsdoc": "strict",
|
|
5
5
|
"description": "SMRT products module: triple-purpose microservice template for standalone apps, federated modules, and NPM libraries",
|
|
6
6
|
"author": "HappyVertical",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"@happyvertical/ai": "^0.116.6",
|
|
63
63
|
"@happyvertical/files": "^0.116.6",
|
|
64
64
|
"@happyvertical/logger": "^0.116.6",
|
|
65
|
-
"@happyvertical/smrt-assets": "0.
|
|
66
|
-
"@happyvertical/smrt-core": "0.
|
|
67
|
-
"@happyvertical/smrt-scanner": "0.
|
|
68
|
-
"@happyvertical/smrt-svelte": "0.
|
|
69
|
-
"@happyvertical/smrt-tenancy": "0.
|
|
70
|
-
"@happyvertical/smrt-ui": "0.
|
|
71
|
-
"@happyvertical/smrt-web": "0.
|
|
65
|
+
"@happyvertical/smrt-assets": "0.70.0",
|
|
66
|
+
"@happyvertical/smrt-core": "0.70.0",
|
|
67
|
+
"@happyvertical/smrt-scanner": "0.70.0",
|
|
68
|
+
"@happyvertical/smrt-svelte": "0.70.0",
|
|
69
|
+
"@happyvertical/smrt-tenancy": "0.70.0",
|
|
70
|
+
"@happyvertical/smrt-ui": "0.70.0",
|
|
71
|
+
"@happyvertical/smrt-web": "0.70.0",
|
|
72
72
|
"@happyvertical/sql": "^0.116.6",
|
|
73
73
|
"@happyvertical/utils": "^0.116.6",
|
|
74
74
|
"cors": "^2.8.6",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@types/cors": "2.8.19",
|
|
90
90
|
"@types/express": "^5.0.6",
|
|
91
91
|
"@types/node": "24.13.6",
|
|
92
|
-
"@happyvertical/smrt-vitest": "0.
|
|
92
|
+
"@happyvertical/smrt-vitest": "0.70.0",
|
|
93
93
|
"concurrently": "^10.0.5",
|
|
94
94
|
"svelte": "^5.57.1",
|
|
95
95
|
"svelte-check": "^4.7.6",
|