@twin.org/tools-core 0.0.4-next.3 → 0.9.0-next.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.
@@ -3,21 +3,21 @@
3
3
  */
4
4
  export declare class FileUtils {
5
5
  /**
6
- * Does the file exist.
6
+ * Check whether a file exists at the given path.
7
7
  * @param filePath The file path.
8
8
  * @returns True if the file exists.
9
9
  */
10
10
  static fileExists(filePath: string): boolean;
11
11
  /**
12
- * Read the file.
12
+ * Read the entire contents of a file as UTF-8 text.
13
13
  * @param filePath The file path.
14
14
  * @returns The file contents.
15
15
  */
16
16
  static readFile(filePath: string): string;
17
17
  /**
18
- * Resolve a path.
18
+ * Resolve a file path to an absolute path.
19
19
  * @param filePath The file path.
20
- * @returns The resolved path.
20
+ * @returns The resolved absolute path.
21
21
  */
22
22
  static resolvePath(filePath: string): string;
23
23
  /**
@@ -28,60 +28,4 @@ export declare class ImportTypeQuerySchemaResolver {
28
28
  * @returns The resolved schema id.
29
29
  */
30
30
  static resolveImportTypeReferenceSchemaId(context: ITypeScriptToSchemaContext, moduleSpecifier: string, typeName: string, title: string): string | undefined;
31
- /**
32
- * Resolve a property value from a const object declaration in an imported source file.
33
- * @param context The generation context.
34
- * @param objectName The imported object symbol name.
35
- * @param propertyName The property name to resolve from the object.
36
- * @returns The resolved literal property value.
37
- */
38
- private static resolveConstObjectProperty;
39
- /**
40
- * Find a variable declaration by traversing import and export chains.
41
- * @param sourceFilePath The source file path to inspect.
42
- * @param variableName The variable name to find.
43
- * @param visitedFiles The set of visited files to prevent recursion cycles.
44
- * @returns The matched variable declaration.
45
- */
46
- private static findVariableDeclarationInModuleGraph;
47
- /**
48
- * Find an imported symbol reference by local identifier name.
49
- * @param sourceFile The active source file.
50
- * @param localName The local identifier name.
51
- * @returns The imported symbol reference.
52
- */
53
- private static findImportedValueReference;
54
- /**
55
- * Resolve an import declaration module specifier to a source file.
56
- * @param containingSourceFilePath The path of the file containing the import declaration.
57
- * @param moduleSpecifier The module specifier to resolve.
58
- * @returns The resolved source file path.
59
- */
60
- private static resolveImportDeclarationSourceFile;
61
- /**
62
- * Extract a const-object property value from a declaration initializer.
63
- * @param objectDeclaration The variable declaration containing the object initializer.
64
- * @param propertyName The property name to resolve.
65
- * @returns The extracted literal property value.
66
- */
67
- private static extractConstObjectPropertyFromDeclarationInitializer;
68
- /**
69
- * Extract a const-object property value from a declaration type annotation.
70
- * @param declarationTypeNode The declaration type node to inspect.
71
- * @param propertyName The property name to resolve.
72
- * @returns The extracted literal property value.
73
- */
74
- private static extractConstObjectPropertyFromDeclarationType;
75
- /**
76
- * Extract a literal value from a type node when possible.
77
- * @param typeNode The type node to inspect.
78
- * @returns The extracted literal value.
79
- */
80
- private static extractLiteralValueFromTypeNode;
81
- /**
82
- * Extract a referenced type name from an import type qualifier.
83
- * @param qualifier The import type qualifier.
84
- * @returns The extracted type name.
85
- */
86
- private static extractImportTypeName;
87
31
  }
@@ -13,10 +13,6 @@ export declare class JsonSchemaBuilder {
13
13
  * Runtime name for the class.
14
14
  */
15
15
  static readonly CLASS_NAME: string;
16
- /**
17
- * Dictionary of TypeScript utility type names to their schema mapping handlers.
18
- */
19
- private static readonly _utilityTypeHandlers;
20
16
  /**
21
17
  * Parse all object declarations from a source file.
22
18
  * @param context The generation context.
@@ -71,11 +71,4 @@ export declare class MappedTypeSchemaResolver {
71
71
  sourceKey: string;
72
72
  mappedKey: string;
73
73
  }[], sourceObjectSchema: IJsonSchema): string[] | undefined;
74
- /**
75
- * Apply TypeScript intrinsic string remapping helpers to a key.
76
- * @param intrinsicName The intrinsic helper name.
77
- * @param value The input key value.
78
- * @returns The remapped key value.
79
- */
80
- private static applyIntrinsicMappedTypeKeyRemap;
81
74
  }
