@almadar/core 4.3.0 → 4.3.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.
- package/dist/builders.d.ts +1 -1
- package/dist/builders.js +1 -0
- package/dist/builders.js.map +1 -1
- package/package.json +1 -1
package/dist/builders.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import '@almadar/patterns';
|
|
|
21
21
|
/**
|
|
22
22
|
* Ensure the fields array has an `id` field. Prepends one if missing.
|
|
23
23
|
*/
|
|
24
|
-
declare function ensureIdField(fields
|
|
24
|
+
declare function ensureIdField(fields?: EntityField[]): EntityField[];
|
|
25
25
|
/**
|
|
26
26
|
* Simple pluralization: append 's'.
|
|
27
27
|
*/
|
package/dist/builders.js
CHANGED
|
@@ -998,6 +998,7 @@ function composeBehaviors(input) {
|
|
|
998
998
|
|
|
999
999
|
// src/builders.ts
|
|
1000
1000
|
function ensureIdField(fields) {
|
|
1001
|
+
if (!fields || fields.length === 0) return [{ name: "id", type: "string", required: true }];
|
|
1001
1002
|
if (fields.some((f) => f.name === "id")) return fields;
|
|
1002
1003
|
return [{ name: "id", type: "string", required: true }, ...fields];
|
|
1003
1004
|
}
|