@azure/data-tables 13.3.0-alpha.20241029.1 → 13.3.0-alpha.20241030.1

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.
Files changed (39) hide show
  1. package/dist/index.js +0 -5
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/TableClient.js +1 -1
  4. package/dist-esm/src/TableClient.js.map +1 -1
  5. package/dist-esm/src/TablePolicies.js +1 -1
  6. package/dist-esm/src/TablePolicies.js.map +1 -1
  7. package/dist-esm/src/TableServiceClient.js +1 -1
  8. package/dist-esm/src/TableServiceClient.js.map +1 -1
  9. package/dist-esm/src/TableTransaction.js +2 -2
  10. package/dist-esm/src/TableTransaction.js.map +1 -1
  11. package/dist-esm/src/cosmosPathPolicy.js.map +1 -1
  12. package/dist-esm/src/logger.js.map +1 -1
  13. package/dist-esm/src/models.js.map +1 -1
  14. package/dist-esm/src/sas/accountSasSignatureValues.js.map +1 -1
  15. package/dist-esm/src/sas/generateAccountSas.js +1 -1
  16. package/dist-esm/src/sas/generateAccountSas.js.map +1 -1
  17. package/dist-esm/src/sas/generateTableSas.js +1 -1
  18. package/dist-esm/src/sas/generateTableSas.js.map +1 -1
  19. package/dist-esm/src/sas/sasQueryParameters.js.map +1 -1
  20. package/dist-esm/src/sas/tableSasSignatureValues.js +0 -5
  21. package/dist-esm/src/sas/tableSasSignatureValues.js.map +1 -1
  22. package/dist-esm/src/secondaryEndpointPolicy.js.map +1 -1
  23. package/dist-esm/src/serialization.js.map +1 -1
  24. package/dist-esm/src/tablesNamedCredentialPolicy.browser.js.map +1 -1
  25. package/dist-esm/src/tablesNamedCredentialPolicy.js.map +1 -1
  26. package/dist-esm/src/tablesSASTokenPolicy.js.map +1 -1
  27. package/dist-esm/src/utils/accountConnectionString.browser.js.map +1 -1
  28. package/dist-esm/src/utils/accountConnectionString.js.map +1 -1
  29. package/dist-esm/src/utils/apiVersionPolicy.js.map +1 -1
  30. package/dist-esm/src/utils/baseTransactionHeaders.js.map +1 -1
  31. package/dist-esm/src/utils/challengeAuthenticationUtils.js.map +1 -1
  32. package/dist-esm/src/utils/connectionString.js.map +1 -1
  33. package/dist-esm/src/utils/errorHelpers.js.map +1 -1
  34. package/dist-esm/src/utils/internalModels.js.map +1 -1
  35. package/dist-esm/src/utils/isCredential.js +1 -1
  36. package/dist-esm/src/utils/isCredential.js.map +1 -1
  37. package/dist-esm/src/utils/transactionHeaders.js.map +1 -1
  38. package/package.json +1 -1
  39. package/types/latest/data-tables.d.ts +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport { TableGetAccessPolicyHeaders, TableInsertEntityHeaders } from \"./generated/models\";\n\n/**\n * Represents the Create or Delete Entity operation to be included in a Transaction request\n */\nexport type CreateDeleteEntityAction = [\"create\" | \"delete\", TableEntity];\n\n/**\n * Represents the Update or Upsert Entity operation to be included in a Transaction request\n */\nexport type UpdateEntityAction =\n | [\"update\" | \"upsert\", TableEntity]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\"]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\", UpdateTableEntityOptions | undefined];\n\n/**\n * Represents the union of all the available transactional actions\n */\nexport type TransactionAction = CreateDeleteEntityAction | UpdateEntityAction;\n\n/**\n * Client options used to configure Tables Api requests\n */\nexport type TableServiceClientOptions = CommonClientOptions & {\n endpoint?: string;\n version?: string;\n};\n\n/**\n * Contains response data for the createEntity operation.\n */\nexport type CreateTableEntityResponse = TableInsertEntityHeaders;\n\n/**\n * Contains response data for the listEntities operation.\n */\nexport type GetTableEntityResponse<T extends object> = TableEntityResult<T>;\n\n/**\n * Optional parameters for DeleteTableEntity operation\n */\nexport type DeleteTableEntityOptions = OperationOptions & {\n /**\n * UTC date/time value generated by the service that indicates the time at which the response was initiated\n */\n etag?: string;\n};\n\n/** The properties for the table item. */\nexport interface TableItem {\n /** The name of the table. */\n name?: string;\n}\n\n/**\n * OData Query options to limit the set of tables returned.\n */\nexport interface TableQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n}\n\n/**\n * OData Query options to limit the set of entities returned.\n */\nexport interface TableEntityQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n /**\n * A select expression limits the properties on each entity to just those requested.\n */\n select?: string[];\n}\n\n/**\n * List tables optional parameters.\n */\nexport type ListTableItemsOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableQueryOptions;\n};\n\n/**\n * Output type for query operations\n */\nexport type TableEntityResult<T> = T & {\n /**\n * etag property. Always returned by the service\n */\n etag: string;\n /**\n * Partition key property. Omitted if a select filter is set and this property is not requested\n */\n partitionKey?: string;\n /**\n * Row key property. Omitted if a select filter is set and this property is not requested\n */\n rowKey?: string;\n /**\n * Timestamp property. This property is assinged by the service on entity creation\n * Omitted if a select filter is set and this property is not requested\n */\n timestamp?: string;\n};\n\n/**\n * Output page type for query operations\n */\nexport type TableEntityResultPage<T> = Array<TableEntityResult<T>> & {\n /**\n * Continuation token to get the next page\n */\n continuationToken?: string;\n};\n\n/**\n * List entities optional parameters.\n */\nexport type ListTableEntitiesOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * GetEntity optional parameters.\n */\nexport type GetTableEntityOptions = OperationOptions & {\n /**\n * Parameter group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * Update entity optional parameters.\n */\nexport type UpdateTableEntityOptions = OperationOptions & {\n /**\n * Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update, set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a replace will be performed if an existing entity is found.\n */\n etag?: string;\n};\n\n/**\n * A set of key-value pairs representing the table entity.\n */\nexport type TableEntity<T extends object = Record<string, unknown>> = T & {\n /**\n * The PartitionKey property of the entity.\n */\n partitionKey: string;\n /**\n * The RowKey property of the entity.\n */\n rowKey: string;\n};\n\n/**\n * Supported EDM Types by Azure Tables.\n */\nexport type EdmTypes =\n | \"Binary\"\n | \"Boolean\"\n | \"DateTime\"\n | \"Double\"\n | \"Guid\"\n | \"Int32\"\n | \"Int64\"\n | \"String\";\n\n/**\n * Entity Data Model representation for an entity property.\n */\nexport interface Edm<T extends EdmTypes> {\n /**\n * The value of the entity property\n */\n value: T extends \"Binary\"\n ? string\n : T extends \"Boolean\"\n ? boolean\n : T extends \"Double\"\n ? number\n : T extends \"Int32\"\n ? number\n : string;\n /**\n * The type of the entity property\n */\n type: T;\n}\n\n/**\n * The different modes for Update and Upsert methods\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n */\nexport type UpdateMode = \"Merge\" | \"Replace\";\n\n/**\n * Represents the response of a Transaction operation\n */\nexport interface TableTransactionResponse {\n /**\n * Collection of sub responses\n */\n subResponses: TableTransactionEntityResponse[];\n /**\n * Main Transaction request status code\n */\n status: number;\n /**\n * Gets a specific response given a row key\n */\n getResponseForEntity: (rowKey: string) => TableTransactionEntityResponse | undefined;\n}\n\n/** The properties for the table query response. */\nexport interface TableQueryResponse {\n /** List of tables. */\n value?: TableItem[];\n}\n\n/**\n * Output page type for table query operations\n */\nexport interface TableItemResultPage extends Array<TableItem> {\n /**\n * Continuation token to get the next TableItem page\n */\n continuationToken?: string;\n}\n\n/**\n * Represents a sub-response of a Transaction operation\n */\nexport interface TableTransactionEntityResponse {\n /**\n * Entity's etag\n */\n etag?: string;\n /**\n * Entity's rowKey\n */\n rowKey?: string;\n /**\n * Sub-response status\n */\n status: number;\n}\n\n/** A signed identifier. */\nexport interface SignedIdentifier {\n /** A unique id. */\n id: string;\n /** The access policy. */\n accessPolicy?: AccessPolicy;\n}\n\n/** An Access policy. */\nexport interface AccessPolicy {\n /** The start datetime from which the policy is active. */\n start?: Date;\n /** The datetime that the policy expires. */\n expiry?: Date;\n /** The permissions for the acl policy. */\n permission?: string;\n}\n\n/** Contains response data for the getAccessPolicy operation. */\nexport type GetAccessPolicyResponse = TableGetAccessPolicyHeaders & SignedIdentifier[];\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TableGetAccessPolicyHeaders, TableInsertEntityHeaders } from \"./generated/models\";\n\n/**\n * Represents the Create or Delete Entity operation to be included in a Transaction request\n */\nexport type CreateDeleteEntityAction = [\"create\" | \"delete\", TableEntity];\n\n/**\n * Represents the Update or Upsert Entity operation to be included in a Transaction request\n */\nexport type UpdateEntityAction =\n | [\"update\" | \"upsert\", TableEntity]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\"]\n | [\"update\" | \"upsert\", TableEntity, \"Merge\" | \"Replace\", UpdateTableEntityOptions | undefined];\n\n/**\n * Represents the union of all the available transactional actions\n */\nexport type TransactionAction = CreateDeleteEntityAction | UpdateEntityAction;\n\n/**\n * Client options used to configure Tables Api requests\n */\nexport type TableServiceClientOptions = CommonClientOptions & {\n endpoint?: string;\n version?: string;\n};\n\n/**\n * Contains response data for the createEntity operation.\n */\nexport type CreateTableEntityResponse = TableInsertEntityHeaders;\n\n/**\n * Contains response data for the listEntities operation.\n */\nexport type GetTableEntityResponse<T extends object> = TableEntityResult<T>;\n\n/**\n * Optional parameters for DeleteTableEntity operation\n */\nexport type DeleteTableEntityOptions = OperationOptions & {\n /**\n * UTC date/time value generated by the service that indicates the time at which the response was initiated\n */\n etag?: string;\n};\n\n/** The properties for the table item. */\nexport interface TableItem {\n /** The name of the table. */\n name?: string;\n}\n\n/**\n * OData Query options to limit the set of tables returned.\n */\nexport interface TableQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n}\n\n/**\n * OData Query options to limit the set of entities returned.\n */\nexport interface TableEntityQueryOptions {\n /**\n * OData filter expression.\n */\n filter?: string;\n /**\n * A select expression limits the properties on each entity to just those requested.\n */\n select?: string[];\n}\n\n/**\n * List tables optional parameters.\n */\nexport type ListTableItemsOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableQueryOptions;\n};\n\n/**\n * Output type for query operations\n */\nexport type TableEntityResult<T> = T & {\n /**\n * etag property. Always returned by the service\n */\n etag: string;\n /**\n * Partition key property. Omitted if a select filter is set and this property is not requested\n */\n partitionKey?: string;\n /**\n * Row key property. Omitted if a select filter is set and this property is not requested\n */\n rowKey?: string;\n /**\n * Timestamp property. This property is assinged by the service on entity creation\n * Omitted if a select filter is set and this property is not requested\n */\n timestamp?: string;\n};\n\n/**\n * Output page type for query operations\n */\nexport type TableEntityResultPage<T> = Array<TableEntityResult<T>> & {\n /**\n * Continuation token to get the next page\n */\n continuationToken?: string;\n};\n\n/**\n * List entities optional parameters.\n */\nexport type ListTableEntitiesOptions = OperationOptions & {\n /**\n * Query options group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * GetEntity optional parameters.\n */\nexport type GetTableEntityOptions = OperationOptions & {\n /**\n * Parameter group\n */\n queryOptions?: TableEntityQueryOptions;\n /**\n * If true, automatic type conversion will be disabled and entity properties will\n * be represented by full metadata types. For example, an Int32 value will be \\{value: \"123\", type: \"Int32\"\\} instead of 123.\n * This option applies for all the properties\n */\n disableTypeConversion?: boolean;\n};\n\n/**\n * Update entity optional parameters.\n */\nexport type UpdateTableEntityOptions = OperationOptions & {\n /**\n * Match condition for an entity to be updated. If specified and a matching entity is not found, an error will be raised. To force an unconditional update, set to the wildcard character (*). If not specified, an insert will be performed when no existing entity is found to update and a replace will be performed if an existing entity is found.\n */\n etag?: string;\n};\n\n/**\n * A set of key-value pairs representing the table entity.\n */\nexport type TableEntity<T extends object = Record<string, unknown>> = T & {\n /**\n * The PartitionKey property of the entity.\n */\n partitionKey: string;\n /**\n * The RowKey property of the entity.\n */\n rowKey: string;\n};\n\n/**\n * Supported EDM Types by Azure Tables.\n */\nexport type EdmTypes =\n | \"Binary\"\n | \"Boolean\"\n | \"DateTime\"\n | \"Double\"\n | \"Guid\"\n | \"Int32\"\n | \"Int64\"\n | \"String\";\n\n/**\n * Entity Data Model representation for an entity property.\n */\nexport interface Edm<T extends EdmTypes> {\n /**\n * The value of the entity property\n */\n value: T extends \"Binary\"\n ? string\n : T extends \"Boolean\"\n ? boolean\n : T extends \"Double\"\n ? number\n : T extends \"Int32\"\n ? number\n : string;\n /**\n * The type of the entity property\n */\n type: T;\n}\n\n/**\n * The different modes for Update and Upsert methods\n * - Merge: Updates an entity by updating the entity's properties without replacing the existing entity.\n * - Replace: Updates an existing entity by replacing the entire entity.\n */\nexport type UpdateMode = \"Merge\" | \"Replace\";\n\n/**\n * Represents the response of a Transaction operation\n */\nexport interface TableTransactionResponse {\n /**\n * Collection of sub responses\n */\n subResponses: TableTransactionEntityResponse[];\n /**\n * Main Transaction request status code\n */\n status: number;\n /**\n * Gets a specific response given a row key\n */\n getResponseForEntity: (rowKey: string) => TableTransactionEntityResponse | undefined;\n}\n\n/** The properties for the table query response. */\nexport interface TableQueryResponse {\n /** List of tables. */\n value?: TableItem[];\n}\n\n/**\n * Output page type for table query operations\n */\nexport interface TableItemResultPage extends Array<TableItem> {\n /**\n * Continuation token to get the next TableItem page\n */\n continuationToken?: string;\n}\n\n/**\n * Represents a sub-response of a Transaction operation\n */\nexport interface TableTransactionEntityResponse {\n /**\n * Entity's etag\n */\n etag?: string;\n /**\n * Entity's rowKey\n */\n rowKey?: string;\n /**\n * Sub-response status\n */\n status: number;\n}\n\n/** A signed identifier. */\nexport interface SignedIdentifier {\n /** A unique id. */\n id: string;\n /** The access policy. */\n accessPolicy?: AccessPolicy;\n}\n\n/** An Access policy. */\nexport interface AccessPolicy {\n /** The start datetime from which the policy is active. */\n start?: Date;\n /** The datetime that the policy expires. */\n expiry?: Date;\n /** The permissions for the acl policy. */\n permission?: string;\n}\n\n/** Contains response data for the getAccessPolicy operation. */\nexport type GetAccessPolicyResponse = TableGetAccessPolicyHeaders & SignedIdentifier[];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"accountSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/accountSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAe,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EACL,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AA8DpE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iCAAiC,CAC/C,yB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QAAQ;QAC5C,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,SAAS,EAAE,yBAAyB,CAAC,SAAS;QAC9C,OAAO,EAAE,yBAAyB,CAAC,OAAO;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AccountSasPermissions, accountSasPermissionsToString } from \"./accountSasPermissions\";\nimport { SasIPRange, ipRangeToString } from \"./sasIPRange\";\nimport { SasProtocol, SasQueryParameters } from \"./sasQueryParameters\";\nimport {\n accountSasResourceTypesFromString,\n accountSasResourceTypesToString,\n} from \"./accountSasResourceTypes\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices\";\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once\n * all the values here are set appropriately, call {@link generateAccountSasQueryParameters} to obtain a representation\n * of the SAS which can actually be applied to table urls. Note: that both this class and {@link SasQueryParameters}\n * exist because the former is mutable and a logical representation while the latter is immutable and used to generate\n * actual REST requests.\n *\n * @see https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1\n * for more conceptual information on SAS\n *\n * @see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas\n * for descriptions of the parameters, including which are required\n */\nexport interface AccountSasSignatureValues {\n /**\n * If not provided, this defaults to the service version targeted by this version of the library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * The time after which the SAS will no longer work.\n */\n expiresOn: Date;\n\n /**\n * Specifies which operations the SAS user may perform. Please refer to {@link AccountSasPermissions} for help\n * constructing the permissions string.\n */\n permissions: AccountSasPermissions;\n\n /**\n * Optional. IP range allowed.\n */\n ipRange?: SasIPRange;\n\n /**\n * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSasServices} to\n * construct this value.\n */\n services: string;\n\n /**\n * The values that indicate the resource types accessible with this SAS. Please refer\n * to {@link AccountSasResourceTypes} to construct this value.\n */\n resourceTypes: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual\n * REST request.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n * @param accountSasSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateAccountSasQueryParameters(\n accountSasSignatureValues: AccountSasSignatureValues,\n credential: NamedKeyCredential,\n): SasQueryParameters {\n const version = accountSasSignatureValues.version\n ? accountSasSignatureValues.version\n : SERVICE_VERSION;\n\n const parsedPermissions = accountSasPermissionsToString(accountSasSignatureValues.permissions);\n const parsedServices = accountSasServicesToString(\n accountSasServicesFromString(accountSasSignatureValues.services),\n );\n // to and from string to guarantee the correct order of resoruce types is generated\n const parsedResourceTypes = accountSasResourceTypesToString(\n accountSasResourceTypesFromString(accountSasSignatureValues.resourceTypes),\n );\n\n const stringToSign = [\n credential.name,\n parsedPermissions,\n parsedServices,\n parsedResourceTypes,\n accountSasSignatureValues.startsOn\n ? truncatedISO8061Date(accountSasSignatureValues.startsOn, false)\n : \"\",\n truncatedISO8061Date(accountSasSignatureValues.expiresOn, false),\n accountSasSignatureValues.ipRange ? ipRangeToString(accountSasSignatureValues.ipRange) : \"\",\n accountSasSignatureValues.protocol ? accountSasSignatureValues.protocol : \"\",\n version,\n \"\", // Account SAS requires an additional newline character\n ].join(\"\\n\");\n\n const signature: string = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: parsedPermissions.toString(),\n services: parsedServices,\n resourceTypes: parsedResourceTypes,\n protocol: accountSasSignatureValues.protocol,\n startsOn: accountSasSignatureValues.startsOn,\n expiresOn: accountSasSignatureValues.expiresOn,\n ipRange: accountSasSignatureValues.ipRange,\n });\n}\n"]}
