@fraym/crud 0.15.0 → 0.15.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.
Files changed (2) hide show
  1. package/dist/cmd/crud.js +18 -4
  2. package/package.json +1 -1
package/dist/cmd/crud.js CHANGED
@@ -220,14 +220,20 @@ const addNestedTypesToSchema = (definitions, nestedTypeName, nestedTypes) => {
220
220
  };
221
221
  }
222
222
  let newSchema = definitions[nestedTypeName].schema;
223
- nestedTypes.push(nestedTypeName);
223
+ if (!nestedTypes.includes(nestedTypeName)) {
224
+ nestedTypes.push(nestedTypeName);
225
+ }
224
226
  nestedTypeDefinition.nestedTypes.forEach(nestedNestedTypeName => {
225
227
  const nestedSchemaData = addNestedTypesToSchema(definitions, nestedNestedTypeName, nestedTypes);
226
228
  if (nestedSchemaData.schema === "") {
227
229
  return;
228
230
  }
229
231
  newSchema += `\n${nestedSchemaData.schema}`;
230
- nestedTypes.push(...nestedSchemaData.nestedTypes);
232
+ nestedSchemaData.nestedTypes.forEach(nestedType => {
233
+ if (!nestedTypes.includes(nestedType)) {
234
+ nestedTypes.push(nestedType);
235
+ }
236
+ });
231
237
  });
232
238
  return {
233
239
  schema: newSchema,
@@ -260,7 +266,11 @@ const migrateSchemas = async (definitions, serverAddress, namespace) => {
260
266
  return;
261
267
  }
262
268
  updateSchema += `\n${nestedSchemaData.schema}`;
263
- nestedTypesToUpdate.push(...nestedSchemaData.nestedTypes);
269
+ nestedSchemaData.nestedTypes.forEach(nestedType => {
270
+ if (!nestedTypesToUpdate.includes(nestedType)) {
271
+ nestedTypesToUpdate.push(nestedType);
272
+ }
273
+ });
264
274
  });
265
275
  }
266
276
  });
@@ -276,7 +286,11 @@ const migrateSchemas = async (definitions, serverAddress, namespace) => {
276
286
  return;
277
287
  }
278
288
  createSchema += `\n${nestedSchemaData.schema}`;
279
- nestedTypesToCreate.push(...nestedSchemaData.nestedTypes);
289
+ nestedSchemaData.nestedTypes.forEach(nestedType => {
290
+ if (!nestedTypesToCreate.includes(nestedType)) {
291
+ nestedTypesToCreate.push(nestedType);
292
+ }
293
+ });
280
294
  });
281
295
  });
282
296
  if (typesToCreate.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fraym/crud",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "license": "UNLICENSED",
5
5
  "homepage": "https://github.com/fraym/crud-nodejs",
6
6
  "repository": {