@pittica/google-business-intelligence-helpers 1.12.7 → 1.13.0
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/LICENSE +201 -201
- package/dist/contents/schema.js +22 -22
- package/dist/contents/sql.js +6 -6
- package/dist/contents/storage.js +28 -28
- package/dist/naming/dataset.js +11 -11
- package/dist/naming/date.js +36 -36
- package/dist/naming/file.js +35 -35
- package/dist/naming/schema.js +6 -6
- package/dist/naming/split.js +11 -11
- package/dist/scripts/comparision.js +42 -0
- package/dist/scripts/unlistened.js +16 -14
- package/package.json +9 -7
package/LICENSE
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2024-2026 Pittica S.r.l.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024-2026 Pittica S.r.l.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/contents/schema.js
CHANGED
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
const fs = require("fs");
|
|
16
16
|
const path = require("path");
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Maps and imports the contents of the given folder.
|
|
20
|
-
*
|
|
21
|
-
* @param {string} folder Path of the folder to scan.
|
|
22
|
-
* @returns The contents of the given folder.
|
|
18
|
+
/**
|
|
19
|
+
* Maps and imports the contents of the given folder.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} folder Path of the folder to scan.
|
|
22
|
+
* @returns The contents of the given folder.
|
|
23
23
|
*/
|
|
24
24
|
exports.getSchemas = folder => {
|
|
25
25
|
const map = {};
|
|
@@ -30,31 +30,31 @@ exports.getSchemas = folder => {
|
|
|
30
30
|
return map;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* Returns the content related to the given name.
|
|
35
|
-
*
|
|
36
|
-
* @param {string} name Filename without extension.
|
|
37
|
-
* @param {string} folder Path of the folder to scan.
|
|
38
|
-
* @returns {object} The content related to the given name.
|
|
33
|
+
/**
|
|
34
|
+
* Returns the content related to the given name.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} name Filename without extension.
|
|
37
|
+
* @param {string} folder Path of the folder to scan.
|
|
38
|
+
* @returns {object} The content related to the given name.
|
|
39
39
|
*/
|
|
40
40
|
exports.getSchema = (name, folder) => {
|
|
41
41
|
const contents = this.getSchemas(folder);
|
|
42
42
|
return Object.keys(contents).includes(name) ? contents[name] : null;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* Gets the keys of the contents in the given folder.
|
|
47
|
-
*
|
|
48
|
-
* @param {string} folder Path of the folder to scan.
|
|
49
|
-
* @returns The keys of the contents in the given folder.
|
|
45
|
+
/**
|
|
46
|
+
* Gets the keys of the contents in the given folder.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} folder Path of the folder to scan.
|
|
49
|
+
* @returns The keys of the contents in the given folder.
|
|
50
50
|
*/
|
|
51
51
|
exports.getSchemaKeys = folder => fs.readdirSync(folder).map(file => file.split(".").slice(0, -1).join("."));
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* Determines whether the given name has an associated content.
|
|
55
|
-
*
|
|
56
|
-
* @param {string} name Filename without extension.
|
|
57
|
-
* @param {string} folder Path of the folder to scan.
|
|
58
|
-
* @returns {boolean} A value indicating whether the given name has an associated content.
|
|
53
|
+
/**
|
|
54
|
+
* Determines whether the given name has an associated content.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} name Filename without extension.
|
|
57
|
+
* @param {string} folder Path of the folder to scan.
|
|
58
|
+
* @returns {boolean} A value indicating whether the given name has an associated content.
|
|
59
59
|
*/
|
|
60
60
|
exports.hasSchema = (name, folder) => this.getSchemaKeys(folder).includes(name);
|
package/dist/contents/sql.js
CHANGED
|
@@ -17,12 +17,12 @@ const {
|
|
|
17
17
|
hasSchema
|
|
18
18
|
} = require("./schema");
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Gets the path of an SQL file with the given name.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} script Script name without extension.
|
|
24
|
-
* @param {object} folders Paths of the folders to scan.
|
|
25
|
-
* @returns {string} The path of an SQL file with the given name.
|
|
20
|
+
/**
|
|
21
|
+
* Gets the path of an SQL file with the given name.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} script Script name without extension.
|
|
24
|
+
* @param {object} folders Paths of the folders to scan.
|
|
25
|
+
* @returns {string} The path of an SQL file with the given name.
|
|
26
26
|
*/
|
|
27
27
|
exports.getSqlFilePath = (script, {
|
|
28
28
|
json,
|
package/dist/contents/storage.js
CHANGED
|
@@ -28,12 +28,12 @@ const {
|
|
|
28
28
|
incrementFilenameVersion
|
|
29
29
|
} = require("../naming/file");
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Maps Google Cloud Storage response.
|
|
33
|
-
*
|
|
34
|
-
* @param {Array} response Google Cloud Storage response.
|
|
35
|
-
* @param {string} schemas Schema files folder path.
|
|
36
|
-
* @returns {object} Mapped response.
|
|
31
|
+
/**
|
|
32
|
+
* Maps Google Cloud Storage response.
|
|
33
|
+
*
|
|
34
|
+
* @param {Array} response Google Cloud Storage response.
|
|
35
|
+
* @param {string} schemas Schema files folder path.
|
|
36
|
+
* @returns {object} Mapped response.
|
|
37
37
|
*/
|
|
38
38
|
exports.mapStorageResponse = (response, schemas = "") => {
|
|
39
39
|
const files = {};
|
|
@@ -53,13 +53,13 @@ exports.mapStorageResponse = (response, schemas = "") => {
|
|
|
53
53
|
return Object.values(files).flat(1).map(file => splitName(file));
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* Maps the given response and returns grouped and ordered object to import.
|
|
58
|
-
*
|
|
59
|
-
* @param {Array} response Google Cloud Storage response.
|
|
60
|
-
* @param {string} schemas Schema files folder path.
|
|
61
|
-
* @param {string} dateFormat Format string.
|
|
62
|
-
* @returns {object} Bucket files.
|
|
56
|
+
/**
|
|
57
|
+
* Maps the given response and returns grouped and ordered object to import.
|
|
58
|
+
*
|
|
59
|
+
* @param {Array} response Google Cloud Storage response.
|
|
60
|
+
* @param {string} schemas Schema files folder path.
|
|
61
|
+
* @param {string} dateFormat Format string.
|
|
62
|
+
* @returns {object} Bucket files.
|
|
63
63
|
*/
|
|
64
64
|
exports.extractStorageResponse = (response, schemas = "", dateFormat = "YYYY-MM-DD") => {
|
|
65
65
|
const days = {};
|
|
@@ -77,14 +77,14 @@ exports.extractStorageResponse = (response, schemas = "", dateFormat = "YYYY-MM-
|
|
|
77
77
|
}, {})).flat();
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
* Ritrieves a safe name of a file in the given folder in the given bucket.
|
|
82
|
-
*
|
|
83
|
-
* @param {Storage} storage Google Cloud Storage object.
|
|
84
|
-
* @param {string} bucket Bucket name.
|
|
85
|
-
* @param {string} filename File name.
|
|
86
|
-
* @param {string} folder Google Storage folder path.
|
|
87
|
-
* @returns {object} A safe name of a file in the given folder in the given bucket.
|
|
80
|
+
/**
|
|
81
|
+
* Ritrieves a safe name of a file in the given folder in the given bucket.
|
|
82
|
+
*
|
|
83
|
+
* @param {Storage} storage Google Cloud Storage object.
|
|
84
|
+
* @param {string} bucket Bucket name.
|
|
85
|
+
* @param {string} filename File name.
|
|
86
|
+
* @param {string} folder Google Storage folder path.
|
|
87
|
+
* @returns {object} A safe name of a file in the given folder in the given bucket.
|
|
88
88
|
*/
|
|
89
89
|
exports.getSafeFilename = (storage, bucket, filename, folder = "") => getFiles(storage, bucket, folder ? `${folder}/${filename}` : filename).then(response => {
|
|
90
90
|
const file = response.flat(3).filter(value => value && typeof value.name !== "undefined").map(({
|
|
@@ -93,13 +93,13 @@ exports.getSafeFilename = (storage, bucket, filename, folder = "") => getFiles(s
|
|
|
93
93
|
return typeof file !== "undefined" && file ? incrementFilenameVersion(splitName(file)) : splitName(filename);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
/**
|
|
97
|
-
* Ritrieves a safe name of a file in the given folder in the given bucket.
|
|
98
|
-
*
|
|
99
|
-
* @param {Bucket} bucket Bucket.
|
|
100
|
-
* @param {string} filename File name.
|
|
101
|
-
* @param {string} folder Google Storage folder path.
|
|
102
|
-
* @returns {object} A safe name of a file in the given folder in the given bucket.
|
|
96
|
+
/**
|
|
97
|
+
* Ritrieves a safe name of a file in the given folder in the given bucket.
|
|
98
|
+
*
|
|
99
|
+
* @param {Bucket} bucket Bucket.
|
|
100
|
+
* @param {string} filename File name.
|
|
101
|
+
* @param {string} folder Google Storage folder path.
|
|
102
|
+
* @returns {object} A safe name of a file in the given folder in the given bucket.
|
|
103
103
|
*/
|
|
104
104
|
exports.getSafeFilenameFromBucket = ({
|
|
105
105
|
storage,
|
package/dist/naming/dataset.js
CHANGED
|
@@ -16,20 +16,20 @@ const {
|
|
|
16
16
|
format
|
|
17
17
|
} = require("date-and-time");
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Gets the suffix of a temporary table.
|
|
21
|
-
*
|
|
22
|
-
* @param {Date} date Date.
|
|
23
|
-
* @returns {string} The suffix of a temporary table.
|
|
19
|
+
/**
|
|
20
|
+
* Gets the suffix of a temporary table.
|
|
21
|
+
*
|
|
22
|
+
* @param {Date} date Date.
|
|
23
|
+
* @returns {string} The suffix of a temporary table.
|
|
24
24
|
*/
|
|
25
25
|
exports.getTemporaryTableSuffix = date => format(date, "YYYY-MM-DD");
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Gets the name of a temporary table.
|
|
29
|
-
*
|
|
30
|
-
* @param {object} filedata Filename data.
|
|
31
|
-
* @param {string} prefix The prefix of a temporary table.
|
|
32
|
-
* @returns {string} The name of a temporary table.
|
|
27
|
+
/**
|
|
28
|
+
* Gets the name of a temporary table.
|
|
29
|
+
*
|
|
30
|
+
* @param {object} filedata Filename data.
|
|
31
|
+
* @param {string} prefix The prefix of a temporary table.
|
|
32
|
+
* @returns {string} The name of a temporary table.
|
|
33
33
|
*/
|
|
34
34
|
exports.getTemporaryTableName = ({
|
|
35
35
|
date,
|
package/dist/naming/date.js
CHANGED
|
@@ -16,27 +16,27 @@ const {
|
|
|
16
16
|
format
|
|
17
17
|
} = require("date-and-time");
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Converts the file name parts to a date object.
|
|
21
|
-
*
|
|
22
|
-
* @param {Array} parts String array from regular expression split representing a date from file name.
|
|
23
|
-
* @returns {Date} The date from the given array.
|
|
19
|
+
/**
|
|
20
|
+
* Converts the file name parts to a date object.
|
|
21
|
+
*
|
|
22
|
+
* @param {Array} parts String array from regular expression split representing a date from file name.
|
|
23
|
+
* @returns {Date} The date from the given array.
|
|
24
24
|
*/
|
|
25
25
|
exports.partsToDate = parts => new Date(parseInt(parts[1]), parseInt(parts[2]) - 1, parseInt(parts[3]));
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Converts the file name parts to an UTC date object.
|
|
29
|
-
*
|
|
30
|
-
* @param {Array} parts String array from regular expression split representing a date from file name.
|
|
31
|
-
* @returns {Date} The UTC date from the given array.
|
|
27
|
+
/**
|
|
28
|
+
* Converts the file name parts to an UTC date object.
|
|
29
|
+
*
|
|
30
|
+
* @param {Array} parts String array from regular expression split representing a date from file name.
|
|
31
|
+
* @returns {Date} The UTC date from the given array.
|
|
32
32
|
*/
|
|
33
33
|
exports.partsToDateUTC = parts => new Date(Date.UTC(parseInt(parts[1]), parseInt(parts[2]) - 1, parseInt(parts[3])));
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* Extracts a date from the given date representation.
|
|
37
|
-
*
|
|
38
|
-
* @param {string} date Date in string format YYYY-MM-DD.
|
|
39
|
-
* @returns {Date} A date from the given date representation.
|
|
35
|
+
/**
|
|
36
|
+
* Extracts a date from the given date representation.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} date Date in string format YYYY-MM-DD.
|
|
39
|
+
* @returns {Date} A date from the given date representation.
|
|
40
40
|
*/
|
|
41
41
|
exports.stringToDate = date => {
|
|
42
42
|
const split = date.split(/^(\d{4})\-(\d{2})\-(\d{2})$/gis);
|
|
@@ -46,11 +46,11 @@ exports.stringToDate = date => {
|
|
|
46
46
|
return null;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Extracts an UTC date from the given date representation.
|
|
51
|
-
*
|
|
52
|
-
* @param {string} date Date in string format YYYY-MM-DD.
|
|
53
|
-
* @returns {Date} An UTC date from the given date representation.
|
|
49
|
+
/**
|
|
50
|
+
* Extracts an UTC date from the given date representation.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} date Date in string format YYYY-MM-DD.
|
|
53
|
+
* @returns {Date} An UTC date from the given date representation.
|
|
54
54
|
*/
|
|
55
55
|
exports.stringToDateUTC = date => {
|
|
56
56
|
const split = date.split(/^(\d{4})\-(\d{2})\-(\d{2})$/gis);
|
|
@@ -60,28 +60,28 @@ exports.stringToDateUTC = date => {
|
|
|
60
60
|
return null;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* Gets the current date in the given format.
|
|
65
|
-
*
|
|
66
|
-
* @param {string} dateFormat Format string.
|
|
67
|
-
* @returns {string} The current date in the given format.
|
|
63
|
+
/**
|
|
64
|
+
* Gets the current date in the given format.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} dateFormat Format string.
|
|
67
|
+
* @returns {string} The current date in the given format.
|
|
68
68
|
*/
|
|
69
69
|
exports.getNow = (dateFormat = "YYYY-MM-DD") => this.formatDate(new Date(), dateFormat);
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
* Gets the given date in the given format.
|
|
73
|
-
*
|
|
74
|
-
* @param {Date} date Date object.
|
|
75
|
-
* @param {string} dateFormat Format string.
|
|
76
|
-
* @returns {string} The given date in the given format.
|
|
71
|
+
/**
|
|
72
|
+
* Gets the given date in the given format.
|
|
73
|
+
*
|
|
74
|
+
* @param {Date} date Date object.
|
|
75
|
+
* @param {string} dateFormat Format string.
|
|
76
|
+
* @returns {string} The given date in the given format.
|
|
77
77
|
*/
|
|
78
78
|
exports.formatDate = (date, dateFormat = "YYYY-MM-DD") => format(date, dateFormat);
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
* Gets the dates from the beginning of the year of the given date.
|
|
82
|
-
*
|
|
83
|
-
* @param {Date} until The day at the end of the loop.
|
|
84
|
-
* @returns {Array} The dates from the beginning of the year of the given date.
|
|
80
|
+
/**
|
|
81
|
+
* Gets the dates from the beginning of the year of the given date.
|
|
82
|
+
*
|
|
83
|
+
* @param {Date} until The day at the end of the loop.
|
|
84
|
+
* @returns {Array} The dates from the beginning of the year of the given date.
|
|
85
85
|
*/
|
|
86
86
|
exports.getDatesUntil = (until = new Date()) => {
|
|
87
87
|
const dates = [];
|
package/dist/naming/file.js
CHANGED
|
@@ -16,11 +16,11 @@ const {
|
|
|
16
16
|
format
|
|
17
17
|
} = require("date-and-time");
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Gets the version of a filename.
|
|
21
|
-
*
|
|
22
|
-
* @param {string} name Filename.
|
|
23
|
-
* @returns {number} The version of a filename.
|
|
19
|
+
/**
|
|
20
|
+
* Gets the version of a filename.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} name Filename.
|
|
23
|
+
* @returns {number} The version of a filename.
|
|
24
24
|
*/
|
|
25
25
|
exports.getFilenameVersion = name => {
|
|
26
26
|
const split = name.split("_");
|
|
@@ -29,11 +29,11 @@ exports.getFilenameVersion = name => {
|
|
|
29
29
|
return isNaN(version) ? 0 : version;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
* Increments the version of a filename in the given filedata.
|
|
34
|
-
*
|
|
35
|
-
* @param {object} filedata File data.
|
|
36
|
-
* @returns {number} The given file data.
|
|
32
|
+
/**
|
|
33
|
+
* Increments the version of a filename in the given filedata.
|
|
34
|
+
*
|
|
35
|
+
* @param {object} filedata File data.
|
|
36
|
+
* @returns {number} The given file data.
|
|
37
37
|
*/
|
|
38
38
|
exports.incrementFilenameVersion = filedata => {
|
|
39
39
|
if (typeof filedata.version !== "undefined") {
|
|
@@ -45,40 +45,40 @@ exports.incrementFilenameVersion = filedata => {
|
|
|
45
45
|
return filedata;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* Gets the name of a JSON storage file.
|
|
50
|
-
*
|
|
51
|
-
* @param {Date} date Date object.
|
|
52
|
-
* @param {string} file File name.
|
|
53
|
-
* @returns {string} The name of a JSON storage file.
|
|
48
|
+
/**
|
|
49
|
+
* Gets the name of a JSON storage file.
|
|
50
|
+
*
|
|
51
|
+
* @param {Date} date Date object.
|
|
52
|
+
* @param {string} file File name.
|
|
53
|
+
* @returns {string} The name of a JSON storage file.
|
|
54
54
|
*/
|
|
55
55
|
exports.getJsonStorageName = (date, file) => `${format(date, "YYYY-MM-DD")}/${format(date, "YYYYMMDDHHmmss")}-${file}.json`;
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* Generates a filename from the givend data.
|
|
59
|
-
*
|
|
60
|
-
* @param {object} filedata File data.
|
|
61
|
-
* @returns {string} A filename from the givend data.
|
|
57
|
+
/**
|
|
58
|
+
* Generates a filename from the givend data.
|
|
59
|
+
*
|
|
60
|
+
* @param {object} filedata File data.
|
|
61
|
+
* @returns {string} A filename from the givend data.
|
|
62
62
|
*/
|
|
63
63
|
exports.createFilename = filedata => `${format(filedata.date, "YYYY-MM-DD")}-${filedata.fullname}.${filedata.extension}`;
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
* Merges the given filename parts.
|
|
67
|
-
*
|
|
68
|
-
* @param {Date} date File date.
|
|
69
|
-
* @param {string} name File or function name.
|
|
70
|
-
* @param {string} extension File extension.
|
|
71
|
-
* @param {int} version File version.
|
|
72
|
-
* @returns {string} The merged given filename parts.
|
|
65
|
+
/**
|
|
66
|
+
* Merges the given filename parts.
|
|
67
|
+
*
|
|
68
|
+
* @param {Date} date File date.
|
|
69
|
+
* @param {string} name File or function name.
|
|
70
|
+
* @param {string} extension File extension.
|
|
71
|
+
* @param {int} version File version.
|
|
72
|
+
* @returns {string} The merged given filename parts.
|
|
73
73
|
*/
|
|
74
74
|
exports.mergeFilename = (date, name, extension, version = 0) => `${format(date, "YYYY-MM-DD")}-${name}${version ? `_${version}` : ""}.${extension.toLowerCase()}`;
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* Merges the given filename data.
|
|
78
|
-
*
|
|
79
|
-
* @param {object} filedata Data to merge.
|
|
80
|
-
* @param {boolean} increment A value indicating whether the file version needs to be increased.
|
|
81
|
-
* @returns {string} The merged given filename data.
|
|
76
|
+
/**
|
|
77
|
+
* Merges the given filename data.
|
|
78
|
+
*
|
|
79
|
+
* @param {object} filedata Data to merge.
|
|
80
|
+
* @param {boolean} increment A value indicating whether the file version needs to be increased.
|
|
81
|
+
* @returns {string} The merged given filename data.
|
|
82
82
|
*/
|
|
83
83
|
exports.mergeFiledata = ({
|
|
84
84
|
date,
|
package/dist/naming/schema.js
CHANGED
|
@@ -16,12 +16,12 @@ const {
|
|
|
16
16
|
hasSchema
|
|
17
17
|
} = require("../contents/schema");
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Determines whether the given file data matches the whitelist requirements.
|
|
21
|
-
*
|
|
22
|
-
* @param {object} data Filename data.
|
|
23
|
-
* @param {string} folder Path of the folder to scan.
|
|
24
|
-
* @returns {boolean} A value indicating whether the given file data matches the whitelist requirements.
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether the given file data matches the whitelist requirements.
|
|
21
|
+
*
|
|
22
|
+
* @param {object} data Filename data.
|
|
23
|
+
* @param {string} folder Path of the folder to scan.
|
|
24
|
+
* @returns {boolean} A value indicating whether the given file data matches the whitelist requirements.
|
|
25
25
|
*/
|
|
26
26
|
exports.isDataCsv = ({
|
|
27
27
|
match,
|
package/dist/naming/split.js
CHANGED
|
@@ -19,11 +19,11 @@ const {
|
|
|
19
19
|
partsToDate
|
|
20
20
|
} = require("./date");
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Splits the given filename.
|
|
24
|
-
*
|
|
25
|
-
* @param {string} name Filename.
|
|
26
|
-
* @returns {object} An object containing the splitted name.
|
|
22
|
+
/**
|
|
23
|
+
* Splits the given filename.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} name Filename.
|
|
26
|
+
* @returns {object} An object containing the splitted name.
|
|
27
27
|
*/
|
|
28
28
|
exports.splitName = name => {
|
|
29
29
|
if (name) {
|
|
@@ -59,12 +59,12 @@ exports.splitName = name => {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Splits an ID into an object.
|
|
64
|
-
*
|
|
65
|
-
* @param {string} id ID representation.
|
|
66
|
-
* @param {array} keys An array of keys.
|
|
67
|
-
* @returns {object} Sliced object of the given ID.
|
|
62
|
+
/**
|
|
63
|
+
* Splits an ID into an object.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} id ID representation.
|
|
66
|
+
* @param {array} keys An array of keys.
|
|
67
|
+
* @returns {object} Sliced object of the given ID.
|
|
68
68
|
*/
|
|
69
69
|
exports.splitIdByKeys = (id, keys) => {
|
|
70
70
|
const slices = {};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
txtContentToArray,
|
|
17
|
+
listFiles
|
|
18
|
+
} = require("@pittica/google-cloud-storage-helpers");
|
|
19
|
+
const {
|
|
20
|
+
stringToDateUTC
|
|
21
|
+
} = require("../naming/date");
|
|
22
|
+
const {
|
|
23
|
+
mergeFilename
|
|
24
|
+
} = require("../naming/file");
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Compares the content of a file in a bucket with a given date to the files contained in the bucket.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} bucket Bucket name.
|
|
30
|
+
* @param {string} date Date to compare against.
|
|
31
|
+
* @returns {void}
|
|
32
|
+
*/
|
|
33
|
+
exports.scriptComparision = async (bucket, date = null) => {
|
|
34
|
+
if (bucket) {
|
|
35
|
+
const day = date ? stringToDateUTC(date) : new Date();
|
|
36
|
+
const filename = mergeFilename(day, "filelist", "txt");
|
|
37
|
+
const content = await txtContentToArray(filename, bucket);
|
|
38
|
+
const files = await listFiles(bucket);
|
|
39
|
+
const missed = content.filter(file => !files.includes(file));
|
|
40
|
+
return missed;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -24,24 +24,26 @@ const {
|
|
|
24
24
|
splitName
|
|
25
25
|
} = require("../naming/split");
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Removes all not allowed files in given bucket.
|
|
29
|
-
*
|
|
30
|
-
* @param {string} bucket Bucket name.
|
|
31
|
-
* @param {string} folder Path of the local folder to scan for schemas.
|
|
32
|
-
* @returns {void}
|
|
27
|
+
/**
|
|
28
|
+
* Removes all not allowed files in given bucket.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} bucket Bucket name.
|
|
31
|
+
* @param {string} folder Path of the local folder to scan for schemas.
|
|
32
|
+
* @returns {void}
|
|
33
33
|
*/
|
|
34
34
|
exports.scriptUnlistened = async (bucket, folder) => {
|
|
35
35
|
if (bucket) {
|
|
36
36
|
const storage = getStorage();
|
|
37
37
|
const [files] = await getFiles(storage, bucket);
|
|
38
|
-
files
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
if (files) {
|
|
39
|
+
files.forEach(file => {
|
|
40
|
+
const {
|
|
41
|
+
name
|
|
42
|
+
} = splitName(file.id);
|
|
43
|
+
if (!hasSchema(name, folder)) {
|
|
44
|
+
deleteFile(file);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
46
48
|
}
|
|
47
49
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pittica/google-business-intelligence-helpers",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.13.0",
|
|
5
5
|
"description": "Helpers for business intelligence for Google Cloud.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rimraf ./dist && mkdirp ./dist && babel src --out-dir dist --copy-files",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
|
-
"unlistened": "npm run build && run-func ./dist/scripts/unlistened.js scriptUnlistened"
|
|
10
|
+
"unlistened": "npm run build && run-func ./dist/scripts/unlistened.js scriptUnlistened",
|
|
11
|
+
"comparision": "npm run build && run-func ./dist/scripts/comparision.js scriptComparision"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
@@ -26,13 +27,14 @@
|
|
|
26
27
|
},
|
|
27
28
|
"homepage": "https://github.com/pittica/google-business-intelligence-helpers#README.md",
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@pittica/google-cloud-storage-helpers": "^1.
|
|
30
|
-
"date-and-time": "^4.
|
|
30
|
+
"@pittica/google-cloud-storage-helpers": "^1.5.0",
|
|
31
|
+
"date-and-time": "^4.5.2"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@babel/cli": "^7.
|
|
34
|
+
"@babel/cli": "^7.29.7",
|
|
34
35
|
"mkdirp": "^3.0.1",
|
|
35
|
-
"prettier": "^3.
|
|
36
|
-
"rimraf": "^6.1.
|
|
36
|
+
"prettier": "^3.9.6",
|
|
37
|
+
"rimraf": "^6.1.3",
|
|
38
|
+
"run-func": "^3.0.0"
|
|
37
39
|
}
|
|
38
40
|
}
|