@learnpack/learnpack 5.0.332 → 5.0.333

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.
@@ -57,6 +57,9 @@ const handleAssetCreation = async (sessionPayload, learnJson, selectedLang, lear
57
57
  let slug = (0, creatorUtilities_1.slugify)(assetTitle).slice(0, 47);
58
58
  slug = `${slug}-${selectedLang}`;
59
59
  const { exists } = await api_1.default.doesAssetExists(sessionPayload.token, slug);
60
+ const technologies = Array.isArray(learnJson === null || learnJson === void 0 ? void 0 : learnJson.technologies) ?
61
+ learnJson.technologies :
62
+ [];
60
63
  if (!exists) {
61
64
  console_1.default.info("Asset does not exist in this academy, creating it");
62
65
  const asset = await api_1.default.createAsset(sessionPayload.token, {
@@ -66,7 +69,7 @@ const handleAssetCreation = async (sessionPayload, learnJson, selectedLang, lear
66
69
  graded: true,
67
70
  description: assetDescription,
68
71
  learnpack_deploy_url: learnpackDeployUrl,
69
- technologies: learnJson.technologies.map((tech) => tech.toLowerCase().replace(/\s+/g, "-")),
72
+ technologies: technologies.map((tech) => String(tech).toLowerCase().replace(/\s+/g, "-")),
70
73
  url: learnpackDeployUrl,
71
74
  category: category,
72
75
  owner: user.id,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@learnpack/learnpack",
3
3
  "description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
4
- "version": "5.0.332",
4
+ "version": "5.0.333",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -84,6 +84,10 @@ export const handleAssetCreation = async (
84
84
 
85
85
  const { exists } = await api.doesAssetExists(sessionPayload.token, slug)
86
86
 
87
+ const technologies: unknown[] = Array.isArray(learnJson?.technologies) ?
88
+ learnJson.technologies :
89
+ []
90
+
87
91
  if (!exists) {
88
92
  Console.info("Asset does not exist in this academy, creating it")
89
93
  const asset = await api.createAsset(sessionPayload.token, {
@@ -93,8 +97,8 @@ export const handleAssetCreation = async (
93
97
  graded: true,
94
98
  description: assetDescription,
95
99
  learnpack_deploy_url: learnpackDeployUrl,
96
- technologies: learnJson.technologies.map((tech: string) =>
97
- tech.toLowerCase().replace(/\s+/g, "-")
100
+ technologies: technologies.map((tech: unknown) =>
101
+ String(tech).toLowerCase().replace(/\s+/g, "-")
98
102
  ),
99
103
  url: learnpackDeployUrl,
100
104
  category: category,