@contrail/cli 3.6.0-alpha-4 → 3.6.0-alpha-5
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/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.6.0-alpha-
|
|
20
|
+
@contrail/cli/3.6.0-alpha-5 darwin-arm64 node-v22.19.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
package/dist/api/types.js
CHANGED
|
@@ -101,6 +101,8 @@ exports.getTypeByPath = getTypeByPath;
|
|
|
101
101
|
async function buildLocalTypesCache(paths) {
|
|
102
102
|
const types = await Promise.all(paths.map((path) => getTypeByPath(path)));
|
|
103
103
|
const newCache = types.reduce((acc, type) => {
|
|
104
|
+
if (!type)
|
|
105
|
+
return acc;
|
|
104
106
|
acc.set(type.typePath, type);
|
|
105
107
|
return acc;
|
|
106
108
|
}, new Map());
|
|
@@ -84,14 +84,14 @@ const FIND_VALID_VALUE_MAP = {
|
|
|
84
84
|
],
|
|
85
85
|
item: [
|
|
86
86
|
{
|
|
87
|
-
slug: '
|
|
87
|
+
slug: 'itemFamilyId',
|
|
88
88
|
findValidValuesFn: async (_items) => new Set(await (0, entities_1.getItemFamilies)(getNumEntitiesToCreate()).then((families) => families === undefined ? undefined : families.map(({ id }) => id))),
|
|
89
89
|
applyValueToEntityFn: (entity, validValues) => {
|
|
90
|
-
if (entity.
|
|
90
|
+
if (entity.itemFamilyId)
|
|
91
91
|
return; // skip if already specified
|
|
92
92
|
if (entity.roles?.includes('option')) {
|
|
93
|
-
entity.
|
|
94
|
-
// can reuse
|
|
93
|
+
entity.itemFamilyId = Array.from(validValues)[Math.floor(Math.random() * validValues.size)];
|
|
94
|
+
// can reuse itemFamilyId for options
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
},
|
|
@@ -452,7 +452,7 @@ function generateRandomNumber(min, max) {
|
|
|
452
452
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
453
453
|
}
|
|
454
454
|
function generateRandomReadableString() {
|
|
455
|
-
return (0, unique_names_generator_1.uniqueNamesGenerator)({ dictionaries: [unique_names_generator_1.adjectives, unique_names_generator_1.animals, unique_names_generator_1.colors, unique_names_generator_1.
|
|
455
|
+
return (0, unique_names_generator_1.uniqueNamesGenerator)({ dictionaries: [unique_names_generator_1.adjectives, unique_names_generator_1.animals, unique_names_generator_1.colors, unique_names_generator_1.animals, unique_names_generator_1.colors], length: 5 });
|
|
456
456
|
}
|
|
457
457
|
function generateRandomDateString() {
|
|
458
458
|
return new Date().toISOString();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Item } from '@contrail/entity-types';
|
|
2
2
|
export declare function throwIfInvalidItemId(itemId: string): Promise<void>;
|
|
3
|
-
export type SparseItem = Pick<Item, 'id' | '
|
|
3
|
+
export type SparseItem = Pick<Item, 'id' | 'itemFamilyId' | 'roles' | 'name'>;
|
|
4
4
|
export declare function getAllItemsUsingCacheFallback(): Promise<SparseItem[]>;
|
|
5
5
|
export declare function getManyItems(maxCount?: number): Promise<SparseItem[]>;
|
|
6
6
|
export declare function getItemFamilies(count: number): Promise<SparseItem[] | undefined>;
|
|
@@ -59,11 +59,11 @@ async function getFamilyName(item) {
|
|
|
59
59
|
if (!item.roles.includes('option')) {
|
|
60
60
|
return undefined;
|
|
61
61
|
}
|
|
62
|
-
if (!item.
|
|
62
|
+
if (!item.itemFamilyId) {
|
|
63
63
|
return undefined;
|
|
64
64
|
}
|
|
65
65
|
await ensureItemCacheIsPopulated();
|
|
66
|
-
const family = ITEMS_CACHE_BY_ID.get(item.
|
|
66
|
+
const family = ITEMS_CACHE_BY_ID.get(item.itemFamilyId);
|
|
67
67
|
return family ? [family.name] : ['placeholder']; // placeholder if family not found
|
|
68
68
|
}
|
|
69
69
|
exports.getFamilyName = getFamilyName;
|
package/oclif.manifest.json
CHANGED