@notifiles/sdk 1.5.1 → 1.5.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@notifiles/sdk",
3
3
  "type": "module",
4
- "version": "1.5.1",
4
+ "version": "1.5.3",
5
5
  "description": "",
6
6
  "author": {
7
7
  "name": "adoucoure",
@@ -11,7 +11,9 @@ export default async (props) => {
11
11
  } = entry
12
12
 
13
13
  const sharedItemsPath = `${path}/attachments`
14
- let sharedItems = await fs.promises.readdir(sharedItemsPath)
14
+ let sharedItems = (await checkFileExists(sharedItemsPath))
15
+ ? await fs.promises.readdir(sharedItemsPath)
16
+ : []
15
17
  let items = (await Promise.all(sharedItems.map(async item => {
16
18
  const folderPath = fsPath.join(sharedItemsPath, item)
17
19
  const folderPathStat = await fs.promises.stat(folderPath)
@@ -9,11 +9,11 @@ export default async (props) => {
9
9
 
10
10
  const { entry, settings } = props
11
11
  const { path, pushNotification, buildPaths, } = entry
12
- // pushNotification is null unless the template folder has a pushnotification.txt (set in lib/entries/getAtPath.js).
13
- // Every template must ship a pushnotification.txt (an empty file is fine, see templates/social/subscription/*)
14
- // or this destructure throws before the existence check below ever runs.
15
- const { text, } = pushNotification
16
12
 
13
+ // pushNotification is null unless the template folder has a pushnotification.txt
14
+ // (set in lib/entries/getAtPath.js, populated in build/lib/pushnotification/index.js).
15
+ // The existence check must run before destructuring it, or a template
16
+ // that simply doesn't ship this channel crashes here instead of skipping.
17
17
  const textPath = `${path}/pushnotification.txt`
18
18
  if (!(await checkFileExists(textPath))) {
19
19
  return {
@@ -21,6 +21,8 @@ export default async (props) => {
21
21
  }
22
22
  }
23
23
 
24
+ const { text, } = pushNotification
25
+
24
26
  await fs.promises.writeFile(
25
27
  buildPaths.pushNotification.text,
26
28
  text
@@ -9,11 +9,11 @@ export default async (props) => {
9
9
 
10
10
  const { entry, settings } = props
11
11
  const { path, textMessage, buildPaths, } = entry
12
- // textMessage is null unless the template folder has a textmessage.txt (set in lib/entries/getAtPath.js).
13
- // Every template must ship a textmessage.txt (an empty file is fine, see templates/social/subscription/*)
14
- // or this destructure throws before the existence check below ever runs.
15
- const { text, } = textMessage
16
12
 
13
+ // textMessage is null unless the template folder has a textmessage.txt
14
+ // (set in lib/entries/getAtPath.js, populated in build/lib/textmessage/index.js).
15
+ // The existence check must run before destructuring it, or a template
16
+ // that simply doesn't ship this channel crashes here instead of skipping.
17
17
  const textPath = `${path}/textmessage.txt`
18
18
  if (!(await checkFileExists(textPath))) {
19
19
  return {
@@ -21,6 +21,8 @@ export default async (props) => {
21
21
  }
22
22
  }
23
23
 
24
+ const { text, } = textMessage
25
+
24
26
  await fs.promises.writeFile(
25
27
  buildPaths.textMessage.text,
26
28
  text