@pittica/google-business-intelligence-helpers 1.17.1 → 1.17.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/dist/index.js CHANGED
@@ -59,9 +59,11 @@ const {
59
59
  createFilename,
60
60
  mergeFilename,
61
61
  mergeFiledata,
62
- isFiledataMatch,
63
- safeFilenamesProcess
62
+ isFiledataMatch
64
63
  } = require("./naming/file");
64
+ const {
65
+ safeFilenamesProcess
66
+ } = require("./naming/collection");
65
67
  const {
66
68
  splitName,
67
69
  splitIdByKeys
@@ -0,0 +1,30 @@
1
+ // Copyright 2024-2026 Pittica S.r.l.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ const {
16
+ splitName
17
+ } = require("./split");
18
+ const {
19
+ mergeFiledata
20
+ } = require("./file");
21
+
22
+ /**
23
+ * Processes filenames safely based on the provided configuration.
24
+ *
25
+ * @param {Array} files Array of file objects.
26
+ * @param {Array} configuration Array of allowed filenames.
27
+ * @returns {Array} Array of processed filenames.
28
+ * @since 1.17.0
29
+ */
30
+ exports.safeFilenamesProcess = (files, configuration = []) => files.map(file => splitName(file)).filter(file => configuration.includes(file.name)).map(file => mergeFiledata(file));
@@ -58,10 +58,10 @@ exports.getJsonStorageName = (date, file) => `${format(date, "YYYY-MM-DD")}/${fo
58
58
  * Generates a filename from the givend data.
59
59
  *
60
60
  * @param {object} filedata File data.
61
- * @param {string} format Date format.
61
+ * @param {string} dateFormat Date format.
62
62
  * @returns {string} A filename from the givend data.
63
63
  */
64
- exports.createFilename = (filedata, format = "YYYY-MM-DD") => `${format(filedata.date, format)}-${filedata.fullname}.${filedata.extension}`;
64
+ exports.createFilename = (filedata, dateFormat = "YYYY-MM-DD") => `${format(filedata.date, dateFormat)}-${filedata.fullname}.${filedata.extension}`;
65
65
 
66
66
  /**
67
67
  * Merges the given filename parts.
@@ -70,10 +70,10 @@ exports.createFilename = (filedata, format = "YYYY-MM-DD") => `${format(filedata
70
70
  * @param {string} name File or function name.
71
71
  * @param {string} extension File extension.
72
72
  * @param {int} version File version.
73
- * @param {string} format Date format.
73
+ * @param {string} dateFormat Date format.
74
74
  * @returns {string} The merged given filename parts.
75
75
  */
76
- exports.mergeFilename = (date, name, extension, version = 0, format = "YYYY-MM-DD") => `${format(date, format)}-${name}${version ? `_${version}` : ""}.${extension.toLowerCase()}`;
76
+ exports.mergeFilename = (date, name, extension, version = 0, dateFormat = "YYYY-MM-DD") => `${format(date, dateFormat)}-${name}${version ? `_${version}` : ""}.${extension.toLowerCase()}`;
77
77
 
78
78
  /**
79
79
  * Merges the given filename data.
@@ -96,14 +96,4 @@ exports.mergeFiledata = ({
96
96
  * @param {object} second Second object compare.
97
97
  * @returns {boolean} True if the filenames match, false otherwise.
98
98
  */
99
- exports.isFiledataMatch = (first, second) => exports.mergeFilename(first) === exports.mergeFilename(second);
100
-
101
- /**
102
- * Processes filenames safely based on the provided configuration.
103
- *
104
- * @param {Array} files Array of file objects.
105
- * @param {Array} configuration Array of allowed filenames.
106
- * @returns {Array} Array of processed filenames.
107
- * @since 1.17.0
108
- */
109
- exports.safeFilenamesProcess = (files, configuration = []) => files.map(file => splitName(file)).filter(file => configuration.includes(file.name)).map(file => mergeFiledata(file));
99
+ exports.isFiledataMatch = (first, second) => exports.mergeFilename(first) === exports.mergeFilename(second);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pittica/google-business-intelligence-helpers",
3
3
  "private": false,
4
- "version": "1.17.1",
4
+ "version": "1.17.3",
5
5
  "description": "Helpers for business intelligence for Google Cloud.",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {