@getaster/data 0.4.0 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schema/csdl.js +8 -0
- package/package.json +1 -1
package/dist/schema/csdl.js
CHANGED
|
@@ -70,6 +70,12 @@ function frozenSet(items) {
|
|
|
70
70
|
function isObject(v) {
|
|
71
71
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
72
72
|
}
|
|
73
|
+
/** An action or function: CSDL JSON writes it as an array of its overloads. */
|
|
74
|
+
function isOperation(v) {
|
|
75
|
+
return (Array.isArray(v) &&
|
|
76
|
+
v.length > 0 &&
|
|
77
|
+
v.every((o) => isObject(o) && (o["$Kind"] === "Action" || o["$Kind"] === "Function")));
|
|
78
|
+
}
|
|
73
79
|
function obj(v, path) {
|
|
74
80
|
if (!isObject(v))
|
|
75
81
|
throw new SchemaError("expected an object", path);
|
|
@@ -209,6 +215,8 @@ export function parseCsdl(json) {
|
|
|
209
215
|
if (name.startsWith("$") || name.startsWith("@"))
|
|
210
216
|
continue;
|
|
211
217
|
const p = `/${ns}/${name}`;
|
|
218
|
+
if (isOperation(member))
|
|
219
|
+
continue;
|
|
212
220
|
const o = obj(member, p);
|
|
213
221
|
if (o["$Kind"] === "EntityType")
|
|
214
222
|
typeDrafts.set(`${ns}.${name}`, { qualified: `${ns}.${name}`, name, namespace: ns, path: p, json: o });
|