1
+ {"version":3,"file":"accountSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/accountSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AA8DpE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iCAAiC,CAC/C,yBAAoD,EACpD,UAA8B;IAE9B,MAAM,OAAO,GAAG,yBAAyB,CAAC,OAAO;QAC/C,CAAC,CAAC,yBAAyB,CAAC,OAAO;QACnC,CAAC,CAAC,eAAe,CAAC;IAEpB,MAAM,iBAAiB,GAAG,6BAA6B,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAC/F,MAAM,cAAc,GAAG,0BAA0B,CAC/C,4BAA4B,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CACjE,CAAC;IACF,mFAAmF;IACnF,MAAM,mBAAmB,GAAG,+BAA+B,CACzD,iCAAiC,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAC3E,CAAC;IAEF,MAAM,YAAY,GAAG;QACnB,UAAU,CAAC,IAAI;QACf,iBAAiB;QACjB,cAAc;QACd,mBAAmB;QACnB,yBAAyB,CAAC,QAAQ;YAChC,CAAC,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,QAAQ,EAAE,KAAK,CAAC;YACjE,CAAC,CAAC,EAAE;QACN,oBAAoB,CAAC,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC;QAChE,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3F,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QAC5E,OAAO;QACP,EAAE,EAAE,uDAAuD;KAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAW,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1E,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;QACzC,QAAQ,EAAE,cAAc;QACxB,aAAa,EAAE,mBAAmB;QAClC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,SAAS,EAAE,yBAAyB,CAAC,SAAS;QAC9C,OAAO,EAAE,yBAAyB,CAAC,OAAO;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccountSasPermissions } from \"./accountSasPermissions\";\nimport { accountSasPermissionsToString } from \"./accountSasPermissions\";\nimport type { SasIPRange } from \"./sasIPRange\";\nimport { ipRangeToString } from \"./sasIPRange\";\nimport type { SasProtocol } from \"./sasQueryParameters\";\nimport { SasQueryParameters } from \"./sasQueryParameters\";\nimport {\n accountSasResourceTypesFromString,\n accountSasResourceTypesToString,\n} from \"./accountSasResourceTypes\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once\n * all the values here are set appropriately, call {@link generateAccountSasQueryParameters} to obtain a representation\n * of the SAS which can actually be applied to table urls. Note: that both this class and {@link SasQueryParameters}\n * exist because the former is mutable and a logical representation while the latter is immutable and used to generate\n * actual REST requests.\n *\n * @see https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1\n * for more conceptual information on SAS\n *\n * @see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas\n * for descriptions of the parameters, including which are required\n */\nexport interface AccountSasSignatureValues {\n /**\n * If not provided, this defaults to the service version targeted by this version of the library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * The time after which the SAS will no longer work.\n */\n expiresOn: Date;\n\n /**\n * Specifies which operations the SAS user may perform. Please refer to {@link AccountSasPermissions} for help\n * constructing the permissions string.\n */\n permissions: AccountSasPermissions;\n\n /**\n * Optional. IP range allowed.\n */\n ipRange?: SasIPRange;\n\n /**\n * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSasServices} to\n * construct this value.\n */\n services: string;\n\n /**\n * The values that indicate the resource types accessible with this SAS. Please refer\n * to {@link AccountSasResourceTypes} to construct this value.\n */\n resourceTypes: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual\n * REST request.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n * @param accountSasSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateAccountSasQueryParameters(\n accountSasSignatureValues: AccountSasSignatureValues,\n credential: NamedKeyCredential,\n): SasQueryParameters {\n const version = accountSasSignatureValues.version\n ? accountSasSignatureValues.version\n : SERVICE_VERSION;\n\n const parsedPermissions = accountSasPermissionsToString(accountSasSignatureValues.permissions);\n const parsedServices = accountSasServicesToString(\n accountSasServicesFromString(accountSasSignatureValues.services),\n );\n // to and from string to guarantee the correct order of resoruce types is generated\n const parsedResourceTypes = accountSasResourceTypesToString(\n accountSasResourceTypesFromString(accountSasSignatureValues.resourceTypes),\n );\n\n const stringToSign = [\n credential.name,\n parsedPermissions,\n parsedServices,\n parsedResourceTypes,\n accountSasSignatureValues.startsOn\n ? truncatedISO8061Date(accountSasSignatureValues.startsOn, false)\n : \"\",\n truncatedISO8061Date(accountSasSignatureValues.expiresOn, false),\n accountSasSignatureValues.ipRange ? ipRangeToString(accountSasSignatureValues.ipRange) : \"\",\n accountSasSignatureValues.protocol ? accountSasSignatureValues.protocol : \"\",\n version,\n \"\", // Account SAS requires an additional newline character\n ].join(\"\\n\");\n\n const signature: string = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: parsedPermissions.toString(),\n services: parsedServices,\n resourceTypes: parsedResourceTypes,\n protocol: accountSasSignatureValues.protocol,\n startsOn: accountSasSignatureValues.startsOn,\n expiresOn: accountSasSignatureValues.expiresOn,\n ipRange: accountSasSignatureValues.ipRange,\n });\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  // Licensed under the MIT License.
3
3
  import { __rest } from "tslib";
4
4
  import { accountSasPermissionsFromString } from "./accountSasPermissions";
5
- import { accountSasServicesFromString, accountSasServicesToString, } from "./accountSasServices";
5
+ import { accountSasServicesFromString, accountSasServicesToString } from "./accountSasServices";
6
6
  import { isNamedKeyCredential } from "@azure/core-auth";
7
7
  import { generateAccountSasQueryParameters } from "./accountSasSignatureValues";
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"generateAccountSas.js","sourceRoot":"","sources":["../../../src/sas/generateAccountSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAyB,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAEL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAsB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8B,EAC9B,UAA6B,EAAE;IAE/B,MAAM,EACJ,SAAS,EACT,WAAW,GAAG,+BAA+B,CAAC,IAAI,CAAC,EACnD,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,4BAA4B,CAAC,GAAG,CAAC,KAE1C,OAAO,EADN,IAAI,UACL,OAAO,EANL,yDAML,CAAU,CAAC;IACZ,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,GAAG,SAAS,CAAC;IAEvB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,GAAG,GAAG,iCAAiC,iBAEzC,WAAW,EACX,SAAS,EAAE,MAAM,EACjB,aAAa,EACb,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC,IAC3C,IAAI,GAET,UAAU,CACX,CAAC,QAAQ,EAAE,CAAC;IAEb,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AccountSasPermissions, accountSasPermissionsFromString } from \"./accountSasPermissions\";\nimport {\n AccountSasServices,\n accountSasServicesFromString,\n accountSasServicesToString,\n} from \"./accountSasServices\";\nimport { NamedKeyCredential, isNamedKeyCredential } from \"@azure/core-auth\";\nimport { SasIPRange } from \"./sasIPRange\";\nimport { SasProtocol } from \"./sasQueryParameters\";\nimport { generateAccountSasQueryParameters } from \"./accountSasSignatureValues\";\n\n/**\n * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas\n *\n * @param options - Optional parameters.\n * @returns An account SAS token\n */\nexport function generateAccountSas(\n credential: NamedKeyCredential,\n options: AccountSasOptions = {},\n): string {\n const {\n expiresOn,\n permissions = accountSasPermissionsFromString(\"rl\"),\n resourceTypes = \"sco\",\n services = accountSasServicesFromString(\"t\"),\n ...rest\n } = options;\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n let expiry = expiresOn;\n\n if (expiry === undefined) {\n const now = new Date();\n expiry = new Date(now.getTime() + 3600 * 1000);\n }\n\n const sas = generateAccountSasQueryParameters(\n {\n permissions,\n expiresOn: expiry,\n resourceTypes,\n services: accountSasServicesToString(services),\n ...rest,\n },\n credential,\n ).toString();\n\n return sas;\n}\n\n/**\n * Options to configure {@link generateAccountSas} operation.\n */\nexport interface AccountSasOptions {\n /**\n * The time at which the shared access signature becomes invalid. Default to an hour later if not provided.\n */\n expiresOn?: Date;\n /**\n * Specifies the list of permissions to be associated with the SAS.\n */\n permissions?: AccountSasPermissions;\n /**\n * Specifies the resource types associated with the shared access signature.\n */\n resourceTypes?: string;\n /**\n * The version of the service this SAS will target. If not specified, it will default to the version targeted by the\n * library.\n */\n version?: string;\n\n /**\n * SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * When the SAS will take effect.\n */\n startsOn?: Date;\n /**\n * IP range allowed.\n */\n ipRange?: SasIPRange;\n /**\n * Account services\n */\n services?: AccountSasServices;\n}\n"]}
1
+ {"version":3,"file":"generateAccountSas.js","sourceRoot":"","sources":["../../../src/sas/generateAccountSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEhG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8B,EAC9B,UAA6B,EAAE;IAE/B,MAAM,EACJ,SAAS,EACT,WAAW,GAAG,+BAA+B,CAAC,IAAI,CAAC,EACnD,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,4BAA4B,CAAC,GAAG,CAAC,KAE1C,OAAO,EADN,IAAI,UACL,OAAO,EANL,yDAML,CAAU,CAAC;IACZ,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,GAAG,SAAS,CAAC;IAEvB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,GAAG,GAAG,iCAAiC,iBAEzC,WAAW,EACX,SAAS,EAAE,MAAM,EACjB,aAAa,EACb,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC,IAC3C,IAAI,GAET,UAAU,CACX,CAAC,QAAQ,EAAE,CAAC;IAEb,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccountSasPermissions } from \"./accountSasPermissions\";\nimport { accountSasPermissionsFromString } from \"./accountSasPermissions\";\nimport type { AccountSasServices } from \"./accountSasServices\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { isNamedKeyCredential } from \"@azure/core-auth\";\nimport type { SasIPRange } from \"./sasIPRange\";\nimport type { SasProtocol } from \"./sasQueryParameters\";\nimport { generateAccountSasQueryParameters } from \"./accountSasSignatureValues\";\n\n/**\n * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas\n *\n * @param options - Optional parameters.\n * @returns An account SAS token\n */\nexport function generateAccountSas(\n credential: NamedKeyCredential,\n options: AccountSasOptions = {},\n): string {\n const {\n expiresOn,\n permissions = accountSasPermissionsFromString(\"rl\"),\n resourceTypes = \"sco\",\n services = accountSasServicesFromString(\"t\"),\n ...rest\n } = options;\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n let expiry = expiresOn;\n\n if (expiry === undefined) {\n const now = new Date();\n expiry = new Date(now.getTime() + 3600 * 1000);\n }\n\n const sas = generateAccountSasQueryParameters(\n {\n permissions,\n expiresOn: expiry,\n resourceTypes,\n services: accountSasServicesToString(services),\n ...rest,\n },\n credential,\n ).toString();\n\n return sas;\n}\n\n/**\n * Options to configure {@link generateAccountSas} operation.\n */\nexport interface AccountSasOptions {\n /**\n * The time at which the shared access signature becomes invalid. Default to an hour later if not provided.\n */\n expiresOn?: Date;\n /**\n * Specifies the list of permissions to be associated with the SAS.\n */\n permissions?: AccountSasPermissions;\n /**\n * Specifies the resource types associated with the shared access signature.\n */\n resourceTypes?: string;\n /**\n * The version of the service this SAS will target. If not specified, it will default to the version targeted by the\n * library.\n */\n version?: string;\n\n /**\n * SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * When the SAS will take effect.\n */\n startsOn?: Date;\n /**\n * IP range allowed.\n */\n ipRange?: SasIPRange;\n /**\n * Account services\n */\n services?: AccountSasServices;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
  import { isNamedKeyCredential } from "@azure/core-auth";
4
- import { generateTableSasQueryParameters, } from "./tableSasSignatureValues";
4
+ import { generateTableSasQueryParameters } from "./tableSasSignatureValues";
5
5
  import { tableSasPermissionsFromString } from "./tableSasPermisions";
6
6
  /**
7
7
  * Generates a Table Service Shared Access Signature (SAS) URI based on the client properties
@@ -1 +1 @@
1
- {"version":3,"file":"generateTableSas.js","sourceRoot":"","sources":["../../../src/sas/generateTableSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAsB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAEL,+BAA+B,GAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,UAA8B,EAC9B,UAAmC,EAAE;IAErC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEzC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,8DAA8D;IAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,+BAA+B,CAAC,SAAS,EAAE,UAAU,kCAC5D,OAAO,KACV,SAAS;QACT,WAAW,IACX,CAAC,QAAQ,EAAE,CAAC;IAEd,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { NamedKeyCredential, isNamedKeyCredential } from \"@azure/core-auth\";\nimport {\n TableSasSignatureValues,\n generateTableSasQueryParameters,\n} from \"./tableSasSignatureValues\";\nimport { tableSasPermissionsFromString } from \"./tableSasPermisions\";\n\n/**\n * Generates a Table Service Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas\n *\n * @param options - Optional parameters.\n * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.\n */\nexport function generateTableSas(\n tableName: string,\n credential: NamedKeyCredential,\n options: TableSasSignatureValues = {},\n): string {\n let { expiresOn, permissions } = options;\n\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n // expiresOn and permissions are optional if an identifier is provided\n // set defaults when no identifier and no values were provided\n if (!options.identifier) {\n if (!permissions) {\n permissions = tableSasPermissionsFromString(\"r\");\n }\n\n if (expiresOn === undefined) {\n const now = new Date();\n expiresOn = new Date(now.getTime() + 3600 * 1000);\n }\n }\n\n const sas = generateTableSasQueryParameters(tableName, credential, {\n ...options,\n expiresOn,\n permissions,\n }).toString();\n\n return sas;\n}\n"]}
1
+ {"version":3,"file":"generateTableSas.js","sourceRoot":"","sources":["../../../src/sas/generateTableSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,UAA8B,EAC9B,UAAmC,EAAE;IAErC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEzC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,8DAA8D;IAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,+BAA+B,CAAC,SAAS,EAAE,UAAU,kCAC5D,OAAO,KACV,SAAS;QACT,WAAW,IACX,CAAC,QAAQ,EAAE,CAAC;IAEd,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { isNamedKeyCredential } from \"@azure/core-auth\";\nimport type { TableSasSignatureValues } from \"./tableSasSignatureValues\";\nimport { generateTableSasQueryParameters } from \"./tableSasSignatureValues\";\nimport { tableSasPermissionsFromString } from \"./tableSasPermisions\";\n\n/**\n * Generates a Table Service Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas\n *\n * @param options - Optional parameters.\n * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.\n */\nexport function generateTableSas(\n tableName: string,\n credential: NamedKeyCredential,\n options: TableSasSignatureValues = {},\n): string {\n let { expiresOn, permissions } = options;\n\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n // expiresOn and permissions are optional if an identifier is provided\n // set defaults when no identifier and no values were provided\n if (!options.identifier) {\n if (!permissions) {\n permissions = tableSasPermissionsFromString(\"r\");\n }\n\n if (expiresOn === undefined) {\n const now = new Date();\n expiresOn = new Date(now.getTime() + 3600 * 1000);\n }\n }\n\n const sas = generateTableSasQueryParameters(tableName, credential, {\n ...options,\n expiresOn,\n permissions,\n }).toString();\n\n return sas;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sasQueryParameters.js","sourceRoot":"","sources":["../../../src/sas/sasQueryParameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAOpE;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IAwI7B;;;;OAIG;IACH,IAAW,OAAO;QAChB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO;gBACL,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG;gBAC1B,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAA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CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { SasIPRange, ipRangeToString } from \"./sasIPRange\";\nimport { UserDelegationKey } from \"./models\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * Protocols for generated SAS.\n */\nexport type SasProtocol = \"https\" | \"https,http\";\n\n/**\n * Represents the components that make up an Azure SAS' query parameters. This type is not constructed directly\n * by the user; it is only generated by the {@link AccountSasSignatureValues} and {@link TableSasSignatureValues}\n * types. Once generated, it can be encoded into a `string` and appended to a URL directly (though caution should\n * be taken here in case there are existing query parameters, which might affect the appropriate means of appending\n * these query parameters).\n *\n * NOTE: Instances of this class are immutable.\n */\nexport class SasQueryParameters {\n /**\n * The Tables API version.\n */\n public readonly version: string;\n\n /**\n * Optional. Table name to generate the SAS for\n */\n public readonly tableName?: string;\n\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n public readonly protocol?: SasProtocol;\n\n /**\n * Optional. The start time for this SAS token.\n */\n public readonly startsOn?: Date;\n\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n public readonly expiresOn?: Date;\n\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSasPermissions}, or {@link TableSasPermissions} for\n * more details.\n */\n public readonly permissions?: string;\n\n /**\n * Optional. The table services being accessed (only for Account SAS). Please refer to {@link AccountSasServices}\n * for more details.\n */\n public readonly services?: string;\n\n /**\n * Optional. The table resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSasResourceTypes} for more details.\n */\n public readonly resourceTypes?: string;\n\n /**\n * Optional. The signed identifier (only for {@link TableSasSignatureValues}).\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n public readonly identifier?: string;\n\n /**\n * The signature for the SAS token.\n */\n public readonly signature: string;\n\n /**\n * Inner value of getter ipRange.\n */\n private readonly ipRangeInner?: SasIPRange;\n\n /**\n * The Azure Active Directory object ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedOid?: string;\n\n /**\n * The Azure Active Directory tenant ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedTenantId?: string;\n\n /**\n * The date-time the key is active.\n * Property of user delegation key.\n */\n private readonly signedStartsOn?: Date;\n\n /**\n * The date-time the key expires.\n * Property of user delegation key.\n */\n private readonly signedExpiresOn?: Date;\n\n /**\n * Abbreviation of the Azure Table service that accepts the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedService?: string;\n\n /**\n * The service version that created the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedVersion?: string;\n\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This is only used for User Delegation SAS.\n */\n public readonly preauthorizedAgentObjectId?: string;\n\n /**\n * A GUID value that will be logged in the table diagnostic logs and can be used to correlate SAS generation with table resource access.\n * This is only used for User Delegation SAS.\n */\n public readonly correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endRowKey?: string;\n\n /**\n * Optional. IP range allowed for this SAS.\n *\n * @readonly\n */\n public get ipRange(): SasIPRange | undefined {\n if (this.ipRangeInner) {\n return {\n end: this.ipRangeInner.end,\n start: this.ipRangeInner.start,\n };\n }\n return undefined;\n }\n\n /**\n * Creates an instance of SASQueryParameters.\n *\n * @param version - Representing the table service version\n * @param signature - Representing the signature for the SAS token\n * @param options - Optional. Options to construct the SASQueryParameters.\n */\n constructor(version: string, signature: string, options: SasQueryParametersOptions = {}) {\n this.version = version;\n this.signature = signature;\n\n this.permissions = options.permissions;\n this.services = options.services;\n this.resourceTypes = options.resourceTypes;\n this.protocol = options.protocol;\n this.startsOn = options.startsOn;\n this.expiresOn = options.expiresOn;\n this.ipRangeInner = options.ipRange;\n this.identifier = options.identifier;\n this.tableName = options.tableName;\n this.endPartitionKey = options.endPartitionKey;\n this.endRowKey = options.endRowKey;\n this.startPartitionKey = options.startPartitionKey;\n this.startRowKey = options.startRowKey;\n\n if (options.userDelegationKey) {\n this.signedOid = options.userDelegationKey.signedObjectId;\n this.signedTenantId = options.userDelegationKey.signedTenantId;\n this.signedStartsOn = options.userDelegationKey.signedStartsOn;\n this.signedExpiresOn = options.userDelegationKey.signedExpiresOn;\n this.signedService = options.userDelegationKey.signedService;\n this.signedVersion = options.userDelegationKey.signedVersion;\n\n this.preauthorizedAgentObjectId = options.preauthorizedAgentObjectId;\n this.correlationId = options.correlationId;\n }\n }\n\n /**\n * Encodes all SAS query parameters into a string that can be appended to a URL.\n *\n */\n public toString(): string {\n const params: string[] = [\n \"sv\", // SignedVersion\n \"ss\", // SignedServices\n \"srt\", // SignedResourceTypes\n \"spr\", // SignedProtocol\n \"st\", // SignedStart\n \"se\", // SignedExpiry\n \"sip\", // SignedIP\n \"si\", // SignedIdentifier\n \"skoid\", // Signed object ID\n \"sktid\", // Signed tenant ID\n \"skt\", // Signed key start time\n \"ske\", // Signed key expiry time\n \"sks\", // Signed key service\n \"skv\", // Signed key version\n \"sr\", // signedResource\n \"sp\", // SignedPermission\n \"sig\", // Signature\n \"rscc\", // Cache-Control\n \"rscd\", // Content-Disposition\n \"rsce\", // Content-Encoding\n \"rscl\", // Content-Language\n \"rsct\", // Content-Type\n \"saoid\", // signedAuthorizedObjectId\n \"scid\", // signedCorrelationId\n \"tn\", // TableName,\n \"srk\", // StartRowKey\n \"spk\", // StartPartitionKey\n \"epk\", // EndPartitionKey\n \"erk\", // EndRowKey\n ];\n const queries: string[] = [];\n\n for (const param of params) {\n switch (param) {\n case \"sv\":\n this.tryAppendQueryParameter(queries, param, this.version);\n break;\n case \"ss\":\n this.tryAppendQueryParameter(queries, param, this.services);\n break;\n case \"srt\":\n this.tryAppendQueryParameter(queries, param, this.resourceTypes);\n break;\n case \"spr\":\n this.tryAppendQueryParameter(queries, param, this.protocol);\n break;\n case \"st\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.startsOn ? truncatedISO8061Date(this.startsOn, false) : undefined,\n );\n break;\n case \"se\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.expiresOn ? truncatedISO8061Date(this.expiresOn, false) : undefined,\n );\n break;\n case \"sip\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.ipRange ? ipRangeToString(this.ipRange) : undefined,\n );\n break;\n case \"si\":\n this.tryAppendQueryParameter(queries, param, this.identifier);\n break;\n case \"skoid\": // Signed object ID\n this.tryAppendQueryParameter(queries, param, this.signedOid);\n break;\n case \"sktid\": // Signed tenant ID\n this.tryAppendQueryParameter(queries, param, this.signedTenantId);\n break;\n case \"skt\": // Signed key start time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedStartsOn ? truncatedISO8061Date(this.signedStartsOn, false) : undefined,\n );\n break;\n case \"ske\": // Signed key expiry time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedExpiresOn ? truncatedISO8061Date(this.signedExpiresOn, false) : undefined,\n );\n break;\n case \"sks\": // Signed key service\n this.tryAppendQueryParameter(queries, param, this.signedService);\n break;\n case \"skv\": // Signed key version\n this.tryAppendQueryParameter(queries, param, this.signedVersion);\n break;\n case \"sp\":\n this.tryAppendQueryParameter(queries, param, this.permissions);\n break;\n case \"sig\":\n this.tryAppendQueryParameter(queries, param, this.signature);\n break;\n case \"saoid\":\n this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId);\n break;\n case \"scid\":\n this.tryAppendQueryParameter(queries, param, this.correlationId);\n break;\n case \"tn\":\n this.tryAppendQueryParameter(queries, param, this.tableName);\n break;\n case \"spk\":\n this.tryAppendQueryParameter(queries, param, this.startPartitionKey);\n break;\n case \"srk\":\n this.tryAppendQueryParameter(queries, param, this.startRowKey);\n break;\n case \"epk\":\n this.tryAppendQueryParameter(queries, param, this.endPartitionKey);\n break;\n case \"erk\":\n this.tryAppendQueryParameter(queries, param, this.endRowKey);\n break;\n }\n }\n return queries.join(\"&\");\n }\n\n /**\n * A private helper method used to filter and append query key/value pairs into an array.\n *\n * @param queries -\n * @param key -\n * @param value -\n */\n private tryAppendQueryParameter(queries: string[], key: string, value?: string): void {\n if (!value) {\n return;\n }\n\n key = encodeURIComponent(key);\n value = encodeURIComponent(value);\n if (key.length > 0 && value.length > 0) {\n queries.push(`${key}=${value}`);\n }\n }\n}\n\n/**\n * Options to construct {@link SasQueryParameters}.\n */\nexport interface SasQueryParametersOptions {\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSasPermissions}, or {@link TableSasPermissions} for\n * more details.\n */\n permissions?: string;\n /**\n * Optional. Table name to generate the SAS for\n */\n tableName?: string;\n /**\n * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSasServices}\n * for more details.\n */\n services?: string;\n /**\n * Optional. The storage resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSasResourceTypes} for more details.\n */\n resourceTypes?: string;\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n protocol?: SasProtocol;\n /**\n * Optional. The start time for this SAS token.\n */\n startsOn?: Date;\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n expiresOn?: Date;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n /**\n * Optional. The signed identifier for access policy\n *\n * @see https://docs.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n /**\n * Optional. Specifies which resources are accessible via the SAS (only for {@link AccountSasSignatureValues}).\n * @see https://docs.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only\n */\n resource?: string;\n /**\n * User delegation key properties.\n */\n userDelegationKey?: UserDelegationKey;\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This cannot be used in conjuction with {@link signedUnauthorizedUserObjectId}.\n * This is only used for User Delegation SAS.\n */\n preauthorizedAgentObjectId?: string;\n /**\n * A GUID value that will be logged in the storage diagnostic logs and can be used to correlate SAS generation with storage resource access.\n * This is only used for User Delegation SAS.\n */\n correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endRowKey?: string;\n}\n"]}
1
+ {"version":3,"file":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;oBAC7D,MAAM;YACV,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACK,uBAAuB,CAAC,OAAiB,EAAE,GAAW,EAAE,KAAc;QAC5E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO;QACT,CAAC;QAED,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { SasIPRange } from \"./sasIPRange\";\nimport { ipRangeToString } from \"./sasIPRange\";\nimport type { UserDelegationKey } from \"./models\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * Protocols for generated SAS.\n */\nexport type SasProtocol = \"https\" | \"https,http\";\n\n/**\n * Represents the components that make up an Azure SAS' query parameters. This type is not constructed directly\n * by the user; it is only generated by the {@link AccountSasSignatureValues} and {@link TableSasSignatureValues}\n * types. Once generated, it can be encoded into a `string` and appended to a URL directly (though caution should\n * be taken here in case there are existing query parameters, which might affect the appropriate means of appending\n * these query parameters).\n *\n * NOTE: Instances of this class are immutable.\n */\nexport class SasQueryParameters {\n /**\n * The Tables API version.\n */\n public readonly version: string;\n\n /**\n * Optional. Table name to generate the SAS for\n */\n public readonly tableName?: string;\n\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n public readonly protocol?: SasProtocol;\n\n /**\n * Optional. The start time for this SAS token.\n */\n public readonly startsOn?: Date;\n\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n public readonly expiresOn?: Date;\n\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSasPermissions}, or {@link TableSasPermissions} for\n * more details.\n */\n public readonly permissions?: string;\n\n /**\n * Optional. The table services being accessed (only for Account SAS). Please refer to {@link AccountSasServices}\n * for more details.\n */\n public readonly services?: string;\n\n /**\n * Optional. The table resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSasResourceTypes} for more details.\n */\n public readonly resourceTypes?: string;\n\n /**\n * Optional. The signed identifier (only for {@link TableSasSignatureValues}).\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n public readonly identifier?: string;\n\n /**\n * The signature for the SAS token.\n */\n public readonly signature: string;\n\n /**\n * Inner value of getter ipRange.\n */\n private readonly ipRangeInner?: SasIPRange;\n\n /**\n * The Azure Active Directory object ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedOid?: string;\n\n /**\n * The Azure Active Directory tenant ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedTenantId?: string;\n\n /**\n * The date-time the key is active.\n * Property of user delegation key.\n */\n private readonly signedStartsOn?: Date;\n\n /**\n * The date-time the key expires.\n * Property of user delegation key.\n */\n private readonly signedExpiresOn?: Date;\n\n /**\n * Abbreviation of the Azure Table service that accepts the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedService?: string;\n\n /**\n * The service version that created the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedVersion?: string;\n\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This is only used for User Delegation SAS.\n */\n public readonly preauthorizedAgentObjectId?: string;\n\n /**\n * A GUID value that will be logged in the table diagnostic logs and can be used to correlate SAS generation with table resource access.\n * This is only used for User Delegation SAS.\n */\n public readonly correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endRowKey?: string;\n\n /**\n * Optional. IP range allowed for this SAS.\n *\n * @readonly\n */\n public get ipRange(): SasIPRange | undefined {\n if (this.ipRangeInner) {\n return {\n end: this.ipRangeInner.end,\n start: this.ipRangeInner.start,\n };\n }\n return undefined;\n }\n\n /**\n * Creates an instance of SASQueryParameters.\n *\n * @param version - Representing the table service version\n * @param signature - Representing the signature for the SAS token\n * @param options - Optional. Options to construct the SASQueryParameters.\n */\n constructor(version: string, signature: string, options: SasQueryParametersOptions = {}) {\n this.version = version;\n this.signature = signature;\n\n this.permissions = options.permissions;\n this.services = options.services;\n this.resourceTypes = options.resourceTypes;\n this.protocol = options.protocol;\n this.startsOn = options.startsOn;\n this.expiresOn = options.expiresOn;\n this.ipRangeInner = options.ipRange;\n this.identifier = options.identifier;\n this.tableName = options.tableName;\n this.endPartitionKey = options.endPartitionKey;\n this.endRowKey = options.endRowKey;\n this.startPartitionKey = options.startPartitionKey;\n this.startRowKey = options.startRowKey;\n\n if (options.userDelegationKey) {\n this.signedOid = options.userDelegationKey.signedObjectId;\n this.signedTenantId = options.userDelegationKey.signedTenantId;\n this.signedStartsOn = options.userDelegationKey.signedStartsOn;\n this.signedExpiresOn = options.userDelegationKey.signedExpiresOn;\n this.signedService = options.userDelegationKey.signedService;\n this.signedVersion = options.userDelegationKey.signedVersion;\n\n this.preauthorizedAgentObjectId = options.preauthorizedAgentObjectId;\n this.correlationId = options.correlationId;\n }\n }\n\n /**\n * Encodes all SAS query parameters into a string that can be appended to a URL.\n *\n */\n public toString(): string {\n const params: string[] = [\n \"sv\", // SignedVersion\n \"ss\", // SignedServices\n \"srt\", // SignedResourceTypes\n \"spr\", // SignedProtocol\n \"st\", // SignedStart\n \"se\", // SignedExpiry\n \"sip\", // SignedIP\n \"si\", // SignedIdentifier\n \"skoid\", // Signed object ID\n \"sktid\", // Signed tenant ID\n \"skt\", // Signed key start time\n \"ske\", // Signed key expiry time\n \"sks\", // Signed key service\n \"skv\", // Signed key version\n \"sr\", // signedResource\n \"sp\", // SignedPermission\n \"sig\", // Signature\n \"rscc\", // Cache-Control\n \"rscd\", // Content-Disposition\n \"rsce\", // Content-Encoding\n \"rscl\", // Content-Language\n \"rsct\", // Content-Type\n \"saoid\", // signedAuthorizedObjectId\n \"scid\", // signedCorrelationId\n \"tn\", // TableName,\n \"srk\", // StartRowKey\n \"spk\", // StartPartitionKey\n \"epk\", // EndPartitionKey\n \"erk\", // EndRowKey\n ];\n const queries: string[] = [];\n\n for (const param of params) {\n switch (param) {\n case \"sv\":\n this.tryAppendQueryParameter(queries, param, this.version);\n break;\n case \"ss\":\n this.tryAppendQueryParameter(queries, param, this.services);\n break;\n case \"srt\":\n this.tryAppendQueryParameter(queries, param, this.resourceTypes);\n break;\n case \"spr\":\n this.tryAppendQueryParameter(queries, param, this.protocol);\n break;\n case \"st\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.startsOn ? truncatedISO8061Date(this.startsOn, false) : undefined,\n );\n break;\n case \"se\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.expiresOn ? truncatedISO8061Date(this.expiresOn, false) : undefined,\n );\n break;\n case \"sip\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.ipRange ? ipRangeToString(this.ipRange) : undefined,\n );\n break;\n case \"si\":\n this.tryAppendQueryParameter(queries, param, this.identifier);\n break;\n case \"skoid\": // Signed object ID\n this.tryAppendQueryParameter(queries, param, this.signedOid);\n break;\n case \"sktid\": // Signed tenant ID\n this.tryAppendQueryParameter(queries, param, this.signedTenantId);\n break;\n case \"skt\": // Signed key start time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedStartsOn ? truncatedISO8061Date(this.signedStartsOn, false) : undefined,\n );\n break;\n case \"ske\": // Signed key expiry time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedExpiresOn ? truncatedISO8061Date(this.signedExpiresOn, false) : undefined,\n );\n break;\n case \"sks\": // Signed key service\n this.tryAppendQueryParameter(queries, param, this.signedService);\n break;\n case \"skv\": // Signed key version\n this.tryAppendQueryParameter(queries, param, this.signedVersion);\n break;\n case \"sp\":\n this.tryAppendQueryParameter(queries, param, this.permissions);\n break;\n case \"sig\":\n this.tryAppendQueryParameter(queries, param, this.signature);\n break;\n case \"saoid\":\n this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId);\n break;\n case \"scid\":\n this.tryAppendQueryParameter(queries, param, this.correlationId);\n break;\n case \"tn\":\n this.tryAppendQueryParameter(queries, param, this.tableName);\n break;\n case \"spk\":\n this.tryAppendQueryParameter(queries, param, this.startPartitionKey);\n break;\n case \"srk\":\n this.tryAppendQueryParameter(queries, param, this.startRowKey);\n break;\n case \"epk\":\n this.tryAppendQueryParameter(queries, param, this.endPartitionKey);\n break;\n case \"erk\":\n this.tryAppendQueryParameter(queries, param, this.endRowKey);\n break;\n }\n }\n return queries.join(\"&\");\n }\n\n /**\n * A private helper method used to filter and append query key/value pairs into an array.\n *\n * @param queries -\n * @param key -\n * @param value -\n */\n private tryAppendQueryParameter(queries: string[], key: string, value?: string): void {\n if (!value) {\n return;\n }\n\n key = encodeURIComponent(key);\n value = encodeURIComponent(value);\n if (key.length > 0 && value.length > 0) {\n queries.push(`${key}=${value}`);\n }\n }\n}\n\n/**\n * Options to construct {@link SasQueryParameters}.\n */\nexport interface SasQueryParametersOptions {\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSasPermissions}, or {@link TableSasPermissions} for\n * more details.\n */\n permissions?: string;\n /**\n * Optional. Table name to generate the SAS for\n */\n tableName?: string;\n /**\n * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSasServices}\n * for more details.\n */\n services?: string;\n /**\n * Optional. The storage resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSasResourceTypes} for more details.\n */\n resourceTypes?: string;\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n protocol?: SasProtocol;\n /**\n * Optional. The start time for this SAS token.\n */\n startsOn?: Date;\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n expiresOn?: Date;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n /**\n * Optional. The signed identifier for access policy\n *\n * @see https://docs.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n /**\n * Optional. Specifies which resources are accessible via the SAS (only for {@link AccountSasSignatureValues}).\n * @see https://docs.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only\n */\n resource?: string;\n /**\n * User delegation key properties.\n */\n userDelegationKey?: UserDelegationKey;\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This cannot be used in conjuction with {@link signedUnauthorizedUserObjectId}.\n * This is only used for User Delegation SAS.\n */\n preauthorizedAgentObjectId?: string;\n /**\n * A GUID value that will be logged in the storage diagnostic logs and can be used to correlate SAS generation with storage resource access.\n * This is only used for User Delegation SAS.\n */\n correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endRowKey?: string;\n}\n"]}
@@ -1,10 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- /**
4
- * ONLY AVAILABLE IN NODE.JS RUNTIME.
5
- *
6
- * TableSASSignatureValues is used to help generating SAS tokens for tables.
7
- */
8
3
  import { ipRangeToString } from "./sasIPRange";
9
4
  import { SasQueryParameters } from "./sasQueryParameters";
10
5
  import { tableSasPermissionsToString } from "./tableSasPermisions";
@@ -1 +1 @@
1
- {"version":3,"file":"tableSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/tableSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AAEH,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAe,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAuB,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AA8EpE;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAC7C,SAAiB,EAC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AuB,CAAC,SAAS,mCAAI,EAAE,CAAC;IAE7D,MAAM,YAAY,GAAG;QACnB,iBAAiB;QACjB,WAAW;QACX,YAAY;QACZ,qBAAqB;QACrB,gBAAgB;QAChB,QAAQ;QACR,cAAc;QACd,OAAO;QACP,oBAAoB;QACpB,cAAc;QACd,kBAAkB;QAClB,YAAY;KACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAG,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAElE,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB;QAC9B,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,SAAS,EAAE,uBAAuB,CAAC,SAAS;QAC5C,OAAO,EAAE,uBAAuB,CAAC,OAAO;QACxC,UAAU,EAAE,uBAAuB,CAAC,UAAU;QAC9C,SAAS;QACT,iBAAiB,EAAE,uBAAuB,CAAC,iBAAiB;QAC5D,WAAW,EAAE,uBAAuB,CAAC,WAAW;QAChD,eAAe,EAAE,uBAAuB,CAAC,eAAe;QACxD,SAAS,EAAE,uBAAuB,CAAC,SAAS;KAC7C,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB;IAC9D,yHAAyH;IACzH,yDAAyD;IACzD,OAAO,UAAU,WAAW,IAAI,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating SAS tokens for tables.\n */\n\nimport { SasIPRange, ipRangeToString } from \"./sasIPRange\";\nimport { SasProtocol, SasQueryParameters } from \"./sasQueryParameters\";\nimport { TableSasPermissions, tableSasPermissionsToString } from \"./tableSasPermisions\";\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating Table service SAS tokens for tables\n */\nexport interface TableSasSignatureValues {\n /**\n * The version of the service this SAS will target. If not specified, it will default to the version targeted by the\n * library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols, HTTPS only or HTTPSandHTTP\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * Optional. If identifier is not provided has a default value of one hour from the time the token is generated.\n * The time after which the SAS will no longer work.\n */\n expiresOn?: Date;\n\n /**\n * Optional. If identifier is not provided has a default value of \"read\"\n * Please refer to {@link TableSasPermissions} depending on the resource\n * being accessed for help constructing the permissions string.\n */\n permissions?: TableSasPermissions;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n\n /**\n * Optional. The name of the access policy on the container this SAS references if any.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n\n /**\n * Define the start of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startPartitionKey?: string;\n /**\n * Define the end of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endPartitionKey?: string;\n /**\n * Define the start of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startRowKey?: string;\n /**\n * Define the end of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endRowKey?: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Creates an instance of SASQueryParameters.\n *\n * **Note**: When identifier is not provided, permissions has a default value of \"read\" and expiresOn of one hour from the time the token is generated.\n */\nexport function generateTableSasQueryParameters(\n tableName: string,\n credential: NamedKeyCredential,\n tableSasSignatureValues: TableSasSignatureValues,\n): SasQueryParameters {\n const version = tableSasSignatureValues.version ?? SERVICE_VERSION;\n\n if (credential === undefined) {\n throw TypeError(\"Invalid NamedKeyCredential\");\n }\n\n if (!tableName) {\n throw new Error(\"Must provide a 'tableName'\");\n }\n\n const signedPermissions = tableSasPermissionsToString(tableSasSignatureValues.permissions);\n const signedStart = tableSasSignatureValues.startsOn\n ? truncatedISO8061Date(tableSasSignatureValues.startsOn, false /** withMilliseconds */)\n : \"\";\n const signedExpiry = tableSasSignatureValues.expiresOn\n ? truncatedISO8061Date(tableSasSignatureValues.expiresOn, false /** withMilliseconds */)\n : \"\";\n const canonicalizedResource = getCanonicalName(credential.name, tableName);\n const signedIdentifier = tableSasSignatureValues.identifier ?? \"\";\n const signedIP = ipRangeToString(tableSasSignatureValues.ipRange);\n const signedProtocol = tableSasSignatureValues.protocol || \"\";\n const startingPartitionKey = tableSasSignatureValues.startPartitionKey ?? \"\";\n const startingRowKey = tableSasSignatureValues.startRowKey ?? \"\";\n const endingPartitionKey = tableSasSignatureValues.endPartitionKey ?? \"\";\n const endingRowKey = tableSasSignatureValues.endRowKey ?? \"\";\n\n const stringToSign = [\n signedPermissions,\n signedStart,\n signedExpiry,\n canonicalizedResource,\n signedIdentifier,\n signedIP,\n signedProtocol,\n version,\n startingPartitionKey,\n startingRowKey,\n endingPartitionKey,\n endingRowKey,\n ].join(\"\\n\");\n\n const signature = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: signedPermissions,\n protocol: tableSasSignatureValues.protocol,\n startsOn: tableSasSignatureValues.startsOn,\n expiresOn: tableSasSignatureValues.expiresOn,\n ipRange: tableSasSignatureValues.ipRange,\n identifier: tableSasSignatureValues.identifier,\n tableName,\n startPartitionKey: tableSasSignatureValues.startPartitionKey,\n startRowKey: tableSasSignatureValues.startRowKey,\n endPartitionKey: tableSasSignatureValues.endPartitionKey,\n endRowKey: tableSasSignatureValues.endRowKey,\n });\n}\n\nfunction getCanonicalName(accountName: string, tableName: string): string {\n // Sample CanonicalName for URL = https://myaccount.table.core.windows.net/Employees(PartitionKey='Jeff',RowKey='Price'):\n // canonicalizedResource = \"/table/myaccount/employees\"\n return `/table/${accountName}/${tableName.toLowerCase()}`;\n}\n"]}
1
+ {"version":3,"file":"tableSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/tableSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AA8EpE;;;;;;GAMG;AACH,MAAM,UA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,MAAM,YAAY,GAAG,MAAA,uBAAuB,CAAC,SAAS,mCAAI,EAAE,CAAC;IAE7D,MAAM,YAAY,GAAG;QACnB,iBAAiB;QACjB,WAAW;QACX,YAAY;QACZ,qBAAqB;QACrB,gBAAgB;QAChB,QAAQ;QACR,cAAc;QACd,OAAO;QACP,oBAAoB;QACpB,cAAc;QACd,kBAAkB;QAClB,YAAY;KACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAG,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAElE,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB;QAC9B,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,SAAS,EAAE,uBAAuB,CAAC,SAAS;QAC5C,OAAO,EAAE,uBAAuB,CAAC,OAAO;QACxC,UAAU,EAAE,uBAAuB,CAAC,UAAU;QAC9C,SAAS;QACT,iBAAiB,EAAE,uBAAuB,CAAC,iBAAiB;QAC5D,WAAW,EAAE,uBAAuB,CAAC,WAAW;QAChD,eAAe,EAAE,uBAAuB,CAAC,eAAe;QACxD,SAAS,EAAE,uBAAuB,CAAC,SAAS;KAC7C,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB;IAC9D,yHAAyH;IACzH,yDAAyD;IACzD,OAAO,UAAU,WAAW,IAAI,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating SAS tokens for tables.\n */\n\nimport type { SasIPRange } from \"./sasIPRange\";\nimport { ipRangeToString } from \"./sasIPRange\";\nimport type { SasProtocol } from \"./sasQueryParameters\";\nimport { SasQueryParameters } from \"./sasQueryParameters\";\nimport type { TableSasPermissions } from \"./tableSasPermisions\";\nimport { tableSasPermissionsToString } from \"./tableSasPermisions\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating Table service SAS tokens for tables\n */\nexport interface TableSasSignatureValues {\n /**\n * The version of the service this SAS will target. If not specified, it will default to the version targeted by the\n * library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols, HTTPS only or HTTPSandHTTP\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * Optional. If identifier is not provided has a default value of one hour from the time the token is generated.\n * The time after which the SAS will no longer work.\n */\n expiresOn?: Date;\n\n /**\n * Optional. If identifier is not provided has a default value of \"read\"\n * Please refer to {@link TableSasPermissions} depending on the resource\n * being accessed for help constructing the permissions string.\n */\n permissions?: TableSasPermissions;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n\n /**\n * Optional. The name of the access policy on the container this SAS references if any.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n\n /**\n * Define the start of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startPartitionKey?: string;\n /**\n * Define the end of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endPartitionKey?: string;\n /**\n * Define the start of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startRowKey?: string;\n /**\n * Define the end of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endRowKey?: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Creates an instance of SASQueryParameters.\n *\n * **Note**: When identifier is not provided, permissions has a default value of \"read\" and expiresOn of one hour from the time the token is generated.\n */\nexport function generateTableSasQueryParameters(\n tableName: string,\n credential: NamedKeyCredential,\n tableSasSignatureValues: TableSasSignatureValues,\n): SasQueryParameters {\n const version = tableSasSignatureValues.version ?? SERVICE_VERSION;\n\n if (credential === undefined) {\n throw TypeError(\"Invalid NamedKeyCredential\");\n }\n\n if (!tableName) {\n throw new Error(\"Must provide a 'tableName'\");\n }\n\n const signedPermissions = tableSasPermissionsToString(tableSasSignatureValues.permissions);\n const signedStart = tableSasSignatureValues.startsOn\n ? truncatedISO8061Date(tableSasSignatureValues.startsOn, false /** withMilliseconds */)\n : \"\";\n const signedExpiry = tableSasSignatureValues.expiresOn\n ? truncatedISO8061Date(tableSasSignatureValues.expiresOn, false /** withMilliseconds */)\n : \"\";\n const canonicalizedResource = getCanonicalName(credential.name, tableName);\n const signedIdentifier = tableSasSignatureValues.identifier ?? \"\";\n const signedIP = ipRangeToString(tableSasSignatureValues.ipRange);\n const signedProtocol = tableSasSignatureValues.protocol || \"\";\n const startingPartitionKey = tableSasSignatureValues.startPartitionKey ?? \"\";\n const startingRowKey = tableSasSignatureValues.startRowKey ?? \"\";\n const endingPartitionKey = tableSasSignatureValues.endPartitionKey ?? \"\";\n const endingRowKey = tableSasSignatureValues.endRowKey ?? \"\";\n\n const stringToSign = [\n signedPermissions,\n signedStart,\n signedExpiry,\n canonicalizedResource,\n signedIdentifier,\n signedIP,\n signedProtocol,\n version,\n startingPartitionKey,\n startingRowKey,\n endingPartitionKey,\n endingRowKey,\n ].join(\"\\n\");\n\n const signature = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: signedPermissions,\n protocol: tableSasSignatureValues.protocol,\n startsOn: tableSasSignatureValues.startsOn,\n expiresOn: tableSasSignatureValues.expiresOn,\n ipRange: tableSasSignatureValues.ipRange,\n identifier: tableSasSignatureValues.identifier,\n tableName,\n startPartitionKey: tableSasSignatureValues.startPartitionKey,\n startRowKey: tableSasSignatureValues.startRowKey,\n endPartitionKey: tableSasSignatureValues.endPartitionKey,\n endRowKey: tableSasSignatureValues.endRowKey,\n });\n}\n\nfunction getCanonicalName(accountName: string, tableName: string): string {\n // Sample CanonicalName for URL = https://myaccount.table.core.windows.net/Employees(PartitionKey='Jeff',RowKey='Price'):\n // canonicalizedResource = \"/table/myaccount/employees\"\n return `/table/${accountName}/${tableName.toLowerCase()}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"secondaryEndpointPolicy.js","sourceRoot":"","sources":["../../src/secondaryEndpointPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AACvE,MAAM,8BAA8B,GAAG,YAAY,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAmB;IAC3D,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC/B,6DAA6D;QAC7D,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,EAAE,CAAC;YACjD,0DAA0D;YAC1D,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;YAChD,yCAAyC;YACzC,GAAG,CAAC,GAAG,GAAG,0BAA0B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAAyB;;IACrE,MAAM,cAAc,GAAG,EAAE,CAAC,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;IACjE,uCACK,OAAO,KACV,cAAc,kCACT,OAAO,CAAC,cAAc,KACzB,aAAa,kCACR,MAAA,OAAO,CAAC,cAAc,0CAAE,aAAa,GACrC,cAAc,QAGrB;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,0BAA0B,CAAC,UAAkB;IACpD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,8BAA8B,EAAE,CAAC;IAC1D,CAAC;IACD,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,gBAAgB,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport { PipelinePolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * The programmatic identifier of the tablesSecondaryEndpointPolicy.\n */\nexport const tablesSecondaryEndpointPolicyName = \"tablesSecondaryEndpointPolicy\";\nexport const SecondaryLocationHeaderName = \"tables-secondary-endpoint\";\nconst SecondaryLocationAccountSuffix = \"-secondary\";\n\n/**\n * Policy that would replace the Primary Endpoint with the secondary endpoint\n * when the `tables-secondary-endpoint` is set in the request\n */\nexport const tablesSecondaryEndpointPolicy: PipelinePolicy = {\n name: tablesSecondaryEndpointPolicyName,\n sendRequest: async (req, next) => {\n // Only replace the URL if the SecondaryLocationHeader is set\n if (req.headers.get(SecondaryLocationHeaderName)) {\n // Since the header is for internal use only, clean it up.\n req.headers.delete(SecondaryLocationHeaderName);\n // Calculate and update the secondary url\n req.url = getSecondaryUrlFromPrimary(req.url);\n }\n\n return next(req);\n },\n};\n\n/**\n * Utility function that injects the SecondaryEndpointHeader into an operation options\n */\nexport function injectSecondaryEndpointHeader(options: OperationOptions): OperationOptions {\n const headerToInject = { [SecondaryLocationHeaderName]: \"true\" };\n return {\n ...options,\n requestOptions: {\n ...options.requestOptions,\n customHeaders: {\n ...options.requestOptions?.customHeaders,\n ...headerToInject,\n },\n },\n };\n}\n\n/**\n * Utility function that calculates the secondary URL for a table instance given the primary URL.\n */\nfunction getSecondaryUrlFromPrimary(primaryUrl: string): string {\n const parsedPrimaryUrl = new URL(primaryUrl);\n const host = parsedPrimaryUrl.hostname.split(\".\");\n if (host.length > 1) {\n host[0] = `${host[0]}${SecondaryLocationAccountSuffix}`;\n }\n parsedPrimaryUrl.hostname = host.join(\".\");\n\n return parsedPrimaryUrl.toString();\n}\n"]}
1
+ {"version":3,"file":"secondaryEndpointPolicy.js","sourceRoot":"","sources":["../../src/secondaryEndpointPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC;AACj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CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,gBAAgB,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * The programmatic identifier of the tablesSecondaryEndpointPolicy.\n */\nexport const tablesSecondaryEndpointPolicyName = \"tablesSecondaryEndpointPolicy\";\nexport const SecondaryLocationHeaderName = \"tables-secondary-endpoint\";\nconst SecondaryLocationAccountSuffix = \"-secondary\";\n\n/**\n * Policy that would replace the Primary Endpoint with the secondary endpoint\n * when the `tables-secondary-endpoint` is set in the request\n */\nexport const tablesSecondaryEndpointPolicy: PipelinePolicy = {\n name: tablesSecondaryEndpointPolicyName,\n sendRequest: async (req, next) => {\n // Only replace the URL if the SecondaryLocationHeader is set\n if (req.headers.get(SecondaryLocationHeaderName)) {\n // Since the header is for internal use only, clean it up.\n req.headers.delete(SecondaryLocationHeaderName);\n // Calculate and update the secondary url\n req.url = getSecondaryUrlFromPrimary(req.url);\n }\n\n return next(req);\n },\n};\n\n/**\n * Utility function that injects the SecondaryEndpointHeader into an operation options\n */\nexport function injectSecondaryEndpointHeader(options: OperationOptions): OperationOptions {\n const headerToInject = { [SecondaryLocationHeaderName]: \"true\" };\n return {\n ...options,\n requestOptions: {\n ...options.requestOptions,\n customHeaders: {\n ...options.requestOptions?.customHeaders,\n ...headerToInject,\n },\n },\n };\n}\n\n/**\n * Utility function that calculates the secondary URL for a table instance given the primary URL.\n */\nfunction getSecondaryUrlFromPrimary(primaryUrl: string): string {\n const parsedPrimaryUrl = new URL(primaryUrl);\n const host = parsedPrimaryUrl.hostname.split(\".\");\n if (host.length > 1) {\n host[0] = `${host[0]}${SecondaryLocationAccountSuffix}`;\n }\n parsedPrimaryUrl.hostname = host.join(\".\");\n\n return parsedPrimaryUrl.toString();\n}\n"]}
@@ -1 +1 @@
1
- {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,CAAC,CAAC,CAAC;aAC7C,GAAG,CAAC,qCAAqC,CAAC;aAC1C,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { EdmTypes, SignedIdentifier, TableEntityQueryOptions } from \"./models\";\nimport {\n QueryOptions as GeneratedQueryOptions,\n SignedIdentifier as GeneratedSignedIdentifier,\n} from \"./generated/models\";\nimport { base64Decode, base64Encode } from \"./utils/bufferSerializer\";\nimport { truncatedISO8061Date } from \"./utils/truncateISO8061Date\";\n\nconst propertyCaseMap: Map<string, string> = new Map<string, string>([\n [\"PartitionKey\", \"partitionKey\"],\n [\"RowKey\", \"rowKey\"],\n [\"odata.etag\", \"etag\"],\n [\"Timestamp\", \"timestamp\"],\n]);\n\nconst Edm = {\n Binary: \"Edm.Binary\",\n Boolean: \"Edm.Boolean\",\n DateTime: \"Edm.DateTime\",\n Double: \"Edm.Double\",\n Guid: \"Edm.Guid\",\n Int32: \"Edm.Int32\",\n Int64: \"Edm.Int64\",\n String: \"Edm.String\",\n} as const;\n\ntype supportedTypes = boolean | string | number | Date | Uint8Array | bigint;\n\ntype serializedType = {\n value: supportedTypes;\n type?: string;\n};\n\nfunction serializePrimitive(value: any): serializedType {\n const serializedValue: serializedType = { value };\n if (\n value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"string\" ||\n typeof value === \"number\"\n ) {\n serializedValue.value = value;\n } else if (typeof value === \"bigint\") {\n serializedValue.value = value.toString();\n serializedValue.type = Edm.Int64;\n } else if (value instanceof Date) {\n serializedValue.value = value;\n serializedValue.type = Edm.DateTime;\n } else if (value instanceof Uint8Array) {\n serializedValue.value = base64Encode(value);\n serializedValue.type = Edm.Binary;\n } else {\n throw new Error(`Unknown EDM type ${typeof value}`);\n }\n\n return serializedValue;\n}\n\nfunction serializeObject(obj: { value: any; type: EdmTypes }): serializedType {\n const serializedValue: serializedType = { value: obj.value };\n if (\n obj.type === \"Boolean\" ||\n obj.type === \"DateTime\" ||\n obj.type === \"Double\" ||\n obj.type === \"Guid\" ||\n obj.type === \"Int32\" ||\n obj.type === \"Int64\" ||\n obj.type === \"String\" ||\n obj.type === \"Binary\"\n ) {\n serializedValue.value = obj.value;\n serializedValue.type = Edm[obj.type];\n } else {\n throw new Error(`Unknown EDM type ${typeof obj.value}`);\n }\n\n return serializedValue;\n}\n\nfunction getSerializedValue(value: any): serializedType {\n if (typeof value === \"object\" && value?.value !== undefined && value?.type !== undefined) {\n return serializeObject(value);\n } else {\n return serializePrimitive(value);\n }\n}\n\nfunction translatePropertyNameForSerialization(propertyName: string): string {\n for (const [original, internal] of propertyCaseMap) {\n if (internal === propertyName) {\n return original;\n }\n }\n\n return propertyName;\n}\n\nexport function serialize(obj: object): Record<string, Record<string, unknown>> {\n const serialized: any = {};\n for (const [propertyName, propertyValue] of Object.entries(obj)) {\n const transformedKey = translatePropertyNameForSerialization(propertyName);\n const serializedVal = getSerializedValue(propertyValue);\n serialized[transformedKey] = serializedVal.value;\n if (serializedVal.type) {\n serialized[`${transformedKey}@odata.type`] = serializedVal.type;\n }\n }\n return serialized;\n}\n\nfunction getTypedObject(value: any, type: string, disableTypeConversion: boolean): any {\n switch (type) {\n case Edm.Boolean:\n return disableTypeConversion ? { value, type: \"Boolean\" } : value;\n case Edm.Double:\n return disableTypeConversion ? { value, type: \"Double\" } : value;\n case Edm.Int32:\n return disableTypeConversion ? { value, type: \"Int32\" } : value;\n case Edm.String:\n return disableTypeConversion ? { value, type: \"String\" } : value;\n case Edm.DateTime:\n return disableTypeConversion ? { value, type: \"DateTime\" } : new Date(value);\n case Edm.Int64:\n return disableTypeConversion ? { value, type: \"Int64\" } : BigInt(value);\n case Edm.Guid:\n return { value, type: \"Guid\" };\n case Edm.Binary:\n return disableTypeConversion ? { value, type: \"Binary\" } : base64Decode(value);\n default:\n throw new Error(`Unknown EDM type ${type}`);\n }\n}\n\nexport function deserialize<T extends object = Record<string, any>>(\n obj: object,\n disableTypeConversion: boolean = false,\n): T {\n const deserialized: any = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key.indexOf(\"@odata.type\") === -1) {\n const transformedKey = propertyCaseMap.get(key) ?? key;\n let typedValue = value;\n if (`${key}@odata.type` in obj) {\n const type = (obj as any)[`${key}@odata.type`];\n typedValue = getTypedObject(value, type, disableTypeConversion);\n } else if (disableTypeConversion && [\"number\", \"string\", \"boolean\"].includes(typeof value)) {\n // The service, doesn't return type metadata for number, strings or booleans\n // if automatic type conversion is disabled we'll infer the EDM object\n typedValue = inferTypedObject(key, value);\n }\n\n deserialized[transformedKey] = typedValue;\n }\n }\n return deserialized;\n}\n\nfunction inferTypedObject(propertyName: string, value: number | string | boolean) {\n // We need to skip service metadata fields such as partitionKey and rowKey and use the same value returned by the service\n if (propertyCaseMap.has(propertyName)) {\n return value;\n }\n\n switch (typeof value) {\n case \"boolean\":\n return { value: String(value), type: \"Boolean\" };\n case \"number\":\n return getTypedNumber(value);\n case \"string\":\n return { value, type: \"String\" };\n default:\n return value;\n }\n}\n\n/**\n * Returns the number when typeConversion is enabled or the EDM object with the correct number format Double or Int32 if disabled\n */\nfunction getTypedNumber(value: number): { value: string; type: \"Int32\" | \"Double\" } {\n const valueStr = String(value);\n if (Number.isSafeInteger(value)) {\n return { value: valueStr, type: \"Int32\" };\n } else {\n return { value: valueStr, type: \"Double\" };\n }\n}\n\nexport function deserializeObjectsArray<T extends object>(\n objArray: object[],\n disableTypeConversion: boolean,\n): T[] {\n return objArray.map((obj) => deserialize<T>(obj, disableTypeConversion));\n}\n\n/**\n * For ACL endpoints the Tables Service takes an ISO Date without decimals however\n * serializing a JavaScript date gives us a date with decimals 2021-07-08T09:10:09.000Z\n * which makes the XML request body invalid, these 2 functions serialize and deserialize the\n * dates so that they are in the expected format\n */\nexport function serializeSignedIdentifiers(\n signedIdentifiers: SignedIdentifier[],\n): GeneratedSignedIdentifier[] {\n return signedIdentifiers.map((acl) => {\n const { id, accessPolicy } = acl;\n const { start, expiry, ...rest } = accessPolicy ?? {};\n const serializedStart = start\n ? truncatedISO8061Date(start, false /** withMilliseconds */)\n : undefined;\n const serializedExpiry = expiry\n ? truncatedISO8061Date(expiry, false /** withMilliseconds */)\n : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(serializedExpiry && { expiry: serializedExpiry }),\n ...(serializedStart && { start: serializedStart }),\n ...rest,\n },\n };\n });\n}\n\nexport function deserializeSignedIdentifier(\n signedIdentifiers: GeneratedSignedIdentifier[],\n): SignedIdentifier[] {\n return signedIdentifiers.map((si) => {\n const { id, accessPolicy } = si;\n const { start, expiry, ...restAcl } = accessPolicy ?? {};\n const deserializedStart = start ? new Date(start) : undefined;\n const deserializedExpiry = expiry ? new Date(expiry) : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(deserializedExpiry && { expiry: deserializedExpiry }),\n ...(deserializedStart && { start: deserializedStart }),\n ...restAcl,\n },\n };\n });\n}\n\nexport function serializeQueryOptions(query: TableEntityQueryOptions): GeneratedQueryOptions {\n const { select, ...queryOptions } = query;\n const mappedQuery: GeneratedQueryOptions = { ...queryOptions };\n // Properties that are always returned by the service but are not allowed in select\n const excludeFromSelect = [\"etag\", \"odata.etag\"];\n if (select) {\n mappedQuery.select = select\n .filter((p) => !excludeFromSelect.includes(p))\n .map(translatePropertyNameForSerialization)\n .join(\",\");\n }\n return mappedQuery;\n}\n"]}
1
+ {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../src/serialization.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAOlC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAiB;IACnE,CAAC,cAAc,EAAE,cAAc,CAAC;IAChC,CAAC,QAAQ,EAAE,QAAQ,CAAC;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MAAM,OAAmC,EAA9B,OAAO,cAA3B,mBAA6B,CAAqB,CAAC;QACzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEjE,OAAO;YACL,EAAE;YACF,YAAY,gDACP,CAAC,kBAAkB,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,GACtD,CAAC,iBAAiB,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,GACnD,OAAO,CACX;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAA8B;IAClE,MAAM,EAAE,MAAM,KAAsB,KAAK,EAAtB,YAAY,UAAK,KAAK,EAAnC,UAA2B,CAAQ,CAAC;IAC1C,MAAM,WAAW,qBAA+B,YAAY,CAAE,CAAC;IAC/D,mFAAmF;IACnF,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACjD,IAAI,MAAM,EAAE,CAAC;QACX,WAAW,CAAC,MAAM,GAAG,MAAM;aACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aAC7C,GAAG,CAAC,qCAAqC,CAAC;aAC1C,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { EdmTypes, SignedIdentifier, TableEntityQueryOptions } from \"./models\";\nimport type {\n QueryOptions as GeneratedQueryOptions,\n SignedIdentifier as GeneratedSignedIdentifier,\n} from \"./generated/models\";\nimport { base64Decode, base64Encode } from \"./utils/bufferSerializer\";\nimport { truncatedISO8061Date } from \"./utils/truncateISO8061Date\";\n\nconst propertyCaseMap: Map<string, string> = new Map<string, string>([\n [\"PartitionKey\", \"partitionKey\"],\n [\"RowKey\", \"rowKey\"],\n [\"odata.etag\", \"etag\"],\n [\"Timestamp\", \"timestamp\"],\n]);\n\nconst Edm = {\n Binary: \"Edm.Binary\",\n Boolean: \"Edm.Boolean\",\n DateTime: \"Edm.DateTime\",\n Double: \"Edm.Double\",\n Guid: \"Edm.Guid\",\n Int32: \"Edm.Int32\",\n Int64: \"Edm.Int64\",\n String: \"Edm.String\",\n} as const;\n\ntype supportedTypes = boolean | string | number | Date | Uint8Array | bigint;\n\ntype serializedType = {\n value: supportedTypes;\n type?: string;\n};\n\nfunction serializePrimitive(value: any): serializedType {\n const serializedValue: serializedType = { value };\n if (\n value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"string\" ||\n typeof value === \"number\"\n ) {\n serializedValue.value = value;\n } else if (typeof value === \"bigint\") {\n serializedValue.value = value.toString();\n serializedValue.type = Edm.Int64;\n } else if (value instanceof Date) {\n serializedValue.value = value;\n serializedValue.type = Edm.DateTime;\n } else if (value instanceof Uint8Array) {\n serializedValue.value = base64Encode(value);\n serializedValue.type = Edm.Binary;\n } else {\n throw new Error(`Unknown EDM type ${typeof value}`);\n }\n\n return serializedValue;\n}\n\nfunction serializeObject(obj: { value: any; type: EdmTypes }): serializedType {\n const serializedValue: serializedType = { value: obj.value };\n if (\n obj.type === \"Boolean\" ||\n obj.type === \"DateTime\" ||\n obj.type === \"Double\" ||\n obj.type === \"Guid\" ||\n obj.type === \"Int32\" ||\n obj.type === \"Int64\" ||\n obj.type === \"String\" ||\n obj.type === \"Binary\"\n ) {\n serializedValue.value = obj.value;\n serializedValue.type = Edm[obj.type];\n } else {\n throw new Error(`Unknown EDM type ${typeof obj.value}`);\n }\n\n return serializedValue;\n}\n\nfunction getSerializedValue(value: any): serializedType {\n if (typeof value === \"object\" && value?.value !== undefined && value?.type !== undefined) {\n return serializeObject(value);\n } else {\n return serializePrimitive(value);\n }\n}\n\nfunction translatePropertyNameForSerialization(propertyName: string): string {\n for (const [original, internal] of propertyCaseMap) {\n if (internal === propertyName) {\n return original;\n }\n }\n\n return propertyName;\n}\n\nexport function serialize(obj: object): Record<string, Record<string, unknown>> {\n const serialized: any = {};\n for (const [propertyName, propertyValue] of Object.entries(obj)) {\n const transformedKey = translatePropertyNameForSerialization(propertyName);\n const serializedVal = getSerializedValue(propertyValue);\n serialized[transformedKey] = serializedVal.value;\n if (serializedVal.type) {\n serialized[`${transformedKey}@odata.type`] = serializedVal.type;\n }\n }\n return serialized;\n}\n\nfunction getTypedObject(value: any, type: string, disableTypeConversion: boolean): any {\n switch (type) {\n case Edm.Boolean:\n return disableTypeConversion ? { value, type: \"Boolean\" } : value;\n case Edm.Double:\n return disableTypeConversion ? { value, type: \"Double\" } : value;\n case Edm.Int32:\n return disableTypeConversion ? { value, type: \"Int32\" } : value;\n case Edm.String:\n return disableTypeConversion ? { value, type: \"String\" } : value;\n case Edm.DateTime:\n return disableTypeConversion ? { value, type: \"DateTime\" } : new Date(value);\n case Edm.Int64:\n return disableTypeConversion ? { value, type: \"Int64\" } : BigInt(value);\n case Edm.Guid:\n return { value, type: \"Guid\" };\n case Edm.Binary:\n return disableTypeConversion ? { value, type: \"Binary\" } : base64Decode(value);\n default:\n throw new Error(`Unknown EDM type ${type}`);\n }\n}\n\nexport function deserialize<T extends object = Record<string, any>>(\n obj: object,\n disableTypeConversion: boolean = false,\n): T {\n const deserialized: any = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key.indexOf(\"@odata.type\") === -1) {\n const transformedKey = propertyCaseMap.get(key) ?? key;\n let typedValue = value;\n if (`${key}@odata.type` in obj) {\n const type = (obj as any)[`${key}@odata.type`];\n typedValue = getTypedObject(value, type, disableTypeConversion);\n } else if (disableTypeConversion && [\"number\", \"string\", \"boolean\"].includes(typeof value)) {\n // The service, doesn't return type metadata for number, strings or booleans\n // if automatic type conversion is disabled we'll infer the EDM object\n typedValue = inferTypedObject(key, value);\n }\n\n deserialized[transformedKey] = typedValue;\n }\n }\n return deserialized;\n}\n\nfunction inferTypedObject(propertyName: string, value: number | string | boolean) {\n // We need to skip service metadata fields such as partitionKey and rowKey and use the same value returned by the service\n if (propertyCaseMap.has(propertyName)) {\n return value;\n }\n\n switch (typeof value) {\n case \"boolean\":\n return { value: String(value), type: \"Boolean\" };\n case \"number\":\n return getTypedNumber(value);\n case \"string\":\n return { value, type: \"String\" };\n default:\n return value;\n }\n}\n\n/**\n * Returns the number when typeConversion is enabled or the EDM object with the correct number format Double or Int32 if disabled\n */\nfunction getTypedNumber(value: number): { value: string; type: \"Int32\" | \"Double\" } {\n const valueStr = String(value);\n if (Number.isSafeInteger(value)) {\n return { value: valueStr, type: \"Int32\" };\n } else {\n return { value: valueStr, type: \"Double\" };\n }\n}\n\nexport function deserializeObjectsArray<T extends object>(\n objArray: object[],\n disableTypeConversion: boolean,\n): T[] {\n return objArray.map((obj) => deserialize<T>(obj, disableTypeConversion));\n}\n\n/**\n * For ACL endpoints the Tables Service takes an ISO Date without decimals however\n * serializing a JavaScript date gives us a date with decimals 2021-07-08T09:10:09.000Z\n * which makes the XML request body invalid, these 2 functions serialize and deserialize the\n * dates so that they are in the expected format\n */\nexport function serializeSignedIdentifiers(\n signedIdentifiers: SignedIdentifier[],\n): GeneratedSignedIdentifier[] {\n return signedIdentifiers.map((acl) => {\n const { id, accessPolicy } = acl;\n const { start, expiry, ...rest } = accessPolicy ?? {};\n const serializedStart = start\n ? truncatedISO8061Date(start, false /** withMilliseconds */)\n : undefined;\n const serializedExpiry = expiry\n ? truncatedISO8061Date(expiry, false /** withMilliseconds */)\n : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(serializedExpiry && { expiry: serializedExpiry }),\n ...(serializedStart && { start: serializedStart }),\n ...rest,\n },\n };\n });\n}\n\nexport function deserializeSignedIdentifier(\n signedIdentifiers: GeneratedSignedIdentifier[],\n): SignedIdentifier[] {\n return signedIdentifiers.map((si) => {\n const { id, accessPolicy } = si;\n const { start, expiry, ...restAcl } = accessPolicy ?? {};\n const deserializedStart = start ? new Date(start) : undefined;\n const deserializedExpiry = expiry ? new Date(expiry) : undefined;\n\n return {\n id,\n accessPolicy: {\n ...(deserializedExpiry && { expiry: deserializedExpiry }),\n ...(deserializedStart && { start: deserializedStart }),\n ...restAcl,\n },\n };\n });\n}\n\nexport function serializeQueryOptions(query: TableEntityQueryOptions): GeneratedQueryOptions {\n const { select, ...queryOptions } = query;\n const mappedQuery: GeneratedQueryOptions = { ...queryOptions };\n // Properties that are always returned by the service but are not allowed in select\n const excludeFromSelect = [\"etag\", \"odata.etag\"];\n if (select) {\n mappedQuery.select = select\n .filter((p) => !excludeFromSelect.includes(p))\n .map(translatePropertyNameForSerialization)\n .join(\",\");\n }\n return mappedQuery;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tablesNamedCredentialPolicy.browser.js","sourceRoot":"","sources":["../../src/tablesNamedCredentialPolicy.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,MAAM,UAAU,8BAA8B,CAAC,WAA+B;IAC5E,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAyB,EACzB,WAA+B;IAE/B,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;AACtF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { PipelineRequest } from \"@azure/core-rest-pipeline\";\n\nexport function tablesNamedKeyCredentialPolicy(_credential: NamedKeyCredential): never {\n throw new Error(\"Shared Access Key authentication is not supported in the browser\");\n}\n\nexport function getAuthorizationHeader(\n _request: PipelineRequest,\n _credential: NamedKeyCredential,\n): never {\n throw new Error(\"Shared Access Key authentication is not supported in the browser\");\n}\n"]}
1
+ {"version":3,"file":"tablesNamedCredentialPolicy.browser.js","sourceRoot":"","sources":["../../src/tablesNamedCredentialPolicy.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,MAAM,UAAU,8BAA8B,CAAC,WAA+B;IAC5E,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAyB,EACzB,WAA+B;IAE/B,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;AACtF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport type { PipelineRequest } from \"@azure/core-rest-pipeline\";\n\nexport function tablesNamedKeyCredentialPolicy(_credential: NamedKeyCredential): never {\n throw new Error(\"Shared Access Key authentication is not supported in the browser\");\n}\n\nexport function getAuthorizationHeader(\n _request: PipelineRequest,\n _credential: NamedKeyCredential,\n): never {\n throw new Error(\"Shared Access Key authentication is not supported in the browser\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tablesNamedCredentialPolicy.js","sourceRoot":"","sources":["../../src/tablesNamedCredentialPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,gCAAgC,CAAC;AAEnF;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAAC,UAA8B;IAC3E,SAAS,WAAW,CAAC,OAAwB;QAC3C,MAAM,WAAW,GAAG,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAChE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,WAAW,C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AC;AAED,SAAS,oBAAoB,CAAC,OAAwB,EAAE,UAAkB;IACxE,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAE9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,8BAA8B,CACrC,OAAwB,EACxB,UAA8B;IAE9B,kJAAkJ;IAClJ,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC;IACjC,IAAI,2BAA2B,GAAG,GAAG,GAAG,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;IAE/D,sKAAsK;IACtK,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE1C,IAAI,IAAI,EAAE,CAAC;QACT,2BAA2B,GAAG,GAAG,2BAA2B,SAAS,IAAI,EAAE,CAAC;IAC9E,CAAC;IAED,OAAO,2BAA2B,CAAC;AACrC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { HeaderConstants } from \"./utils/constants\";\nimport { NamedKeyCredential } from \"@azure/core-auth\";\nimport { computeHMACSHA256 } from \"./utils/computeHMACSHA256\";\n\n/**\n * The programmatic identifier of the tablesNamedKeyCredentialPolicy.\n */\nexport const tablesNamedKeyCredentialPolicyName = \"tablesNamedKeyCredentialPolicy\";\n\n/**\n * tablesNamedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key.\n */\nexport function tablesNamedKeyCredentialPolicy(credential: NamedKeyCredential): PipelinePolicy {\n function signRequest(request: PipelineRequest): void {\n const headerValue = getAuthorizationHeader(request, credential);\n request.headers.set(HeaderConstants.AUTHORIZATION, headerValue);\n }\n\n return {\n name: tablesNamedKeyCredentialPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n signRequest(request);\n return next(request);\n },\n };\n}\n\nexport function getAuthorizationHeader(\n request: PipelineRequest,\n credential: NamedKeyCredential,\n): string {\n if (!request.headers.has(HeaderConstants.X_MS_DATE)) {\n request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString());\n }\n\n if (request.body && typeof request.body === \"string\" && request.body.length > 0) {\n request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));\n }\n\n // If x-ms-date is present, use it otherwise date\n const dateHeader = getHeaderValueToSign(request, HeaderConstants.X_MS_DATE);\n\n if (!dateHeader) {\n throw new Error(\"Failed to sign request: x-ms-date or date header must be present\");\n }\n\n const stringToSign: string = [\n dateHeader,\n getCanonicalizedResourceString(request, credential),\n ].join(\"\\n\");\n\n const signature = computeHMACSHA256(stringToSign, credential.key);\n\n return `SharedKeyLite ${credential.name}:${signature}`;\n}\n\nfunction getHeaderValueToSign(request: PipelineRequest, headerName: string): string {\n const value = request.headers.get(headerName);\n\n if (!value) {\n return \"\";\n }\n return value;\n}\n\nfunction getCanonicalizedResourceString(\n request: PipelineRequest,\n credential: NamedKeyCredential,\n): string {\n // https://docs.microsoft.com/rest/api/storageservices/authorize-with-shared-key#shared-key-lite-and-table-service-format-for-2009-09-19-and-later\n const url = new URL(request.url);\n const path = url.pathname || \"/\";\n let canonicalizedResourceString = \"/\" + credential.name + path;\n\n // The query string should include the question mark and the comp parameter (for example, ?comp=metadata). No other parameters should be included on the query string.\n const comp = url.searchParams.get(\"comp\");\n\n if (comp) {\n canonicalizedResourceString = `${canonicalizedResourceString}?comp=${comp}`;\n }\n\n return canonicalizedResourceString;\n}\n"]}
1
+ {"version":3,"file":"tablesNamedCredentialPolicy.js","sourceRoot":"","sources":["../../src/tablesNamedCredentialPolicy.ts"],"names":[],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{\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { HeaderConstants } from \"./utils/constants\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { computeHMACSHA256 } from \"./utils/computeHMACSHA256\";\n\n/**\n * The programmatic identifier of the tablesNamedKeyCredentialPolicy.\n */\nexport const tablesNamedKeyCredentialPolicyName = \"tablesNamedKeyCredentialPolicy\";\n\n/**\n * tablesNamedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key.\n */\nexport function tablesNamedKeyCredentialPolicy(credential: NamedKeyCredential): PipelinePolicy {\n function signRequest(request: PipelineRequest): void {\n const headerValue = getAuthorizationHeader(request, credential);\n request.headers.set(HeaderConstants.AUTHORIZATION, headerValue);\n }\n\n return {\n name: tablesNamedKeyCredentialPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n signRequest(request);\n return next(request);\n },\n };\n}\n\nexport function getAuthorizationHeader(\n request: PipelineRequest,\n credential: NamedKeyCredential,\n): string {\n if (!request.headers.has(HeaderConstants.X_MS_DATE)) {\n request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString());\n }\n\n if (request.body && typeof request.body === \"string\" && request.body.length > 0) {\n request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));\n }\n\n // If x-ms-date is present, use it otherwise date\n const dateHeader = getHeaderValueToSign(request, HeaderConstants.X_MS_DATE);\n\n if (!dateHeader) {\n throw new Error(\"Failed to sign request: x-ms-date or date header must be present\");\n }\n\n const stringToSign: string = [\n dateHeader,\n getCanonicalizedResourceString(request, credential),\n ].join(\"\\n\");\n\n const signature = computeHMACSHA256(stringToSign, credential.key);\n\n return `SharedKeyLite ${credential.name}:${signature}`;\n}\n\nfunction getHeaderValueToSign(request: PipelineRequest, headerName: string): string {\n const value = request.headers.get(headerName);\n\n if (!value) {\n return \"\";\n }\n return value;\n}\n\nfunction getCanonicalizedResourceString(\n request: PipelineRequest,\n credential: NamedKeyCredential,\n): string {\n // https://docs.microsoft.com/rest/api/storageservices/authorize-with-shared-key#shared-key-lite-and-table-service-format-for-2009-09-19-and-later\n const url = new URL(request.url);\n const path = url.pathname || \"/\";\n let canonicalizedResourceString = \"/\" + credential.name + path;\n\n // The query string should include the question mark and the comp parameter (for example, ?comp=metadata). No other parameters should be included on the query string.\n const comp = url.searchParams.get(\"comp\");\n\n if (comp) {\n canonicalizedResourceString = `${canonicalizedResourceString}?comp=${comp}`;\n }\n\n return canonicalizedResourceString;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tablesSASTokenPolicy.js","sourceRoot":"","sources":["../../src/tablesSASTokenPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAyB;IAC5D,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAwB,EAAE,UAAyB;IAChF,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEjC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;QACtC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { SASCredential } from \"@azure/core-auth\";\n\n/**\n * The programmatic identifier of the tablesSASTokenPolicy.\n */\nexport const tablesSASTokenPolicyName = \"tablesSASTokenPolicy\";\n\n/**\n * tablesSASTokenPolicy is a policy used to sign HTTP request with a shared key.\n */\nexport function tablesSASTokenPolicy(credential: SASCredential): PipelinePolicy {\n return {\n name: tablesSASTokenPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n signURLWithSAS(request, credential);\n return next(request);\n },\n };\n}\n\nexport function signURLWithSAS(request: PipelineRequest, credential: SASCredential): void {\n const sasParams = new URLSearchParams(credential.signature);\n const url = new URL(request.url);\n\n for (const [name, value] of sasParams) {\n url.searchParams.append(name, value);\n }\n request.url = url.toString();\n}\n"]}
1
+ {"version":3,"file":"tablesSASTokenPolicy.js","sourceRoot":"","sources":["../../src/tablesSASTokenPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAyB;IAC5D,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAwB,EAAE,UAAyB;IAChF,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEjC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;QACtC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport type { SASCredential } from \"@azure/core-auth\";\n\n/**\n * The programmatic identifier of the tablesSASTokenPolicy.\n */\nexport const tablesSASTokenPolicyName = \"tablesSASTokenPolicy\";\n\n/**\n * tablesSASTokenPolicy is a policy used to sign HTTP request with a shared key.\n */\nexport function tablesSASTokenPolicy(credential: SASCredential): PipelinePolicy {\n return {\n name: tablesSASTokenPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n signURLWithSAS(request, credential);\n return next(request);\n },\n };\n}\n\nexport function signURLWithSAS(request: PipelineRequest, credential: SASCredential): void {\n const sasParams = new URLSearchParams(credential.signature);\n const url = new URL(request.url);\n\n for (const [name, value] of sasParams) {\n url.searchParams.append(name, value);\n }\n request.url = url.toString();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"accountConnectionString.browser.js","sourceRoot":"","sources":["../../../src/utils/accountConnectionString.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;;;GAKG;AACH,+HAA+H;AAC/H,MAAM,UAAU,2BAA2B,CACzC,iBAAmC,EACnC,QAAoC;IAEpC,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,YAAoB,EACpB,WAAmB,EACnB,yBAAiC,EACjC,eAAwB,EACxB,cAAuB;IAEvB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ConnectionString } from \"./internalModels\";\nimport { TableServiceClientOptions } from \"..\";\n\n/**\n * Gets client parameters from an Account Connection String\n * Only supported in Node.js not supported for Browsers\n * @param _extractedCreds - parsed connection string\n * @param _options - TablesServiceClient options\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types\nexport function fromAccountConnectionString(\n _connectionString: ConnectionString,\n _options?: TableServiceClientOptions,\n) {\n throw new Error(\"Account connection string is only supported in Node.js environment\");\n}\n\nexport function getAccountConnectionString(\n _accountName: string,\n _accountKey: string,\n _defaultEndpointsProtocol: string,\n _endpointSuffix?: string,\n _tableEndpoint?: string,\n): ConnectionString {\n throw new Error(\"Account connection string is only supported in Node.js environment\");\n}\n"]}
1
+ {"version":3,"file":"accountConnectionString.browser.js","sourceRoot":"","sources":["../../../src/utils/accountConnectionString.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;;;;GAKG;AACH,+HAA+H;AAC/H,MAAM,UAAU,2BAA2B,CACzC,iBAAmC,EACnC,QAAoC;IAEpC,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,YAAoB,EACpB,WAAmB,EACnB,yBAAiC,EACjC,eAAwB,EACxB,cAAuB;IAEvB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ConnectionString } from \"./internalModels\";\nimport type { TableServiceClientOptions } from \"..\";\n\n/**\n * Gets client parameters from an Account Connection String\n * Only supported in Node.js not supported for Browsers\n * @param _extractedCreds - parsed connection string\n * @param _options - TablesServiceClient options\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types\nexport function fromAccountConnectionString(\n _connectionString: ConnectionString,\n _options?: TableServiceClientOptions,\n) {\n throw new Error(\"Account connection string is only supported in Node.js environment\");\n}\n\nexport function getAccountConnectionString(\n _accountName: string,\n _accountKey: string,\n _defaultEndpointsProtocol: string,\n _endpointSuffix?: string,\n _tableEndpoint?: string,\n): ConnectionString {\n throw new Error(\"Account connection string is only supported in Node.js environment\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"accountConnectionString.js","sourceRoot":"","sources":["../../../src/utils/accountConnectionString.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,cAAgC,EAChC,UAAqC,EAAE;IAEvC,MAAM,mBAAmB,GAAG,IAAI,uBAAuB,CACrD,cAAc,CAAC,WAAY,EAC3B,cAAc,CAAC,UAAU,CAC1B,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,cAAc,CAAC,GAAG;QACvB,OAAO;QACP,UAAU,EAAE,mBAAmB;KAChC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,WAAmB,EACnB,UAAkB,EAClB,wBAAgC,EAChC,cAAuB,EACvB,aAAsB;IAEtB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,gEAAgE;QAChE,8FAA8F;QAC9F,MAAM,QAAQ,GAAG,wBAAwB,CAAC,WAAW,EAAE,CAAC;QACxD,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC9E,CAAC;QACD,aAAa,GAAG,GAAG,wBAAwB,MAAM,WAAW,UAAU,cAAc,EAAE,CAAC;IACzF,CAAC;IAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;SAAM,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,GAAG,EAAE,aAAa;QAClB,WAAW;QACX,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ClientParamsFromConnectionString, ConnectionString } from \"./internalModels\";\nimport { AzureNamedKeyCredential } from \"@azure/core-auth\";\nimport { TableServiceClientOptions } from \"..\";\n\n/**\n * Gets client parameters from an Account Connection String\n * Only supported in Node.js not supported for Browsers\n * @param extractedCreds - parsed connection string\n * @param options - TablesServiceClient options\n */\nexport function fromAccountConnectionString(\n extractedCreds: ConnectionString,\n options: TableServiceClientOptions = {},\n): ClientParamsFromConnectionString {\n const sharedKeyCredential = new AzureNamedKeyCredential(\n extractedCreds.accountName!,\n extractedCreds.accountKey,\n );\n\n return {\n url: extractedCreds.url,\n options,\n credential: sharedKeyCredential,\n };\n}\n\nexport function getAccountConnectionString(\n accountName: string,\n accountKey: string,\n defaultEndpointsProtocol: string,\n endpointSuffix?: string,\n tableEndpoint?: string,\n): ConnectionString {\n if (!tableEndpoint) {\n // TableEndpoint is not present in the Account connection string\n // Can be obtained from `${defaultEndpointsProtocol}://${accountName}.table.${endpointSuffix}`\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 if (!endpointSuffix) {\n throw new Error(\"Invalid EndpointSuffix in the provided Connection String\");\n }\n tableEndpoint = `${defaultEndpointsProtocol}://${accountName}.table.${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: tableEndpoint,\n accountName,\n accountKey,\n };\n}\n"]}
1
+ {"version":3,"file":"accountConnectionString.js","sourceRoot":"","sources":["../../../src/utils/accountConnectionString.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,cAAgC,EAChC,UAAqC,EAAE;IAEvC,MAAM,mBAAmB,GAAG,IAAI,uBAAuB,CACrD,cAAc,CAAC,WAAY,EAC3B,cAAc,CAAC,UAAU,CAC1B,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,cAAc,CAAC,GAAG;QACvB,OAAO;QACP,UAAU,EAAE,mBAAmB;KAChC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,WAAmB,EACnB,UAAkB,EAClB,wBAAgC,EAChC,cAAuB,EACvB,aAAsB;IAEtB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,gEAAgE;QAChE,8FAA8F;QAC9F,MAAM,QAAQ,GAAG,wBAAwB,CAAC,WAAW,EAAE,CAAC;QACxD,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC9E,CAAC;QACD,aAAa,GAAG,GAAG,wBAAwB,MAAM,WAAW,UAAU,cAAc,EAAE,CAAC;IACzF,CAAC;IAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;SAAM,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,GAAG,EAAE,aAAa;QAClB,WAAW;QACX,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientParamsFromConnectionString, ConnectionString } from \"./internalModels\";\nimport { AzureNamedKeyCredential } from \"@azure/core-auth\";\nimport type { TableServiceClientOptions } from \"..\";\n\n/**\n * Gets client parameters from an Account Connection String\n * Only supported in Node.js not supported for Browsers\n * @param extractedCreds - parsed connection string\n * @param options - TablesServiceClient options\n */\nexport function fromAccountConnectionString(\n extractedCreds: ConnectionString,\n options: TableServiceClientOptions = {},\n): ClientParamsFromConnectionString {\n const sharedKeyCredential = new AzureNamedKeyCredential(\n extractedCreds.accountName!,\n extractedCreds.accountKey,\n );\n\n return {\n url: extractedCreds.url,\n options,\n credential: sharedKeyCredential,\n };\n}\n\nexport function getAccountConnectionString(\n accountName: string,\n accountKey: string,\n defaultEndpointsProtocol: string,\n endpointSuffix?: string,\n tableEndpoint?: string,\n): ConnectionString {\n if (!tableEndpoint) {\n // TableEndpoint is not present in the Account connection string\n // Can be obtained from `${defaultEndpointsProtocol}://${accountName}.table.${endpointSuffix}`\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 if (!endpointSuffix) {\n throw new Error(\"Invalid EndpointSuffix in the provided Connection String\");\n }\n tableEndpoint = `${defaultEndpointsProtocol}://${accountName}.table.${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: tableEndpoint,\n accountName,\n accountKey,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apiVersionPolicy.js","sourceRoot":"","sources":["../../../src/utils/apiVersionPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA2C,CAAC,UAAkB,EAAE,EAAE;IAC7F,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC/B,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PipelinePolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Name of the apiVersion Policy\n * @internal\n */\nexport const apiVersionPolicyName = \"apiVersionPolicy\";\n\n/**\n * Pipeline policy that enables users to override the default api version\n * @internal\n */\nexport const apiVersionPolicy: (apiVersion: string) => PipelinePolicy = (apiVersion: string) => {\n return {\n name: apiVersionPolicyName,\n sendRequest: async (req, next) => {\n req.headers.set(\"x-ms-version\", apiVersion);\n return next(req);\n },\n };\n};\n"]}
1
+ {"version":3,"file":"apiVersionPolicy.js","sourceRoot":"","sources":["../../../src/utils/apiVersionPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA2C,CAAC,UAAkB,EAAE,EAAE;IAC7F,OAAO;QACL,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC/B,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * Name of the apiVersion Policy\n * @internal\n */\nexport const apiVersionPolicyName = \"apiVersionPolicy\";\n\n/**\n * Pipeline policy that enables users to override the default api version\n * @internal\n */\nexport const apiVersionPolicy: (apiVersion: string) => PipelinePolicy = (apiVersion: string) => {\n return {\n name: apiVersionPolicyName,\n sendRequest: async (req, next) => {\n req.headers.set(\"x-ms-version\", apiVersion);\n return next(req);\n },\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"baseTransactionHeaders.js","sourceRoot":"","sources":["../../../src/utils/baseTransactionHeaders.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,eAAuB;IAC/D,OAAO;QACL,MAAM,EAAE,kBAAkB;QAC1B,cAAc,EAAE,YAAY;QAC5B,kBAAkB,EAAE,MAAM;QAC1B,qBAAqB,EAAE,WAAW;QAClC,cAAc,EAAE,mCAAmC,eAAe,EAAE;KACrE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\n\n/**\n * @internal\n * Builds an object with the required headers for a Transaction request. For both Node and Browser\n */\nexport function getBaseTransactionHeaders(transactionGuid: string): RawHttpHeaders {\n return {\n accept: \"application/json\",\n \"x-ms-version\": \"2019-02-02\",\n DataServiceVersion: \"3.0;\",\n MaxDataServiceVersion: \"3.0;NetFx\",\n \"Content-Type\": `multipart/mixed; boundary=batch_${transactionGuid}`,\n };\n}\n"]}
1
+ {"version":3,"file":"baseTransactionHeaders.js","sourceRoot":"","sources":["../../../src/utils/baseTransactionHeaders.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,eAAuB;IAC/D,OAAO;QACL,MAAM,EAAE,kBAAkB;QAC1B,cAAc,EAAE,YAAY;QAC5B,kBAAkB,EAAE,MAAM;QAC1B,qBAAqB,EAAE,WAAW;QAClC,cAAc,EAAE,mCAAmC,eAAe,EAAE;KACrE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\n\n/**\n * @internal\n * Builds an object with the required headers for a Transaction request. For both Node and Browser\n */\nexport function getBaseTransactionHeaders(transactionGuid: string): RawHttpHeaders {\n return {\n accept: \"application/json\",\n \"x-ms-version\": \"2019-02-02\",\n DataServiceVersion: \"3.0;\",\n MaxDataServiceVersion: \"3.0;NetFx\",\n \"Content-Type\": `multipart/mixed; boundary=batch_${transactionGuid}`,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"challengeAuthenticationUtils.js","sourceRoot":"","sources":["../../../src/utils/challengeAuthenticationUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAY,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAGtF,OAAO,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AAEvE;;;GAGG;AACH,MAAM,UAAU,qCAAqC,CACnD,QAAkB,EAClB,UAA2B,EAC3B,MAAyB;IAEzB,yCAAyC;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;IACrD,QAAQ,CAAC,SAAS,CAChB,+BAA+B,CAAC;QAC9B,UAAU;QACV,MAAM;QACN,kBAAkB,EAAE,EAAE,2BAA2B,EAAE,iCAAiC,EAAE;KACvF,CAAC,EACF;QACE,KAAK,EAAE,MAAM;KACd,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Pipeline, bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { authorizeRequestOnTenantChallenge } from \"@azure/core-client\";\n\n/**\n * @internal\n * Setups the challenge authentication policy for the provided token credential.\n */\nexport function setTokenChallengeAuthenticationPolicy(\n pipeline: Pipeline,\n credential: TokenCredential,\n scopes: string | string[],\n): void {\n // Make sure no bearerTokenPolicy is set.\n pipeline.removePolicy({ name: \"bearerTokenPolicy\" });\n pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes,\n challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },\n }),\n {\n phase: \"Sign\",\n },\n );\n}\n"]}
1
+ {"version":3,"file":"challengeAuthenticationUtils.js","sourceRoot":"","sources":["../../../src/utils/challengeAuthenticationUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AAEvE;;;GAGG;AACH,MAAM,UAAU,qCAAqC,CACnD,QAAkB,EAClB,UAA2B,EAC3B,MAAyB;IAEzB,yCAAyC;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;IACrD,QAAQ,CAAC,SAAS,CAChB,+BAA+B,CAAC;QAC9B,UAAU;QACV,MAAM;QACN,kBAAkB,EAAE,EAAE,2BAA2B,EAAE,iCAAiC,EAAE;KACvF,CAAC,EACF;QACE,KAAK,EAAE,MAAM;KACd,CACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { authorizeRequestOnTenantChallenge } from \"@azure/core-client\";\n\n/**\n * @internal\n * Setups the challenge authentication policy for the provided token credential.\n */\nexport function setTokenChallengeAuthenticationPolicy(\n pipeline: Pipeline,\n credential: TokenCredential,\n scopes: string | string[],\n): void {\n // Make sure no bearerTokenPolicy is set.\n pipeline.removePolicy({ name: \"bearerTokenPolicy\" });\n pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes,\n challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },\n }),\n {\n phase: \"Sign\",\n },\n );\n}\n"]}