@api-client/core 0.17.4 → 0.17.6
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/build/src/modeling/Semantics.d.ts +9 -5
- package/build/src/modeling/Semantics.d.ts.map +1 -1
- package/build/src/modeling/Semantics.js +14 -10
- package/build/src/modeling/Semantics.js.map +1 -1
- package/build/src/modeling/definitions/{Price.d.ts → Currency.d.ts} +24 -24
- package/build/src/modeling/definitions/Currency.d.ts.map +1 -0
- package/build/src/modeling/definitions/{Price.js → Currency.js} +18 -18
- package/build/src/modeling/definitions/Currency.js.map +1 -0
- package/build/src/modeling/definitions/Email.d.ts +2 -2
- package/build/src/modeling/definitions/Email.d.ts.map +1 -1
- package/build/src/modeling/definitions/Email.js.map +1 -1
- package/build/src/modeling/definitions/GeospatialCoordinates.d.ts +46 -1
- package/build/src/modeling/definitions/GeospatialCoordinates.d.ts.map +1 -1
- package/build/src/modeling/definitions/GeospatialCoordinates.js.map +1 -1
- package/build/src/modeling/definitions/HTML.d.ts +17 -4
- package/build/src/modeling/definitions/HTML.d.ts.map +1 -1
- package/build/src/modeling/definitions/HTML.js +0 -1
- package/build/src/modeling/definitions/HTML.js.map +1 -1
- package/build/src/modeling/definitions/Markdown.d.ts +12 -4
- package/build/src/modeling/definitions/Markdown.d.ts.map +1 -1
- package/build/src/modeling/definitions/Markdown.js +0 -1
- package/build/src/modeling/definitions/Markdown.js.map +1 -1
- package/build/src/modeling/definitions/Phone.d.ts +5 -7
- package/build/src/modeling/definitions/Phone.d.ts.map +1 -1
- package/build/src/modeling/definitions/Phone.js +2 -2
- package/build/src/modeling/definitions/Phone.js.map +1 -1
- package/build/src/modeling/definitions/PublicUniqueName.d.ts +1 -9
- package/build/src/modeling/definitions/PublicUniqueName.d.ts.map +1 -1
- package/build/src/modeling/definitions/PublicUniqueName.js +0 -1
- package/build/src/modeling/definitions/PublicUniqueName.js.map +1 -1
- package/build/src/modeling/definitions/SKU.d.ts +4 -1
- package/build/src/modeling/definitions/SKU.d.ts.map +1 -1
- package/build/src/modeling/definitions/SKU.js.map +1 -1
- package/build/src/modeling/definitions/Status.d.ts +1 -1
- package/build/src/modeling/definitions/Status.d.ts.map +1 -1
- package/build/src/modeling/definitions/Status.js +1 -0
- package/build/src/modeling/definitions/Status.js.map +1 -1
- package/build/src/modeling/definitions/URL.d.ts +1 -4
- package/build/src/modeling/definitions/URL.d.ts.map +1 -1
- package/build/src/modeling/definitions/URL.js +0 -1
- package/build/src/modeling/definitions/URL.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +10 -10
- package/package.json +1 -1
- package/src/modeling/Semantics.ts +14 -10
- package/src/modeling/definitions/{Price.examples.md → Currency.examples.md} +12 -12
- package/src/modeling/definitions/{Price.ts → Currency.ts} +26 -26
- package/src/modeling/definitions/Email.ts +2 -2
- package/src/modeling/definitions/GeospatialCoordinates.ts +46 -1
- package/src/modeling/definitions/HTML.ts +17 -5
- package/src/modeling/definitions/Markdown.ts +12 -5
- package/src/modeling/definitions/Phone.ts +6 -8
- package/src/modeling/definitions/PublicUniqueName.ts +1 -10
- package/src/modeling/definitions/SKU.ts +4 -1
- package/src/modeling/definitions/Status.ts +2 -1
- package/src/modeling/definitions/URL.ts +1 -5
- package/tests/unit/modeling/definitions/{price.spec.ts → currency.spec.ts} +114 -114
- package/tests/unit/modeling/definitions/derived.spec.ts +1 -2
- package/tests/unit/modeling/definitions/description.spec.ts +0 -2
- package/tests/unit/modeling/definitions/url.spec.ts +0 -1
- package/tests/unit/modeling/semantic-configs.spec.ts +45 -46
- package/tests/unit/modeling/semantics.spec.ts +10 -1
- package/build/src/modeling/definitions/Price.d.ts.map +0 -1
- package/build/src/modeling/definitions/Price.js.map +0 -1
|
@@ -92,11 +92,15 @@ export interface GeospatialCoordinatesConfig {
|
|
|
92
92
|
/**
|
|
93
93
|
* The spatial reference system (SRS) for the coordinates.
|
|
94
94
|
* Defaults to WGS84 (EPSG:4326) if not specified.
|
|
95
|
+
*
|
|
96
|
+
* Note: If `format` is set to `GeoJSON`, this value is automatically locked to `WGS84`
|
|
97
|
+
* as per the GeoJSON specification (RFC 7946).
|
|
95
98
|
*/
|
|
96
99
|
spatialReferenceSystem?: GeospatialSpatialReferenceSystem;
|
|
97
100
|
/**
|
|
98
101
|
* The default distance unit for spatial queries.
|
|
99
102
|
* Defaults to 'meters' if not specified.
|
|
103
|
+
* Only applicable when `enableDistanceQueries` is true.
|
|
100
104
|
*/
|
|
101
105
|
defaultDistanceUnit?: GeospatialDistanceUnit;
|
|
102
106
|
/**
|
|
@@ -111,7 +115,8 @@ export interface GeospatialCoordinatesConfig {
|
|
|
111
115
|
enableValidation?: boolean;
|
|
112
116
|
/**
|
|
113
117
|
* Custom validation rules for coordinate bounds.
|
|
114
|
-
*
|
|
118
|
+
* Values are in decimal degrees.
|
|
119
|
+
* If not specified, uses standard latitude (-90.0 to 90.0) and longitude (-180.0 to 180.0) bounds.
|
|
115
120
|
*/
|
|
116
121
|
validationBounds?: {
|
|
117
122
|
/**
|
|
@@ -134,41 +139,75 @@ export interface GeospatialCoordinatesConfig {
|
|
|
134
139
|
/**
|
|
135
140
|
* Whether to enable automatic PostGIS integration when using PostgreSQL.
|
|
136
141
|
* Defaults to true if not specified.
|
|
142
|
+
*
|
|
143
|
+
* This is an advanced setting. For UIs targeting non-technical users,
|
|
144
|
+
* it is safe to hide this option and keep it enabled. The backend should
|
|
145
|
+
* gracefully handle cases where the database is not PostgreSQL.
|
|
137
146
|
*/
|
|
138
147
|
enablePostGISIntegration?: boolean;
|
|
139
148
|
/**
|
|
140
149
|
* The PostGIS geometry type to use for storage.
|
|
141
150
|
* Defaults to 'POINT' if not specified.
|
|
151
|
+
* This choice fundamentally defines the shape of the data and the types of queries that can be performed.
|
|
152
|
+
*
|
|
153
|
+
* - **POINT**: For single locations (e.g., a store, a user's location).
|
|
154
|
+
* - **LINESTRING**: For paths or routes (e.g., a delivery route, a hiking trail).
|
|
155
|
+
* - **POLYGON**: For defined areas (e.g., a delivery zone, a sales territory, a city boundary).
|
|
156
|
+
* - **MULTI***: For collections of the above types (e.g., all stores in a chain as a MULTIPOINT).
|
|
142
157
|
*/
|
|
143
158
|
postGISGeometryType?: 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON';
|
|
144
159
|
/**
|
|
145
160
|
* Whether to enable distance-based query endpoints.
|
|
161
|
+
* This is not mutually exclusive with other query types and is useful for all geometry types.
|
|
146
162
|
* Defaults to true if not specified.
|
|
163
|
+
*
|
|
164
|
+
* - For **POINT**: Finds points within a certain radius.
|
|
165
|
+
* - For **POLYGON**: Finds polygons that are within a certain distance of a point
|
|
166
|
+
* (e.g., "find all parks within 5 miles").
|
|
167
|
+
* - For **LINESTRING**: Finds paths/routes within a certain distance of a point
|
|
168
|
+
* (e.g., "find all subway lines near me").
|
|
147
169
|
*/
|
|
148
170
|
enableDistanceQueries?: boolean;
|
|
149
171
|
/**
|
|
150
172
|
* Maximum distance allowed in distance queries (in the default distance unit).
|
|
151
173
|
* Defaults to 100000 (100km) if not specified.
|
|
174
|
+
* Only applicable when `enableDistanceQueries` is true.
|
|
152
175
|
*/
|
|
153
176
|
maxQueryDistance?: number;
|
|
154
177
|
/**
|
|
155
178
|
* Whether to enable bounding box query endpoints.
|
|
179
|
+
* This is not mutually exclusive with other query types.
|
|
156
180
|
* Defaults to true if not specified.
|
|
157
181
|
*/
|
|
158
182
|
enableBoundingBoxQueries?: boolean;
|
|
159
183
|
/**
|
|
160
184
|
* Whether to enable polygon intersection query endpoints.
|
|
185
|
+
* This is not mutually exclusive with other query types.
|
|
161
186
|
* Defaults to false if not specified.
|
|
162
187
|
*/
|
|
163
188
|
enablePolygonQueries?: boolean;
|
|
164
189
|
/**
|
|
165
190
|
* Custom API endpoint prefix for geospatial queries.
|
|
166
191
|
* Defaults to '/nearby' if not specified.
|
|
192
|
+
* Only applicable if `enableDistanceQueries`, `enableBoundingBoxQueries`,
|
|
193
|
+
* or `enablePolygonQueries` is true.
|
|
194
|
+
*
|
|
195
|
+
* The generated endpoints would be:
|
|
196
|
+
* - **Distance Query**: `GET {apiEndpointPrefix}`
|
|
197
|
+
* - **Bounding Box Query**: `GET {apiEndpointPrefix}/bbox`
|
|
198
|
+
* - **Polygon Query**: `POST {apiEndpointPrefix}/polygon`
|
|
167
199
|
*/
|
|
168
200
|
apiEndpointPrefix?: string;
|
|
169
201
|
/**
|
|
170
202
|
* Whether to include elevation data in coordinates (3D coordinates).
|
|
171
203
|
* Defaults to false if not specified.
|
|
204
|
+
* When true, a third value for elevation is expected in the coordinate data.
|
|
205
|
+
*
|
|
206
|
+
* - **LatLon**: `"40.7128,-74.0060,10"` (latitude, longitude, elevation)
|
|
207
|
+
* - **PostGIS/WKT**: `"POINT Z (-74.0060 40.7128 10)"`
|
|
208
|
+
* - **GeoJSON**: `{"type": "Point", "coordinates": [-74.0060, 40.7128, 10]}`
|
|
209
|
+
*
|
|
210
|
+
* The unit for elevation is determined by `defaultDistanceUnit`.
|
|
172
211
|
*/
|
|
173
212
|
includeElevation?: boolean;
|
|
174
213
|
/**
|
|
@@ -179,6 +218,12 @@ export interface GeospatialCoordinatesConfig {
|
|
|
179
218
|
/**
|
|
180
219
|
* Whether to enable reverse geocoding capabilities.
|
|
181
220
|
* Defaults to false if not specified.
|
|
221
|
+
*
|
|
222
|
+
* When enabled, the system can convert geographic coordinates (e.g., `40.7128, -74.0060`)
|
|
223
|
+
* into a human-readable address (e.g., "New York, NY, USA").
|
|
224
|
+
*
|
|
225
|
+
* This often requires integration with an external geocoding service and may have
|
|
226
|
+
* associated costs or usage limits.
|
|
182
227
|
*/
|
|
183
228
|
enableReverseGeocoding?: boolean;
|
|
184
229
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeospatialCoordinates.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/GeospatialCoordinates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;GAEG;AACH,oBAAY,0BAA0B;IACpC;;OAEG;IACH,MAAM,YAAY;IAClB;;OAEG;IACH,MAAM,YAAY;IAClB;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,sBAAsB;IAChC;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,UAAU,eAAe;IACzB;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,aAAa,mBAAmB;CACjC;AAED;;GAEG;AACH,oBAAY,gCAAgC;IAC1C;;OAEG;IACH,KAAK,cAAc;IACnB;;OAEG;IACH,WAAW,cAAc;IACzB;;OAEG;IACH,KAAK,cAAc;IACnB;;OAEG;IACH,KAAK,cAAc;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,0BAA0B,CAAA;IAEnC
|
|
1
|
+
{"version":3,"file":"GeospatialCoordinates.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/GeospatialCoordinates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;GAEG;AACH,oBAAY,0BAA0B;IACpC;;OAEG;IACH,MAAM,YAAY;IAClB;;OAEG;IACH,MAAM,YAAY;IAClB;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,OA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MAAM,CAAA;IAEzB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAElC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAE9B;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAE1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B;;;;;;;;;OASG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAElC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oCAAqC,SAAQ,mBAAmB;IAC/E,EAAE,EAAE,YAAY,CAAC,qBAAqB,CAAA;IACtC,MAAM,CAAC,EAAE,2BAA2B,CAAA;CACrC;AAED;;GAEG;AACH,eAAO,MAAM,+BAA+B,GAC1C,UAAU,mBAAmB,KAC5B,QAAQ,IAAI,oCAEd,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mCAAmC,GAC9C,SAAQ,2BAAgC,KACvC,oCAgBF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,2BAgBvC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeospatialCoordinates.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/GeospatialCoordinates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAN,IAAY,0BAyBX;AAzBD,WAAY,0BAA0B;IACpC;;OAEG;IACH,gDAAkB,CAAA;IAClB;;OAEG;IACH,gDAAkB,CAAA;IAClB;;OAEG;IACH,iDAAmB,CAAA;IACnB;;OAEG;I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AAgB,EAAE,CAAA;IAChE,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,qBAAqB;QACtC,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAgC;IACpE,MAAM,EAAE,0BAA0B,CAAC,MAAM;IACzC,sBAAsB,EAAE,gCAAgC,CAAC,KAAK;IAC9D,mBAAmB,EAAE,sBAAsB,CAAC,MAAM;IAClD,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,mBAAmB,EAAE,OAAO;IAC5B,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,MAAM;IACxB,wBAAwB,EAAE,IAAI;IAC9B,oBAAoB,EAAE,KAAK;IAC3B,iBAAiB,EAAE,SAAS;IAC5B,gBAAgB,EAAE,KAAK;IACvB,mBAAmB,EAAE,CAAC;IACtB,sBAAsB,EAAE,KAAK;CAC9B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Supported coordinate formats for geospatial data.\n */\nexport enum GeospatialCoordinateFormat {\n /**\n * Latitude, Longitude format: \"40.7128,-74.0060\"\n */\n LatLon = 'lat,lon',\n /**\n * Longitude, Latitude format: \"-74.0060,40.7128\"\n */\n LonLat = 'lon,lat',\n /**\n * PostGIS POINT format: \"POINT(-74.0060 40.7128)\"\n */\n PostGIS = 'postgis',\n /**\n * Degree format with cardinal directions: \"40.7128°N, 74.0060°W\"\n */\n Degree = 'degree',\n /**\n * Well-Known Text (WKT) format: \"POINT(-74.0060 40.7128)\"\n */\n WKT = 'wkt',\n /**\n * GeoJSON format: {\"type\": \"Point\", \"coordinates\": [-74.0060, 40.7128]}\n */\n GeoJSON = 'geojson',\n}\n\n/**\n * Supported distance units for spatial queries.\n */\nexport enum GeospatialDistanceUnit {\n /**\n * Meters (SI unit)\n */\n Meters = 'meters',\n /**\n * Kilometers\n */\n Kilometers = 'kilometers',\n /**\n * Miles (imperial)\n */\n Miles = 'miles',\n /**\n * Feet (imperial)\n */\n Feet = 'feet',\n /**\n * Yards (imperial)\n */\n Yards = 'yards',\n /**\n * Nautical miles\n */\n NauticalMiles = 'nautical_miles',\n}\n\n/**\n * Supported spatial reference systems.\n */\nexport enum GeospatialSpatialReferenceSystem {\n /**\n * WGS84 (World Geodetic System 1984) - Most common for GPS coordinates\n */\n WGS84 = 'EPSG:4326',\n /**\n * Web Mercator - Common for web mapping\n */\n WebMercator = 'EPSG:3857',\n /**\n * NAD83 (North American Datum 1983)\n */\n NAD83 = 'EPSG:4269',\n /**\n * NAD27 (North American Datum 1927)\n */\n NAD27 = 'EPSG:4267',\n}\n\n/**\n * Configuration options for the GeospatialCoordinates semantic.\n * These options control how the runtime handles geospatial data and queries.\n */\nexport interface GeospatialCoordinatesConfig {\n /**\n * The coordinate format expected for input/output.\n * Defaults to 'lat,lon' if not specified.\n */\n format?: GeospatialCoordinateFormat\n\n /**\n * The spatial reference system (SRS) for the coordinates.\n * Defaults to WGS84 (EPSG:4326) if not specified.\n */\n spatialReferenceSystem?: GeospatialSpatialReferenceSystem\n\n /**\n * The default distance unit for spatial queries.\n * Defaults to 'meters' if not specified.\n */\n defaultDistanceUnit?: GeospatialDistanceUnit\n\n /**\n * Whether to enable automatic spatial indexing.\n * Defaults to true if not specified.\n */\n enableSpatialIndexing?: boolean\n\n /**\n * Whether to enable automatic coordinate validation.\n * Defaults to true if not specified.\n */\n enableValidation?: boolean\n\n /**\n * Custom validation rules for coordinate bounds.\n * If not specified, uses standard latitude (-90 to 90) and longitude (-180 to 180) bounds.\n */\n validationBounds?: {\n /**\n * Minimum latitude value\n */\n minLatitude?: number\n /**\n * Maximum latitude value\n */\n maxLatitude?: number\n /**\n * Minimum longitude value\n */\n minLongitude?: number\n /**\n * Maximum longitude value\n */\n maxLongitude?: number\n }\n\n /**\n * Whether to enable automatic PostGIS integration when using PostgreSQL.\n * Defaults to true if not specified.\n */\n enablePostGISIntegration?: boolean\n\n /**\n * The PostGIS geometry type to use for storage.\n * Defaults to 'POINT' if not specified.\n */\n postGISGeometryType?: 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON'\n\n /**\n * Whether to enable distance-based query endpoints.\n * Defaults to true if not specified.\n */\n enableDistanceQueries?: boolean\n\n /**\n * Maximum distance allowed in distance queries (in the default distance unit).\n * Defaults to 100000 (100km) if not specified.\n */\n maxQueryDistance?: number\n\n /**\n * Whether to enable bounding box query endpoints.\n * Defaults to true if not specified.\n */\n enableBoundingBoxQueries?: boolean\n\n /**\n * Whether to enable polygon intersection query endpoints.\n * Defaults to false if not specified.\n */\n enablePolygonQueries?: boolean\n\n /**\n * Custom API endpoint prefix for geospatial queries.\n * Defaults to '/nearby' if not specified.\n */\n apiEndpointPrefix?: string\n\n /**\n * Whether to include elevation data in coordinates (3D coordinates).\n * Defaults to false if not specified.\n */\n includeElevation?: boolean\n\n /**\n * Precision for coordinate storage (number of decimal places).\n * Defaults to 6 if not specified.\n */\n coordinatePrecision?: number\n\n /**\n * Whether to enable reverse geocoding capabilities.\n * Defaults to false if not specified.\n */\n enableReverseGeocoding?: boolean\n\n /**\n * Custom metadata for the geospatial field.\n */\n metadata?: Record<string, unknown>\n\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for GeospatialCoordinates semantic.\n */\nexport interface AppliedGeospatialCoordinatesSemantic extends AppliedDataSemantic {\n id: SemanticType.GeospatialCoordinates\n config?: GeospatialCoordinatesConfig\n}\n\n/**\n * Type guard to check if a semantic is a GeospatialCoordinates semantic.\n */\nexport const isGeospatialCoordinatesSemantic = (\n semantic: AppliedDataSemantic\n): semantic is AppliedGeospatialCoordinatesSemantic => {\n return semantic.id === SemanticType.GeospatialCoordinates\n}\n\n/**\n * Helper function to create a GeospatialCoordinates semantic with configuration.\n */\nexport const createGeospatialCoordinatesSemantic = (\n config: GeospatialCoordinatesConfig = {}\n): AppliedGeospatialCoordinatesSemantic => {\n const mergedConfig = {\n ...DEFAULT_GEOSPATIAL_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n if (config.validationBounds) {\n mergedConfig.validationBounds = { ...config.validationBounds }\n }\n\n return {\n id: SemanticType.GeospatialCoordinates,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for GeospatialCoordinates semantic.\n */\nexport const DEFAULT_GEOSPATIAL_CONFIG: GeospatialCoordinatesConfig = {\n format: GeospatialCoordinateFormat.LatLon,\n spatialReferenceSystem: GeospatialSpatialReferenceSystem.WGS84,\n defaultDistanceUnit: GeospatialDistanceUnit.Meters,\n enableSpatialIndexing: true,\n enableValidation: true,\n enablePostGISIntegration: true,\n postGISGeometryType: 'POINT',\n enableDistanceQueries: true,\n maxQueryDistance: 100000,\n enableBoundingBoxQueries: true,\n enablePolygonQueries: false,\n apiEndpointPrefix: '/nearby',\n includeElevation: false,\n coordinatePrecision: 6,\n enableReverseGeocoding: false,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GeospatialCoordinates.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/GeospatialCoordinates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAN,IAAY,0BAyBX;AAzBD,WAAY,0BAA0B;IACpC;;OAEG;IACH,gDAAkB,CAAA;IAClB;;OAEG;IACH,gDAAkB,CAAA;IAClB;;OAEG;IACH,iDAAmB,CAAA;IACnB;;OAEG;IACH,+CAAiB,CAAA;IACjB;;OAEG;IACH,yCAAW,CAAA;IACX;;OAEG;IACH,iDAAmB,CAAA;AACrB,CAAC,EAzBW,0BAA0B,KAA1B,0BAA0B,QAyBrC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,sBAyBX;AAzBD,WAA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,MAAM,EAAE,0BAA0B,CAAC,MAAM;IACzC,sBAAsB,EAAE,gCAAgC,CAAC,KAAK;IAC9D,mBAAmB,EAAE,sBAAsB,CAAC,MAAM;IAClD,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,mBAAmB,EAAE,OAAO;IAC5B,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,MAAM;IACxB,wBAAwB,EAAE,IAAI;IAC9B,oBAAoB,EAAE,KAAK;IAC3B,iBAAiB,EAAE,SAAS;IAC5B,gBAAgB,EAAE,KAAK;IACvB,mBAAmB,EAAE,CAAC;IACtB,sBAAsB,EAAE,KAAK;CAC9B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Supported coordinate formats for geospatial data.\n */\nexport enum GeospatialCoordinateFormat {\n /**\n * Latitude, Longitude format: \"40.7128,-74.0060\"\n */\n LatLon = 'lat,lon',\n /**\n * Longitude, Latitude format: \"-74.0060,40.7128\"\n */\n LonLat = 'lon,lat',\n /**\n * PostGIS POINT format: \"POINT(-74.0060 40.7128)\"\n */\n PostGIS = 'postgis',\n /**\n * Degree format with cardinal directions: \"40.7128°N, 74.0060°W\"\n */\n Degree = 'degree',\n /**\n * Well-Known Text (WKT) format: \"POINT(-74.0060 40.7128)\"\n */\n WKT = 'wkt',\n /**\n * GeoJSON format: {\"type\": \"Point\", \"coordinates\": [-74.0060, 40.7128]}\n */\n GeoJSON = 'geojson',\n}\n\n/**\n * Supported distance units for spatial queries.\n */\nexport enum GeospatialDistanceUnit {\n /**\n * Meters (SI unit)\n */\n Meters = 'meters',\n /**\n * Kilometers\n */\n Kilometers = 'kilometers',\n /**\n * Miles (imperial)\n */\n Miles = 'miles',\n /**\n * Feet (imperial)\n */\n Feet = 'feet',\n /**\n * Yards (imperial)\n */\n Yards = 'yards',\n /**\n * Nautical miles\n */\n NauticalMiles = 'nautical_miles',\n}\n\n/**\n * Supported spatial reference systems.\n */\nexport enum GeospatialSpatialReferenceSystem {\n /**\n * WGS84 (World Geodetic System 1984) - Most common for GPS coordinates\n */\n WGS84 = 'EPSG:4326',\n /**\n * Web Mercator - Common for web mapping\n */\n WebMercator = 'EPSG:3857',\n /**\n * NAD83 (North American Datum 1983)\n */\n NAD83 = 'EPSG:4269',\n /**\n * NAD27 (North American Datum 1927)\n */\n NAD27 = 'EPSG:4267',\n}\n\n/**\n * Configuration options for the GeospatialCoordinates semantic.\n * These options control how the runtime handles geospatial data and queries.\n */\nexport interface GeospatialCoordinatesConfig {\n /**\n * The coordinate format expected for input/output.\n * Defaults to 'lat,lon' if not specified.\n */\n format?: GeospatialCoordinateFormat\n\n /**\n * The spatial reference system (SRS) for the coordinates.\n * Defaults to WGS84 (EPSG:4326) if not specified.\n *\n * Note: If `format` is set to `GeoJSON`, this value is automatically locked to `WGS84`\n * as per the GeoJSON specification (RFC 7946).\n */\n spatialReferenceSystem?: GeospatialSpatialReferenceSystem\n\n /**\n * The default distance unit for spatial queries.\n * Defaults to 'meters' if not specified.\n * Only applicable when `enableDistanceQueries` is true.\n */\n defaultDistanceUnit?: GeospatialDistanceUnit\n\n /**\n * Whether to enable automatic spatial indexing.\n * Defaults to true if not specified.\n */\n enableSpatialIndexing?: boolean\n\n /**\n * Whether to enable automatic coordinate validation.\n * Defaults to true if not specified.\n */\n enableValidation?: boolean\n\n /**\n * Custom validation rules for coordinate bounds.\n * Values are in decimal degrees.\n * If not specified, uses standard latitude (-90.0 to 90.0) and longitude (-180.0 to 180.0) bounds.\n */\n validationBounds?: {\n /**\n * Minimum latitude value\n */\n minLatitude?: number\n /**\n * Maximum latitude value\n */\n maxLatitude?: number\n /**\n * Minimum longitude value\n */\n minLongitude?: number\n /**\n * Maximum longitude value\n */\n maxLongitude?: number\n }\n\n /**\n * Whether to enable automatic PostGIS integration when using PostgreSQL.\n * Defaults to true if not specified.\n *\n * This is an advanced setting. For UIs targeting non-technical users,\n * it is safe to hide this option and keep it enabled. The backend should\n * gracefully handle cases where the database is not PostgreSQL.\n */\n enablePostGISIntegration?: boolean\n\n /**\n * The PostGIS geometry type to use for storage.\n * Defaults to 'POINT' if not specified.\n * This choice fundamentally defines the shape of the data and the types of queries that can be performed.\n *\n * - **POINT**: For single locations (e.g., a store, a user's location).\n * - **LINESTRING**: For paths or routes (e.g., a delivery route, a hiking trail).\n * - **POLYGON**: For defined areas (e.g., a delivery zone, a sales territory, a city boundary).\n * - **MULTI***: For collections of the above types (e.g., all stores in a chain as a MULTIPOINT).\n */\n postGISGeometryType?: 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON'\n\n /**\n * Whether to enable distance-based query endpoints.\n * This is not mutually exclusive with other query types and is useful for all geometry types.\n * Defaults to true if not specified.\n *\n * - For **POINT**: Finds points within a certain radius.\n * - For **POLYGON**: Finds polygons that are within a certain distance of a point\n * (e.g., \"find all parks within 5 miles\").\n * - For **LINESTRING**: Finds paths/routes within a certain distance of a point\n * (e.g., \"find all subway lines near me\").\n */\n enableDistanceQueries?: boolean\n\n /**\n * Maximum distance allowed in distance queries (in the default distance unit).\n * Defaults to 100000 (100km) if not specified.\n * Only applicable when `enableDistanceQueries` is true.\n */\n maxQueryDistance?: number\n\n /**\n * Whether to enable bounding box query endpoints.\n * This is not mutually exclusive with other query types.\n * Defaults to true if not specified.\n */\n enableBoundingBoxQueries?: boolean\n\n /**\n * Whether to enable polygon intersection query endpoints.\n * This is not mutually exclusive with other query types.\n * Defaults to false if not specified.\n */\n enablePolygonQueries?: boolean\n\n /**\n * Custom API endpoint prefix for geospatial queries.\n * Defaults to '/nearby' if not specified.\n * Only applicable if `enableDistanceQueries`, `enableBoundingBoxQueries`,\n * or `enablePolygonQueries` is true.\n *\n * The generated endpoints would be:\n * - **Distance Query**: `GET {apiEndpointPrefix}`\n * - **Bounding Box Query**: `GET {apiEndpointPrefix}/bbox`\n * - **Polygon Query**: `POST {apiEndpointPrefix}/polygon`\n */\n apiEndpointPrefix?: string\n\n /**\n * Whether to include elevation data in coordinates (3D coordinates).\n * Defaults to false if not specified.\n * When true, a third value for elevation is expected in the coordinate data.\n *\n * - **LatLon**: `\"40.7128,-74.0060,10\"` (latitude, longitude, elevation)\n * - **PostGIS/WKT**: `\"POINT Z (-74.0060 40.7128 10)\"`\n * - **GeoJSON**: `{\"type\": \"Point\", \"coordinates\": [-74.0060, 40.7128, 10]}`\n *\n * The unit for elevation is determined by `defaultDistanceUnit`.\n */\n includeElevation?: boolean\n\n /**\n * Precision for coordinate storage (number of decimal places).\n * Defaults to 6 if not specified.\n */\n coordinatePrecision?: number\n\n /**\n * Whether to enable reverse geocoding capabilities.\n * Defaults to false if not specified.\n *\n * When enabled, the system can convert geographic coordinates (e.g., `40.7128, -74.0060`)\n * into a human-readable address (e.g., \"New York, NY, USA\").\n *\n * This often requires integration with an external geocoding service and may have\n * associated costs or usage limits.\n */\n enableReverseGeocoding?: boolean\n\n /**\n * Custom metadata for the geospatial field.\n */\n metadata?: Record<string, unknown>\n\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for GeospatialCoordinates semantic.\n */\nexport interface AppliedGeospatialCoordinatesSemantic extends AppliedDataSemantic {\n id: SemanticType.GeospatialCoordinates\n config?: GeospatialCoordinatesConfig\n}\n\n/**\n * Type guard to check if a semantic is a GeospatialCoordinates semantic.\n */\nexport const isGeospatialCoordinatesSemantic = (\n semantic: AppliedDataSemantic\n): semantic is AppliedGeospatialCoordinatesSemantic => {\n return semantic.id === SemanticType.GeospatialCoordinates\n}\n\n/**\n * Helper function to create a GeospatialCoordinates semantic with configuration.\n */\nexport const createGeospatialCoordinatesSemantic = (\n config: GeospatialCoordinatesConfig = {}\n): AppliedGeospatialCoordinatesSemantic => {\n const mergedConfig = {\n ...DEFAULT_GEOSPATIAL_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n if (config.validationBounds) {\n mergedConfig.validationBounds = { ...config.validationBounds }\n }\n\n return {\n id: SemanticType.GeospatialCoordinates,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for GeospatialCoordinates semantic.\n */\nexport const DEFAULT_GEOSPATIAL_CONFIG: GeospatialCoordinatesConfig = {\n format: GeospatialCoordinateFormat.LatLon,\n spatialReferenceSystem: GeospatialSpatialReferenceSystem.WGS84,\n defaultDistanceUnit: GeospatialDistanceUnit.Meters,\n enableSpatialIndexing: true,\n enableValidation: true,\n enablePostGISIntegration: true,\n postGISGeometryType: 'POINT',\n enableDistanceQueries: true,\n maxQueryDistance: 100000,\n enableBoundingBoxQueries: true,\n enablePolygonQueries: false,\n apiEndpointPrefix: '/nearby',\n includeElevation: false,\n coordinatePrecision: 6,\n enableReverseGeocoding: false,\n}\n"]}
|
|
@@ -9,12 +9,25 @@ export interface HTMLConfig {
|
|
|
9
9
|
* List of allowed HTML tags in the content.
|
|
10
10
|
*/
|
|
11
11
|
allowedTags?: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Maximum length of the HTML content.
|
|
14
|
-
*/
|
|
15
|
-
maxLength?: number;
|
|
16
12
|
/**
|
|
17
13
|
* Render mode: 'html', 'text', or 'both'.
|
|
14
|
+
*
|
|
15
|
+
* - `html` - The API returns the HTML content as-is (after sanitization based on your other rules like allowedTags).
|
|
16
|
+
* - `text` - The API returns the text content, stripping out all HTML tags.
|
|
17
|
+
* This is extremely useful for various backend and frontend tasks:
|
|
18
|
+
* - **Search Indexing**: You can easily feed the plain text content into a search engine like Elasticsearch
|
|
19
|
+
* without the noise of HTML tags.
|
|
20
|
+
* - **Content Previews/Summaries**: Displaying a snippet of the content in a list view or a notification
|
|
21
|
+
* where formatting is not desired.
|
|
22
|
+
* - **Compatibility**: Sending the content to systems that don't support HTML, such as plain-text
|
|
23
|
+
* emails or SMS notifications.
|
|
24
|
+
* - `both` - The API returns an object containing both the raw HTML and the plain text version. For example:
|
|
25
|
+
* ```json
|
|
26
|
+
* {
|
|
27
|
+
* "html": "<p>Hello, <strong>world</strong>!</p>",
|
|
28
|
+
* "text": "Hello, world!"
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
18
31
|
*/
|
|
19
32
|
renderMode?: 'html' | 'text' | 'both';
|
|
20
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/HTML.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB
|
|
1
|
+
{"version":3,"file":"HTML.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/HTML.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IACrC;;OAEG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAA;IAC9C;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,EAAE,EAAE,YAAY,CAAC,IAAI,CAAA;IACrB,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,mBAE1E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAQ,UAAe,KAAG,mBAa5D,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,UAajC,CAAA"}
|
|
@@ -26,7 +26,6 @@ export const createHTMLSemantic = (config = {}) => {
|
|
|
26
26
|
*/
|
|
27
27
|
export const DEFAULT_HTML_CONFIG = {
|
|
28
28
|
allowedTags: ['b', 'i', 'em', 'strong', 'a', 'ul', 'ol', 'li', 'p', 'br', 'pre', 'code', 'div', 'span'],
|
|
29
|
-
maxLength: 10000,
|
|
30
29
|
renderMode: 'html',
|
|
31
30
|
sanitizeLevel: 'strict',
|
|
32
31
|
allowImages: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/HTML.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"HTML.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/HTML.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA0F9C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAA6B,EAAmC,EAAE;IAC/F,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,IAAI,CAAA;AAC1C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAqB,EAAE,EAAuB,EAAE;IACjF,MAAM,YAAY,GAAG;QACnB,GAAG,mBAAmB;QACtB,GAAG,MAAM;KACV,CAAA;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,IAAI;QACrB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;IACvG,UAAU,EAAE,MAAM;IAClB,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,KAAK;IAClB,mBAAmB,EAAE,KAAK;CAC3B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the HTML semantic.\n * Controls rendering, sanitization, and allowed HTML features.\n */\nexport interface HTMLConfig {\n /**\n * List of allowed HTML tags in the content.\n */\n allowedTags?: string[]\n /**\n * Render mode: 'html', 'text', or 'both'.\n *\n * - `html` - The API returns the HTML content as-is (after sanitization based on your other rules like allowedTags).\n * - `text` - The API returns the text content, stripping out all HTML tags.\n * This is extremely useful for various backend and frontend tasks:\n * - **Search Indexing**: You can easily feed the plain text content into a search engine like Elasticsearch\n * without the noise of HTML tags.\n * - **Content Previews/Summaries**: Displaying a snippet of the content in a list view or a notification\n * where formatting is not desired.\n * - **Compatibility**: Sending the content to systems that don't support HTML, such as plain-text\n * emails or SMS notifications.\n * - `both` - The API returns an object containing both the raw HTML and the plain text version. For example:\n * ```json\n * {\n * \"html\": \"<p>Hello, <strong>world</strong>!</p>\",\n * \"text\": \"Hello, world!\"\n * }\n * ```\n */\n renderMode?: 'html' | 'text' | 'both'\n /**\n * Sanitization level: 'strict', 'moderate', or 'none'.\n */\n sanitizeLevel?: 'strict' | 'moderate' | 'none'\n /**\n * Whether to allow images in HTML.\n */\n allowImages?: boolean\n /**\n * Whether to allow links in HTML.\n */\n allowLinks?: boolean\n /**\n * Whether to allow tables in HTML.\n */\n allowTables?: boolean\n /**\n * Whether to allow forms in HTML.\n */\n allowForms?: boolean\n /**\n * Whether to allow scripts in HTML.\n */\n allowScripts?: boolean\n /**\n * Whether to allow iframes in HTML.\n */\n allowIframes?: boolean\n /**\n * Whether to allow embedded content (video, audio, etc.).\n */\n allowEmbedded?: boolean\n /**\n * Whether to allow CSS styles in HTML.\n */\n allowStyles?: boolean\n /**\n * Whether to allow data attributes in HTML.\n */\n allowDataAttributes?: boolean\n /**\n * Custom metadata for the HTML field.\n */\n metadata?: Record<string, unknown>\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for HTML semantic.\n */\nexport interface AppliedHTMLSemantic extends AppliedDataSemantic {\n id: SemanticType.HTML\n config?: HTMLConfig\n}\n\n/**\n * Type guard to check if a semantic is an HTML semantic.\n */\nexport const isHTMLSemantic = (semantic: AppliedDataSemantic): semantic is AppliedHTMLSemantic => {\n return semantic.id === SemanticType.HTML\n}\n\n/**\n * Helper function to create an HTML semantic with configuration.\n */\nexport const createHTMLSemantic = (config: HTMLConfig = {}): AppliedHTMLSemantic => {\n const mergedConfig = {\n ...DEFAULT_HTML_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.HTML,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for HTML semantic.\n */\nexport const DEFAULT_HTML_CONFIG: HTMLConfig = {\n allowedTags: ['b', 'i', 'em', 'strong', 'a', 'ul', 'ol', 'li', 'p', 'br', 'pre', 'code', 'div', 'span'],\n renderMode: 'html',\n sanitizeLevel: 'strict',\n allowImages: true,\n allowLinks: true,\n allowTables: true,\n allowForms: false,\n allowScripts: false,\n allowIframes: false,\n allowEmbedded: false,\n allowStyles: false,\n allowDataAttributes: false,\n}\n"]}
|
|
@@ -9,12 +9,20 @@ export interface MarkdownConfig {
|
|
|
9
9
|
* List of allowed HTML tags in the rendered output.
|
|
10
10
|
*/
|
|
11
11
|
allowedTags?: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Maximum length of the markdown content.
|
|
14
|
-
*/
|
|
15
|
-
maxLength?: number;
|
|
16
12
|
/**
|
|
17
13
|
* Render mode: 'html', 'text', or 'both'.
|
|
14
|
+
* This controls how the stored Markdown content is transformed and returned by the API.
|
|
15
|
+
*
|
|
16
|
+
* - `html` - The API converts the Markdown to HTML and returns the sanitized result.
|
|
17
|
+
* - `text` - The original Markdown as when created, but sanitized.
|
|
18
|
+
* - `both` - The API returns an object containing both the rendered HTML and the plain text version.
|
|
19
|
+
* This provides maximum flexibility for client applications.
|
|
20
|
+
* ```json
|
|
21
|
+
* {
|
|
22
|
+
* "html": "<h1>Title</h1><p>Some <strong>bold</strong> text.</p>",
|
|
23
|
+
* "text": "Title Some bold text."
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
18
26
|
*/
|
|
19
27
|
renderMode?: 'html' | 'text' | 'both';
|
|
20
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB
|
|
1
|
+
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IACrC;;OAEG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAA;IAC9C;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,EAAE,EAAE,YAAY,CAAC,QAAQ,CAAA;IACzB,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,uBAE9E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAQ,cAAmB,KAAG,uBAapE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAYrC,CAAA"}
|
|
@@ -26,7 +26,6 @@ export const createMarkdownSemantic = (config = {}) => {
|
|
|
26
26
|
*/
|
|
27
27
|
export const DEFAULT_MARKDOWN_CONFIG = {
|
|
28
28
|
allowedTags: ['b', 'i', 'em', 'strong', 'a', 'ul', 'ol', 'li', 'p', 'br', 'pre', 'code'],
|
|
29
|
-
maxLength: 10000,
|
|
30
29
|
renderMode: 'html',
|
|
31
30
|
sanitizeLevel: 'strict',
|
|
32
31
|
allowImages: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Markdown.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"Markdown.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Markdown.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAiF9C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAA6B,EAAuC,EAAE;IACvG,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,QAAQ,CAAA;AAC9C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAyB,EAAE,EAA2B,EAAE;IAC7F,MAAM,YAAY,GAAG;QACnB,GAAG,uBAAuB;QAC1B,GAAG,MAAM;KACV,CAAA;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,QAAQ;QACzB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC;IACxF,UAAU,EAAE,MAAM;IAClB,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,KAAK;IAChB,cAAc,EAAE,KAAK;IACrB,cAAc,EAAE,KAAK;IACrB,kBAAkB,EAAE,IAAI;IACxB,SAAS,EAAE,KAAK;CACjB,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the Markdown semantic.\n * Controls rendering, sanitization, and allowed features.\n */\nexport interface MarkdownConfig {\n /**\n * List of allowed HTML tags in the rendered output.\n */\n allowedTags?: string[]\n /**\n * Render mode: 'html', 'text', or 'both'.\n * This controls how the stored Markdown content is transformed and returned by the API.\n *\n * - `html` - The API converts the Markdown to HTML and returns the sanitized result.\n * - `text` - The original Markdown as when created, but sanitized.\n * - `both` - The API returns an object containing both the rendered HTML and the plain text version.\n * This provides maximum flexibility for client applications.\n * ```json\n * {\n * \"html\": \"<h1>Title</h1><p>Some <strong>bold</strong> text.</p>\",\n * \"text\": \"Title Some bold text.\"\n * }\n * ```\n */\n renderMode?: 'html' | 'text' | 'both'\n /**\n * Sanitization level: 'strict', 'moderate', or 'none'.\n */\n sanitizeLevel?: 'strict' | 'moderate' | 'none'\n /**\n * Whether to allow images in markdown.\n */\n allowImages?: boolean\n /**\n * Whether to allow links in markdown.\n */\n allowLinks?: boolean\n /**\n * Whether to allow tables in markdown.\n */\n allowTables?: boolean\n /**\n * Whether to allow raw HTML in markdown.\n */\n allowHtml?: boolean\n /**\n * Whether to allow footnotes in markdown.\n */\n allowFootnotes?: boolean\n /**\n * Whether to allow GitHub-style task lists.\n */\n allowTaskLists?: boolean\n /**\n * Whether to allow strikethrough formatting.\n */\n allowStrikethrough?: boolean\n /**\n * Whether to allow math expressions (e.g., LaTeX).\n */\n allowMath?: boolean\n /**\n * Custom metadata for the markdown field.\n */\n metadata?: Record<string, unknown>\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for Markdown semantic.\n */\nexport interface AppliedMarkdownSemantic extends AppliedDataSemantic {\n id: SemanticType.Markdown\n config?: MarkdownConfig\n}\n\n/**\n * Type guard to check if a semantic is a Markdown semantic.\n */\nexport const isMarkdownSemantic = (semantic: AppliedDataSemantic): semantic is AppliedMarkdownSemantic => {\n return semantic.id === SemanticType.Markdown\n}\n\n/**\n * Helper function to create a Markdown semantic with configuration.\n */\nexport const createMarkdownSemantic = (config: MarkdownConfig = {}): AppliedMarkdownSemantic => {\n const mergedConfig = {\n ...DEFAULT_MARKDOWN_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.Markdown,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for Markdown semantic.\n */\nexport const DEFAULT_MARKDOWN_CONFIG: MarkdownConfig = {\n allowedTags: ['b', 'i', 'em', 'strong', 'a', 'ul', 'ol', 'li', 'p', 'br', 'pre', 'code'],\n renderMode: 'html',\n sanitizeLevel: 'strict',\n allowImages: true,\n allowLinks: true,\n allowTables: true,\n allowHtml: false,\n allowFootnotes: false,\n allowTaskLists: false,\n allowStrikethrough: true,\n allowMath: false,\n}\n"]}
|
|
@@ -13,17 +13,16 @@ export interface PhoneConfig {
|
|
|
13
13
|
allowedCountries?: string[];
|
|
14
14
|
/**
|
|
15
15
|
* Whether the phone number must include a country code.
|
|
16
|
-
* Defaults to true for
|
|
16
|
+
* Defaults to true for international format.
|
|
17
17
|
*/
|
|
18
18
|
requireCountryCode?: boolean;
|
|
19
19
|
/**
|
|
20
20
|
* Format for phone number validation and display.
|
|
21
|
-
* - 'E.164': International format with + prefix (e.g., +1234567890)
|
|
22
21
|
* - 'national': Country-specific format without country code
|
|
23
|
-
* - 'international':
|
|
22
|
+
* - 'international': E.164 international format with + prefix (e.g., +1234567890)
|
|
24
23
|
* - 'custom': Use customFormat pattern
|
|
25
24
|
*/
|
|
26
|
-
format?: '
|
|
25
|
+
format?: 'national' | 'international' | 'custom';
|
|
27
26
|
/**
|
|
28
27
|
* Custom format pattern for phone number validation.
|
|
29
28
|
* Only used when format is set to 'custom'.
|
|
@@ -44,9 +43,8 @@ export interface PhoneConfig {
|
|
|
44
43
|
* Method to use for phone verification.
|
|
45
44
|
* - 'sms': Send verification code via SMS
|
|
46
45
|
* - 'call': Make verification call
|
|
47
|
-
* - 'none': No verification required
|
|
48
46
|
*/
|
|
49
|
-
verificationMethod?: 'sms' | 'call'
|
|
47
|
+
verificationMethod?: 'sms' | 'call';
|
|
50
48
|
/**
|
|
51
49
|
* Custom metadata for the phone field.
|
|
52
50
|
*/
|
|
@@ -77,7 +75,7 @@ export declare const isPhoneSemantic: (semantic: AppliedDataSemantic) => semanti
|
|
|
77
75
|
export declare const createPhoneSemantic: (config?: PhoneConfig) => AppliedPhoneSemantic;
|
|
78
76
|
/**
|
|
79
77
|
* Default configuration for Phone semantic.
|
|
80
|
-
* Uses
|
|
78
|
+
* Uses international format with country code required and SMS verification.
|
|
81
79
|
*/
|
|
82
80
|
export declare const DEFAULT_PHONE_CONFIG: PhoneConfig;
|
|
83
81
|
//# sourceMappingURL=Phone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Phone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE3B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B
|
|
1
|
+
{"version":3,"file":"Phone.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Phone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE3B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,eAAe,GAAG,QAAQ,CAAA;IAEhD;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IAExB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAE7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IAEnC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAElC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,EAAE,EAAE,YAAY,CAAC,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,oBAE3E,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAQ,WAAgB,KAAG,oBAa9D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAMlC,CAAA"}
|
|
@@ -27,11 +27,11 @@ export const createPhoneSemantic = (config = {}) => {
|
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
29
|
* Default configuration for Phone semantic.
|
|
30
|
-
* Uses
|
|
30
|
+
* Uses international format with country code required and SMS verification.
|
|
31
31
|
*/
|
|
32
32
|
export const DEFAULT_PHONE_CONFIG = {
|
|
33
33
|
requireCountryCode: true,
|
|
34
|
-
format: '
|
|
34
|
+
format: 'international',
|
|
35
35
|
allowExtension: false,
|
|
36
36
|
requireVerification: false,
|
|
37
37
|
verificationMethod: 'sms',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phone.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Phone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"Phone.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Phone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAyE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA6B,EAAoC,EAAE;IACjG,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,KAAK,CAAA;AAC3C,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAsB,EAAE,EAAwB,EAAE;IACpF,MAAM,YAAY,GAAG;QACnB,GAAG,oBAAoB;QACvB,GAAG,MAAM;KACV,CAAA;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,KAAK;QACtB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,kBAAkB,EAAE,IAAI;IACxB,MAAM,EAAE,eAAe;IACvB,cAAc,EAAE,KAAK;IACrB,mBAAmB,EAAE,KAAK;IAC1B,kBAAkB,EAAE,KAAK;CAC1B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the Phone semantic.\n * Controls validation, formatting, and verification of phone numbers.\n */\nexport interface PhoneConfig {\n /**\n * List of allowed country codes (ISO 3166-1 alpha-2 format).\n * If not specified, all countries are allowed.\n * Examples: ['US', 'CA', 'GB', 'DE']\n */\n allowedCountries?: string[]\n\n /**\n * Whether the phone number must include a country code.\n * Defaults to true for international format.\n */\n requireCountryCode?: boolean\n\n /**\n * Format for phone number validation and display.\n * - 'national': Country-specific format without country code\n * - 'international': E.164 international format with + prefix (e.g., +1234567890)\n * - 'custom': Use customFormat pattern\n */\n format?: 'national' | 'international' | 'custom'\n\n /**\n * Custom format pattern for phone number validation.\n * Only used when format is set to 'custom'.\n * Examples: '###-###-####', '(###) ###-####'\n */\n customFormat?: string\n\n /**\n * Whether to allow phone extensions (e.g., +1234567890 ext 123).\n * Defaults to false.\n */\n allowExtension?: boolean\n\n /**\n * Whether phone number verification is required.\n * Defaults to false.\n */\n requireVerification?: boolean\n\n /**\n * Method to use for phone verification.\n * - 'sms': Send verification code via SMS\n * - 'call': Make verification call\n */\n verificationMethod?: 'sms' | 'call'\n\n /**\n * Custom metadata for the phone field.\n */\n metadata?: Record<string, unknown>\n\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for Phone semantic.\n */\nexport interface AppliedPhoneSemantic extends AppliedDataSemantic {\n id: SemanticType.Phone\n config?: PhoneConfig\n}\n\n/**\n * Type guard to check if a semantic is a Phone semantic.\n * @param semantic - The semantic to check\n * @returns True if the semantic is a Phone semantic\n */\nexport const isPhoneSemantic = (semantic: AppliedDataSemantic): semantic is AppliedPhoneSemantic => {\n return semantic.id === SemanticType.Phone\n}\n\n/**\n * Helper function to create a Phone semantic with configuration.\n * @param config - Configuration options for the phone semantic\n * @returns AppliedPhoneSemantic with the specified configuration\n */\nexport const createPhoneSemantic = (config: PhoneConfig = {}): AppliedPhoneSemantic => {\n const mergedConfig = {\n ...DEFAULT_PHONE_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.Phone,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for Phone semantic.\n * Uses international format with country code required and SMS verification.\n */\nexport const DEFAULT_PHONE_CONFIG: PhoneConfig = {\n requireCountryCode: true,\n format: 'international',\n allowExtension: false,\n requireVerification: false,\n verificationMethod: 'sms',\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { SemanticType } from '../Semantics.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface PublicUniqueNameConfig {
|
|
8
8
|
/**
|
|
9
|
-
* The source field to generate the slug from
|
|
9
|
+
* The key of the source field to generate the slug from.
|
|
10
10
|
* Default to the field that is annotated with the Title semantic.
|
|
11
11
|
*/
|
|
12
12
|
sourceField?: string;
|
|
@@ -14,10 +14,6 @@ export interface PublicUniqueNameConfig {
|
|
|
14
14
|
* Separator character to use in the slug (default: '-').
|
|
15
15
|
*/
|
|
16
16
|
separator?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Maximum length of the slug (default: 64).
|
|
19
|
-
*/
|
|
20
|
-
maxLength?: number;
|
|
21
17
|
/**
|
|
22
18
|
* Whether the slug is case sensitive (default: false).
|
|
23
19
|
*/
|
|
@@ -26,10 +22,6 @@ export interface PublicUniqueNameConfig {
|
|
|
26
22
|
* Whether to allow Unicode characters in the slug (default: false).
|
|
27
23
|
*/
|
|
28
24
|
allowUnicode?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Name of a custom generator function to use for slug creation.
|
|
31
|
-
*/
|
|
32
|
-
customGenerator?: string;
|
|
33
25
|
/**
|
|
34
26
|
* Whether to allow duplicate slugs (default: false).
|
|
35
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicUniqueName.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/PublicUniqueName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"PublicUniqueName.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/PublicUniqueName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB;IAC1E,EAAE,EAAE,YAAY,CAAC,gBAAgB,CAAA;IACjC,MAAM,CAAC,EAAE,sBAAsB,CAAA;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,mBAAmB,KAC5B,QAAQ,IAAI,+BAEd,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,GACzC,SAAQ,sBAA2B,KAClC,+BAaF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,sBAK/C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicUniqueName.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/PublicUniqueName.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"PublicUniqueName.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/PublicUniqueName.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAkD9C;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,QAA6B,EACgB,EAAE;IAC/C,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,gBAAgB,CAAA;AACtD,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC5C,SAAiC,EAAE,EACF,EAAE;IACnC,MAAM,YAAY,GAAG;QACnB,GAAG,iCAAiC;QACpC,GAAG,MAAM;KACV,CAAA;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,gBAAgB;QACjC,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAA2B;IACvE,SAAS,EAAE,GAAG;IACd,aAAa,EAAE,KAAK;IACpB,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,KAAK;CACvB,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the PublicUniqueName (slug) semantic.\n * Controls how slugs are generated and validated.\n */\nexport interface PublicUniqueNameConfig {\n /**\n * The key of the source field to generate the slug from.\n * Default to the field that is annotated with the Title semantic.\n */\n sourceField?: string\n /**\n * Separator character to use in the slug (default: '-').\n */\n separator?: string\n /**\n * Whether the slug is case sensitive (default: false).\n */\n caseSensitive?: boolean\n /**\n * Whether to allow Unicode characters in the slug (default: false).\n */\n allowUnicode?: boolean\n /**\n * Whether to allow duplicate slugs (default: false).\n */\n allowDuplicates?: boolean\n /**\n * Fallback field to use if the source field is empty or invalid.\n */\n fallbackField?: string\n /**\n * Custom metadata for the slug field.\n */\n metadata?: Record<string, unknown>\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for PublicUniqueName semantic.\n */\nexport interface AppliedPublicUniqueNameSemantic extends AppliedDataSemantic {\n id: SemanticType.PublicUniqueName\n config?: PublicUniqueNameConfig\n}\n\n/**\n * Type guard to check if a semantic is a PublicUniqueName semantic.\n */\nexport const isPublicUniqueNameSemantic = (\n semantic: AppliedDataSemantic\n): semantic is AppliedPublicUniqueNameSemantic => {\n return semantic.id === SemanticType.PublicUniqueName\n}\n\n/**\n * Helper function to create a PublicUniqueName semantic with configuration.\n */\nexport const createPublicUniqueNameSemantic = (\n config: PublicUniqueNameConfig = {}\n): AppliedPublicUniqueNameSemantic => {\n const mergedConfig = {\n ...DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.PublicUniqueName,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for PublicUniqueName semantic.\n */\nexport const DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG: PublicUniqueNameConfig = {\n separator: '-',\n caseSensitive: false,\n allowUnicode: false,\n allowDuplicates: false,\n}\n"]}
|
|
@@ -51,9 +51,12 @@ export interface SKUConfig {
|
|
|
51
51
|
*/
|
|
52
52
|
autoGenerate?: boolean;
|
|
53
53
|
/**
|
|
54
|
-
* Field
|
|
54
|
+
* Field key to use as source for auto-generation.
|
|
55
55
|
* Only used when autoGenerate is true.
|
|
56
56
|
* If not specified, uses random generation.
|
|
57
|
+
*
|
|
58
|
+
* The kay can be any field that provides a meaningful value for the SKU. It can also be a key of
|
|
59
|
+
* a property in one of the parent entities.
|
|
57
60
|
*/
|
|
58
61
|
autoGenerateSource?: string;
|
|
59
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SKU.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/SKU.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;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AAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Supported SKU validation modes.\n */\nexport type SKUValidationMode = 'strict' | 'lenient' | 'custom'\n\n/**\n * Supported SKU case transformation modes.\n */\nexport type SKUCaseMode = 'uppercase' | 'lowercase' | 'preserve'\n\n/**\n * Configuration options for the SKU semantic.\n * Controls SKU validation, formatting, uniqueness enforcement, and pattern matching.\n */\nexport interface SKUConfig {\n /**\n * The validation mode for SKU format.\n *\n * - 'strict': Enforces alphanumeric characters with optional hyphens/underscores\n * - 'lenient': Allows more special characters but still validates basic format\n * - 'custom': Uses custom regex pattern defined in `customPattern`\n */\n validationMode?: SKUValidationMode\n\n /**\n * Custom regex pattern for SKU validation when using 'custom' validation mode.\n * Only used when validationMode is 'custom'.\n */\n customPattern?: string\n\n /**\n * Case transformation to apply to SKUs.\n * - 'uppercase': Convert to uppercase (recommended for consistency)\n * - 'lowercase': Convert to lowercase\n * - 'preserve': Keep original case\n */\n caseMode?: SKUCaseMode\n\n /**\n * Prefix to automatically add to SKUs if not present.\n * Useful for organizing SKUs by category (e.g., 'PROD-', 'SKU-').\n */\n prefix?: string\n\n /**\n * Whether to enforce global uniqueness across all entities.\n * When true, creates unique database constraints.\n * Default: true\n */\n enforceUniqueness?: boolean\n\n /**\n * Whether to auto-generate SKUs when not provided.\n * When true, generates SKUs based on other fields or random values.\n * Default: false\n */\n autoGenerate?: boolean\n\n /**\n * Field name to use as source for auto-generation.\n * Only used when autoGenerate is true.\n * If not specified, uses random generation.\n */\n autoGenerateSource?: string\n\n /**\n * Whether to validate that SKU doesn't conflict with reserved words or patterns.\n * Default: true\n */\n validateReservedWords?: boolean\n\n /**\n * List of reserved SKU values that cannot be used.\n * Common examples: 'ADMIN', 'TEST', 'NULL', 'DEFAULT'\n */\n reservedValues?: string[]\n\n /**\n * Custom metadata for the SKU field.\n */\n metadata?: Record<string, unknown>\n\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for SKU semantic.\n */\nexport interface AppliedSKUSemantic extends AppliedDataSemantic {\n id: SemanticType.SKU\n config?: SKUConfig\n}\n\n/**\n * Type guard to check if a semantic is a SKU semantic.\n */\nexport const isSKUSemantic = (semantic: AppliedDataSemantic): semantic is AppliedSKUSemantic => {\n return semantic.id === SemanticType.SKU\n}\n\n/**\n * Helper function to create a SKU semantic with configuration.\n */\nexport const createSKUSemantic = (config: SKUConfig = {}): AppliedSKUSemantic => {\n const mergedConfig = {\n ...DEFAULT_SKU_CONFIG,\n ...config,\n }\n\n // Merge metadata separately\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.SKU,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for SKU semantic.\n * Optimized for common product catalog use cases.\n */\nexport const DEFAULT_SKU_CONFIG: SKUConfig = {\n validationMode: 'strict',\n caseMode: 'uppercase',\n enforceUniqueness: true,\n autoGenerate: false,\n validateReservedWords: true,\n reservedValues: ['ADMIN', 'TEST', 'NULL', 'DEFAULT', 'UNDEFINED', 'SAMPLE', 'DEMO'],\n}\n\n/**\n * Predefined configurations for common use cases.\n */\nexport const SKU_PRESETS = {\n /**\n * Standard product SKU with strict validation and uppercase formatting.\n */\n PRODUCT_STANDARD: createSKUSemantic({\n validationMode: 'strict',\n caseMode: 'uppercase',\n prefix: 'PROD-',\n enforceUniqueness: true,\n }),\n\n /**\n * Simple SKU configuration for basic catalogs.\n */\n SIMPLE: createSKUSemantic({\n validationMode: 'lenient',\n caseMode: 'preserve',\n enforceUniqueness: true,\n }),\n\n /**\n * Auto-generating SKU from product name.\n */\n AUTO_GENERATE: createSKUSemantic({\n validationMode: 'strict',\n caseMode: 'uppercase',\n autoGenerate: true,\n autoGenerateSource: 'name',\n enforceUniqueness: true,\n }),\n\n /**\n * Flexible SKU for variable product types.\n */\n FLEXIBLE: createSKUSemantic({\n validationMode: 'lenient',\n caseMode: 'preserve',\n enforceUniqueness: true,\n validateReservedWords: false,\n }),\n} as const\n\n/**\n * Helper function to validate a SKU configuration.\n */\nexport const validateSKUConfig = (config: SKUConfig): string[] => {\n const errors: string[] = []\n\n if (config.validationMode === 'custom' && !config.customPattern) {\n errors.push('customPattern is required when validationMode is custom')\n }\n\n if (config.customPattern) {\n try {\n new RegExp(config.customPattern)\n } catch {\n errors.push('customPattern must be a valid regular expression')\n }\n }\n\n if (config.prefix && config.prefix.length === 0) {\n errors.push('prefix cannot be empty string')\n }\n\n if (config.autoGenerateSource && !config.autoGenerate) {\n errors.push('autoGenerate must be true when autoGenerateSource is specified')\n }\n\n return errors\n}\n\n/**\n * Helper function to validate SKU value against configuration.\n */\nexport const validateSKUValue = (value: string, config: SKUConfig = DEFAULT_SKU_CONFIG): string[] => {\n const errors: string[] = []\n const mergedConfig = { ...DEFAULT_SKU_CONFIG, ...config }\n\n if (!value || typeof value !== 'string') {\n errors.push('SKU value must be a non-empty string')\n return errors\n }\n\n if (mergedConfig.validateReservedWords && mergedConfig.reservedValues) {\n const normalizedValue = value.toUpperCase()\n if (mergedConfig.reservedValues.some((reserved) => reserved.toUpperCase() === normalizedValue)) {\n errors.push(`SKU cannot use reserved value: ${value}`)\n }\n }\n\n // Validation pattern checks\n if (mergedConfig.validationMode === 'strict') {\n if (!/^[A-Za-z0-9_-]+$/.test(value)) {\n errors.push('SKU can only contain alphanumeric characters, hyphens, and underscores')\n }\n } else if (mergedConfig.validationMode === 'lenient') {\n if (!/^[A-Za-z0-9_.-]+$/.test(value)) {\n errors.push('SKU contains invalid characters')\n }\n } else if (mergedConfig.validationMode === 'custom' && mergedConfig.customPattern) {\n try {\n const regex = new RegExp(mergedConfig.customPattern)\n if (!regex.test(value)) {\n errors.push('SKU does not match the required pattern')\n }\n } catch {\n errors.push('Invalid custom pattern configuration')\n }\n }\n\n return errors\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SKU.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/SKU.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAqG9C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA6B,EAAkC,EAAE;IAC7F,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,GAAG,CAAA;AACzC,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAoB,EAAE,EAAsB,EAAE;IAC9E,MAAM,YAAY,GAAG;QACnB,GAAG,kBAAkB;QACrB,GAAG,MAAM;KACV,CAAA;IAED,4BAA4B;IAC5B,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,GAAG;QACpB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAc;IAC3C,cAAc,EAAE,QAAQ;IACxB,QAAQ,EAAE,WAAW;IACrB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,KAAK;IACnB,qBAAqB,EAAE,IAAI;IAC3B,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;CACpF,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;;OAEG;IACH,gBAAgB,EAAE,iBAAiB,CAAC;QAClC,cAAc,EAAE,QAAQ;QACxB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,OAAO;QACf,iBAAiB,EAAE,IAAI;K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,IAAI,YAAY,CAAC,aAAa,EAAE,CAAC;QAClF,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;YACpD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACvB,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAA;YACxD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Supported SKU validation modes.\n */\nexport type SKUValidationMode = 'strict' | 'lenient' | 'custom'\n\n/**\n * Supported SKU case transformation modes.\n */\nexport type SKUCaseMode = 'uppercase' | 'lowercase' | 'preserve'\n\n/**\n * Configuration options for the SKU semantic.\n * Controls SKU validation, formatting, uniqueness enforcement, and pattern matching.\n */\nexport interface SKUConfig {\n /**\n * The validation mode for SKU format.\n *\n * - 'strict': Enforces alphanumeric characters with optional hyphens/underscores\n * - 'lenient': Allows more special characters but still validates basic format\n * - 'custom': Uses custom regex pattern defined in `customPattern`\n */\n validationMode?: SKUValidationMode\n\n /**\n * Custom regex pattern for SKU validation when using 'custom' validation mode.\n * Only used when validationMode is 'custom'.\n */\n customPattern?: string\n\n /**\n * Case transformation to apply to SKUs.\n * - 'uppercase': Convert to uppercase (recommended for consistency)\n * - 'lowercase': Convert to lowercase\n * - 'preserve': Keep original case\n */\n caseMode?: SKUCaseMode\n\n /**\n * Prefix to automatically add to SKUs if not present.\n * Useful for organizing SKUs by category (e.g., 'PROD-', 'SKU-').\n */\n prefix?: string\n\n /**\n * Whether to enforce global uniqueness across all entities.\n * When true, creates unique database constraints.\n * Default: true\n */\n enforceUniqueness?: boolean\n\n /**\n * Whether to auto-generate SKUs when not provided.\n * When true, generates SKUs based on other fields or random values.\n * Default: false\n */\n autoGenerate?: boolean\n\n /**\n * Field key to use as source for auto-generation.\n * Only used when autoGenerate is true.\n * If not specified, uses random generation.\n *\n * The kay can be any field that provides a meaningful value for the SKU. It can also be a key of\n * a property in one of the parent entities.\n */\n autoGenerateSource?: string\n\n /**\n * Whether to validate that SKU doesn't conflict with reserved words or patterns.\n * Default: true\n */\n validateReservedWords?: boolean\n\n /**\n * List of reserved SKU values that cannot be used.\n * Common examples: 'ADMIN', 'TEST', 'NULL', 'DEFAULT'\n */\n reservedValues?: string[]\n\n /**\n * Custom metadata for the SKU field.\n */\n metadata?: Record<string, unknown>\n\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for SKU semantic.\n */\nexport interface AppliedSKUSemantic extends AppliedDataSemantic {\n id: SemanticType.SKU\n config?: SKUConfig\n}\n\n/**\n * Type guard to check if a semantic is a SKU semantic.\n */\nexport const isSKUSemantic = (semantic: AppliedDataSemantic): semantic is AppliedSKUSemantic => {\n return semantic.id === SemanticType.SKU\n}\n\n/**\n * Helper function to create a SKU semantic with configuration.\n */\nexport const createSKUSemantic = (config: SKUConfig = {}): AppliedSKUSemantic => {\n const mergedConfig = {\n ...DEFAULT_SKU_CONFIG,\n ...config,\n }\n\n // Merge metadata separately\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.SKU,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for SKU semantic.\n * Optimized for common product catalog use cases.\n */\nexport const DEFAULT_SKU_CONFIG: SKUConfig = {\n validationMode: 'strict',\n caseMode: 'uppercase',\n enforceUniqueness: true,\n autoGenerate: false,\n validateReservedWords: true,\n reservedValues: ['ADMIN', 'TEST', 'NULL', 'DEFAULT', 'UNDEFINED', 'SAMPLE', 'DEMO'],\n}\n\n/**\n * Predefined configurations for common use cases.\n */\nexport const SKU_PRESETS = {\n /**\n * Standard product SKU with strict validation and uppercase formatting.\n */\n PRODUCT_STANDARD: createSKUSemantic({\n validationMode: 'strict',\n caseMode: 'uppercase',\n prefix: 'PROD-',\n enforceUniqueness: true,\n }),\n\n /**\n * Simple SKU configuration for basic catalogs.\n */\n SIMPLE: createSKUSemantic({\n validationMode: 'lenient',\n caseMode: 'preserve',\n enforceUniqueness: true,\n }),\n\n /**\n * Auto-generating SKU from product name.\n */\n AUTO_GENERATE: createSKUSemantic({\n validationMode: 'strict',\n caseMode: 'uppercase',\n autoGenerate: true,\n autoGenerateSource: 'name',\n enforceUniqueness: true,\n }),\n\n /**\n * Flexible SKU for variable product types.\n */\n FLEXIBLE: createSKUSemantic({\n validationMode: 'lenient',\n caseMode: 'preserve',\n enforceUniqueness: true,\n validateReservedWords: false,\n }),\n} as const\n\n/**\n * Helper function to validate a SKU configuration.\n */\nexport const validateSKUConfig = (config: SKUConfig): string[] => {\n const errors: string[] = []\n\n if (config.validationMode === 'custom' && !config.customPattern) {\n errors.push('customPattern is required when validationMode is custom')\n }\n\n if (config.customPattern) {\n try {\n new RegExp(config.customPattern)\n } catch {\n errors.push('customPattern must be a valid regular expression')\n }\n }\n\n if (config.prefix && config.prefix.length === 0) {\n errors.push('prefix cannot be empty string')\n }\n\n if (config.autoGenerateSource && !config.autoGenerate) {\n errors.push('autoGenerate must be true when autoGenerateSource is specified')\n }\n\n return errors\n}\n\n/**\n * Helper function to validate SKU value against configuration.\n */\nexport const validateSKUValue = (value: string, config: SKUConfig = DEFAULT_SKU_CONFIG): string[] => {\n const errors: string[] = []\n const mergedConfig = { ...DEFAULT_SKU_CONFIG, ...config }\n\n if (!value || typeof value !== 'string') {\n errors.push('SKU value must be a non-empty string')\n return errors\n }\n\n if (mergedConfig.validateReservedWords && mergedConfig.reservedValues) {\n const normalizedValue = value.toUpperCase()\n if (mergedConfig.reservedValues.some((reserved) => reserved.toUpperCase() === normalizedValue)) {\n errors.push(`SKU cannot use reserved value: ${value}`)\n }\n }\n\n // Validation pattern checks\n if (mergedConfig.validationMode === 'strict') {\n if (!/^[A-Za-z0-9_-]+$/.test(value)) {\n errors.push('SKU can only contain alphanumeric characters, hyphens, and underscores')\n }\n } else if (mergedConfig.validationMode === 'lenient') {\n if (!/^[A-Za-z0-9_.-]+$/.test(value)) {\n errors.push('SKU contains invalid characters')\n }\n } else if (mergedConfig.validationMode === 'custom' && mergedConfig.customPattern) {\n try {\n const regex = new RegExp(mergedConfig.customPattern)\n if (!regex.test(value)) {\n errors.push('SKU does not match the required pattern')\n }\n } catch {\n errors.push('Invalid custom pattern configuration')\n }\n }\n\n return errors\n}\n"]}
|
|
@@ -15,7 +15,7 @@ export interface StatusConfig {
|
|
|
15
15
|
* Default state when creating new records.
|
|
16
16
|
* Must be one of the allowedStates (if specified) or enum values from the schema.
|
|
17
17
|
*/
|
|
18
|
-
defaultState
|
|
18
|
+
defaultState?: string;
|
|
19
19
|
/**
|
|
20
20
|
* State transitions configuration.
|
|
21
21
|
* Maps from current state to array of allowed next states.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IAExB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IAC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B;;;WAGG;QACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAC3B,EAAE,CAAA;IAEH;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAElC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,EAAE,EAAE,YAAY,CAAC,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,qBAE5E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAQ,OAAO,CAAC,YAAY,CAAM,KAAG,qBAqBzE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,YA0BnC,CAAA"}
|
|
@@ -32,6 +32,7 @@ export const createStatusSemantic = (config = {}) => {
|
|
|
32
32
|
* Default configuration for Status semantic.
|
|
33
33
|
*/
|
|
34
34
|
export const DEFAULT_STATUS_CONFIG = {
|
|
35
|
+
allowedStates: ['draft', 'published', 'archived'],
|
|
35
36
|
defaultState: 'draft',
|
|
36
37
|
stateBehaviors: {
|
|
37
38
|
draft: {
|