@@ -28,65 +28,4 @@ export declare class TypeScriptToSchema {
28
28
  * @returns True if the diagnostic originated from the package.
29
29
  */
30
30
  isDiagnosticFromPackage(path: string, fileName: string | undefined, packageName: string): boolean;
31
- /**
32
- * Rewrite refs to @json-schema embedded local types into the current schema's $defs.
33
- * @param context The generation context.
34
- * @param schema The root schema to rewrite.
35
- * @param rootTitle The title of the root schema.
36
- */
37
- private inlineEmbeddedSchemas;
38
- /**
39
- * Traverse a schema tree and move embedded local refs into the root schema's $defs.
40
- * @param context The generation context.
41
- * @param rootSchema The root schema document being rewritten.
42
- * @param currentNode The current schema node.
43
- * @param rootTitle The title of the root schema.
44
- * @param ancestry Titles currently being expanded to avoid recursion cycles.
45
- * @returns True if inline embedding changed this node or a descendant.
46
- */
47
- private inlineEmbeddedSchemasInNode;
48
- /**
49
- * Flatten inline-expanded object allOf branches into the containing schema.
50
- * @param schema The schema to flatten.
51
- */
52
- private flattenInlineAllOfBranches;
53
- /**
54
- * Determine whether an allOf branch can be flattened into its parent after inline embedding.
55
- * @param branch The allOf branch.
56
- * @returns True if the branch is a plain object schema.
57
- */
58
- private canFlattenInlineAllOfBranch;
59
- /**
60
- * Create a clone of an embedded schema suitable for defs or inline expansion.
61
- * @param context The generation context.
62
- * @param embeddedSchema The source schema.
63
- * @param embeddedMode The embedding mode.
64
- * @returns The cloned schema.
65
- */
66
- private createEmbeddedSchemaClone;
67
- /**
68
- * Replace the contents of a schema node while keeping the same object reference.
69
- * @param target The schema node to mutate.
70
- * @param replacement The replacement content.
71
- */
72
- private replaceSchemaNode;
73
- /**
74
- * Find a generated schema by its canonical id across all loaded packages.
75
- * @param context The generation context.
76
- * @param schemaId The schema id to locate.
77
- * @returns The schema when found.
78
- */
79
- private findSchemaById;
80
- /**
81
- * Resolve the local $defs key to use for an embedded schema.
82
- * @param schema The embedded schema.
83
- * @param schemaId The canonical schema id.
84
- * @returns The local definition key.
85
- */
86
- private getEmbeddedDefinitionKey;
87
- /**
88
- * Remove $comment fields from a schema tree.
89
- * @param schema The schema tree to clean.
90
- */
91
- private removeSchemaComments;
92
31
  }
@@ -99,52 +99,4 @@ export declare class UtilityTypeSchemaMapper {
99
99
  * @returns The mapped schema.
100
100
  */
101
101
  static mapSingleOccurrenceArrayUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode): IJsonSchema | undefined;
