@happyvertical/smrt-products 0.51.32 → 0.51.34
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/app/main.d.ts +9 -0
- package/dist/lib/chunks/{__smrt-register__-BBA7MNne.js → __smrt-register__-Bxvcz_sW.js} +2 -2
- package/dist/lib/chunks/{__smrt-register__-BBA7MNne.js.map → __smrt-register__-Bxvcz_sW.js.map} +1 -1
- package/dist/lib/chunks/{collections-DsvZvlcc.js → collections-DfwgtT-B.js} +2 -2
- package/dist/lib/chunks/{collections-DsvZvlcc.js.map → collections-DfwgtT-B.js.map} +1 -1
- package/dist/lib/chunks/{generated-Co-Mj97W.js → generated-CDtcl3fy.js} +2 -2
- package/dist/lib/chunks/{generated-Co-Mj97W.js.map → generated-CDtcl3fy.js.map} +1 -1
- package/dist/lib/chunks/models-BSzAJPlu.js +2 -0
- package/dist/lib/collections.js +1 -1
- package/dist/lib/generated.js +1 -1
- package/dist/lib/index.d.ts +18 -0
- package/dist/lib/index.js +4 -4
- package/dist/lib/lib/collections/CategoryCollection.d.ts +3 -0
- package/dist/lib/lib/collections/MaterialCollection.d.ts +7 -1
- package/dist/lib/lib/collections/ProductAssetCollection.d.ts +3 -2
- package/dist/lib/lib/collections/ProductCollection.d.ts +1 -1
- package/dist/lib/lib/collections/ProductVariantCollection.d.ts +8 -0
- package/dist/lib/lib/collections/SkuCollection.d.ts +5 -0
- package/dist/lib/lib/collections/index.d.ts +1 -0
- package/dist/lib/lib/generated/index.d.ts +9 -0
- package/dist/lib/lib/mock-smrt-client.d.ts +7 -1
- package/dist/lib/lib/models/Category.d.ts +6 -1
- package/dist/lib/lib/models/Material.d.ts +14 -3
- package/dist/lib/lib/models/Product.d.ts +7 -2
- package/dist/lib/lib/models/ProductAsset.d.ts +2 -1
- package/dist/lib/lib/models/ProductVariant.d.ts +24 -1
- package/dist/lib/lib/models/Sku.d.ts +22 -1
- package/dist/lib/lib/models/index.d.ts +11 -0
- package/dist/lib/manifest.json +1 -1
- package/dist/lib/models.js +1 -1
- package/dist/lib/smrt-knowledge.json +4 -4
- package/package.json +10 -10
- package/dist/lib/chunks/models-CIZqZgKA.js +0 -2
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MaterialCollection — Collection manager for {@link Material} objects.
|
|
3
|
+
*
|
|
4
|
+
* STI framework auto-filters by `_meta_type` to return only Material rows
|
|
5
|
+
* from the shared `products` table.
|
|
6
|
+
*/
|
|
1
7
|
import { Material } from '../models/Material';
|
|
2
|
-
import { MaterialKind } from '../models/types';
|
|
8
|
+
import type { MaterialKind } from '../models/types';
|
|
3
9
|
import { ProductCollection } from './ProductCollection';
|
|
4
10
|
export declare class MaterialCollection extends ProductCollection {
|
|
5
11
|
static readonly _itemClass: typeof Material;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Asset } from '@happyvertical/smrt-assets';
|
|
2
|
-
import { SmrtCollectionOptions
|
|
1
|
+
import type { Asset } from '@happyvertical/smrt-assets';
|
|
2
|
+
import type { SmrtCollectionOptions } from '@happyvertical/smrt-core';
|
|
3
|
+
import { SmrtJunction } from '@happyvertical/smrt-core';
|
|
3
4
|
import { ProductAsset } from '../models/ProductAsset';
|
|
4
5
|
export interface ProductAssetCollectionOptions extends SmrtCollectionOptions {
|
|
5
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Asset } from '@happyvertical/smrt-assets';
|
|
1
|
+
import type { Asset } from '@happyvertical/smrt-assets';
|
|
2
2
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
3
3
|
import { Product } from '../models/Product';
|
|
4
4
|
export declare class ProductCollection extends SmrtCollection<Product> {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProductVariantCollection — read helpers for {@link ProductVariant} rows.
|
|
3
|
+
*
|
|
4
|
+
* {@link ProductVariant} is a standalone model (not a Product STI subtype),
|
|
5
|
+
* so this collection drives its own table (`product_variants`). Helper
|
|
6
|
+
* methods cover the two common query patterns: "what axes does this
|
|
7
|
+
* product vary along?" and "tell me about the size axis specifically."
|
|
8
|
+
*/
|
|
1
9
|
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
2
10
|
import { ProductVariant } from '../models/ProductVariant';
|
|
3
11
|
export declare class ProductVariantCollection extends SmrtCollection<ProductVariant> {
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated SMRT Components
|
|
3
|
+
*
|
|
4
|
+
* This file is automatically generated by the SMRT Vite plugin.
|
|
5
|
+
* It exports UI components that are auto-generated from @smrt() decorated classes.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
|
|
8
|
+
*/
|
|
9
|
+
import '../../__smrt-register__.js';
|
|
1
10
|
export declare const autoGeneratedComponents: {};
|
|
2
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Mock SMRT Client - Temporary implementation for demo purposes
|
|
3
|
+
*
|
|
4
|
+
* This replaces the missing @smrt/client virtual module with a working implementation
|
|
5
|
+
* that demonstrates the intended functionality.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProductData } from './types';
|
|
2
8
|
export type { ProductData } from './types';
|
|
3
9
|
export interface ApiResponse<T> {
|
|
4
10
|
data: T;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Product knowledge base category model
|
|
3
|
+
*
|
|
4
|
+
* SMRT auto-generates REST APIs, MCP tools, and TypeScript clients from this class.
|
|
5
|
+
*/
|
|
6
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
2
7
|
/**
|
|
3
8
|
* Options for Category initialization
|
|
4
9
|
*/
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Material — STI subtype of Product representing a raw input consumed by
|
|
3
|
+
* manufacturing: fabric, thread, trim, labels, packaging, components.
|
|
4
|
+
*
|
|
5
|
+
* Materials are first-class products in the catalog (the SAP/NetSuite pattern):
|
|
6
|
+
* they have a name, description, vendor, unit cost, and live in inventory just
|
|
7
|
+
* like finished goods. Bills of materials in `@happyvertical/smrt-manufacturing`
|
|
8
|
+
* reference Materials by id.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import { type Meta } from '@happyvertical/smrt-core';
|
|
13
|
+
import { Product, type ProductOptions } from './Product';
|
|
14
|
+
import { type MaterialKind, ProductType } from './types';
|
|
4
15
|
export interface MaterialOptions extends ProductOptions {
|
|
5
16
|
materialKind?: MaterialKind;
|
|
6
17
|
uom?: string;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Product knowledge base model
|
|
3
|
+
*
|
|
4
|
+
* SMRT auto-generates REST APIs, MCP tools, and TypeScript clients from this class.
|
|
5
|
+
*/
|
|
6
|
+
import type { Asset } from '@happyvertical/smrt-assets';
|
|
7
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
3
8
|
import { ProductType } from './types';
|
|
4
9
|
/**
|
|
5
10
|
* Options for Product initialization
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SmrtObjectOptions
|
|
1
|
+
import type { SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
2
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
2
3
|
export interface ProductAssetOptions extends SmrtObjectOptions {
|
|
3
4
|
tenantId?: string | null;
|
|
4
5
|
productId?: string;
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ProductVariant — declarative description of one axis along which a
|
|
3
|
+
* product's SKUs differ.
|
|
4
|
+
*
|
|
5
|
+
* A `ProductVariant` row says "for product X, axis Y has the following
|
|
6
|
+
* allowed values". The actual per-SKU value lives on `Sku.attributes`
|
|
7
|
+
* (also in this package — `Sku` was relocated to `@happyvertical/smrt-products`
|
|
8
|
+
* in Phase 1; inventory only holds stock motion now), keyed by `axisName`.
|
|
9
|
+
* This split keeps the axis catalog (form choices, UI grouping, ordering)
|
|
10
|
+
* separate from the per-unit instances.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately generic. `axisName` is free-form — apparel teams might
|
|
13
|
+
* use `'size'` and `'color'`, automotive teams `'trim'` and `'engine'`,
|
|
14
|
+
* CPG teams `'packSize'` and `'flavor'`. The framework never inspects
|
|
15
|
+
* the axis name.
|
|
16
|
+
*
|
|
17
|
+
* NOT a Product STI subtype — it's its own model with its own table,
|
|
18
|
+
* because the shape (axis declaration) doesn't fit the Product schema
|
|
19
|
+
* (no name, no price, no category — it's metadata about a Product, not
|
|
20
|
+
* a Product itself).
|
|
21
|
+
*
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
24
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
2
25
|
/**
|
|
3
26
|
* Options accepted by the {@link ProductVariant} constructor.
|
|
4
27
|
*/
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Sku — smallest sellable and countable unit.
|
|
3
|
+
*
|
|
4
|
+
* A SKU is the concrete catalog row that downstream inventory counts.
|
|
5
|
+
* It references a higher-level concept in this same package (a
|
|
6
|
+
* {@link Product} or any of its STI subtypes) via the plain string
|
|
7
|
+
* `productId` field. The same pattern serves apparel (one SKU per
|
|
8
|
+
* size/color), furniture (one SKU per finish), automotive parts,
|
|
9
|
+
* grocery (one SKU per pack size), or any other vertical that needs
|
|
10
|
+
* to count discrete units.
|
|
11
|
+
*
|
|
12
|
+
* Axis values such as `{ size: 'M', color: 'navy' }`, `{ finish: 'walnut' }`,
|
|
13
|
+
* or `{ packSize: '12oz' }` are stored as opaque JSON in `attributes`;
|
|
14
|
+
* the declarative axis catalog lives in {@link ProductVariant} in this
|
|
15
|
+
* same package.
|
|
16
|
+
*
|
|
17
|
+
* Stock balance and movement history for a SKU live in
|
|
18
|
+
* `@happyvertical/smrt-inventory` as `StockLevel` and `StockMovement`.
|
|
19
|
+
*
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
2
23
|
/**
|
|
3
24
|
* Options accepted by the {@link Sku} constructor.
|
|
4
25
|
*/
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMRT Template Models
|
|
3
|
+
*
|
|
4
|
+
* Domain models that demonstrate SMRT auto-generation capabilities.
|
|
5
|
+
* These classes are decorated with @smrt() and automatically generate:
|
|
6
|
+
* - REST APIs
|
|
7
|
+
* - TypeScript clients
|
|
8
|
+
* - MCP tools for AI
|
|
9
|
+
* - UI components
|
|
10
|
+
*/
|
|
11
|
+
import '../../__smrt-register__.js';
|
|
1
12
|
export type { CategoryOptions } from './Category';
|
|
2
13
|
export { Category } from './Category';
|
|
3
14
|
export type { MaterialOptions } from './Material';
|
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-Bq9Fr-2f.js";
|
|
2
|
-
import "./chunks/models-
|
|
2
|
+
import "./chunks/models-BSzAJPlu.js";
|
|
3
3
|
export { Category, Material, Product, ProductAsset, ProductType, ProductVariant, Sku };
|
|
@@ -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.51.
|
|
6
|
+
"packageVersion": "0.51.34",
|
|
7
7
|
"sourceManifestPath": "dist/lib/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "10c10668e3c55c26444998675de9fa3a90cac60c3ed31bd5e1eeb9bb880cb902",
|
|
11
|
+
"packageJson": "69317dc83d28893a68e69ded83251006f77cefe1f9ec19fb07457ed795b50378",
|
|
12
12
|
"agents": "4ddde01c48baf13de773cdb57353a148f3fe3b93d21e99d8ac57677cda809e26"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"concurrently": "^10.0.5",
|
|
49
49
|
"svelte": "^5.57.1",
|
|
50
50
|
"svelte-check": "^4.7.6",
|
|
51
|
-
"typescript": "
|
|
51
|
+
"typescript": "6.0.3",
|
|
52
52
|
"vite": "8.1.4",
|
|
53
53
|
"vitest": "4.1.10"
|
|
54
54
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-products",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.34",
|
|
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",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"@happyvertical/ai": "^0.94.1",
|
|
58
58
|
"@happyvertical/files": "^0.94.1",
|
|
59
59
|
"@happyvertical/logger": "^0.94.1",
|
|
60
|
-
"@happyvertical/smrt-assets": "0.51.
|
|
61
|
-
"@happyvertical/smrt-core": "0.51.
|
|
62
|
-
"@happyvertical/smrt-scanner": "0.51.
|
|
63
|
-
"@happyvertical/smrt-svelte": "0.51.
|
|
64
|
-
"@happyvertical/smrt-tenancy": "0.51.
|
|
65
|
-
"@happyvertical/smrt-ui": "0.51.
|
|
66
|
-
"@happyvertical/smrt-web": "0.51.
|
|
60
|
+
"@happyvertical/smrt-assets": "0.51.34",
|
|
61
|
+
"@happyvertical/smrt-core": "0.51.34",
|
|
62
|
+
"@happyvertical/smrt-scanner": "0.51.34",
|
|
63
|
+
"@happyvertical/smrt-svelte": "0.51.34",
|
|
64
|
+
"@happyvertical/smrt-tenancy": "0.51.34",
|
|
65
|
+
"@happyvertical/smrt-ui": "0.51.34",
|
|
66
|
+
"@happyvertical/smrt-web": "0.51.34",
|
|
67
67
|
"@happyvertical/sql": "^0.94.1",
|
|
68
68
|
"@happyvertical/utils": "^0.94.1",
|
|
69
69
|
"cors": "^2.8.6",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"@types/cors": "2.8.19",
|
|
85
85
|
"@types/express": "^5.0.6",
|
|
86
86
|
"@types/node": "24.13.6",
|
|
87
|
-
"@happyvertical/smrt-vitest": "0.51.
|
|
87
|
+
"@happyvertical/smrt-vitest": "0.51.34",
|
|
88
88
|
"concurrently": "^10.0.5",
|
|
89
89
|
"svelte": "^5.57.1",
|
|
90
90
|
"svelte-check": "^4.7.6",
|
|
91
|
-
"typescript": "
|
|
91
|
+
"typescript": "6.0.3",
|
|
92
92
|
"vite": "8.1.4",
|
|
93
93
|
"vitest": "4.1.10"
|
|
94
94
|
},
|