@@ -101,104 +101,3 @@ export const fromAthena = (event, options = {}) => fromSqs(event)
101101 event : JSON . parse ( uow . record . body ) ,
102102 } ) )
103103 . map ( faulty ( toEventEnvelope ) ) ;
104-
105- // // uow.record.s3.s3.object.key.match(opt.pk || /table=(\d+)\/year=(\d+)\/month=(\d+)\/day=(\d+)\/hour=(\d+)\/minute=(\d+)/),
106-
107- // export const decodeKey = (key) => decodeURIComponent(key)
108- // .split('/')
109- // .reduce((a, c, i, r) => {
110- // if (c.includes('=')) {
111- // const [k, v] = c.split('=');
112- // return {
113- // ...a,
114- // [k]: v,
115- // };
116- // } else if (c.includes('.')) {
117- // const [k, v] = c.split('.');
118- // return {
119- // ...a,
120- // file: k,
121- // contentType: v, // TODO .metadata ???
122- // };
123- // } else if (r[r.length - 1] === c) {
124- // return {
125- // ...a,
126- // file: c,
127- // };
128- // } else {
129- // return {
130- // ...a,
131- // prefix: [...a.prefix, c],
132- // };
133- // }
134- // }, {
135- // prefix: [],
136- // });
137-
138- // export const buildS3PartitionKey = (key, level = 1) => key.split('/').slice(0, -level).join('/');
139-
140- // export const mapPartition = (uow) => ({
141- // event: {
142- // id: uow.record.sqs.messageId, // `${uow.record.s3.s3.object.key}-${uow.record.s3.s3.object.eTag}`, // sequencer
143- // type: uow.record.s3.eventName,
144- // timestamp: (new Date(uow.record.s3.eventTime)).getTime(),
145- // partitionKey: buildS3PartitionKey(decodeURIComponent(uow.record.s3.s3.object.key)),
146- // // tags: {
147- // // // account
148- // // // region
149- // // },
150- // notification: {
151- // type: uow.record.s3.eventName,
152- // bucket: uow.record.s3.s3.bucket.name,
153- // key: decodeURIComponent(uow.record.s3.s3.object.key),
154- // partition: decodeKey(uow.record.s3.s3.object.key),
155- // },
156- // raw: uow.record.s3,
157- // },
158- // });
159-
160- // export const mapJobRequest = (uow) => ({
161- // getJobRequest: {
162- // Bucket: uow.record.s3.s3.bucket.name,
163- // Key: uow.record.s3.s3.object.key,
164- // VersionId: uow.record.s3.s3.object.versionId,
165- // },
166- // });
167-
168- // export const fromS3 = (event, options = {}) => fromSqsSnsS3(event)
169- // .map((uow) => ({
170- // ...uow,
171- // isJob: uow.record.s3.s3.object.key.includes('/jobs/'),
172- // }))
173- // .map((uow) => ({
174- // ...uow,
175- // ...(!uow.isJob && mapPartition(uow)),
176- // ...(uow.isJob && mapJobRequest(uow)),
177- // }))
178- // .through(getObjectFromS3({
179- // id: 'handler:fromS3',
180- // getRequestField: 'getJobRequest',
181- // getResponseField: 'getJobResponse',
182- // additionalClientOpts: {
183- // followRegionRedirects: true,
184- // },
185- // ...options,
186- // }))
187- // .map(faulty((uow) => {
188- // if (!uow.getJobResponse) return uow;
189-
190- // const job = JSON.parse(Buffer.from(uow.getJobResponse.Body));
191- // return ({
192- // ...uow,
193- // event: {
194- // id: uow.record.sqs.messageId,
195- // type: job.type,
196- // timestamp: (new Date(uow.record.s3.eventTime)).getTime(),
197- // job: {
198- // id: uow.record.s3.s3.object.versionId,
199- // ...job,
200- // },
201- // raw: uow.event,
202- // },
203- // });
204- // }));
0 commit comments