This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
admin-panel/graphql-types/node_modules/@graphql-tools/prisma-loader/index.cjs.js.map

1 line
98 KiB
Plaintext
Raw Normal View History

2021-03-09 18:44:13 +00:00
{"version":3,"file":"index.cjs.js","sources":["../../../dist/loaders/prisma/src/prisma-yml/constants.js","../../../dist/loaders/prisma/src/prisma-yml/utils/parseEndpoint.js","../../../dist/loaders/prisma/src/prisma-yml/utils/getProxyAgent.js","../../../dist/loaders/prisma/src/prisma-yml/Cluster.js","../../../dist/loaders/prisma/src/prisma-yml/prisma-json-schema.js","../../../dist/loaders/prisma/src/prisma-yml/Output.js","../../../dist/loaders/prisma/src/prisma-yml/Variables.js","../../../dist/loaders/prisma/src/prisma-yml/yaml.js","../../../dist/loaders/prisma/src/prisma-yml/utils/yamlComment.js","../../../dist/loaders/prisma/src/prisma-yml/PrismaDefinition.js","../../../dist/loaders/prisma/src/prisma-yml/errors/ClusterNotFound.js","../../../dist/loaders/prisma/src/prisma-yml/errors/ClusterNotSet.js","../../../dist/loaders/prisma/src/prisma-yml/Environment.js","../../../dist/loaders/prisma/src/index.js"],"sourcesContent":["import { invert } from 'lodash';\nexport const cloudApiEndpoint = process.env.CLOUD_API_ENDPOINT || 'https://api.cloud.prisma.sh';\nexport const clusterEndpointMap = {\n 'prisma-eu1': 'https://eu1.prisma.sh',\n 'prisma-us1': 'https://us1.prisma.sh',\n};\nexport const clusterEndpointMapReverse = invert(clusterEndpointMap);\n//# sourceMappingURL=constants.js.map","import { clusterEndpointMapReverse } from '../constants';\nimport { URL } from 'url';\nfunction getClusterName(origin) {\n if (clusterEndpointMapReverse[origin]) {\n return clusterEndpointMapReverse[origin];\n }\n if (origin.endsWith('prisma.sh')) {\n return origin.split('_')[0].replace(/https?:\\/\\//, '');\n }\n if (isLocal(origin)) {\n return 'local';\n }\n return 'default';\n}\nconst getWorkspaceFromPrivateOrigin = (origin) => {\n const split = origin.split('_');\n if (split.length > 1) {\n return split[1].split('.')[0];\n }\n return null;\n};\nconst isLocal = (origin) => origin.includes('localhost') || origin.includes('127.0.0.1');\nexport function parseEndpoint(endpoint) {\n /*\n Terminology:\n local - hosted locally using docker and accessed using localhost or prisma or local web proxy like domain.dev\n shared - demo server\n isPrivate - private hosted by Prisma or private and self-hosted, important that in our terminology a local server is not private\n */\n const url = new URL(endpoint);\n const splittedPath = url.pathname.split('/');\n // assuming, that the pathname always starts with a leading /, we always can ignore the first element of the split array\n const service = splittedPath.length > 3 ? splittedPath[2] : splittedPath[1] || 'default';\n const stage = splittedPath.length > 3 ? splittedPath[3] : splittedPath[2] || 'default';\n // This logic might break for self-hosted servers incorrectly yielding a \"workspace\" simply if the UX has\n // enough \"/\"es like if https://custom.dev/not-a-workspace/ is the base Prisma URL then for default/default service/stage\n // pair. This function would incorrectly return not-a-workspace as a workspace.\n let workspaceSlug = splittedPath.length > 3 ? splittedPath[1] : null;\n const shared = ['eu1.prisma.sh', 'us1.prisma.sh'].includes(url.host);\n // When using localAliases, do an exact match because of 'prisma' option which is added for local docker networking access\n const localAliases = ['localhost', '127.0.0.1', 'prisma'];\n const isPrivate = !shared && !localAliases.includes(url.hostname);\n const local = !shared && !isPrivate && !workspaceSlug;\n if (isPrivate && !workspaceSlug) {\n workspaceSlug = getWorkspaceFromPrivateOrigin(url.origin);\n }\n return {\n clusterBaseUrl: url.origin,\n service,\n stage,\n local,\n isPrivate,\n shared,\n workspaceSlug,\n clusterName: getClusterName(url.origin),\n };\n}\n//# sourceMappingURL=parseEndpoint.js.map","'use strict';\nimport HttpsProxyAgent from 'https-proxy-agent';\nimport HttpProxyAgent from 'http-proxy-agent';\n// code from http