workflow_launcher/node_modules/builder-util-runtime/out/uuid.js.map
2024-03-12 12:57:14 +01:00

1 line
12 KiB
Plaintext

{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../src/uuid.ts"],"names":[],"mappings":";;;AAAA,mCAAgD;AAChD,mCAAkC;AAElC,MAAM,WAAW,GAAG,kDAAkD,CAAA;AAEtE,2CAA2C;AAC3C,MAAM,UAAU,GAAG,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAA;AAClC,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;AAEpC,2BAA2B;AAC3B,MAAM,QAAQ,GAAQ,EAAE,CAAA;AAExB,2BAA2B;AAC3B,MAAM,QAAQ,GAAkB,EAAE,CAAA;AAClC,yBAAyB;AACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAC9C,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACjB,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AACnB,CAAC;AAED,aAAa;AACb,MAAa,IAAI;IAQf,YAAY,IAAqB;QAPzB,UAAK,GAAkB,IAAI,CAAA;QAClB,WAAM,GAAkB,IAAI,CAAA;QAO3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;QAC/B,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAQ,CAAA;QAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,KAAK,GAAG,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AM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CACrB,CAAA;AACH,CAAC;AAED,qCAAqC;AACxB,QAAA,GAAG,GAAG,IAAI,IAAI,CAAC,sCAAsC,CAAC,CAAA;AAEnE,uBAAuB;AAEvB,+BAA+B;AAE/B,0CAA0C;AAC1C,uDAAuD;AACvD,IAAI","sourcesContent":["import { createHash, randomBytes } from \"crypto\"\nimport { newError } from \"./index\"\n\nconst invalidName = \"options.name must be either a string or a Buffer\"\n\n// Node ID according to rfc4122#section-4.5\nconst randomHost = randomBytes(16)\nrandomHost[0] = randomHost[0] | 0x01\n\n// lookup table hex to byte\nconst hex2byte: any = {}\n\n// lookup table byte to hex\nconst byte2hex: Array<string> = []\n// populate lookup tables\nfor (let i = 0; i < 256; i++) {\n const hex = (i + 0x100).toString(16).substr(1)\n hex2byte[hex] = i\n byte2hex[i] = hex\n}\n\n// UUID class\nexport class UUID {\n private ascii: string | null = null\n private readonly binary: Buffer | null = null\n private readonly version: number\n\n // from rfc4122#appendix-C\n static readonly OID = UUID.parse(\"6ba7b812-9dad-11d1-80b4-00c04fd430c8\")\n\n constructor(uuid: Buffer | string) {\n const check = UUID.check(uuid)\n if (!check) {\n throw new Error(\"not a UUID\")\n }\n\n this.version = check.version!\n\n if (check.format === \"ascii\") {\n this.ascii = uuid as string\n } else {\n this.binary = uuid as Buffer\n }\n }\n\n static v5(name: string | Buffer, namespace: Buffer) {\n return uuidNamed(name, \"sha1\", 0x50, namespace)\n }\n\n toString() {\n if (this.ascii == null) {\n this.ascii = stringify(this.binary!)\n }\n return this.ascii\n }\n\n inspect() {\n return `UUID v${this.version} ${this.toString()}`\n }\n\n static check(uuid: Buffer | string, offset = 0) {\n if (typeof uuid === \"string\") {\n uuid = uuid.toLowerCase()\n\n if (!/^[a-f0-9]{8}(-[a-f0-9]{4}){3}-([a-f0-9]{12})$/.test(uuid)) {\n return false\n }\n\n if (uuid === \"00000000-0000-0000-0000-000000000000\") {\n return { version: undefined, variant: \"nil\", format: \"ascii\" }\n }\n\n return {\n version: (hex2byte[uuid[14] + uuid[15]] & 0xf0) >> 4,\n variant: getVariant((hex2byte[uuid[19] + uuid[20]] & 0xe0) >> 5),\n format: \"ascii\",\n }\n }\n\n if (Buffer.isBuffer(uuid)) {\n if (uuid.length < offset + 16) {\n return false\n }\n\n let i = 0\n for (; i < 16; i++) {\n if (uuid[offset + i] !== 0) {\n break\n }\n }\n if (i === 16) {\n return { version: undefined, variant: \"nil\", format: \"binary\" }\n }\n\n return {\n version: (uuid[offset + 6] & 0xf0) >> 4,\n variant: getVariant((uuid[offset + 8] & 0xe0) >> 5),\n format: \"binary\",\n }\n }\n\n throw newError(\"Unknown type of uuid\", \"ERR_UNKNOWN_UUID_TYPE\")\n }\n\n // read stringified uuid into a Buffer\n static parse(input: string) {\n const buffer = Buffer.allocUnsafe(16)\n let j = 0\n for (let i = 0; i < 16; i++) {\n buffer[i] = hex2byte[input[j++] + input[j++]]\n if (i === 3 || i === 5 || i === 7 || i === 9) {\n j += 1\n }\n }\n return buffer\n }\n}\n\n// according to rfc4122#section-4.1.1\nfunction getVariant(bits: number) {\n switch (bits) {\n case 0:\n case 1:\n case 3:\n return \"ncs\"\n case 4:\n case 5:\n return \"rfc4122\"\n case 6:\n return \"microsoft\"\n default:\n return \"future\"\n }\n}\n\nenum UuidEncoding {\n ASCII,\n BINARY,\n OBJECT,\n}\n\n// v3 + v5\nfunction uuidNamed(name: string | Buffer, hashMethod: string, version: number, namespace: Buffer, encoding: UuidEncoding = UuidEncoding.ASCII) {\n const hash = createHash(hashMethod)\n\n const nameIsNotAString = typeof name !== \"string\"\n if (nameIsNotAString && !Buffer.isBuffer(name)) {\n throw newError(invalidName, \"ERR_INVALID_UUID_NAME\")\n }\n\n hash.update(namespace)\n hash.update(name)\n\n const buffer = hash.digest()\n let result: any\n switch (encoding) {\n case UuidEncoding.BINARY:\n buffer[6] = (buffer[6] & 0x0f) | version\n buffer[8] = (buffer[8] & 0x3f) | 0x80\n result = buffer\n break\n case UuidEncoding.OBJECT:\n buffer[6] = (buffer[6] & 0x0f) | version\n buffer[8] = (buffer[8] & 0x3f) | 0x80\n result = new UUID(buffer)\n break\n default:\n result =\n byte2hex[buffer[0]] +\n byte2hex[buffer[1]] +\n byte2hex[buffer[2]] +\n byte2hex[buffer[3]] +\n \"-\" +\n byte2hex[buffer[4]] +\n byte2hex[buffer[5]] +\n \"-\" +\n byte2hex[(buffer[6] & 0x0f) | version] +\n byte2hex[buffer[7]] +\n \"-\" +\n byte2hex[(buffer[8] & 0x3f) | 0x80] +\n byte2hex[buffer[9]] +\n \"-\" +\n byte2hex[buffer[10]] +\n byte2hex[buffer[11]] +\n byte2hex[buffer[12]] +\n byte2hex[buffer[13]] +\n byte2hex[buffer[14]] +\n byte2hex[buffer[15]]\n break\n }\n return result\n}\n\nfunction stringify(buffer: Buffer) {\n return (\n byte2hex[buffer[0]] +\n byte2hex[buffer[1]] +\n byte2hex[buffer[2]] +\n byte2hex[buffer[3]] +\n \"-\" +\n byte2hex[buffer[4]] +\n byte2hex[buffer[5]] +\n \"-\" +\n byte2hex[buffer[6]] +\n byte2hex[buffer[7]] +\n \"-\" +\n byte2hex[buffer[8]] +\n byte2hex[buffer[9]] +\n \"-\" +\n byte2hex[buffer[10]] +\n byte2hex[buffer[11]] +\n byte2hex[buffer[12]] +\n byte2hex[buffer[13]] +\n byte2hex[buffer[14]] +\n byte2hex[buffer[15]]\n )\n}\n\n// according to rfc4122#section-4.1.7\nexport const nil = new UUID(\"00000000-0000-0000-0000-000000000000\")\n\n// UUID.v4 = uuidRandom\n\n// UUID.v4fast = uuidRandomFast\n\n// UUID.v3 = function(options, callback) {\n// return uuidNamed(\"md5\", 0x30, options, callback)\n// }\n"]}