102
- /**
103
- * Determine whether a type node represents null or undefined.
104
- * @param typeNode The type node to inspect.
105
- * @returns True if the node represents null or undefined; otherwise false.
106
- */
107
- private static isNullOrUndefinedTypeNode;
108
- /**
109
- * Extract literal keys from a Record key type argument.
110
- * @param keyTypeNode The Record key type argument to inspect.
111
- * @returns The extracted literal keys.
112
- */
113
- private static extractRecordLiteralKeys;
114
- /**
115
- * Resolve a default schema for JsonLdObject utility key additions when the type argument is omitted.
116
- * @param context The generation context.
117
- * @param baseSchema The base object schema being transformed.
118
- * @param keyToAdd The key to add when no explicit value type argument is provided.
119
- * @returns The resolved default schema for the added key.
120
- */
121
- private static mapJsonLdObjectDefaultSchemaByKey;
122
- /**
123
- * Resolve default id schema for JsonLdObjectWithId when Id type argument is omitted.
124
- * @param baseSchema The base object schema being transformed.
125
- * @returns The default id schema.
126
- */
127
- private static mapJsonLdObjectWithIdDefaultIdSchema;
128
- /**
129
- * Resolve default type schema for JsonLdObjectWithType when Type argument is omitted.
130
- * @param baseSchema The base object schema being transformed.
131
- * @returns The default type schema.
132
- */
133
- private static mapJsonLdObjectWithTypeDefaultTypeSchema;
134
- /**
135
- * Resolve default context schema for JsonLdObjectWithContext when Context argument is omitted.
136
- * @param context The generation context.
137
- * @param baseSchema The base object schema being transformed.
138
- * @returns The default context schema.
139
- */
140
- private static mapJsonLdObjectWithContextDefaultContextSchema;
141
- /**
142
- * Resolve default schema from either of two source keys, with fallback when both are absent.
143
- * @param baseSchema The base object schema being transformed.
144
- * @param firstKey The first property key to check.
145
- * @param secondKey The second property key to check.
146
- * @param fallbackSchema The fallback schema when neither key is present.
147
- * @returns The resolved schema.
148
- */
149
- private static mapJsonLdObjectDefaultEitherSchema;
150
102
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.0-next.1](https://github.com/iotaledger/twin-tools/compare/tools-core-v0.9.0-next.0...tools-core-v0.9.0-next.1) (2026-06-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * add 'byte' to supported json-schema format values ([#122](https://github.com/iotaledger/twin-tools/issues/122)) ([54c2a27](https://github.com/iotaledger/twin-tools/commit/54c2a279c1fdc4f6779667e3deb3de3a199237ac))
9
+ * add context id features ([#54](https://github.com/iotaledger/twin-tools/issues/54)) ([41ad65d](https://github.com/iotaledger/twin-tools/commit/41ad65d5ae33d0533d32a2864cd94e5c35e56c76))
10
+ * add examples to json schema ([#109](https://github.com/iotaledger/twin-tools/issues/109)) ([def5b13](https://github.com/iotaledger/twin-tools/commit/def5b1312e7a0ffefe662fb14575cb655d1c0774))
11
+ * add jsdoc default value to schema ([7886a84](https://github.com/iotaledger/twin-tools/commit/7886a84961e692d2054f223e2e99205a654b76a6))
12
+ * add jsdoc tag validation ([971b8d3](https://github.com/iotaledger/twin-tools/commit/971b8d3817d40467bfd7549c99af602f0c590299))
13
+ * add json-schema embedded mode ([#102](https://github.com/iotaledger/twin-tools/issues/102)) ([f070967](https://github.com/iotaledger/twin-tools/commit/f070967f8f3308e0b5320eab278a319c9d229e3e))
14
+ * add support for auto expand types ([dd1e10a](https://github.com/iotaledger/twin-tools/commit/dd1e10a5b2fea6f80890ff6f3971f48e239cb4c1))
15
+ * add validate-locales ([97bb11f](https://github.com/iotaledger/twin-tools/commit/97bb11fd9e6ed400e7fa69671075ba78f36ca6e6))
16
+ * correctly handle auto expand types ([57fce0f](https://github.com/iotaledger/twin-tools/commit/57fce0f9ec4a0876665d70adc6e885f6feb3caf7))
17
+ * eslint migration to flat config ([25acfcf](https://github.com/iotaledger/twin-tools/commit/25acfcf4c4e0c496fffeaf67659fe171bc15199a))
18
+ * improve auto expand types ([6181d1d](https://github.com/iotaledger/twin-tools/commit/6181d1daded1f91323195cf7efbc2f1881f38b41))
19
+ * improve discriminated unions ([9c36ea7](https://github.com/iotaledger/twin-tools/commit/9c36ea7283230089ff19085ddc4b4c30a4e3f8a2))
20
+ * improve inheritance redefinition optionality ([e7024f6](https://github.com/iotaledger/twin-tools/commit/e7024f699988c0b3de8315a0dbe455a13268e75d))
21
+ * improve type name normalisation ([1fe28e5](https://github.com/iotaledger/twin-tools/commit/1fe28e567593e46a41a833fbba95fe4cd958f525))
22
+ * remove additionalProperties ([f9b5d81](https://github.com/iotaledger/twin-tools/commit/f9b5d81e952468f9579593cb979f2b84db6f0dfa))
23
+ * remove auto expanded types from final output ([18e05dc](https://github.com/iotaledger/twin-tools/commit/18e05dc88f71a0a27b79d1d076b1261b42d2c4c2))
24
+ * tighten the types included with the regex matching ([e54909b](https://github.com/iotaledger/twin-tools/commit/e54909bded4a19d00560dd3ec783e9146580bda3))
25
+ * ts to schema ([#86](https://github.com/iotaledger/twin-tools/issues/86)) ([ffebda5](https://github.com/iotaledger/twin-tools/commit/ffebda5f14ab5ec734bf37c9fb70a7ec3d4012c3))
26
+ * typescript 6 update ([02d2e47](https://github.com/iotaledger/twin-tools/commit/02d2e47859a1d64c81e840626cc2d443816af45b))
27
+ * update dependencies ([5bdd8be](https://github.com/iotaledger/twin-tools/commit/5bdd8becf9f08b35342ea8f298f74578951f4bac))
28
+ * update framework core ([559cb98](https://github.com/iotaledger/twin-tools/commit/559cb98612c05a05458b37462cda806b9591b18a))
29
+ * use correct json-ld context schema ([c831486](https://github.com/iotaledger/twin-tools/commit/c8314864a63635556cd5f2912162a2989056e974))
30
+ * use jsdoc tags for json-ld markup ([1ea872e](https://github.com/iotaledger/twin-tools/commit/1ea872e07a1cc0e94178158a57383d64008e02e3))
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * additionalItems object check ([ca81668](https://github.com/iotaledger/twin-tools/commit/ca81668e1ee0d2b1a479215265e651932d7b76de))
36
+ * ajv stack overflow for oneOf on large enums ([#112](https://github.com/iotaledger/twin-tools/issues/112)) ([6be32a3](https://github.com/iotaledger/twin-tools/commit/6be32a3ae5b3cf188c0d1caf1080f497b648705c))
37
+ * improve schema output ([9e53cbe](https://github.com/iotaledger/twin-tools/commit/9e53cbe26e6272323d72c65e277b7d24521fdbba))
38
+ * missing type definitions when importing relative from dynamic node_modules ([52d9fc5](https://github.com/iotaledger/twin-tools/commit/52d9fc5f2618a09c02b9f5dbe585b37cf60c9f20))
39
+ * module resolution ([f3aa10c](https://github.com/iotaledger/twin-tools/commit/f3aa10c9c9af073de392a2ef6b8411e947e991c2))
40
+ * remove byte support ([#124](https://github.com/iotaledger/twin-tools/issues/124)) ([7f8c9cd](https://github.com/iotaledger/twin-tools/commit/7f8c9cd4dcc49c58ccc9a985f5bcd03736b5ef0f))
41
+ * support json-ld with aliases type ([#127](https://github.com/iotaledger/twin-tools/issues/127)) ([1eb6c4f](https://github.com/iotaledger/twin-tools/commit/1eb6c4f00088955506c88f026cfaba6e1e1a61b7))
42
+ * work for schema generator spread defect ([1a705ff](https://github.com/iotaledger/twin-tools/commit/1a705ffc74b353f652e74ea43454164a2f6740bf))
43
+
44
+
45
+ ### Dependencies
46
+
47
+ * The following workspace dependencies were updated
48
+ * dependencies
49
+ * @twin.org/tools-models bumped from 0.9.0-next.0 to 0.9.0-next.1
50
+
3
51
  ## [0.0.4-next.3](https://github.com/iotaledger/twin-tools/compare/tools-core-v0.0.4-next.2...tools-core-v0.0.4-next.3) (2026-06-02)
4
52
 
5
53
 
@@ -18,7 +18,7 @@ Utility helpers for TypeScript file and directory paths.
18
18
 
19
19
  > `static` **fileExists**(`filePath`): `boolean`
20
20
 
21
- Does the file exist.
21
+ Check whether a file exists at the given path.
22
22
 
23
23
  #### Parameters
24
24
 
@@ -40,7 +40,7 @@ True if the file exists.
40
40
 
41
41
  > `static` **readFile**(`filePath`): `string`
42
42
 
43
- Read the file.
43
+ Read the entire contents of a file as UTF-8 text.
44
44
 
45
45
  #### Parameters
46
46
 
@@ -62,7 +62,7 @@ The file contents.
62
62
 
63
63
  > `static` **resolvePath**(`filePath`): `string`
64
64
 
65
- Resolve a path.
65
+ Resolve a file path to an absolute path.
66
66
 
67
67
  #### Parameters
68
68
 
@@ -76,7 +76,7 @@ The file path.
76
76
 
77
77
  `string`
78
78
 
79
- The resolved path.
79
+ The resolved absolute path.
80
80
 
81
81
  ***
82
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/tools-core",
3
- "version": "0.0.4-next.3",
3
+ "version": "0.9.0-next.1",
4
4
  "description": "Shared utilities and models for tooling packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,9 +14,9 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "next",
18
- "@twin.org/nameof": "next",
19
- "@twin.org/tools-models": "0.0.4-next.3",
17
+ "@twin.org/core": "0.9.0-next.1",
18
+ "@twin.org/nameof": "0.9.0-next.1",
19
+ "@twin.org/tools-models": "0.9.0-next.1",
20
20
  "glob": "13.0.6"
21
21
  },
22
22
  "main": "./dist/es/index.js",