@engine9-io/input-tools 1.8.3 → 1.8.4
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/file/FileUtilities.js +21 -11
- package/file/Parquet.js +4 -1
- package/package.json +1 -1
- package/timelineTypes.js +7 -4
package/file/FileUtilities.js
CHANGED
|
@@ -812,20 +812,30 @@ Worker.prototype.move.metadata = {
|
|
|
812
812
|
|
|
813
813
|
Worker.prototype.stat = async function ({ filename }) {
|
|
814
814
|
if (!filename) throw new Error('filename is required');
|
|
815
|
+
const output = {};
|
|
816
|
+
|
|
817
|
+
if (filename.slice(-8) === '.parquet') {
|
|
818
|
+
const pq = new ParquetWorker(this);
|
|
819
|
+
output.schema = await pq.schema({ filename });
|
|
820
|
+
output.records = (await pq.meta({ filename }))?.records;
|
|
821
|
+
}
|
|
822
|
+
|
|
815
823
|
if (filename.startsWith('s3://') || filename.startsWith('r2://')) {
|
|
816
824
|
const worker = new (filename.startsWith('r2://') ? R2Worker : S3Worker)(this);
|
|
817
|
-
|
|
825
|
+
Object.assign(output, await worker.stat({ filename }));
|
|
826
|
+
} else {
|
|
827
|
+
const { ctime, birthtime, size } = await fsp.stat(filename);
|
|
828
|
+
const modifiedAt = new Date(ctime);
|
|
829
|
+
let createdAt = birthtime;
|
|
830
|
+
if (createdAt === 0 || !createdAt) createdAt = ctime;
|
|
831
|
+
createdAt = new Date(createdAt);
|
|
832
|
+
Object.assign(output, {
|
|
833
|
+
createdAt,
|
|
834
|
+
modifiedAt,
|
|
835
|
+
size
|
|
836
|
+
});
|
|
818
837
|
}
|
|
819
|
-
|
|
820
|
-
const modifiedAt = new Date(ctime);
|
|
821
|
-
let createdAt = birthtime;
|
|
822
|
-
if (createdAt === 0 || !createdAt) createdAt = ctime;
|
|
823
|
-
createdAt = new Date(createdAt);
|
|
824
|
-
return {
|
|
825
|
-
createdAt,
|
|
826
|
-
modifiedAt,
|
|
827
|
-
size
|
|
828
|
-
};
|
|
838
|
+
return output;
|
|
829
839
|
};
|
|
830
840
|
Worker.prototype.stat.metadata = {
|
|
831
841
|
options: {
|
package/file/Parquet.js
CHANGED
|
@@ -24,8 +24,11 @@ async function getReader(options) {
|
|
|
24
24
|
|
|
25
25
|
Worker.prototype.meta = async function (options) {
|
|
26
26
|
const reader = await getReader(options);
|
|
27
|
+
const schema = reader.getSchema();
|
|
27
28
|
return {
|
|
28
|
-
|
|
29
|
+
//stored as a buffer
|
|
30
|
+
schema,
|
|
31
|
+
records: parseInt(reader.metadata?.num_rows?.toString(), 10)
|
|
29
32
|
};
|
|
30
33
|
// getMetadata();
|
|
31
34
|
};
|
package/package.json
CHANGED
package/timelineTypes.js
CHANGED
|
@@ -64,6 +64,7 @@ const MESSAGE_DELIVERY_FAILURE_SHOULD_RETRY = 66;
|
|
|
64
64
|
const MESSAGE_DELIVERY_FAILURE_SHOULD_NOT_RETRY = 66;
|
|
65
65
|
|
|
66
66
|
const FORM_ADVOCACY = 66;
|
|
67
|
+
const FORM_SURVEY = 67;
|
|
67
68
|
|
|
68
69
|
const FILE_IMPORT = 70;
|
|
69
70
|
|
|
@@ -128,6 +129,7 @@ const TIMELINE_ENTRY_TYPES = {
|
|
|
128
129
|
FORM_PETITION,
|
|
129
130
|
FORM_PETITION_CONTACT_TARGET,
|
|
130
131
|
FORM_ADVOCACY,
|
|
132
|
+
FORM_SURVEY,
|
|
131
133
|
|
|
132
134
|
MESSAGE_CONVERSION,
|
|
133
135
|
MESSAGE_CONVERSION_ADVOCACY,
|
|
@@ -138,10 +140,11 @@ const TIMELINE_ENTRY_TYPES = {
|
|
|
138
140
|
FILE_IMPORT,
|
|
139
141
|
EXPORT,
|
|
140
142
|
EXPORT_FOR_REMOTE,
|
|
141
|
-
EXPORT_FOR_MESSAGING
|
|
142
|
-
|
|
143
|
+
EXPORT_FOR_MESSAGING
|
|
143
144
|
};
|
|
144
|
-
Object.entries(TIMELINE_ENTRY_TYPES).forEach(([k, v]) => {
|
|
145
|
+
Object.entries(TIMELINE_ENTRY_TYPES).forEach(([k, v]) => {
|
|
146
|
+
TIMELINE_ENTRY_TYPES[v] = k;
|
|
147
|
+
});
|
|
145
148
|
module.exports = {
|
|
146
|
-
TIMELINE_ENTRY_TYPES
|
|
149
|
+
TIMELINE_ENTRY_TYPES
|
|
147
150
|
};
|