Skip to content

Instantly share code, notes, and snippets.

@lobot

lobot/old_code Secret

Created August 1, 2022 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lobot/355d8427de567d9b2c5b083bcf9f6073 to your computer and use it in GitHub Desktop.
Save lobot/355d8427de567d9b2c5b083bcf9f6073 to your computer and use it in GitHub Desktop.
Rich_old_code
/*
* To do its job, the PDFer only needs -
* 1. resource_id/order_id
* 2. picasso.use_preflight feature flag
* However, UpdateOrder and Thumbnailer need more and therefore it gets passed
* more than what it needs. We'll have to refactor the flow to get past this
* undesirable situation. To minimize the spillover of larger than needed objects
* within this code, we use this method to return only whats needed.
* This should also help in refactoring later.
*/
function getWhatsRequired(msg) {
const id = msg.resource.id;
const required = {
id,
resource_type: msg.resource_type,
receiptHandle: msg.receiptHandle,
rawUri: '/' + id.substring(id.indexOf('_') + 1) + '/' + id + '_raw.pdf',
rawX1a: '/' + id.substring(id.indexOf('_') + 1) + '/' + id + '_raw.pdfx',
rawNonX1a:
'/' + id.substring(id.indexOf('_') + 1) + '/' + id + '_raw_non_x1a.pdf',
proofUri: '/' + id.substring(id.indexOf('_') + 1) + '/' + id + '.pdf',
proofX1a: '/' + id.substring(id.indexOf('_') + 1) + '/' + id + '.pdfx',
proofNonX1a:
'/' + id.substring(id.indexOf('_') + 1) + '/' + id + '_non_x1a.pdf',
usePreflight:
msg.launch_darkly_flags['picasso.use_preflight'] === 1 ? true : false,
strictPreflight:
msg.launch_darkly_flags['picasso.strict_preflight'] === 1 ? true : false,
};
return required;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment