@diagonal-hq/cli 0.28.2 → 0.28.3
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/cli.mjs +22 -13
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -316123,17 +316123,10 @@ function readWorkspaceField(path, argument, declared, diagnostics, generatedEntr
|
|
|
316123
316123
|
}
|
|
316124
316124
|
}
|
|
316125
316125
|
const builder2 = entry.definition;
|
|
316126
|
-
|
|
316127
|
-
throw new SourceError('"definition" must be a field.<type>({...}) call', nodes.definition ?? argument);
|
|
316128
|
-
}
|
|
316129
|
-
checkBuilderOptions(builder2);
|
|
316126
|
+
const { field: field2, metadata } = readWorkspaceFieldDefinition(key, builder2, nodes.definition ?? argument);
|
|
316130
316127
|
if (!Object.hasOwn(entry, "value")) {
|
|
316131
316128
|
throw new SourceError('Add "value". Write null for a field without a value', argument);
|
|
316132
316129
|
}
|
|
316133
|
-
const field2 = buildField(key, builder2, nodes.definition, { checkKey: false });
|
|
316134
|
-
if (field2.type === "relation") {
|
|
316135
|
-
throw new SourceError("A workspace field cannot be a relation. A workspace field has no record", builder2.node);
|
|
316136
|
-
}
|
|
316137
316130
|
const problem2 = valueProblem2(field2, entry.value);
|
|
316138
316131
|
if (problem2 !== null) {
|
|
316139
316132
|
throw new SourceError(`"value" ${problem2}`, nodes.value);
|
|
@@ -316151,15 +316144,31 @@ function readWorkspaceField(path, argument, declared, diagnostics, generatedEntr
|
|
|
316151
316144
|
return {
|
|
316152
316145
|
path,
|
|
316153
316146
|
key,
|
|
316154
|
-
|
|
316155
|
-
label: field2.label,
|
|
316156
|
-
description: field2.description,
|
|
316157
|
-
guard: [field2.required ? "required" : "nullable", ...field2.guard],
|
|
316158
|
-
settings: field2.settings,
|
|
316147
|
+
...metadata,
|
|
316159
316148
|
value: entry.value,
|
|
316160
316149
|
nodes: { definition: builder2.node, value: nodes.value }
|
|
316161
316150
|
};
|
|
316162
316151
|
}
|
|
316152
|
+
function readWorkspaceFieldDefinition(key, builder2, node) {
|
|
316153
|
+
if (!(builder2 instanceof FieldBuilderValue)) {
|
|
316154
|
+
throw new SourceError('"definition" must be a field.<type>({...}) call', node);
|
|
316155
|
+
}
|
|
316156
|
+
checkBuilderOptions(builder2);
|
|
316157
|
+
const field2 = buildField(key, builder2, node, { checkKey: false });
|
|
316158
|
+
if (field2.type === "relation") {
|
|
316159
|
+
throw new SourceError("A workspace field cannot be a relation. A workspace field has no record", builder2.node);
|
|
316160
|
+
}
|
|
316161
|
+
return {
|
|
316162
|
+
field: field2,
|
|
316163
|
+
metadata: {
|
|
316164
|
+
type: field2.type,
|
|
316165
|
+
label: field2.label,
|
|
316166
|
+
description: field2.description,
|
|
316167
|
+
guard: [field2.required ? "required" : "nullable", ...field2.guard],
|
|
316168
|
+
settings: field2.settings
|
|
316169
|
+
}
|
|
316170
|
+
};
|
|
316171
|
+
}
|
|
316163
316172
|
function checkBuilderOptions(builder2) {
|
|
316164
316173
|
const option = RESOURCE_ONLY_OPTIONS.find((item) => builder2.options[item] !== void 0);
|
|
316165
316174
|
if (option !== void 0) {
|