(existing: boolean)
| 58 | ...passwordFields, |
| 59 | { id: 'notesPlain', label: 'notesPlain', type: 'STRING', purpose: 'NOTES', value: '' } |
| 60 | ], |
| 61 | sections: [] |
| 62 | })); |
| 63 | } else if (args[0] === 'item' && args[1] === 'create') { |
| 64 | // Mirrors 1Password's real server-side validation for the PASSWORD category: |
| 65 | // an item cannot be created unless one of its fields carries a populated |
| 66 | // \`purpose: 'PASSWORD'\` value. |
| 67 | let item = {}; |
| 68 | try { item = JSON.parse(templateInput); } catch {} |
| 69 | const fields = Array.isArray(item.fields) ? item.fields : []; |
| 70 | const hasPasswordPurpose = fields.some(field => field && field.purpose === 'PASSWORD' && field.value); |
| 71 | if (item.category === 'PASSWORD' && !hasPasswordPurpose) { |
| 72 | process.stderr.write('[ItemValidator] has found 1 errors, 0 warnings: \\nErrors:{1. Password item requires ps value}\\n'); |
| 73 | process.exitCode = 1; |
| 74 | } else { |
| 75 | process.stdout.write(templateInput || stdin); |
| 76 | } |
| 77 | } else if (args[0] === 'item' && args[1] === 'edit') { |
| 78 | process.stdout.write(templateInput || stdin); |
| 79 | } else { |
| 80 | process.exitCode = 1; |
| 81 | } |
| 82 | `; |
| 83 | |
| 84 | const FAKE_OP_AUTH_FAILURE = `#!/usr/bin/env node |
| 85 | process.stderr.write('You are not currently signed in to a 1Password account.\\n'); |
| 86 | process.exitCode = 1; |
| 87 | `; |
| 88 | |
| 89 | const FAKE_PNPM_REDEPLOY = `#!/usr/bin/env node |
| 90 | const fs = require('node:fs'); |
| 91 | const args = process.argv.slice(2); |
no test coverage detected