ember-tribe 2.4.8 → 2.4.10

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.
@@ -25,16 +25,74 @@ export default class TypesService extends Service {
25
25
  @attr slug;
26
26
  @attr modules;
27
27
  }
28
-
28
+
29
29
  if (!owner.hasRegistration(`model:${modelDynamicName}`)) {
30
30
  owner.register(`model:${modelDynamicName}`, DynamicModel);
31
31
  }
32
32
  });
33
-
33
+
34
34
  this.json = await this.store.findRecord('webapp', 0, {
35
35
  include: ['total_objects'],
36
36
  });
37
37
  this.json = this.json;
38
+ this.simplifiedJson = this.convertTypesToSimplified(this.json);
39
+ //console.log(this.simplifiedJson);
40
+ }
41
+ }
42
+
43
+ convertTypesToSimplified = (typesJson) => {
44
+ // Create the basic structure with a types object
45
+ const simplifiedTypes = {
46
+ project_description: typesJson.modules.webapp.project_description ?? "",
47
+ types: {},
48
+ };
49
+
50
+ // Iterate through each content type in the original file
51
+ for (const [typeSlug, typeData] of Object.entries(typesJson.modules)) {
52
+ // Skip the webapp info and any types without modules
53
+ if (
54
+ typeSlug === 'webapp' ||
55
+ typeSlug === 'deleted_record' ||
56
+ typeSlug === 'platform_record' ||
57
+ typeSlug === 'blueprint_record' ||
58
+ typeSlug === 'file_record' ||
59
+ typeSlug === 'apikey_record' ||
60
+ !typeData.modules ||
61
+ !Array.isArray(typeData.modules)
62
+ ) {
63
+ continue;
64
+ }
65
+
66
+ // Create a new object for this type
67
+ simplifiedTypes.types[typeSlug] = {};
68
+
69
+ // Process each module in the content type
70
+ typeData.modules.forEach((module) => {
71
+ const slug = module.input_slug;
72
+ let varType = (module.var_type ?? "string") + (module.linked_type ? " | *"+module.linked_type : "");
73
+
74
+ // Handle select options if they exist
75
+ if (
76
+ module.input_options &&
77
+ Array.isArray(module.input_options) &&
78
+ module.input_options.length > 0
79
+ ) {
80
+ // Extract all option slugs
81
+ const optionSlugs = module.input_options.map(
82
+ (option) => option.slug,
83
+ );
84
+
85
+ // Add the piped extension to the var_type
86
+ if (optionSlugs.length > 0) {
87
+ varType += ` | ${optionSlugs.join(', ')}`;
88
+ }
89
+ }
90
+
91
+ // Add the module to the simplified type
92
+ simplifiedTypes.types[typeSlug][slug] = varType;
93
+ });
38
94
  }
95
+
96
+ return simplifiedTypes;
39
97
  }
40
98
  }
@@ -39,6 +39,25 @@ module.exports = {
39
39
  { name: 'howler' },
40
40
  { name: 'ripplet.js' },
41
41
  { name: '@ember/string' },
42
+ { name: '@editorjs/editorjs' },
43
+ { name: '@editorjs/image' },
44
+ { name: '@editorjs/header' },
45
+ { name: '@editorjs/raw' },
46
+ { name: '@editorjs/code' },
47
+ { name: '@editorjs/marker' },
48
+ { name: '@editorjs/delimiter' },
49
+ { name: '@editorjs/quote' },
50
+ { name: '@editorjs/list' },
51
+ { name: '@editorjs/attaches' },
52
+ { name: '@editorjs/footnotes' },
53
+ { name: '@editorjs/table' },
54
+ { name: 'editorjs-hyperlink' },
55
+ { name: 'miragejs' },
56
+ { name: 'papaparse' },
57
+ { name: 'sortablejs' },
58
+ { name: 'highlight.js' },
59
+ { name: 'uuid' },
60
+ { name: 'pretty-print-json' },
42
61
  ]);
43
62
  });
44
63
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ember-tribe",
3
- "version": "2.4.8",
4
- "description": "The default blueprint for using Tribe within EmberJS.",
3
+ "version": "2.4.10",
4
+ "description": "The default blueprint for using Tribe and Junction within EmberJS.",
5
5
  "keywords": [
6
6
  "ember-addon"
7
7
  ],