@azure/storage-file-datalake 12.30.0 → 12.31.0
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/README.md +4 -15
- package/dist/browser/clients.d.ts +36 -32
- package/dist/browser/clients.d.ts.map +1 -1
- package/dist/browser/clients.js +65 -31
- package/dist/browser/clients.js.map +1 -1
- package/dist/browser/generated/src/models/parameters.js +1 -1
- package/dist/browser/generated/src/models/parameters.js.map +1 -1
- package/dist/browser/generated/src/storageClient.js +2 -2
- package/dist/browser/generated/src/storageClient.js.map +1 -1
- package/dist/browser/models.d.ts +160 -1
- package/dist/browser/models.d.ts.map +1 -1
- package/dist/browser/models.js.map +1 -1
- package/dist/browser/sas/DataLakeSASPermissions.d.ts +4 -0
- package/dist/browser/sas/DataLakeSASPermissions.d.ts.map +1 -1
- package/dist/browser/sas/DataLakeSASPermissions.js +10 -0
- package/dist/browser/sas/DataLakeSASPermissions.js.map +1 -1
- package/dist/browser/sas/FileSystemSASPermissions.d.ts +4 -0
- package/dist/browser/sas/FileSystemSASPermissions.d.ts.map +1 -1
- package/dist/browser/sas/FileSystemSASPermissions.js +10 -0
- package/dist/browser/sas/FileSystemSASPermissions.js.map +1 -1
- package/dist/browser/utils/constants.js +2 -2
- package/dist/browser/utils/constants.js.map +1 -1
- package/dist/browser/utils/utils.common.d.ts.map +1 -1
- package/dist/browser/utils/utils.common.js +14 -0
- package/dist/browser/utils/utils.common.js.map +1 -1
- package/dist/commonjs/clients.d.ts +36 -32
- package/dist/commonjs/clients.d.ts.map +1 -1
- package/dist/commonjs/clients.js +71 -31
- package/dist/commonjs/clients.js.map +2 -2
- package/dist/commonjs/generated/src/models/parameters.js +1 -1
- package/dist/commonjs/generated/src/models/parameters.js.map +1 -1
- package/dist/commonjs/generated/src/storageClient.js +2 -2
- package/dist/commonjs/generated/src/storageClient.js.map +1 -1
- package/dist/commonjs/models.d.ts +160 -1
- package/dist/commonjs/models.d.ts.map +1 -1
- package/dist/commonjs/models.js.map +2 -2
- package/dist/commonjs/sas/DataLakeSASPermissions.d.ts +4 -0
- package/dist/commonjs/sas/DataLakeSASPermissions.d.ts.map +1 -1
- package/dist/commonjs/sas/DataLakeSASPermissions.js +10 -0
- package/dist/commonjs/sas/DataLakeSASPermissions.js.map +2 -2
- package/dist/commonjs/sas/FileSystemSASPermissions.d.ts +4 -0
- package/dist/commonjs/sas/FileSystemSASPermissions.d.ts.map +1 -1
- package/dist/commonjs/sas/FileSystemSASPermissions.js +10 -0
- package/dist/commonjs/sas/FileSystemSASPermissions.js.map +2 -2
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils/constants.js +2 -2
- package/dist/commonjs/utils/constants.js.map +1 -1
- package/dist/commonjs/utils/utils.common.d.ts.map +1 -1
- package/dist/commonjs/utils/utils.common.js +13 -0
- package/dist/commonjs/utils/utils.common.js.map +2 -2
- package/dist/esm/clients.d.ts +36 -32
- package/dist/esm/clients.d.ts.map +1 -1
- package/dist/esm/clients.js +65 -31
- package/dist/esm/clients.js.map +1 -1
- package/dist/esm/generated/src/models/parameters.js +1 -1
- package/dist/esm/generated/src/models/parameters.js.map +1 -1
- package/dist/esm/generated/src/storageClient.js +2 -2
- package/dist/esm/generated/src/storageClient.js.map +1 -1
- package/dist/esm/models.d.ts +160 -1
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/sas/DataLakeSASPermissions.d.ts +4 -0
- package/dist/esm/sas/DataLakeSASPermissions.d.ts.map +1 -1
- package/dist/esm/sas/DataLakeSASPermissions.js +10 -0
- package/dist/esm/sas/DataLakeSASPermissions.js.map +1 -1
- package/dist/esm/sas/FileSystemSASPermissions.d.ts +4 -0
- package/dist/esm/sas/FileSystemSASPermissions.d.ts.map +1 -1
- package/dist/esm/sas/FileSystemSASPermissions.js +10 -0
- package/dist/esm/sas/FileSystemSASPermissions.js.map +1 -1
- package/dist/esm/utils/constants.js +2 -2
- package/dist/esm/utils/constants.js.map +1 -1
- package/dist/esm/utils/utils.common.d.ts.map +1 -1
- package/dist/esm/utils/utils.common.js +14 -0
- package/dist/esm/utils/utils.common.js.map +1 -1
- package/dist/react-native/clients.d.ts +36 -32
- package/dist/react-native/clients.d.ts.map +1 -1
- package/dist/react-native/clients.js +65 -31
- package/dist/react-native/clients.js.map +1 -1
- package/dist/react-native/generated/src/models/parameters.js +1 -1
- package/dist/react-native/generated/src/models/parameters.js.map +1 -1
- package/dist/react-native/generated/src/storageClient.js +2 -2
- package/dist/react-native/generated/src/storageClient.js.map +1 -1
- package/dist/react-native/models.d.ts +160 -1
- package/dist/react-native/models.d.ts.map +1 -1
- package/dist/react-native/models.js.map +1 -1
- package/dist/react-native/sas/DataLakeSASPermissions.d.ts +4 -0
- package/dist/react-native/sas/DataLakeSASPermissions.d.ts.map +1 -1
- package/dist/react-native/sas/DataLakeSASPermissions.js +10 -0
- package/dist/react-native/sas/DataLakeSASPermissions.js.map +1 -1
- package/dist/react-native/sas/FileSystemSASPermissions.d.ts +4 -0
- package/dist/react-native/sas/FileSystemSASPermissions.d.ts.map +1 -1
- package/dist/react-native/sas/FileSystemSASPermissions.js +10 -0
- package/dist/react-native/sas/FileSystemSASPermissions.js.map +1 -1
- package/dist/react-native/utils/constants.js +2 -2
- package/dist/react-native/utils/constants.js.map +1 -1
- package/dist/react-native/utils/utils.common.d.ts.map +1 -1
- package/dist/react-native/utils/utils.common.js +14 -0
- package/dist/react-native/utils/utils.common.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/utils.common.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { HttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { createHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { isNodeLike } from \"@azure/core-util\";\nimport type { ContainerEncryptionScope, HttpRequestBody, WithResponse } from \"@azure/storage-blob\";\nimport {\n CpkInfo,\n DataLakeGetUserDelegationKeyParameters,\n FileSystemEncryptionScope,\n PathAccessControlItem,\n PathPermissions,\n StorageChecksumAlgorithm,\n} from \"../models.js\";\n\nimport {\n DevelopmentConnectionString,\n EncryptionAlgorithmAES25,\n HeaderConstants,\n PathStylePorts,\n UrlConstants,\n} from \"./constants.js\";\nimport type { HttpResponse } from \"@azure/storage-blob\";\nimport type { HttpHeadersLike } from \"@azure/core-http-compat\";\nimport { toAcl, toPermissions } from \"../transforms.js\";\nimport { PathHttpHeaders } from \"../generated/src/index.js\";\nimport { StorageCRC64Calculator, structuredMessageEncoding } from \"@azure/storage-common\";\n\n/**\n * Reserved URL characters must be properly escaped for Storage services like Blob or File.\n *\n * ## URL encode and escape strategy for JS SDKs\n *\n * When customers pass a URL string into XxxClient classes constructors, the URL string may already be URL encoded or not.\n * But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL\n * string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XxxClient constructors.\n *\n * ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK.\n *\n * This is what legacy V2 SDK does, simple and works for most of the cases.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b:\",\n * SDK will encode it to \"http://account.blob.core.windows.net/con/b%3A\" and send to server. A blob named \"b:\" will be created.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b%3A\",\n * SDK will encode it to \"http://account.blob.core.windows.net/con/b%253A\" and send to server. A blob named \"b%3A\" will be created.\n *\n * But this strategy will make it not possible to create a blob with \"?\" in it's name. Because when customer URL string is\n * \"http://account.blob.core.windows.net/con/blob?name\", the \"?name\" will be treated as URL paramter instead of blob name.\n * If customer URL string is \"http://account.blob.core.windows.net/con/blob%3Fname\", a blob named \"blob%3Fname\" will be created.\n * V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it.\n * We cannot accept a SDK cannot create a blob name with \"?\". So we implement strategy two:\n *\n * ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters.\n *\n * This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b:\",\n * SDK will escape \":\" like \"http://account.blob.core.windows.net/con/b%3A\" and send to server. A blob named \"b:\" will be created.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b%3A\",\n * There is no special characters, so send \"http://account.blob.core.windows.net/con/b%3A\" to server. A blob named \"b:\" will be created.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b%253A\",\n * There is no special characters, so send \"http://account.blob.core.windows.net/con/b%253A\" to server. A blob named \"b%3A\" will be created.\n *\n * This strategy gives us flexibility to create with any special characters. But \"%\" will be treated as a special characters, if the URL string\n * is not encoded, there shouldn't a \"%\" in the URL string, otherwise the URL is not a valid URL.\n * If customer needs to create a blob with \"%\" in it's blob name, use \"%25\" instead of \"%\". Just like above 3rd sample.\n * And following URL strings are invalid:\n * - \"http://account.blob.core.windows.net/con/b%\"\n * - \"http://account.blob.core.windows.net/con/b%2\"\n * - \"http://account.blob.core.windows.net/con/b%G\"\n *\n * Another special character is \"?\", use \"%2F\" to represent a blob name with \"?\" in a URL string.\n *\n * ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `containerClient.getBlobClient(blobName)`\n *\n * We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL.\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata\n * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata\n *\n * @param url -\n */\nexport function escapeURLPath(url: string): string {\n const urlParsed = new URL(url);\n\n let path = urlParsed.pathname;\n path = path || \"/\";\n\n path = escape(path);\n urlParsed.pathname = path;\n\n return urlParsed.toString();\n}\n\nexport interface ConnectionString {\n kind: \"AccountConnString\" | \"SASConnString\";\n url: string;\n accountName: string;\n accountKey?: any;\n accountSas?: string;\n proxyUri?: string; // Development Connection String may contain proxyUri\n}\n\nfunction getProxyUriFromDevConnString(connectionString: string): string {\n // Development Connection String\n // https://learn.microsoft.com/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key\n let proxyUri = \"\";\n if (connectionString.search(\"DevelopmentStorageProxyUri=\") !== -1) {\n // CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri\n const matchCredentials = connectionString.split(\";\");\n for (const element of matchCredentials) {\n if (element.trim().startsWith(\"DevelopmentStorageProxyUri=\")) {\n proxyUri = element.trim().match(\"DevelopmentStorageProxyUri=(.*)\")![1];\n }\n }\n }\n return proxyUri;\n}\n\nexport function getValueInConnString(\n connectionString: string,\n argument:\n | \"BlobEndpoint\"\n | \"AccountName\"\n | \"AccountKey\"\n | \"DefaultEndpointsProtocol\"\n | \"EndpointSuffix\"\n | \"SharedAccessSignature\",\n): string {\n const elements = connectionString.split(\";\");\n for (const element of elements) {\n if (element.trim().startsWith(argument)) {\n return element.trim().match(argument + \"=(.*)\")![1];\n }\n }\n return \"\";\n}\n\n/**\n * Extracts the parts of an Azure Storage account connection string.\n *\n * @param connectionString - Connection string.\n * @returns String key value pairs of the storage account's url and credentials.\n */\nexport function extractConnectionStringParts(connectionString: string): ConnectionString {\n let proxyUri = \"\";\n\n if (connectionString.startsWith(\"UseDevelopmentStorage=true\")) {\n // Development connection string\n proxyUri = getProxyUriFromDevConnString(connectionString);\n connectionString = DevelopmentConnectionString;\n }\n\n // Matching BlobEndpoint in the Account connection string\n let blobEndpoint = getValueInConnString(connectionString, \"BlobEndpoint\");\n // Slicing off '/' at the end if exists\n // (The methods that use `extractConnectionStringParts` expect the url to not have `/` at the end)\n blobEndpoint = blobEndpoint.endsWith(\"/\") ? blobEndpoint.slice(0, -1) : blobEndpoint;\n\n if (\n connectionString.search(\"DefaultEndpointsProtocol=\") !== -1 &&\n connectionString.search(\"AccountKey=\") !== -1\n ) {\n // Account connection string\n\n let defaultEndpointsProtocol = \"\";\n let accountName = \"\";\n let accountKey = Buffer.from(\"accountKey\", \"base64\");\n let endpointSuffix = \"\";\n\n // Get account name and key\n accountName = getValueInConnString(connectionString, \"AccountName\");\n accountKey = Buffer.from(getValueInConnString(connectionString, \"AccountKey\"), \"base64\");\n\n if (!blobEndpoint) {\n // BlobEndpoint is not present in the Account connection string\n // Can be obtained from `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`\n\n defaultEndpointsProtocol = getValueInConnString(connectionString, \"DefaultEndpointsProtocol\");\n const protocol = defaultEndpointsProtocol!.toLowerCase();\n if (protocol !== \"https\" && protocol !== \"http\") {\n throw new Error(\n \"Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'\",\n );\n }\n\n endpointSuffix = getValueInConnString(connectionString, \"EndpointSuffix\");\n if (!endpointSuffix) {\n throw new Error(\"Invalid EndpointSuffix in the provided Connection String\");\n }\n blobEndpoint = `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`;\n }\n\n if (!accountName) {\n throw new Error(\"Invalid AccountName in the provided Connection String\");\n } else if (accountKey.length === 0) {\n throw new Error(\"Invalid AccountKey in the provided Connection String\");\n }\n\n return {\n kind: \"AccountConnString\",\n url: blobEndpoint,\n accountName,\n accountKey,\n proxyUri,\n };\n } else {\n // SAS connection string\n\n const accountSas = getValueInConnString(connectionString, \"SharedAccessSignature\");\n let accountName = getValueInConnString(connectionString, \"AccountName\");\n // if accountName is empty, try to read it from BlobEndpoint\n if (!accountName) {\n accountName = getAccountNameFromUrl(blobEndpoint);\n }\n if (!blobEndpoint) {\n throw new Error(\"Invalid BlobEndpoint in the provided SAS Connection String\");\n } else if (!accountSas) {\n throw new Error(\"Invalid SharedAccessSignature in the provided SAS Connection String\");\n }\n\n return { kind: \"SASConnString\", url: blobEndpoint, accountName, accountSas };\n }\n}\n\n/**\n * Internal escape method implemented Strategy Two mentioned in escapeURL() description.\n *\n * @param text -\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nfunction escape(text: string): string {\n return encodeURIComponent(text)\n .replace(/%2F/g, \"/\") // Don't escape for \"/\"\n .replace(/'/g, \"%27\") // Escape for \"'\"\n .replace(/\\+/g, \"%20\")\n .replace(/%25/g, \"%\"); // Revert encoded \"%\"\n}\n\n/**\n * Append a string to URL path. Will remove duplicated \"/\" in front of the string\n * when URL path ends with a \"/\".\n *\n * @param url - Source URL string\n * @param name - String to be appended to URL\n * @returns An updated URL string\n */\nexport function appendToURLPath(url: string, name: string): string {\n const urlParsed = new URL(url);\n\n let path = urlParsed.pathname;\n path = path ? (path.endsWith(\"/\") ? `${path}${name}` : `${path}/${name}`) : name;\n urlParsed.pathname = path;\n\n return urlParsed.toString();\n}\n\n/**\n * Append a string to URL query.\n *\n * @param url - Source URL string.\n * @param queryParts - String to be appended to the URL query.\n * @returns An updated URL string.\n */\nexport function appendToURLQuery(url: string, queryParts: string): string {\n const urlParsed = new URL(url);\n\n let query = urlParsed.search;\n if (query) {\n query += \"&\" + queryParts;\n } else {\n query = queryParts;\n }\n\n urlParsed.search = query;\n return urlParsed.toString();\n}\n\n/**\n * Set URL parameter name and value. If name exists in URL parameters, old value\n * will be replaced by name key. If not provide value, the parameter will be deleted.\n *\n * @param url - Source URL string\n * @param name - Parameter name\n * @param value - Parameter value\n * @returns An updated URL string\n */\nexport function setURLParameter(url: string, name: string, value?: string): string {\n const urlParsed = new URL(url);\n const encodedName = encodeURIComponent(name);\n const encodedValue = value ? encodeURIComponent(value) : undefined;\n // mutating searchParams will change the encoding, so we have to do this ourselves\n const searchString = urlParsed.search === \"\" ? \"?\" : urlParsed.search;\n\n const searchPieces: string[] = [];\n\n for (const pair of searchString.slice(1).split(\"&\")) {\n if (pair) {\n const [key] = pair.split(\"=\", 2);\n if (key !== encodedName) {\n searchPieces.push(pair);\n }\n }\n }\n if (encodedValue) {\n searchPieces.push(`${encodedName}=${encodedValue}`);\n }\n\n urlParsed.search = searchPieces.length ? `?${searchPieces.join(\"&\")}` : \"\";\n\n return urlParsed.toString();\n}\n\n/**\n * Get URL parameter by name.\n *\n * @param url -\n * @param name -\n */\nexport function getURLParameter(url: string, name: string): string | string[] | undefined {\n const urlParsed = new URL(url);\n return urlParsed.searchParams.get(name) ?? undefined;\n}\n\n/**\n * Set URL host.\n *\n * @param url - Source URL string\n * @param host - New host string\n * @returns An updated URL string\n */\nexport function setURLHost(url: string, host: string): string {\n const urlParsed = new URL(url);\n urlParsed.hostname = host;\n return urlParsed.toString();\n}\n\n/**\n * Get URL path from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURLPath(url: string): string | undefined {\n try {\n const urlParsed = new URL(url);\n return urlParsed.pathname;\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * Set URL path.\n *\n * @param url -\n * @param path -\n */\nexport function setURLPath(url: string, path: string): string {\n const urlParsed = new URL(url);\n urlParsed.pathname = path;\n return urlParsed.toString();\n}\n\n/**\n * Get URL scheme from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURLScheme(url: string): string | undefined {\n try {\n const urlParsed = new URL(url);\n return urlParsed.protocol.endsWith(\":\") ? urlParsed.protocol.slice(0, -1) : urlParsed.protocol;\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * Get URL path and query from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURLPathAndQuery(url: string): string | undefined {\n const urlParsed = new URL(url);\n const pathString = urlParsed.pathname;\n if (!pathString) {\n throw new RangeError(\"Invalid url without valid path.\");\n }\n\n let queryString = urlParsed.search || \"\";\n queryString = queryString.trim();\n if (queryString !== \"\") {\n queryString = queryString.startsWith(\"?\") ? queryString : `?${queryString}`; // Ensure query string start with '?'\n }\n\n return `${pathString}${queryString}`;\n}\n\n/**\n * Get URL query key value pairs from an URL string.\n *\n * @param url -\n */\nexport function getURLQueries(url: string): { [key: string]: string } {\n let queryString = new URL(url).search;\n if (!queryString) {\n return {};\n }\n\n queryString = queryString.trim();\n queryString = queryString.startsWith(\"?\") ? queryString.substring(1) : queryString;\n\n let querySubStrings: string[] = queryString.split(\"&\");\n querySubStrings = querySubStrings.filter((value: string) => {\n const indexOfEqual = value.indexOf(\"=\");\n const lastIndexOfEqual = value.lastIndexOf(\"=\");\n return (\n indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1\n );\n });\n\n const queries: { [key: string]: string } = {};\n for (const querySubString of querySubStrings) {\n const splitResults = querySubString.split(\"=\");\n const key: string = splitResults[0];\n const value: string = splitResults[1];\n queries[key] = value;\n }\n\n return queries;\n}\n\n/**\n * Set URL query string.\n *\n * @param url -\n * @param queryString -\n */\nexport function setURLQueries(url: string, queryString: string): string {\n const urlParsed = new URL(url);\n urlParsed.search = queryString;\n return urlParsed.toString();\n}\n\n/**\n * Rounds a date off to seconds.\n *\n * @param date -\n * @param withMilliseconds - If true, YYYY-MM-DDThh:mm:ss.fffffffZ will be returned;\n * If false, YYYY-MM-DDThh:mm:ssZ will be returned.\n * @returns Date string in ISO8061 format, with or without 7 milliseconds component\n */\nexport function truncatedISO8061Date(date: Date, withMilliseconds: boolean = true): string {\n // Date.toISOString() will return like \"2018-10-29T06:34:36.139Z\"\n const dateString = date.toISOString();\n\n return withMilliseconds\n ? dateString.substring(0, dateString.length - 1) + \"0000\" + \"Z\"\n : dateString.substring(0, dateString.length - 5) + \"Z\";\n}\n\n/**\n * Base64 encode.\n *\n * @param content -\n */\nexport function base64encode(content: string): string {\n return !isNodeLike ? btoa(content) : Buffer.from(content).toString(\"base64\");\n}\n\n/**\n * Base64 decode.\n *\n * @param encodedString -\n */\nexport function base64decode(encodedString: string): string {\n return !isNodeLike ? atob(encodedString) : Buffer.from(encodedString, \"base64\").toString();\n}\n\n/**\n * Generate a 64 bytes base64 block ID string.\n *\n * @param blockIndex -\n */\nexport function generateBlockID(blockIDPrefix: string, blockIndex: number): string {\n // To generate a 64 bytes base64 string, source string should be 48\n const maxSourceStringLength = 48;\n\n // A blob can have a maximum of 100,000 uncommitted blocks at any given time\n const maxBlockIndexLength = 6;\n\n const maxAllowedBlockIDPrefixLength = maxSourceStringLength - maxBlockIndexLength;\n\n if (blockIDPrefix.length > maxAllowedBlockIDPrefixLength) {\n blockIDPrefix = blockIDPrefix.slice(0, maxAllowedBlockIDPrefixLength);\n }\n const res =\n blockIDPrefix +\n blockIndex.toString().padStart(maxSourceStringLength - blockIDPrefix.length, \"0\");\n return base64encode(res);\n}\n\nexport function sanitizeURL(url: string): string {\n let safeURL: string = url;\n if (getURLParameter(safeURL, UrlConstants.Parameters.SIGNATURE)) {\n safeURL = setURLParameter(safeURL, UrlConstants.Parameters.SIGNATURE, \"*****\");\n }\n\n return safeURL;\n}\n\nexport function sanitizeHeaders(originalHeader: HttpHeaders): HttpHeaders {\n const headers: HttpHeaders = createHttpHeaders();\n for (const [name, value] of originalHeader) {\n if (name.toLowerCase() === HeaderConstants.AUTHORIZATION.toLowerCase()) {\n headers.set(name, \"*****\");\n } else if (name.toLowerCase() === HeaderConstants.X_MS_COPY_SOURCE) {\n headers.set(name, sanitizeURL(value));\n } else {\n headers.set(name, value);\n }\n }\n\n return headers;\n}\n/**\n * If two strings are equal when compared case insensitive.\n *\n * @param str1 -\n * @param str2 -\n */\nexport function iEqual(str1: string, str2: string): boolean {\n return str1.toLocaleLowerCase() === str2.toLocaleLowerCase();\n}\n\n/**\n * Extracts account name from the url\n * @param url - url to extract the account name from\n * @returns with the account name\n */\nexport function getAccountNameFromUrl(url: string): string {\n const parsedUrl = new URL(url);\n let accountName;\n try {\n if (parsedUrl.hostname.split(\".\")[1] === \"blob\") {\n // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`;\n accountName = parsedUrl.hostname.split(\".\")[0];\n } else if (isIpEndpointStyle(parsedUrl)) {\n // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/\n // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/\n // .getPath() -> /devstoreaccount1/\n accountName = parsedUrl.pathname.split(\"/\")[1];\n } else {\n // Custom domain case: \"https://customdomain.com/containername/blob\".\n accountName = \"\";\n }\n return accountName;\n } catch (error: any) {\n throw new Error(\"Unable to extract accountName with provided information.\");\n }\n}\n\nexport function isIpEndpointStyle(parsedUrl: URL): boolean {\n const host = parsedUrl.host;\n\n // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'.\n // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part.\n // Case 3: Ipv4, use broad regex which just check if host contains Ipv4.\n // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.\n return (\n /^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])){3}(:[0-9]+)?$/.test(\n host,\n ) ||\n (Boolean(parsedUrl.port) && PathStylePorts.includes(parsedUrl.port))\n );\n}\n\n/**\n * This is to convert a Windows File Time ticks to a Date object.\n */\nexport function windowsFileTimeTicksToTime(timeNumber: string | undefined): Date | undefined {\n if (!timeNumber) return undefined;\n // A windows file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed\n // since 12:00 A.M. January 1, 1601 Coordinated Universal Time (UTC).\n // JS Date accepts a value that represents milliseconds from 12:00 A.M. January 1, 1970\n // So, we'll handle the calculations in milliseconds from here\n\n // Time in milliseconds since \"12:00 A.M. January 1, 1601\"\n const timeElapsed = parseInt(timeNumber) / 10000;\n\n if (timeElapsed === 0) return undefined;\n\n // Reference - https://stackoverflow.com/a/24188106/4137356\n\n // Milliseconds calculated relative to \"12:00 A.M. January 1, 1970\" (will be negative)\n const initialFrameOfReference = Date.UTC(1601, 0, 1);\n\n // TimeRelativeTo1970 = (TimeAt1601 - TimeAt1970) + (Current - TimeAt1601) = (Current - TimeAt1970)\n return new Date(initialFrameOfReference + timeElapsed);\n}\n\nexport function ensureCpkIfSpecified(cpk: CpkInfo | undefined, isHttps: boolean): void {\n if (cpk && !isHttps) {\n throw new RangeError(\"Customer-provided encryption key must be used over HTTPS.\");\n }\n\n if (cpk && !cpk.encryptionAlgorithm) {\n cpk.encryptionAlgorithm = EncryptionAlgorithmAES25;\n }\n}\n\nexport function ToBlobContainerEncryptionScope(\n fileSystemEncryptionScope?: FileSystemEncryptionScope,\n): ContainerEncryptionScope | undefined {\n if (!fileSystemEncryptionScope) return undefined;\n\n if (!fileSystemEncryptionScope.defaultEncryptionScope) return undefined;\n\n return {\n defaultEncryptionScope: fileSystemEncryptionScope.defaultEncryptionScope,\n preventEncryptionScopeOverride: true,\n };\n}\n\n/**\n * Escape the file or directory name but keep path separator ('/').\n */\nexport function EscapePath(pathName: string): string {\n const split = pathName.split(\"/\");\n for (let i = 0; i < split.length; i++) {\n split[i] = encodeURIComponent(split[i]);\n }\n return split.join(\"/\");\n}\n\n/**\n * A typesafe helper for ensuring that a given response object has\n * the original _response attached.\n * @param response - A response object from calling a client operation\n * @returns The same object, but with known _response property\n */\nexport function assertResponse<T extends object, Headers = undefined, Body = undefined>(\n response: T,\n): WithResponse<T, Headers, Body> {\n if (`_response` in response) {\n return response as WithResponse<T, Headers, Body>;\n }\n\n throw new TypeError(`Unexpected response object ${response}`);\n}\n\nexport interface PathGetPropertiesRawResponseWithExtraPropertiesLike {\n encryptionContext?: string;\n owner?: string;\n group?: string;\n permissions?: PathPermissions;\n acl: PathAccessControlItem[];\n _response: HttpResponse & {\n parsedHeaders: {\n encryptionContext?: string;\n owner?: string;\n group?: string;\n permissions?: PathPermissions;\n acl: PathAccessControlItem[];\n };\n };\n}\n\nfunction ParseHeaderValue(\n rawResponse: PathGetPropertiesRawResponseWithExtraPropertiesLike,\n headerName: string,\n): string | undefined {\n if (rawResponse._response) {\n const headers = rawResponse._response.headers as HttpHeadersLike;\n if (headers) {\n return headers.get(headerName);\n }\n }\n\n return undefined;\n}\n\n/**\n * Parse extra properties values from headers in raw response.\n */\nexport function ParsePathGetPropertiesExtraHeaderValues(\n rawResponse: PathGetPropertiesRawResponseWithExtraPropertiesLike,\n): PathGetPropertiesRawResponseWithExtraPropertiesLike {\n const response = rawResponse;\n response.encryptionContext = ParseHeaderValue(rawResponse, \"x-ms-encryption-context\");\n response.owner = ParseHeaderValue(rawResponse, \"x-ms-owner\");\n response.group = ParseHeaderValue(rawResponse, \"x-ms-group\");\n response.permissions = toPermissions(ParseHeaderValue(rawResponse, \"x-ms-permissions\"));\n response.acl = toAcl(ParseHeaderValue(rawResponse, \"x-ms-acl\"));\n if (response._response?.parsedHeaders) {\n response._response.parsedHeaders.encryptionContext = response.encryptionContext;\n response._response.parsedHeaders.owner = response.owner;\n response._response.parsedHeaders.group = response.group;\n response._response.parsedHeaders.permissions = response.permissions;\n response._response.parsedHeaders.acl = response.acl;\n }\n return response;\n}\n\ninterface UploadChecksumParametersLike {\n /** Parameter group */\n pathHttpHeaders?: PathHttpHeaders;\n transactionalContentCrc64?: Uint8Array;\n contentChecksumAlgorithm?: StorageChecksumAlgorithm;\n structuredBodyType?: string;\n structuredContentLength?: number;\n}\n\ninterface UploadChecksumOptionsLike {\n transactionalContentMD5?: Uint8Array;\n transactionalContentCrc64?: Uint8Array;\n contentChecksumAlgorithm?: StorageChecksumAlgorithm;\n structuredBodyType?: string;\n structuredContentLength?: number;\n}\n\ninterface UploadCheckSumBody {\n contentChecksumAlgorithm?: StorageChecksumAlgorithm;\n body: HttpRequestBody;\n contentLength: number;\n}\n\nexport async function setUploadChecksumParameters(\n body: HttpRequestBody,\n contentLength: number,\n parameters: UploadChecksumParametersLike,\n uploadOptions: UploadChecksumOptionsLike,\n configContentChecksumAlgorithm?: StorageChecksumAlgorithm,\n): Promise<UploadCheckSumBody> {\n let contentChecksumAlgorithm =\n uploadOptions.contentChecksumAlgorithm ?? configContentChecksumAlgorithm;\n if (contentChecksumAlgorithm === undefined) {\n contentChecksumAlgorithm = \"Customized\";\n }\n\n if (contentChecksumAlgorithm === \"Auto\") {\n contentChecksumAlgorithm = \"StorageCrc64\";\n }\n\n let bodyInfo = undefined;\n if (contentChecksumAlgorithm === \"Customized\") {\n if (parameters.pathHttpHeaders === undefined) {\n parameters.pathHttpHeaders = {\n contentMD5: uploadOptions.transactionalContentMD5,\n };\n } else {\n parameters.pathHttpHeaders.transactionalContentHash = uploadOptions.transactionalContentMD5;\n (parameters as any).transactionalContentHash = uploadOptions.transactionalContentMD5;\n }\n parameters.transactionalContentCrc64 = uploadOptions.transactionalContentCrc64;\n } else if (contentChecksumAlgorithm === \"StorageCrc64\") {\n await StorageCRC64Calculator.init();\n bodyInfo = await structuredMessageEncoding(body, contentLength);\n parameters.structuredBodyType = \"XSM/1.0; properties=crc64\";\n parameters.structuredContentLength = contentLength;\n }\n\n return {\n body: contentChecksumAlgorithm === \"StorageCrc64\" ? bodyInfo!.body : body,\n contentLength:\n contentChecksumAlgorithm === \"StorageCrc64\" ? bodyInfo!.encodedContentLength : contentLength,\n contentChecksumAlgorithm: contentChecksumAlgorithm,\n };\n}\n\nexport function isDataLakeGetUserDelegationKeyParameters(\n parameter: unknown,\n): parameter is DataLakeGetUserDelegationKeyParameters {\n if (!parameter || typeof parameter !== \"object\") {\n return false;\n }\n\n const castParameter = parameter as DataLakeGetUserDelegationKeyParameters;\n\n return castParameter.expiresOn instanceof Date;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAAkC;AAClC,uBAA2B;AAW3B,uBAMO;AAGP,wBAAqC;AAErC,4BAAkE;AAsD3D,SAAS,cAAc,KAAqB;AACjD,QAAM,YAAY,IAAI,IAAI,GAA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AEA,SAAO;AACT;AAEO,SAAS,gBAAgB,gBAA0C;AACxE,QAAM,cAAuB,6CAAkB;AAC/C,aAAW,CAAC,MAAM,KAAK,KAAK,gBAAgB;AAC1C,QAAI,KAAK,YAAY,MAAM,iCAAgB,cAAc,YAAY,GAAG;AACtE,cAAQ,IAAI,MAAM,OAAO;AAAA,IAC3B,WAAW,KAAK,YAAY,MAAM,iCAAgB,kBAAkB;AAClE,cAAQ,IAAI,MAAM,YAAY,KAAK,CAAC;AAAA,IACtC,OAAO;AACL,cAAQ,IAAI,MAAM,KAAK;AAAA,IACzB;AAAA,EACF;AAEA,SAAO;AACT;AAOO,SAAS,OAAO,MAAc,MAAuB;AAC1D,SAAO,KAAK,kBAAkB,MAAM,KAAK,kBAAkB;AAC7D;AAOO,SAAS,sBAAsB,KAAqB;AACzD,QAAM,YAAY,IAAI,IAAI,GAAG;AAC7B,MAAI;AACJ,MAAI;AACF,QAAI,UAAU,SAAS,MAAM,GAAG,EAAE,CAAC,MAAM,QAAQ;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { HttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { createHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { isNodeLike } from \"@azure/core-util\";\nimport type { ContainerEncryptionScope, HttpRequestBody, WithResponse } from \"@azure/storage-blob\";\nimport {\n CpkInfo,\n DataLakeGetUserDelegationKeyParameters,\n FileSystemEncryptionScope,\n PathAccessControlItem,\n PathPermissions,\n StorageChecksumAlgorithm,\n} from \"../models.js\";\n\nimport {\n DevelopmentConnectionString,\n EncryptionAlgorithmAES25,\n HeaderConstants,\n PathStylePorts,\n UrlConstants,\n} from \"./constants.js\";\nimport type { HttpResponse } from \"@azure/storage-blob\";\nimport type { HttpHeadersLike } from \"@azure/core-http-compat\";\nimport { toAcl, toPermissions } from \"../transforms.js\";\nimport { PathHttpHeaders } from \"../generated/src/index.js\";\nimport { StorageCRC64Calculator, structuredMessageEncoding } from \"@azure/storage-common\";\n\n/**\n * Reserved URL characters must be properly escaped for Storage services like Blob or File.\n *\n * ## URL encode and escape strategy for JS SDKs\n *\n * When customers pass a URL string into XxxClient classes constructors, the URL string may already be URL encoded or not.\n * But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL\n * string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XxxClient constructors.\n *\n * ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK.\n *\n * This is what legacy V2 SDK does, simple and works for most of the cases.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b:\",\n * SDK will encode it to \"http://account.blob.core.windows.net/con/b%3A\" and send to server. A blob named \"b:\" will be created.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b%3A\",\n * SDK will encode it to \"http://account.blob.core.windows.net/con/b%253A\" and send to server. A blob named \"b%3A\" will be created.\n *\n * But this strategy will make it not possible to create a blob with \"?\" in it's name. Because when customer URL string is\n * \"http://account.blob.core.windows.net/con/blob?name\", the \"?name\" will be treated as URL paramter instead of blob name.\n * If customer URL string is \"http://account.blob.core.windows.net/con/blob%3Fname\", a blob named \"blob%3Fname\" will be created.\n * V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it.\n * We cannot accept a SDK cannot create a blob name with \"?\". So we implement strategy two:\n *\n * ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters.\n *\n * This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b:\",\n * SDK will escape \":\" like \"http://account.blob.core.windows.net/con/b%3A\" and send to server. A blob named \"b:\" will be created.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b%3A\",\n * There is no special characters, so send \"http://account.blob.core.windows.net/con/b%3A\" to server. A blob named \"b:\" will be created.\n * - When customer URL string is \"http://account.blob.core.windows.net/con/b%253A\",\n * There is no special characters, so send \"http://account.blob.core.windows.net/con/b%253A\" to server. A blob named \"b%3A\" will be created.\n *\n * This strategy gives us flexibility to create with any special characters. But \"%\" will be treated as a special characters, if the URL string\n * is not encoded, there shouldn't a \"%\" in the URL string, otherwise the URL is not a valid URL.\n * If customer needs to create a blob with \"%\" in it's blob name, use \"%25\" instead of \"%\". Just like above 3rd sample.\n * And following URL strings are invalid:\n * - \"http://account.blob.core.windows.net/con/b%\"\n * - \"http://account.blob.core.windows.net/con/b%2\"\n * - \"http://account.blob.core.windows.net/con/b%G\"\n *\n * Another special character is \"?\", use \"%2F\" to represent a blob name with \"?\" in a URL string.\n *\n * ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `containerClient.getBlobClient(blobName)`\n *\n * We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL.\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata\n * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata\n *\n * @param url -\n */\nexport function escapeURLPath(url: string): string {\n const urlParsed = new URL(url);\n\n let path = urlParsed.pathname;\n path = path || \"/\";\n\n path = escape(path);\n urlParsed.pathname = path;\n\n return urlParsed.toString();\n}\n\nexport interface ConnectionString {\n kind: \"AccountConnString\" | \"SASConnString\";\n url: string;\n accountName: string;\n accountKey?: any;\n accountSas?: string;\n proxyUri?: string; // Development Connection String may contain proxyUri\n}\n\nfunction getProxyUriFromDevConnString(connectionString: string): string {\n // Development Connection String\n // https://learn.microsoft.com/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key\n let proxyUri = \"\";\n if (connectionString.search(\"DevelopmentStorageProxyUri=\") !== -1) {\n // CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri\n const matchCredentials = connectionString.split(\";\");\n for (const element of matchCredentials) {\n if (element.trim().startsWith(\"DevelopmentStorageProxyUri=\")) {\n proxyUri = element.trim().match(\"DevelopmentStorageProxyUri=(.*)\")![1];\n }\n }\n }\n return proxyUri;\n}\n\nexport function getValueInConnString(\n connectionString: string,\n argument:\n | \"BlobEndpoint\"\n | \"AccountName\"\n | \"AccountKey\"\n | \"DefaultEndpointsProtocol\"\n | \"EndpointSuffix\"\n | \"SharedAccessSignature\",\n): string {\n const elements = connectionString.split(\";\");\n for (const element of elements) {\n if (element.trim().startsWith(argument)) {\n return element.trim().match(argument + \"=(.*)\")![1];\n }\n }\n return \"\";\n}\n\n/**\n * Extracts the parts of an Azure Storage account connection string.\n *\n * @param connectionString - Connection string.\n * @returns String key value pairs of the storage account's url and credentials.\n */\nexport function extractConnectionStringParts(connectionString: string): ConnectionString {\n let proxyUri = \"\";\n\n if (connectionString.startsWith(\"UseDevelopmentStorage=true\")) {\n // Development connection string\n proxyUri = getProxyUriFromDevConnString(connectionString);\n connectionString = DevelopmentConnectionString;\n }\n\n // Matching BlobEndpoint in the Account connection string\n let blobEndpoint = getValueInConnString(connectionString, \"BlobEndpoint\");\n // Slicing off '/' at the end if exists\n // (The methods that use `extractConnectionStringParts` expect the url to not have `/` at the end)\n blobEndpoint = blobEndpoint.endsWith(\"/\") ? blobEndpoint.slice(0, -1) : blobEndpoint;\n\n if (\n connectionString.search(\"DefaultEndpointsProtocol=\") !== -1 &&\n connectionString.search(\"AccountKey=\") !== -1\n ) {\n // Account connection string\n\n let defaultEndpointsProtocol = \"\";\n let accountName = \"\";\n let accountKey = Buffer.from(\"accountKey\", \"base64\");\n let endpointSuffix = \"\";\n\n // Get account name and key\n accountName = getValueInConnString(connectionString, \"AccountName\");\n accountKey = Buffer.from(getValueInConnString(connectionString, \"AccountKey\"), \"base64\");\n\n if (!blobEndpoint) {\n // BlobEndpoint is not present in the Account connection string\n // Can be obtained from `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`\n\n defaultEndpointsProtocol = getValueInConnString(connectionString, \"DefaultEndpointsProtocol\");\n const protocol = defaultEndpointsProtocol!.toLowerCase();\n if (protocol !== \"https\" && protocol !== \"http\") {\n throw new Error(\n \"Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'\",\n );\n }\n\n endpointSuffix = getValueInConnString(connectionString, \"EndpointSuffix\");\n if (!endpointSuffix) {\n throw new Error(\"Invalid EndpointSuffix in the provided Connection String\");\n }\n blobEndpoint = `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`;\n }\n\n if (!accountName) {\n throw new Error(\"Invalid AccountName in the provided Connection String\");\n } else if (accountKey.length === 0) {\n throw new Error(\"Invalid AccountKey in the provided Connection String\");\n }\n\n return {\n kind: \"AccountConnString\",\n url: blobEndpoint,\n accountName,\n accountKey,\n proxyUri,\n };\n } else {\n // SAS connection string\n\n const accountSas = getValueInConnString(connectionString, \"SharedAccessSignature\");\n let accountName = getValueInConnString(connectionString, \"AccountName\");\n // if accountName is empty, try to read it from BlobEndpoint\n if (!accountName) {\n accountName = getAccountNameFromUrl(blobEndpoint);\n }\n if (!blobEndpoint) {\n throw new Error(\"Invalid BlobEndpoint in the provided SAS Connection String\");\n } else if (!accountSas) {\n throw new Error(\"Invalid SharedAccessSignature in the provided SAS Connection String\");\n }\n\n return { kind: \"SASConnString\", url: blobEndpoint, accountName, accountSas };\n }\n}\n\n/**\n * Internal escape method implemented Strategy Two mentioned in escapeURL() description.\n *\n * @param text -\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nfunction escape(text: string): string {\n return encodeURIComponent(text)\n .replace(/%2F/g, \"/\") // Don't escape for \"/\"\n .replace(/'/g, \"%27\") // Escape for \"'\"\n .replace(/\\+/g, \"%20\")\n .replace(/%25/g, \"%\"); // Revert encoded \"%\"\n}\n\n/**\n * Append a string to URL path. Will remove duplicated \"/\" in front of the string\n * when URL path ends with a \"/\".\n *\n * @param url - Source URL string\n * @param name - String to be appended to URL\n * @returns An updated URL string\n */\nexport function appendToURLPath(url: string, name: string): string {\n const urlParsed = new URL(url);\n\n let path = urlParsed.pathname;\n path = path ? (path.endsWith(\"/\") ? `${path}${name}` : `${path}/${name}`) : name;\n urlParsed.pathname = path;\n\n return urlParsed.toString();\n}\n\n/**\n * Append a string to URL query.\n *\n * @param url - Source URL string.\n * @param queryParts - String to be appended to the URL query.\n * @returns An updated URL string.\n */\nexport function appendToURLQuery(url: string, queryParts: string): string {\n const urlParsed = new URL(url);\n\n let query = urlParsed.search;\n if (query) {\n query += \"&\" + queryParts;\n } else {\n query = queryParts;\n }\n\n urlParsed.search = query;\n return urlParsed.toString();\n}\n\n/**\n * Set URL parameter name and value. If name exists in URL parameters, old value\n * will be replaced by name key. If not provide value, the parameter will be deleted.\n *\n * @param url - Source URL string\n * @param name - Parameter name\n * @param value - Parameter value\n * @returns An updated URL string\n */\nexport function setURLParameter(url: string, name: string, value?: string): string {\n const urlParsed = new URL(url);\n const encodedName = encodeURIComponent(name);\n const encodedValue = value ? encodeURIComponent(value) : undefined;\n // mutating searchParams will change the encoding, so we have to do this ourselves\n const searchString = urlParsed.search === \"\" ? \"?\" : urlParsed.search;\n\n const searchPieces: string[] = [];\n\n for (const pair of searchString.slice(1).split(\"&\")) {\n if (pair) {\n const [key] = pair.split(\"=\", 2);\n if (key !== encodedName) {\n searchPieces.push(pair);\n }\n }\n }\n if (encodedValue) {\n searchPieces.push(`${encodedName}=${encodedValue}`);\n }\n\n urlParsed.search = searchPieces.length ? `?${searchPieces.join(\"&\")}` : \"\";\n\n return urlParsed.toString();\n}\n\n/**\n * Get URL parameter by name.\n *\n * @param url -\n * @param name -\n */\nexport function getURLParameter(url: string, name: string): string | string[] | undefined {\n const urlParsed = new URL(url);\n return urlParsed.searchParams.get(name) ?? undefined;\n}\n\n/**\n * Set URL host.\n *\n * @param url - Source URL string\n * @param host - New host string\n * @returns An updated URL string\n */\nexport function setURLHost(url: string, host: string): string {\n const urlParsed = new URL(url);\n urlParsed.hostname = host;\n return urlParsed.toString();\n}\n\n/**\n * Get URL path from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURLPath(url: string): string | undefined {\n try {\n const urlParsed = new URL(url);\n return urlParsed.pathname;\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * Set URL path.\n *\n * @param url -\n * @param path -\n */\nexport function setURLPath(url: string, path: string): string {\n const urlParsed = new URL(url);\n urlParsed.pathname = path;\n return urlParsed.toString();\n}\n\n/**\n * Get URL scheme from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURLScheme(url: string): string | undefined {\n try {\n const urlParsed = new URL(url);\n return urlParsed.protocol.endsWith(\":\") ? urlParsed.protocol.slice(0, -1) : urlParsed.protocol;\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * Get URL path and query from an URL string.\n *\n * @param url - Source URL string\n */\nexport function getURLPathAndQuery(url: string): string | undefined {\n const urlParsed = new URL(url);\n const pathString = urlParsed.pathname;\n if (!pathString) {\n throw new RangeError(\"Invalid url without valid path.\");\n }\n\n let queryString = urlParsed.search || \"\";\n queryString = queryString.trim();\n if (queryString !== \"\") {\n queryString = queryString.startsWith(\"?\") ? queryString : `?${queryString}`; // Ensure query string start with '?'\n }\n\n return `${pathString}${queryString}`;\n}\n\n/**\n * Get URL query key value pairs from an URL string.\n *\n * @param url -\n */\nexport function getURLQueries(url: string): { [key: string]: string } {\n let queryString = new URL(url).search;\n if (!queryString) {\n return {};\n }\n\n queryString = queryString.trim();\n queryString = queryString.startsWith(\"?\") ? queryString.substring(1) : queryString;\n\n let querySubStrings: string[] = queryString.split(\"&\");\n querySubStrings = querySubStrings.filter((value: string) => {\n const indexOfEqual = value.indexOf(\"=\");\n const lastIndexOfEqual = value.lastIndexOf(\"=\");\n return (\n indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1\n );\n });\n\n const queries: { [key: string]: string } = {};\n for (const querySubString of querySubStrings) {\n const splitResults = querySubString.split(\"=\");\n const key: string = splitResults[0];\n const value: string = splitResults[1];\n queries[key] = value;\n }\n\n return queries;\n}\n\n/**\n * Set URL query string.\n *\n * @param url -\n * @param queryString -\n */\nexport function setURLQueries(url: string, queryString: string): string {\n const urlParsed = new URL(url);\n urlParsed.search = queryString;\n return urlParsed.toString();\n}\n\n/**\n * Rounds a date off to seconds.\n *\n * @param date -\n * @param withMilliseconds - If true, YYYY-MM-DDThh:mm:ss.fffffffZ will be returned;\n * If false, YYYY-MM-DDThh:mm:ssZ will be returned.\n * @returns Date string in ISO8061 format, with or without 7 milliseconds component\n */\nexport function truncatedISO8061Date(date: Date, withMilliseconds: boolean = true): string {\n // Date.toISOString() will return like \"2018-10-29T06:34:36.139Z\"\n const dateString = date.toISOString();\n\n return withMilliseconds\n ? dateString.substring(0, dateString.length - 1) + \"0000\" + \"Z\"\n : dateString.substring(0, dateString.length - 5) + \"Z\";\n}\n\n/**\n * Base64 encode.\n *\n * @param content -\n */\nexport function base64encode(content: string): string {\n return !isNodeLike ? btoa(content) : Buffer.from(content).toString(\"base64\");\n}\n\n/**\n * Base64 decode.\n *\n * @param encodedString -\n */\nexport function base64decode(encodedString: string): string {\n return !isNodeLike ? atob(encodedString) : Buffer.from(encodedString, \"base64\").toString();\n}\n\n/**\n * Generate a 64 bytes base64 block ID string.\n *\n * @param blockIndex -\n */\nexport function generateBlockID(blockIDPrefix: string, blockIndex: number): string {\n // To generate a 64 bytes base64 string, source string should be 48\n const maxSourceStringLength = 48;\n\n // A blob can have a maximum of 100,000 uncommitted blocks at any given time\n const maxBlockIndexLength = 6;\n\n const maxAllowedBlockIDPrefixLength = maxSourceStringLength - maxBlockIndexLength;\n\n if (blockIDPrefix.length > maxAllowedBlockIDPrefixLength) {\n blockIDPrefix = blockIDPrefix.slice(0, maxAllowedBlockIDPrefixLength);\n }\n const res =\n blockIDPrefix +\n blockIndex.toString().padStart(maxSourceStringLength - blockIDPrefix.length, \"0\");\n return base64encode(res);\n}\n\nexport function sanitizeURL(url: string): string {\n let safeURL: string = url;\n if (getURLParameter(safeURL, UrlConstants.Parameters.SIGNATURE)) {\n safeURL = setURLParameter(safeURL, UrlConstants.Parameters.SIGNATURE, \"*****\");\n }\n\n return safeURL;\n}\n\nexport function sanitizeHeaders(originalHeader: HttpHeaders): HttpHeaders {\n const headers: HttpHeaders = createHttpHeaders();\n for (const [name, value] of originalHeader) {\n if (name.toLowerCase() === HeaderConstants.AUTHORIZATION.toLowerCase()) {\n headers.set(name, \"*****\");\n } else if (name.toLowerCase() === HeaderConstants.X_MS_COPY_SOURCE) {\n headers.set(name, sanitizeURL(value));\n } else {\n headers.set(name, value);\n }\n }\n\n return headers;\n}\n/**\n * If two strings are equal when compared case insensitive.\n *\n * @param str1 -\n * @param str2 -\n */\nexport function iEqual(str1: string, str2: string): boolean {\n return str1.toLocaleLowerCase() === str2.toLocaleLowerCase();\n}\n\nconst accountNameSuffixes = [\n \"-secondary-ipv6\",\n \"-secondary-dualstack\",\n \"-ipv6\",\n \"-dualstack\",\n \"-secondary\",\n];\n\n/**\n * Extracts account name from the url\n * @param url - url to extract the account name from\n * @returns with the account name\n */\nexport function getAccountNameFromUrl(url: string): string {\n const parsedUrl = new URL(url);\n let accountName;\n try {\n if (parsedUrl.hostname.split(\".\")[1] === \"blob\") {\n // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`;\n // `${defaultEndpointsProtocol}://${accountName}-suffix.blob.${endpointSuffix}`;\n accountName = parsedUrl.hostname.split(\".\")[0];\n for (let i = 0; i < accountNameSuffixes.length; ++i) {\n const suffix = accountNameSuffixes[i];\n if (accountName.endsWith(suffix)) {\n accountName = accountName.substring(0, accountName.length - suffix.length);\n }\n }\n } else if (isIpEndpointStyle(parsedUrl)) {\n // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/\n // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/\n // .getPath() -> /devstoreaccount1/\n accountName = parsedUrl.pathname.split(\"/\")[1];\n } else {\n // Custom domain case: \"https://customdomain.com/containername/blob\".\n accountName = \"\";\n }\n return accountName;\n } catch (error: any) {\n throw new Error(\"Unable to extract accountName with provided information.\");\n }\n}\n\nexport function isIpEndpointStyle(parsedUrl: URL): boolean {\n const host = parsedUrl.host;\n\n // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'.\n // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part.\n // Case 3: Ipv4, use broad regex which just check if host contains Ipv4.\n // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.\n return (\n /^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])){3}(:[0-9]+)?$/.test(\n host,\n ) ||\n (Boolean(parsedUrl.port) && PathStylePorts.includes(parsedUrl.port))\n );\n}\n\n/**\n * This is to convert a Windows File Time ticks to a Date object.\n */\nexport function windowsFileTimeTicksToTime(timeNumber: string | undefined): Date | undefined {\n if (!timeNumber) return undefined;\n // A windows file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed\n // since 12:00 A.M. January 1, 1601 Coordinated Universal Time (UTC).\n // JS Date accepts a value that represents milliseconds from 12:00 A.M. January 1, 1970\n // So, we'll handle the calculations in milliseconds from here\n\n // Time in milliseconds since \"12:00 A.M. January 1, 1601\"\n const timeElapsed = parseInt(timeNumber) / 10000;\n\n if (timeElapsed === 0) return undefined;\n\n // Reference - https://stackoverflow.com/a/24188106/4137356\n\n // Milliseconds calculated relative to \"12:00 A.M. January 1, 1970\" (will be negative)\n const initialFrameOfReference = Date.UTC(1601, 0, 1);\n\n // TimeRelativeTo1970 = (TimeAt1601 - TimeAt1970) + (Current - TimeAt1601) = (Current - TimeAt1970)\n return new Date(initialFrameOfReference + timeElapsed);\n}\n\nexport function ensureCpkIfSpecified(cpk: CpkInfo | undefined, isHttps: boolean): void {\n if (cpk && !isHttps) {\n throw new RangeError(\"Customer-provided encryption key must be used over HTTPS.\");\n }\n\n if (cpk && !cpk.encryptionAlgorithm) {\n cpk.encryptionAlgorithm = EncryptionAlgorithmAES25;\n }\n}\n\nexport function ToBlobContainerEncryptionScope(\n fileSystemEncryptionScope?: FileSystemEncryptionScope,\n): ContainerEncryptionScope | undefined {\n if (!fileSystemEncryptionScope) return undefined;\n\n if (!fileSystemEncryptionScope.defaultEncryptionScope) return undefined;\n\n return {\n defaultEncryptionScope: fileSystemEncryptionScope.defaultEncryptionScope,\n preventEncryptionScopeOverride: true,\n };\n}\n\n/**\n * Escape the file or directory name but keep path separator ('/').\n */\nexport function EscapePath(pathName: string): string {\n const split = pathName.split(\"/\");\n for (let i = 0; i < split.length; i++) {\n split[i] = encodeURIComponent(split[i]);\n }\n return split.join(\"/\");\n}\n\n/**\n * A typesafe helper for ensuring that a given response object has\n * the original _response attached.\n * @param response - A response object from calling a client operation\n * @returns The same object, but with known _response property\n */\nexport function assertResponse<T extends object, Headers = undefined, Body = undefined>(\n response: T,\n): WithResponse<T, Headers, Body> {\n if (`_response` in response) {\n return response as WithResponse<T, Headers, Body>;\n }\n\n throw new TypeError(`Unexpected response object ${response}`);\n}\n\nexport interface PathGetPropertiesRawResponseWithExtraPropertiesLike {\n encryptionContext?: string;\n owner?: string;\n group?: string;\n permissions?: PathPermissions;\n acl: PathAccessControlItem[];\n _response: HttpResponse & {\n parsedHeaders: {\n encryptionContext?: string;\n owner?: string;\n group?: string;\n permissions?: PathPermissions;\n acl: PathAccessControlItem[];\n };\n };\n}\n\nfunction ParseHeaderValue(\n rawResponse: PathGetPropertiesRawResponseWithExtraPropertiesLike,\n headerName: string,\n): string | undefined {\n if (rawResponse._response) {\n const headers = rawResponse._response.headers as HttpHeadersLike;\n if (headers) {\n return headers.get(headerName);\n }\n }\n\n return undefined;\n}\n\n/**\n * Parse extra properties values from headers in raw response.\n */\nexport function ParsePathGetPropertiesExtraHeaderValues(\n rawResponse: PathGetPropertiesRawResponseWithExtraPropertiesLike,\n): PathGetPropertiesRawResponseWithExtraPropertiesLike {\n const response = rawResponse;\n response.encryptionContext = ParseHeaderValue(rawResponse, \"x-ms-encryption-context\");\n response.owner = ParseHeaderValue(rawResponse, \"x-ms-owner\");\n response.group = ParseHeaderValue(rawResponse, \"x-ms-group\");\n response.permissions = toPermissions(ParseHeaderValue(rawResponse, \"x-ms-permissions\"));\n response.acl = toAcl(ParseHeaderValue(rawResponse, \"x-ms-acl\"));\n if (response._response?.parsedHeaders) {\n response._response.parsedHeaders.encryptionContext = response.encryptionContext;\n response._response.parsedHeaders.owner = response.owner;\n response._response.parsedHeaders.group = response.group;\n response._response.parsedHeaders.permissions = response.permissions;\n response._response.parsedHeaders.acl = response.acl;\n }\n return response;\n}\n\ninterface UploadChecksumParametersLike {\n /** Parameter group */\n pathHttpHeaders?: PathHttpHeaders;\n transactionalContentCrc64?: Uint8Array;\n contentChecksumAlgorithm?: StorageChecksumAlgorithm;\n structuredBodyType?: string;\n structuredContentLength?: number;\n}\n\ninterface UploadChecksumOptionsLike {\n transactionalContentMD5?: Uint8Array;\n transactionalContentCrc64?: Uint8Array;\n contentChecksumAlgorithm?: StorageChecksumAlgorithm;\n structuredBodyType?: string;\n structuredContentLength?: number;\n}\n\ninterface UploadCheckSumBody {\n contentChecksumAlgorithm?: StorageChecksumAlgorithm;\n body: HttpRequestBody;\n contentLength: number;\n}\n\nexport async function setUploadChecksumParameters(\n body: HttpRequestBody,\n contentLength: number,\n parameters: UploadChecksumParametersLike,\n uploadOptions: UploadChecksumOptionsLike,\n configContentChecksumAlgorithm?: StorageChecksumAlgorithm,\n): Promise<UploadCheckSumBody> {\n let contentChecksumAlgorithm =\n uploadOptions.contentChecksumAlgorithm ?? configContentChecksumAlgorithm;\n if (contentChecksumAlgorithm === undefined) {\n contentChecksumAlgorithm = \"Customized\";\n }\n\n if (contentChecksumAlgorithm === \"Auto\") {\n contentChecksumAlgorithm = \"StorageCrc64\";\n }\n\n let bodyInfo = undefined;\n if (contentChecksumAlgorithm === \"Customized\") {\n if (parameters.pathHttpHeaders === undefined) {\n parameters.pathHttpHeaders = {\n contentMD5: uploadOptions.transactionalContentMD5,\n };\n } else {\n parameters.pathHttpHeaders.transactionalContentHash = uploadOptions.transactionalContentMD5;\n (parameters as any).transactionalContentHash = uploadOptions.transactionalContentMD5;\n }\n parameters.transactionalContentCrc64 = uploadOptions.transactionalContentCrc64;\n } else if (contentChecksumAlgorithm === \"StorageCrc64\") {\n await StorageCRC64Calculator.init();\n bodyInfo = await structuredMessageEncoding(body, contentLength);\n parameters.structuredBodyType = \"XSM/1.0; properties=crc64\";\n parameters.structuredContentLength = contentLength;\n }\n\n return {\n body: contentChecksumAlgorithm === \"StorageCrc64\" ? bodyInfo!.body : body,\n contentLength:\n contentChecksumAlgorithm === \"StorageCrc64\" ? bodyInfo!.encodedContentLength : contentLength,\n contentChecksumAlgorithm: contentChecksumAlgorithm,\n };\n}\n\nexport function isDataLakeGetUserDelegationKeyParameters(\n parameter: unknown,\n): parameter is DataLakeGetUserDelegationKeyParameters {\n if (!parameter || typeof parameter !== \"object\") {\n return false;\n }\n\n const castParameter = parameter as DataLakeGetUserDelegationKeyParameters;\n\n return castParameter.expiresOn instanceof Date;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAAkC;AAClC,uBAA2B;AAW3B,uBAMO;AAGP,wBAAqC;AAErC,4BAAkE;AAsD3D,SAAS,cAAc,KAAqB;AACjD,QAAM,YAAY,IAAI,IAAI,GAAG;AAE7B,MAAI,OAAO,UAAU;AACrB,SAAO,QAAQ;AAEf,SAAO,OAAO,IAAI;AAClB,YAAU,WAAW;AAErB,SAAO,UAAU,SAAS;AAC5B;AAWA,SAAS,6BAA6B,kB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AAqB;AAC5C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/clients.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { TokenCredential } from "@azure/core-auth";
|
|
2
2
|
import type { RequestBodyType as HttpRequestBody } from "@azure/core-rest-pipeline";
|
|
3
3
|
import type { Pipeline } from "./Pipeline.js";
|
|
4
|
+
import { Tags } from "@azure/storage-blob";
|
|
4
5
|
import { AnonymousCredential } from "@azure/storage-common";
|
|
5
6
|
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential.js";
|
|
6
7
|
import type { Readable } from "node:stream";
|
|
7
8
|
import type { UserDelegationKey } from "@azure/storage-common";
|
|
8
9
|
import { DataLakeLeaseClient } from "./DataLakeLeaseClient.js";
|
|
9
|
-
import type { DataLakeClientConfig, DataLakeFileClientOptions, DataLakePathClientOptions, DirectoryCreateIfNotExistsOptions, DirectoryCreateIfNotExistsResponse, DirectoryCreateOptions, DirectoryCreateResponse, DirectoryGenerateSasUrlOptions, FileAppendOptions, FileAppendResponse, FileCreateIfNotExistsOptions, FileCreateIfNotExistsResponse, FileCreateOptions, FileCreateResponse, FileExpiryMode, FileFlushOptions, FileFlushResponse, FileGenerateSasUrlOptions, FileParallelUploadOptions, FileQueryOptions, FileReadOptions, FileReadResponse, FileReadToBufferOptions, FileSetExpiryOptions, FileSetExpiryResponse, FileUploadResponse, Metadata, PathAccessControlItem, PathChangeAccessControlRecursiveOptions, PathChangeAccessControlRecursiveResponse, PathCreateIfNotExistsOptions, PathCreateIfNotExistsResponse, PathCreateOptions, PathCreateResponse, PathDeleteIfExistsResponse, PathDeleteOptions, PathDeleteResponse, PathExistsOptions, PathGetAccessControlOptions, PathGetAccessControlResponse, PathGetPropertiesOptions, PathGetPropertiesResponse, PathHttpHeaders, PathMoveOptions, PathMoveResponse, PathPermissions, PathResourceTypeModel, PathSetAccessControlOptions, PathSetAccessControlResponse, PathSetHttpHeadersOptions, PathSetHttpHeadersResponse, PathSetMetadataOptions, PathSetMetadataResponse, PathSetPermissionsOptions, PathSetPermissionsResponse, RemovePathAccessControlItem } from "./models.js";
|
|
10
|
+
import type { DataLakeClientConfig, DataLakeFileClientOptions, DataLakePathClientOptions, DirectoryCreateIfNotExistsOptions, DirectoryCreateIfNotExistsResponse, DirectoryCreateOptions, DirectoryCreateResponse, DirectoryGenerateSasUrlOptions, FileAppendOptions, FileAppendResponse, FileCreateIfNotExistsOptions, FileCreateIfNotExistsResponse, FileCreateOptions, FileCreateResponse, FileExpiryMode, FileFlushOptions, FileFlushResponse, FileGenerateSasUrlOptions, FileParallelUploadOptions, FileQueryOptions, FileReadOptions, FileReadResponse, FileReadToBufferOptions, FileSetExpiryOptions, FileSetExpiryResponse, FileUploadResponse, Metadata, PathAccessControlItem, PathChangeAccessControlRecursiveOptions, PathChangeAccessControlRecursiveResponse, PathCreateIfNotExistsOptions, PathCreateIfNotExistsResponse, PathCreateOptions, PathCreateResponse, PathDeleteIfExistsResponse, PathDeleteOptions, PathDeleteResponse, PathExistsOptions, PathGetAccessControlOptions, PathGetAccessControlResponse, PathGetPropertiesOptions, PathGetPropertiesResponse, PathGetSystemPropertiesOptions, PathGetSystemPropertiesResponse, PathGetTagsOptions, PathGetTagsResponse, PathHttpHeaders, PathMoveOptions, PathMoveResponse, PathPermissions, PathResourceTypeModel, PathSetAccessControlOptions, PathSetAccessControlResponse, PathSetHttpHeadersOptions, PathSetHttpHeadersResponse, PathSetMetadataOptions, PathSetMetadataResponse, PathSetPermissionsOptions, PathSetPermissionsResponse, PathSetTagsOptions, PathSetTagsResponse, RemovePathAccessControlItem } from "./models.js";
|
|
10
11
|
import { StorageClient } from "./StorageClient.js";
|
|
11
12
|
/**
|
|
12
13
|
* A DataLakePathClient represents a URL to the Azure Storage path (directory or file).
|
|
@@ -178,6 +179,15 @@ export declare class DataLakePathClient extends StorageClient {
|
|
|
178
179
|
* @param options - Optional. Options when setting path permissions.
|
|
179
180
|
*/
|
|
180
181
|
setPermissions(permissions: PathPermissions, options?: PathSetPermissionsOptions): Promise<PathSetPermissionsResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* Returns all standard HTTP properties, and system properties
|
|
184
|
+
* for the path (directory or file).
|
|
185
|
+
*
|
|
186
|
+
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/get-properties?view=rest-storageservices-datalakestoragegen2-2019-12-12
|
|
187
|
+
*
|
|
188
|
+
* @param options - Optional. Options when getting path properties.
|
|
189
|
+
*/
|
|
190
|
+
getSystemProperties(options?: PathGetSystemPropertiesOptions): Promise<PathGetSystemPropertiesResponse>;
|
|
181
191
|
/**
|
|
182
192
|
* Returns all user-defined metadata, standard HTTP properties, and system properties
|
|
183
193
|
* for the path (directory or file).
|
|
@@ -216,6 +226,22 @@ export declare class DataLakePathClient extends StorageClient {
|
|
|
216
226
|
* @param options - Optional. Options when setting path metadata.
|
|
217
227
|
*/
|
|
218
228
|
setMetadata(metadata?: Metadata, options?: PathSetMetadataOptions): Promise<PathSetMetadataResponse>;
|
|
229
|
+
/**
|
|
230
|
+
* Gets the tags associated with the underlying path.
|
|
231
|
+
*
|
|
232
|
+
* @param options -
|
|
233
|
+
*/
|
|
234
|
+
getTags(options?: PathGetTagsOptions): Promise<PathGetTagsResponse>;
|
|
235
|
+
/**
|
|
236
|
+
* Sets tags on the underlying path.
|
|
237
|
+
* A path can have up to 10 tags. Tag keys must be between 1 and 128 characters. Tag values must be between 0 and 256 characters.
|
|
238
|
+
* Valid tag key and value characters include lower and upper case letters, digits (0-9),
|
|
239
|
+
* space (' '), plus ('+'), minus ('-'), period ('.'), forward slash ('/'), colon (':'), equals ('='), and underscore ('_').
|
|
240
|
+
*
|
|
241
|
+
* @param tags -
|
|
242
|
+
* @param options -
|
|
243
|
+
*/
|
|
244
|
+
setTags(tags: Tags, options?: PathSetTagsOptions): Promise<PathSetTagsResponse>;
|
|
219
245
|
/**
|
|
220
246
|
* Move directory or file within same file system.
|
|
221
247
|
*
|
|
@@ -416,6 +442,7 @@ export declare class DataLakeFileClient extends DataLakePathClient {
|
|
|
416
442
|
* ```ts snippet:ReadmeSampleDownloadFile_Node
|
|
417
443
|
* import { DataLakeServiceClient } from "@azure/storage-file-datalake";
|
|
418
444
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
445
|
+
* import { buffer } from "node:stream/consumers";
|
|
419
446
|
*
|
|
420
447
|
* const account = "<account>";
|
|
421
448
|
* const datalakeServiceClient = new DataLakeServiceClient(
|
|
@@ -432,23 +459,11 @@ export declare class DataLakeFileClient extends DataLakePathClient {
|
|
|
432
459
|
* // In Node.js, get downloaded data by accessing downloadResponse.readableStreamBody
|
|
433
460
|
* const downloadResponse = await fileClient.read();
|
|
434
461
|
* if (downloadResponse.readableStreamBody) {
|
|
435
|
-
*
|
|
462
|
+
* // Download the raw bytes of the file. Use `text` from "node:stream/consumers"
|
|
463
|
+
* // instead if you want to read the content as a string directly.
|
|
464
|
+
* const downloaded = await buffer(downloadResponse.readableStreamBody);
|
|
436
465
|
* console.log("Downloaded file content:", downloaded.toString());
|
|
437
466
|
* }
|
|
438
|
-
*
|
|
439
|
-
* // [Node.js only] A helper method used to read a Node.js readable stream into a Buffer.
|
|
440
|
-
* async function streamToBuffer(readableStream: NodeJS.ReadableStream): Promise<Buffer> {
|
|
441
|
-
* return new Promise((resolve, reject) => {
|
|
442
|
-
* const chunks: Buffer[] = [];
|
|
443
|
-
* readableStream.on("data", (data) => {
|
|
444
|
-
* chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
|
445
|
-
* });
|
|
446
|
-
* readableStream.on("end", () => {
|
|
447
|
-
* resolve(Buffer.concat(chunks));
|
|
448
|
-
* });
|
|
449
|
-
* readableStream.on("error", reject);
|
|
450
|
-
* });
|
|
451
|
-
* }
|
|
452
467
|
* ```
|
|
453
468
|
*
|
|
454
469
|
* Example usage (browser):
|
|
@@ -595,6 +610,7 @@ export declare class DataLakeFileClient extends DataLakePathClient {
|
|
|
595
610
|
*
|
|
596
611
|
* ```ts snippet:ReadmeSampleQueryFile_Node
|
|
597
612
|
* import { DataLakeServiceClient } from "@azure/storage-file-datalake";
|
|
613
|
+
* import { buffer } from "node:stream/consumers";
|
|
598
614
|
*
|
|
599
615
|
* const account = "<account>";
|
|
600
616
|
* const sas = "<sas token>";
|
|
@@ -610,22 +626,10 @@ export declare class DataLakeFileClient extends DataLakePathClient {
|
|
|
610
626
|
* // Query and convert a file to a string
|
|
611
627
|
* const queryResponse = await fileClient.query("select * from BlobStorage");
|
|
612
628
|
* if (queryResponse.readableStreamBody) {
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
* }
|
|
617
|
-
*
|
|
618
|
-
* async function streamToBuffer(readableStream: NodeJS.ReadableStream): Promise<Buffer> {
|
|
619
|
-
* return new Promise((resolve, reject) => {
|
|
620
|
-
* const chunks: Buffer[] = [];
|
|
621
|
-
* readableStream.on("data", (data) => {
|
|
622
|
-
* chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
|
623
|
-
* });
|
|
624
|
-
* readableStream.on("end", () => {
|
|
625
|
-
* resolve(Buffer.concat(chunks));
|
|
626
|
-
* });
|
|
627
|
-
* readableStream.on("error", reject);
|
|
628
|
-
* });
|
|
629
|
+
* // Read the response bytes. Use `text` from "node:stream/consumers" instead
|
|
630
|
+
* // if you want the response as a string directly.
|
|
631
|
+
* const responseBuffer = await buffer(queryResponse.readableStreamBody);
|
|
632
|
+
* console.log(`Query file content: ${responseBuffer.toString()}`);
|
|
629
633
|
* }
|
|
630
634
|
* ```
|
|
631
635
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../src/clients.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEpF,OAAO,KAAK,EAAE,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427
427
|
});
|
|
428
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* Returns all standard HTTP properties, and system properties
|
|
431
|
+
* for the path (directory or file).
|
|
432
|
+
*
|
|
433
|
+
* @see https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/get-properties?view=rest-storageservices-datalakestoragegen2-2019-12-12
|
|
434
|
+
*
|
|
435
|
+
* @param options - Optional. Options when getting path properties.
|
|
436
|
+
*/
|
|
437
|
+
async getSystemProperties(options = {}) {
|
|
438
|
+
return tracingClient.withSpan("DataLakePathClient-getSystemProperties", options, async (updatedOptions) => {
|
|
439
|
+
const response = assertResponse(await this.pathContext.getProperties({
|
|
440
|
+
...updatedOptions,
|
|
441
|
+
action: "getStatus",
|
|
442
|
+
upn: options.userPrincipalName,
|
|
443
|
+
leaseAccessConditions: options.conditions,
|
|
444
|
+
modifiedAccessConditions: options.conditions,
|
|
445
|
+
abortSignal: options.abortSignal,
|
|
446
|
+
}));
|
|
447
|
+
return {
|
|
448
|
+
...response,
|
|
449
|
+
_response: response._response,
|
|
450
|
+
isDirectory: response.resourceType === "directory",
|
|
451
|
+
permissions: toPermissions(response.permissions),
|
|
452
|
+
};
|
|
453
|
+
});
|
|
454
|
+
}
|
|
429
455
|
/**
|
|
430
456
|
* Returns all user-defined metadata, standard HTTP properties, and system properties
|
|
431
457
|
* for the path (directory or file).
|
|
@@ -492,6 +518,36 @@ export class DataLakePathClient extends StorageClient {
|
|
|
492
518
|
});
|
|
493
519
|
});
|
|
494
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Gets the tags associated with the underlying path.
|
|
523
|
+
*
|
|
524
|
+
* @param options -
|
|
525
|
+
*/
|
|
526
|
+
async getTags(options = {}) {
|
|
527
|
+
return tracingClient.withSpan("DataLakePathClient-getTags", options, async (updatedOptions) => {
|
|
528
|
+
return this.blobClient.getTags({
|
|
529
|
+
...options,
|
|
530
|
+
tracingOptions: updatedOptions.tracingOptions,
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Sets tags on the underlying path.
|
|
536
|
+
* A path can have up to 10 tags. Tag keys must be between 1 and 128 characters. Tag values must be between 0 and 256 characters.
|
|
537
|
+
* Valid tag key and value characters include lower and upper case letters, digits (0-9),
|
|
538
|
+
* space (' '), plus ('+'), minus ('-'), period ('.'), forward slash ('/'), colon (':'), equals ('='), and underscore ('_').
|
|
539
|
+
*
|
|
540
|
+
* @param tags -
|
|
541
|
+
* @param options -
|
|
542
|
+
*/
|
|
543
|
+
async setTags(tags, options = {}) {
|
|
544
|
+
return tracingClient.withSpan("DataLakePathClient-setTags", options, async (updatedOptions) => {
|
|
545
|
+
return this.blobClient.setTags(tags, {
|
|
546
|
+
...options,
|
|
547
|
+
tracingOptions: updatedOptions.tracingOptions,
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
}
|
|
495
551
|
async move(destinationPathOrFileSystem, destinationPathOrOptions, options) {
|
|
496
552
|
let destinationFileSystem = this.fileSystemName;
|
|
497
553
|
let destinationPath = destinationPathOrFileSystem;
|
|
@@ -755,6 +811,7 @@ export class DataLakeFileClient extends DataLakePathClient {
|
|
|
755
811
|
* ```ts snippet:ReadmeSampleDownloadFile_Node
|
|
756
812
|
* import { DataLakeServiceClient } from "@azure/storage-file-datalake";
|
|
757
813
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
814
|
+
* import { buffer } from "node:stream/consumers";
|
|
758
815
|
*
|
|
759
816
|
* const account = "<account>";
|
|
760
817
|
* const datalakeServiceClient = new DataLakeServiceClient(
|
|
@@ -771,23 +828,11 @@ export class DataLakeFileClient extends DataLakePathClient {
|
|
|
771
828
|
* // In Node.js, get downloaded data by accessing downloadResponse.readableStreamBody
|
|
772
829
|
* const downloadResponse = await fileClient.read();
|
|
773
830
|
* if (downloadResponse.readableStreamBody) {
|
|
774
|
-
*
|
|
831
|
+
* // Download the raw bytes of the file. Use `text` from "node:stream/consumers"
|
|
832
|
+
* // instead if you want to read the content as a string directly.
|
|
833
|
+
* const downloaded = await buffer(downloadResponse.readableStreamBody);
|
|
775
834
|
* console.log("Downloaded file content:", downloaded.toString());
|
|
776
835
|
* }
|
|
777
|
-
*
|
|
778
|
-
* // [Node.js only] A helper method used to read a Node.js readable stream into a Buffer.
|
|
779
|
-
* async function streamToBuffer(readableStream: NodeJS.ReadableStream): Promise<Buffer> {
|
|
780
|
-
* return new Promise((resolve, reject) => {
|
|
781
|
-
* const chunks: Buffer[] = [];
|
|
782
|
-
* readableStream.on("data", (data) => {
|
|
783
|
-
* chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
|
784
|
-
* });
|
|
785
|
-
* readableStream.on("end", () => {
|
|
786
|
-
* resolve(Buffer.concat(chunks));
|
|
787
|
-
* });
|
|
788
|
-
* readableStream.on("error", reject);
|
|
789
|
-
* });
|
|
790
|
-
* }
|
|
791
836
|
* ```
|
|
792
837
|
*
|
|
793
838
|
* Example usage (browser):
|
|
@@ -1202,6 +1247,7 @@ export class DataLakeFileClient extends DataLakePathClient {
|
|
|
1202
1247
|
*
|
|
1203
1248
|
* ```ts snippet:ReadmeSampleQueryFile_Node
|
|
1204
1249
|
* import { DataLakeServiceClient } from "@azure/storage-file-datalake";
|
|
1250
|
+
* import { buffer } from "node:stream/consumers";
|
|
1205
1251
|
*
|
|
1206
1252
|
* const account = "<account>";
|
|
1207
1253
|
* const sas = "<sas token>";
|
|
@@ -1217,22 +1263,10 @@ export class DataLakeFileClient extends DataLakePathClient {
|
|
|
1217
1263
|
* // Query and convert a file to a string
|
|
1218
1264
|
* const queryResponse = await fileClient.query("select * from BlobStorage");
|
|
1219
1265
|
* if (queryResponse.readableStreamBody) {
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
* }
|
|
1224
|
-
*
|
|
1225
|
-
* async function streamToBuffer(readableStream: NodeJS.ReadableStream): Promise<Buffer> {
|
|
1226
|
-
* return new Promise((resolve, reject) => {
|
|
1227
|
-
* const chunks: Buffer[] = [];
|
|
1228
|
-
* readableStream.on("data", (data) => {
|
|
1229
|
-
* chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
|
1230
|
-
* });
|
|
1231
|
-
* readableStream.on("end", () => {
|
|
1232
|
-
* resolve(Buffer.concat(chunks));
|
|
1233
|
-
* });
|
|
1234
|
-
* readableStream.on("error", reject);
|
|
1235
|
-
* });
|
|
1266
|
+
* // Read the response bytes. Use `text` from "node:stream/consumers" instead
|
|
1267
|
+
* // if you want the response as a string directly.
|
|
1268
|
+
* const responseBuffer = await buffer(queryResponse.readableStreamBody);
|
|
1269
|
+
* console.log(`Query file content: ${responseBuffer.toString()}`);
|
|
1236
1270
|
* }
|
|
1237
1271
|
* ```
|
|
1238
1272
|
*
|