@seliseblocks/cli-os 0.1.0-beta.1 → 0.1.1

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.
@@ -27,19 +27,20 @@ export async function writeAssetsFeature(root) {
27
27
  " value: number;",
28
28
  "};",
29
29
  "",
30
- "// Advanced filters here are applied client-side, not sent to Blocks Data:",
31
- "// the generic collection list endpoint only documents full-text search",
32
- "// (Keyword) server-side, not structured per-field filters, so filtering by",
33
- "// category/status/value only narrows the page already fetched.",
30
+ "// Advanced filters here are applied client-side. The collection helper uses",
31
+ "// Data Gateway GraphQL and sends only paging plus the optional search filter",
32
+ "// below, so category/status/value filters narrow the page already fetched.",
34
33
  "export type AssetFilters = { category?: string; maxValue?: number; minValue?: number; status?: string };",
35
34
  "",
36
- "const assets = blocksClient.data.collection<Asset>(\"Assets\");",
35
+ "const assets = blocksClient.data.collection<Asset>(\"Asset\", {",
36
+ " fields: [\"name\", \"assetTag\", \"category\", \"status\", \"assignedTo\", \"value\"]",
37
+ "});",
37
38
  "",
38
39
  "export async function listAssets({ page, pageSize, search }: { page: number; pageSize: number; search: string }) {",
39
40
  " const response = await assets.list({",
40
41
  " pageNo: page,",
41
42
  " pageSize,",
42
- " query: search ? { Keyword: search } : undefined",
43
+ " filter: search ? { name: { $regex: search, $options: \"i\" } } : undefined",
43
44
  " });",
44
45
  " return normalizeAssetList(response);",
45
46
  "}",
@@ -75,10 +76,11 @@ export async function writeAssetsFeature(root) {
75
76
  "}",
76
77
  "",
77
78
  "function normalizeAssetList(response: unknown): { items: Asset[]; totalCount: number } {",
78
- " const record = response as { data?: { items?: Asset[]; totalCount?: number } | Asset[]; items?: Asset[]; totalCount?: number };",
79
+ " const record = response as { data?: { getAssets?: { items?: Asset[]; totalCount?: number }; items?: Asset[]; totalCount?: number } | Asset[]; items?: Asset[]; totalCount?: number };",
79
80
  " if (Array.isArray(record.data)) return { items: record.data, totalCount: record.data.length };",
80
- " const items = record.data?.items ?? record.items ?? [];",
81
- " return { items, totalCount: record.data?.totalCount ?? record.totalCount ?? items.length };",
81
+ " const gateway = record.data?.getAssets;",
82
+ " const items = gateway?.items ?? record.data?.items ?? record.items ?? [];",
83
+ " return { items, totalCount: gateway?.totalCount ?? record.data?.totalCount ?? record.totalCount ?? items.length };",
82
84
  "}",
83
85
  ""
84
86
  ].join("\n"));
@@ -18,7 +18,7 @@ export async function writeRootFiles(root, options) {
18
18
  },
19
19
  dependencies: {
20
20
  "@radix-ui/react-dropdown-menu": "^2.1.24",
21
- "@seliseblocks/client": "^0.1.0-beta.2",
21
+ "@seliseblocks/client": "^0.1.1",
22
22
  "@tanstack/react-query": "^5.101.4",
23
23
  clsx: "^2.1.1",
24
24
  "lucide-react": "^1.28.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seliseblocks/cli-os",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.1",
4
4
  "description": "CLI for SELISE Blocks OS project setup and configuration.",
5
5
  "license": "MIT",
6
6
  "type": "module",