@ossy/deployment-tools 0.0.28 → 0.0.30
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/dist/619.index.js +2 -0
- package/dist/619.index.js.map +1 -0
- package/dist/index.js +37 -27
- package/dist/index.js.map +1 -0
- package/dist/sourcemap-register.cjs +1 -0
- package/package.json +2 -2
- package/src/aws-credentials-client.ts +24 -16
- package/src/deployment-platform-client.ts +5 -3
- package/src/deployment-queue-client.ts +1 -1
- package/src/log/index.ts +1 -1
- package/src/types/index.ts +1 -1
package/dist/619.index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"619.index.js","mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://@ossy/deployment-tools/./node_modules/node-fetch/src/utils/multipart-parser.js"],"sourcesContent":["import {File} from 'fetch-blob/from.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\n\nlet s = 0;\nconst S = {\n\tSTART_BOUNDARY: s++,\n\tHEADER_FIELD_START: s++,\n\tHEADER_FIELD: s++,\n\tHEADER_VALUE_START: s++,\n\tHEADER_VALUE: s++,\n\tHEADER_VALUE_ALMOST_DONE: s++,\n\tHEADERS_ALMOST_DONE: s++,\n\tPART_DATA_START: s++,\n\tPART_DATA: s++,\n\tEND: s++\n};\n\nlet f = 1;\nconst F = {\n\tPART_BOUNDARY: f,\n\tLAST_BOUNDARY: f *= 2\n};\n\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst HYPHEN = 45;\nconst COLON = 58;\nconst A = 97;\nconst Z = 122;\n\nconst lower = c => c | 0x20;\n\nconst noop = () => {};\n\nclass MultipartParser {\n\t/**\n\t * @param {string} boundary\n\t */\n\tconstructor(boundary) {\n\t\tthis.index = 0;\n\t\tthis.flags = 0;\n\n\t\tthis.onHeaderEnd = noop;\n\t\tthis.onHeaderField = noop;\n\t\tthis.onHeadersEnd = noop;\n\t\tthis.onHeaderValue = noop;\n\t\tthis.onPartBegin = noop;\n\t\tthis.onPartData = noop;\n\t\tthis.onPartEnd = noop;\n\n\t\tthis.boundaryChars = {};\n\n\t\tboundary = '\\r\\n--' + boundary;\n\t\tconst ui8a = new Uint8Array(boundary.length);\n\t\tfor (let i = 0; i < boundary.length; i++) {\n\t\t\tui8a[i] = boundary.charCodeAt(i);\n\t\t\tthis.boundaryChars[ui8a[i]] = true;\n\t\t}\n\n\t\tthis.boundary = ui8a;\n\t\tthis.lookbehind = new Uint8Array(this.boundary.length + 8);\n\t\tthis.state = S.START_BOUNDARY;\n\t}\n\n\t/**\n\t * @param {Uint8Array} data\n\t */\n\twrite(data) {\n\t\tlet i = 0;\n\t\tconst length_ = data.length;\n\t\tlet previousIndex = this.index;\n\t\tlet {lookbehind, boundary, boundaryChars, index, state, flags} = this;\n\t\tconst boundaryLength = this.boundary.length;\n\t\tconst boundaryEnd = boundaryLength - 1;\n\t\tconst bufferLength = data.length;\n\t\tlet c;\n\t\tlet cl;\n\n\t\tconst mark = name => {\n\t\t\tthis[name + 'Mark'] = i;\n\t\t};\n\n\t\tconst clear = name => {\n\t\t\tdelete this[name + 'Mark'];\n\t\t};\n\n\t\tconst callback = (callbackSymbol, start, end, ui8a) => {\n\t\t\tif (start === undefined || start !== end) {\n\t\t\t\tthis[callbackSymbol](ui8a && ui8a.subarray(start, end));\n\t\t\t}\n\t\t};\n\n\t\tconst dataCallback = (name, clear) => {\n\t\t\tconst markSymbol = name + 'Mark';\n\t\t\tif (!(markSymbol in this)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clear) {\n\t\t\t\tcallback(name, this[markSymbol], i, data);\n\t\t\t\tdelete this[markSymbol];\n\t\t\t} else {\n\t\t\t\tcallback(name, this[markSymbol], data.length, data);\n\t\t\t\tthis[markSymbol] = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (i = 0; i < length_; i++) {\n\t\t\tc = data[i];\n\n\t\t\tswitch (state) {\n\t\t\t\tcase S.START_BOUNDARY:\n\t\t\t\t\tif (index === boundary.length - 2) {\n\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else if (c !== CR) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (index - 1 === boundary.length - 2) {\n\t\t\t\t\t\tif (flags & F.LAST_BOUNDARY && c === HYPHEN) {\n\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c !== boundary[index + 2]) {\n\t\t\t\t\t\tindex = -2;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === boundary[index + 2]) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_FIELD_START:\n\t\t\t\t\tstate = S.HEADER_FIELD;\n\t\t\t\t\tmark('onHeaderField');\n\t\t\t\t\tindex = 0;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_FIELD:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tclear('onHeaderField');\n\t\t\t\t\t\tstate = S.HEADERS_ALMOST_DONE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === COLON) {\n\t\t\t\t\t\tif (index === 1) {\n\t\t\t\t\t\t\t// empty header field\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdataCallback('onHeaderField', true);\n\t\t\t\t\t\tstate = S.HEADER_VALUE_START;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcl = lower(c);\n\t\t\t\t\tif (cl < A || cl > Z) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_START:\n\t\t\t\t\tif (c === SPACE) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tmark('onHeaderValue');\n\t\t\t\t\tstate = S.HEADER_VALUE;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_VALUE:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tdataCallback('onHeaderValue', true);\n\t\t\t\t\t\tcallback('onHeaderEnd');\n\t\t\t\t\t\tstate = S.HEADER_VALUE_ALMOST_DONE;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADERS_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback('onHeadersEnd');\n\t\t\t\t\tstate = S.PART_DATA_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.PART_DATA_START:\n\t\t\t\t\tstate = S.PART_DATA;\n\t\t\t\t\tmark('onPartData');\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.PART_DATA:\n\t\t\t\t\tpreviousIndex = index;\n\n\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t// boyer-moore derrived algorithm to safely skip non-boundary data\n\t\t\t\t\t\ti += boundaryEnd;\n\t\t\t\t\t\twhile (i < bufferLength && !(data[i] in boundaryChars)) {\n\t\t\t\t\t\t\ti += boundaryLength;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti -= boundaryEnd;\n\t\t\t\t\t\tc = data[i];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index < boundary.length) {\n\t\t\t\t\t\tif (boundary[index] === c) {\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdataCallback('onPartData', true);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === boundary.length) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\t\t// CR = part boundary\n\t\t\t\t\t\t\tflags |= F.PART_BOUNDARY;\n\t\t\t\t\t\t} else if (c === HYPHEN) {\n\t\t\t\t\t\t\t// HYPHEN = end boundary\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index - 1 === boundary.length) {\n\t\t\t\t\t\tif (flags & F.PART_BOUNDARY) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tif (c === LF) {\n\t\t\t\t\t\t\t\t// unset the PART_BOUNDARY flag\n\t\t\t\t\t\t\t\tflags &= ~F.PART_BOUNDARY;\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (flags & F.LAST_BOUNDARY) {\n\t\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\t// when matching a possible boundary, keep a lookbehind reference\n\t\t\t\t\t\t// in case it turns out to be a false lead\n\t\t\t\t\t\tlookbehind[index - 1] = c;\n\t\t\t\t\t} else if (previousIndex > 0) {\n\t\t\t\t\t\t// if our boundary turned out to be rubbish, the captured lookbehind\n\t\t\t\t\t\t// belongs to partData\n\t\t\t\t\t\tconst _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);\n\t\t\t\t\t\tcallback('onPartData', 0, previousIndex, _lookbehind);\n\t\t\t\t\t\tpreviousIndex = 0;\n\t\t\t\t\t\tmark('onPartData');\n\n\t\t\t\t\t\t// reconsider the current character even so it interrupted the sequence\n\t\t\t\t\t\t// it could be the beginning of a new sequence\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.END:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unexpected state entered: ${state}`);\n\t\t\t}\n\t\t}\n\n\t\tdataCallback('onHeaderField');\n\t\tdataCallback('onHeaderValue');\n\t\tdataCallback('onPartData');\n\n\t\t// Update properties for the next call\n\t\tthis.index = index;\n\t\tthis.state = state;\n\t\tthis.flags = flags;\n\t}\n\n\tend() {\n\t\tif ((this.state === S.HEADER_FIELD_START && this.index === 0) ||\n\t\t\t(this.state === S.PART_DATA && this.index === this.boundary.length)) {\n\t\t\tthis.onPartEnd();\n\t\t} else if (this.state !== S.END) {\n\t\t\tthrow new Error('MultipartParser.end(): stream ended unexpectedly');\n\t\t}\n\t}\n}\n\nfunction _fileName(headerValue) {\n\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\tconst m = headerValue.match(/\\bfilename=(\"(.*?)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))($|;\\s)/i);\n\tif (!m) {\n\t\treturn;\n\t}\n\n\tconst match = m[2] || m[3] || '';\n\tlet filename = match.slice(match.lastIndexOf('\\\\') + 1);\n\tfilename = filename.replace(/%22/g, '\"');\n\tfilename = filename.replace(/&#(\\d{4});/g, (m, code) => {\n\t\treturn String.fromCharCode(code);\n\t});\n\treturn filename;\n}\n\nexport async function toFormData(Body, ct) {\n\tif (!/multipart/i.test(ct)) {\n\t\tthrow new TypeError('Failed to fetch');\n\t}\n\n\tconst m = ct.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n\n\tif (!m) {\n\t\tthrow new TypeError('no or bad content-type header, no multipart boundary');\n\t}\n\n\tconst parser = new MultipartParser(m[1] || m[2]);\n\n\tlet headerField;\n\tlet headerValue;\n\tlet entryValue;\n\tlet entryName;\n\tlet contentType;\n\tlet filename;\n\tconst entryChunks = [];\n\tconst formData = new FormData();\n\n\tconst onPartData = ui8a => {\n\t\tentryValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tconst appendToFile = ui8a => {\n\t\tentryChunks.push(ui8a);\n\t};\n\n\tconst appendFileToFormData = () => {\n\t\tconst file = new File(entryChunks, filename, {type: contentType});\n\t\tformData.append(entryName, file);\n\t};\n\n\tconst appendEntryToFormData = () => {\n\t\tformData.append(entryName, entryValue);\n\t};\n\n\tconst decoder = new TextDecoder('utf-8');\n\tdecoder.decode();\n\n\tparser.onPartBegin = function () {\n\t\tparser.onPartData = onPartData;\n\t\tparser.onPartEnd = appendEntryToFormData;\n\n\t\theaderField = '';\n\t\theaderValue = '';\n\t\tentryValue = '';\n\t\tentryName = '';\n\t\tcontentType = '';\n\t\tfilename = null;\n\t\tentryChunks.length = 0;\n\t};\n\n\tparser.onHeaderField = function (ui8a) {\n\t\theaderField += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderValue = function (ui8a) {\n\t\theaderValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderEnd = function () {\n\t\theaderValue += decoder.decode();\n\t\theaderField = headerField.toLowerCase();\n\n\t\tif (headerField === 'content-disposition') {\n\t\t\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\t\t\tconst m = headerValue.match(/\\bname=(\"([^\"]*)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))/i);\n\n\t\t\tif (m) {\n\t\t\t\tentryName = m[2] || m[3] || '';\n\t\t\t}\n\n\t\t\tfilename = _fileName(headerValue);\n\n\t\t\tif (filename) {\n\t\t\t\tparser.onPartData = appendToFile;\n\t\t\t\tparser.onPartEnd = appendFileToFormData;\n\t\t\t}\n\t\t} else if (headerField === 'content-type') {\n\t\t\tcontentType = headerValue;\n\t\t}\n\n\t\theaderValue = '';\n\t\theaderField = '';\n\t};\n\n\tfor await (const chunk of Body) {\n\t\tparser.write(chunk);\n\t}\n\n\tparser.end();\n\n\treturn formData;\n}\n"],"names":[],"sourceRoot":""}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
|
|
2
|
+
import './sourcemap-register.cjs';import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
|
|
3
3
|
/******/ var __webpack_modules__ = ({
|
|
4
4
|
|
|
5
5
|
/***/ 3625:
|
|
@@ -58356,7 +58356,7 @@ var __webpack_exports__ = {};
|
|
|
58356
58356
|
const log = ({ type, message, error } = { type: 'info', message: '' }) => {
|
|
58357
58357
|
const messagePrefix = `[${type.toUpperCase()}]${message.startsWith('[') ? '' : ': '}`;
|
|
58358
58358
|
console.log(`${messagePrefix}${message}`);
|
|
58359
|
-
error && console.log('\
|
|
58359
|
+
error && console.log('\n[Reason]:', error, '\n');
|
|
58360
58360
|
};
|
|
58361
58361
|
|
|
58362
58362
|
// EXTERNAL MODULE: ./node_modules/arg/index.js
|
|
@@ -60536,7 +60536,7 @@ class CaddyClient {
|
|
|
60536
60536
|
}
|
|
60537
60537
|
]))
|
|
60538
60538
|
})
|
|
60539
|
-
.catch(
|
|
60539
|
+
.catch(error => log({ type: 'error', message: `[CaddyClient] Could not update caddy config to include ${url}`, error }));
|
|
60540
60540
|
}
|
|
60541
60541
|
static applyDefaultServerConfig(deploymentPlatform) {
|
|
60542
60542
|
log({ type: 'info', message: '[CaddyClient] Applying default caddy config' });
|
|
@@ -60601,7 +60601,7 @@ class CaddyClient {
|
|
|
60601
60601
|
}
|
|
60602
60602
|
})
|
|
60603
60603
|
})
|
|
60604
|
-
.catch(
|
|
60604
|
+
.catch(error => log({ type: 'error', message: '[CaddyClient] Could not apply default caddy config', error }));
|
|
60605
60605
|
}
|
|
60606
60606
|
}
|
|
60607
60607
|
|
|
@@ -60734,28 +60734,36 @@ var client_sts_dist_cjs = __nccwpck_require__(11451);
|
|
|
60734
60734
|
;// CONCATENATED MODULE: ./src/aws-credentials-client.ts
|
|
60735
60735
|
|
|
60736
60736
|
|
|
60737
|
+
|
|
60737
60738
|
class AwsCredentialsClient {
|
|
60738
|
-
static resolveAwsCredentials(
|
|
60739
|
+
static resolveAwsCredentials({ awsAccountId, awsRegion, awsRoleToAssume }) {
|
|
60739
60740
|
// If awsRoleToAssume is present, then we assume we run in a github workflow
|
|
60740
60741
|
// If awsRoleToAssume is not present, then we assume they are resolved localy by aws-sdk
|
|
60741
|
-
|
|
60742
|
-
|
|
60743
|
-
|
|
60744
|
-
|
|
60745
|
-
static getTemporaryCredentials({ awsAccountId, awsRegion, awsRoleToAssume }) {
|
|
60742
|
+
if (!awsRoleToAssume) {
|
|
60743
|
+
log({ type: 'info', message: `[AwsCredentialsClient] No aws role to assume was found, leaving auth logic to @aws-sdk package` });
|
|
60744
|
+
return Promise.resolve(undefined);
|
|
60745
|
+
}
|
|
60746
60746
|
const stsClient = new client_sts_dist_cjs.STSClient({ region: awsRegion });
|
|
60747
|
+
log({ type: 'info', message: '[AwsCredentialsClient] Fetching GitHub ID token' });
|
|
60747
60748
|
return core.getIDToken('sts.amazonaws.com')
|
|
60748
|
-
.then(webIdentityToken =>
|
|
60749
|
-
|
|
60750
|
-
|
|
60751
|
-
|
|
60752
|
-
|
|
60753
|
-
|
|
60749
|
+
.then(webIdentityToken => {
|
|
60750
|
+
log({ type: 'info', message: `[AwsCredentialsClient] Attempting to resolve aws credentials by assuming the role: ${awsRoleToAssume}` });
|
|
60751
|
+
return stsClient.send(new client_sts_dist_cjs.AssumeRoleWithWebIdentityCommand({
|
|
60752
|
+
RoleArn: `arn:aws:iam::${awsAccountId}:role/${awsRoleToAssume}`,
|
|
60753
|
+
RoleSessionName: 'GitHubActions',
|
|
60754
|
+
DurationSeconds: 15 * 60,
|
|
60755
|
+
WebIdentityToken: webIdentityToken
|
|
60756
|
+
}));
|
|
60757
|
+
})
|
|
60754
60758
|
.then(responseData => ({
|
|
60755
|
-
|
|
60756
|
-
|
|
60757
|
-
|
|
60758
|
-
}))
|
|
60759
|
+
AccessKeyId: responseData.Credentials.AccessKeyId,
|
|
60760
|
+
SessionToken: responseData.Credentials.SessionToken,
|
|
60761
|
+
SecretAccessKey: responseData.Credentials.SecretAccessKey,
|
|
60762
|
+
}))
|
|
60763
|
+
.catch(error => {
|
|
60764
|
+
log({ type: 'error', message: '[AwsCredentialsClient] Could not resolve temporary credentials', error });
|
|
60765
|
+
return undefined;
|
|
60766
|
+
});
|
|
60759
60767
|
}
|
|
60760
60768
|
}
|
|
60761
60769
|
|
|
@@ -60765,7 +60773,7 @@ class AwsCredentialsClient {
|
|
|
60765
60773
|
|
|
60766
60774
|
class DeploymentQueueClient {
|
|
60767
60775
|
static sendDeploymentRequest(deploymentPlatform, deploymentRequest) {
|
|
60768
|
-
log({ type: 'info', message: '[DeploymentQueueClient]
|
|
60776
|
+
log({ type: 'info', message: '[DeploymentQueueClient] Starting deployment sequence' });
|
|
60769
60777
|
return DeploymentQueueClient.createAwsSqsClient(deploymentPlatform)
|
|
60770
60778
|
.then(sqsClient => {
|
|
60771
60779
|
const command = new dist_cjs.SendMessageCommand({
|
|
@@ -60798,10 +60806,10 @@ class DeploymentQueueClient {
|
|
|
60798
60806
|
});
|
|
60799
60807
|
sqsClient.send(deleteMessageCommand)
|
|
60800
60808
|
.then(() => log({ type: 'info', message: '[DeploymentQueueClient] Removing deployment request from queue' }))
|
|
60801
|
-
.catch(
|
|
60809
|
+
.catch(error => log({ type: 'error', message: '[DeploymentQueueClient] Could not delete message from queue', error }));
|
|
60802
60810
|
});
|
|
60803
60811
|
}))
|
|
60804
|
-
.catch(
|
|
60812
|
+
.catch(error => log({ type: 'error', message: '[ContainerManagerServer] Could not handle incoming deployment request', error }));
|
|
60805
60813
|
}, FIVE_MINUTES);
|
|
60806
60814
|
});
|
|
60807
60815
|
}
|
|
@@ -60860,7 +60868,7 @@ class DeploymentPlatformClient {
|
|
|
60860
60868
|
return Promise.resolve();
|
|
60861
60869
|
});
|
|
60862
60870
|
})
|
|
60863
|
-
.catch(
|
|
60871
|
+
.catch(error => log({ type: 'error', message: '[DeploymentPlatformClient] Could not start the deployment platform', error }));
|
|
60864
60872
|
}
|
|
60865
60873
|
//eslint-disable-next-line max-params
|
|
60866
60874
|
static deploy(username, authentication, targetEnvironment, pathToDeploymentPlatforms, pathToOssyFile) {
|
|
@@ -60872,7 +60880,7 @@ class DeploymentPlatformClient {
|
|
|
60872
60880
|
deploymentTemplates.map(deploymentTemplate => {
|
|
60873
60881
|
log({
|
|
60874
60882
|
type: 'info',
|
|
60875
|
-
message: `[DeploymentPlatformClient]: Found deployment platforms [${platforms.join(', ')}]`
|
|
60883
|
+
message: `[DeploymentPlatformClient]: Found deployment platforms [${platforms.map(x => x.platformName).join(', ')}]`
|
|
60876
60884
|
});
|
|
60877
60885
|
const deploymentPlatform = platforms.find(platform => platform.platformName === deploymentTemplate.targetDeploymentPlatform);
|
|
60878
60886
|
if (!deploymentPlatform) {
|
|
@@ -60888,7 +60896,7 @@ class DeploymentPlatformClient {
|
|
|
60888
60896
|
return DeploymentQueueClient.sendDeploymentRequest(deploymentPlatform, deploymentRequest);
|
|
60889
60897
|
});
|
|
60890
60898
|
})
|
|
60891
|
-
.catch(error =>
|
|
60899
|
+
.catch(error => log({ type: 'error', message: '[DeploymentPlatformClient] Could not send deployment request', error }));
|
|
60892
60900
|
}
|
|
60893
60901
|
static getDeploymentTemplates(pathToOssyFile) {
|
|
60894
60902
|
const ossyfile = JSON.parse((0,external_fs_.readFileSync)((0,external_path_.resolve)(pathToOssyFile), 'utf8'));
|
|
@@ -60909,7 +60917,7 @@ class DeploymentPlatformClient {
|
|
|
60909
60917
|
return DeploymentPlatformClient.setCalculatedDeploymentPlatformValues(DeploymentPlatformClient.setDefaultDeploymentPlatformValues(deploymentPlatform));
|
|
60910
60918
|
}
|
|
60911
60919
|
static setDefaultDeploymentPlatformValues(deploymentPlatform) {
|
|
60912
|
-
return Object.assign({ platformName: SupportedEnvironments.LOCAL, domain: 'localhost', activeEnvironment: SupportedEnvironments.LOCAL, supportedDeploymentTypes: ['CONTAINER'], ciSubDomain: 'ci', ciInternalServerPort: 3000, ciServerName: 'ci-client', ciDockerNetworkName: 'deployment-tools' }, deploymentPlatform);
|
|
60920
|
+
return Object.assign({ platformName: SupportedEnvironments.LOCAL, domain: 'localhost', activeEnvironment: SupportedEnvironments.LOCAL, supportedDeploymentTypes: ['CONTAINER'], ciSubDomain: 'ci', ciInternalServerPort: 3000, ciServerName: 'ci-client', ciDockerNetworkName: 'deployment-tools', awsRegion: SupportedRegions.North }, deploymentPlatform);
|
|
60913
60921
|
}
|
|
60914
60922
|
static setCalculatedDeploymentPlatformValues(deploymentPlatform) {
|
|
60915
60923
|
return Object.assign({ awsDeploymentSqsArn: `https://sqs.${deploymentPlatform.awsRegion}.amazonaws.com/${deploymentPlatform.awsAccountId}/${deploymentPlatform.platformName}-${deploymentPlatform.activeEnvironment}` }, deploymentPlatform);
|
|
@@ -61003,3 +61011,5 @@ runCliCommand({ name: command, args: restArgs });
|
|
|
61003
61011
|
|
|
61004
61012
|
})();
|
|
61005
61013
|
|
|
61014
|
+
|
|
61015
|
+
//# sourceMappingURL=index.js.map
|