@azure/core-client 1.9.3-alpha.20240701.3 → 1.9.3-alpha.20240705.2

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 (42) hide show
  1. package/dist/browser/serviceClient.d.ts +0 -1
  2. package/dist/browser/serviceClient.d.ts.map +1 -1
  3. package/dist/browser/serviceClient.js +0 -1
  4. package/dist/browser/serviceClient.js.map +1 -1
  5. package/dist/commonjs/authorizeRequestOnClaimChallenge.js +2 -3
  6. package/dist/commonjs/authorizeRequestOnClaimChallenge.js.map +1 -1
  7. package/dist/commonjs/base64.js +4 -5
  8. package/dist/commonjs/base64.js.map +1 -1
  9. package/dist/commonjs/deserializationPolicy.js +2 -2
  10. package/dist/commonjs/deserializationPolicy.js.map +1 -1
  11. package/dist/commonjs/httpClientCache.js +1 -2
  12. package/dist/commonjs/httpClientCache.js.map +1 -1
  13. package/dist/commonjs/interfaceHelpers.js +2 -3
  14. package/dist/commonjs/interfaceHelpers.js.map +1 -1
  15. package/dist/commonjs/operationHelpers.js +2 -3
  16. package/dist/commonjs/operationHelpers.js.map +1 -1
  17. package/dist/commonjs/pipeline.js +1 -2
  18. package/dist/commonjs/pipeline.js.map +1 -1
  19. package/dist/commonjs/serializationPolicy.js +4 -4
  20. package/dist/commonjs/serializationPolicy.js.map +1 -1
  21. package/dist/commonjs/serializer.js +2 -2
  22. package/dist/commonjs/serializer.js.map +1 -1
  23. package/dist/commonjs/serviceClient.d.ts +0 -1
  24. package/dist/commonjs/serviceClient.d.ts.map +1 -1
  25. package/dist/commonjs/serviceClient.js +0 -1
  26. package/dist/commonjs/serviceClient.js.map +1 -1
  27. package/dist/commonjs/urlHelpers.js +2 -3
  28. package/dist/commonjs/urlHelpers.js.map +1 -1
  29. package/dist/commonjs/utils.js +4 -5
  30. package/dist/commonjs/utils.js.map +1 -1
  31. package/dist/core-client.d.ts +0 -1
  32. package/dist/esm/serviceClient.d.ts +0 -1
  33. package/dist/esm/serviceClient.d.ts.map +1 -1
  34. package/dist/esm/serviceClient.js +0 -1
  35. package/dist/esm/serviceClient.js.map +1 -1
  36. package/dist/esm/state.d.ts.map +1 -1
  37. package/dist/react-native/serviceClient.d.ts +0 -1
  38. package/dist/react-native/serviceClient.d.ts.map +1 -1
  39. package/dist/react-native/serviceClient.js +0 -1
  40. package/dist/react-native/serviceClient.js.map +1 -1
  41. package/dist/react-native/state.d.ts.map +1 -1
  42. package/package.json +5 -4
@@ -2,7 +2,10 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.flattenResponse = exports.isValidUuid = exports.isDuration = exports.isPrimitiveBody = void 0;
5
+ exports.isPrimitiveBody = isPrimitiveBody;
6
+ exports.isDuration = isDuration;
7
+ exports.isValidUuid = isValidUuid;
8
+ exports.flattenResponse = flattenResponse;
6
9
  /**
7
10
  * A type guard for a primitive response body.
8
11
  * @param value - Value to test
@@ -20,7 +23,6 @@ function isPrimitiveBody(value, mapperTypeName) {
20
23
  value === undefined ||
21
24
  value === null));
22
25
  }
23
- exports.isPrimitiveBody = isPrimitiveBody;
24
26
  const validateISODuration = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
25
27
  /**
26
28
  * Returns true if the given string is in ISO 8601 format.
@@ -30,7 +32,6 @@ const validateISODuration = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?
30
32
  function isDuration(value) {
31
33
  return validateISODuration.test(value);
32
34
  }
33
- exports.isDuration = isDuration;
34
35
  const validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;
35
36
  /**
36
37
  * Returns true if the provided uuid is valid.
@@ -42,7 +43,6 @@ const validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F
42
43
  function isValidUuid(uuid) {
43
44
  return validUuidRegex.test(uuid);
44
45
  }
45
- exports.isValidUuid = isValidUuid;
46
46
  /**
47
47
  * Maps the response as follows:
48
48
  * - wraps the response body if needed (typically if its type is primitive).
@@ -118,5 +118,4 @@ function flattenResponse(fullResponse, responseSpec) {
118
118
  shouldWrapBody: isPrimitiveBody(fullResponse.parsedBody, expectedBodyTypeName),
119
119
  });
120
120
  }
121
- exports.flattenResponse = flattenResponse;
122
121
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAUlC;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAAc,EAAE,cAAuB;IACrE,OAAO,CACL,cAAc,KAAK,WAAW;QAC9B,cAAc,KAAK,YAAY;QAC/B,CAAC,OAAO,KAAK,KAAK,QAAQ;YACxB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,SAAS;YAC1B,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,CAAC,iEAAiE,CAAC;gBACtF,IAAI;YACN,KAAK,KAAK,SAAS;YACnB,KAAK,KAAK,IAAI,CAAC,CAClB,CAAC;AACJ,CAAC;AAZD,0CAYC;AAED,MAAM,mBAAmB,GACvB,qKAAqK,CAAC;AAExK;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAFD,gCAEC;AAED,MAAM,cAAc,GAClB,gFAAgF,CAAC;AAEnF;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC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OAAO,EAAE,aAAa;QACtB,eAAe,EAAE,UAAU;QAC3B,cAAc,EAAE,eAAe,CAAC,YAAY,CAAC,UAAU,EAAE,oBAAoB,CAAC;KAC/E,CAAC,CAAC;AACL,CAAC;AA/DD,0CA+DC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CompositeMapper, FullOperationResponse, OperationResponseMap } from \"./interfaces.js\";\n\n/**\n * The union of all possible types for a primitive response body.\n * @internal\n */\nexport type BodyPrimitive = number | string | boolean | Date | Uint8Array | undefined | null;\n\n/**\n * A type guard for a primitive response body.\n * @param value - Value to test\n *\n * @internal\n */\nexport function isPrimitiveBody(value: unknown, mapperTypeName?: string): value is BodyPrimitive {\n return (\n mapperTypeName !== \"Composite\" &&\n mapperTypeName !== \"Dictionary\" &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\" ||\n mapperTypeName?.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i) !==\n null ||\n value === undefined ||\n value === null)\n );\n}\n\nconst validateISODuration =\n /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\n/**\n * Returns true if the given string is in ISO 8601 format.\n * @param value - The value to be validated for ISO 8601 duration format.\n * @internal\n */\nexport function isDuration(value: string): boolean {\n return validateISODuration.test(value);\n}\n\nconst validUuidRegex =\n /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;\n\n/**\n * Returns true if the provided uuid is valid.\n *\n * @param uuid - The uuid that needs to be validated.\n *\n * @internal\n */\nexport function isValidUuid(uuid: string): boolean {\n return validUuidRegex.test(uuid);\n}\n\n/**\n * Representation of parsed response headers and body coupled with information\n * about how to map them:\n * - whether the response body should be wrapped (typically if its type is primitive).\n * - whether the response is nullable so it can be null if the combination of\n * the headers and the body is empty.\n */\ninterface ResponseObjectWithMetadata {\n /** whether the mapper allows nullable body */\n hasNullableType: boolean;\n /** whether the response's body should be wrapped */\n shouldWrapBody: boolean;\n /** parsed headers of the response */\n headers:\n | {\n [key: string]: unknown;\n }\n | undefined;\n /** parsed body of the response */\n body: any;\n}\n\n/**\n * Maps the response as follows:\n * - wraps the response body if needed (typically if its type is primitive).\n * - returns null if the combination of the headers and the body is empty.\n * - otherwise, returns the combination of the headers and the body.\n *\n * @param responseObject - a representation of the parsed response\n * @returns the response that will be returned to the user which can be null and/or wrapped\n *\n * @internal\n */\nfunction handleNullableResponseAndWrappableBody(\n responseObject: ResponseObjectWithMetadata,\n): unknown | null {\n const combinedHeadersAndBody = {\n ...responseObject.headers,\n ...responseObject.body,\n };\n if (\n responseObject.hasNullableType &&\n Object.getOwnPropertyNames(combinedHeadersAndBody).length === 0\n ) {\n return responseObject.shouldWrapBody ? { body: null } : null;\n } else {\n return responseObject.shouldWrapBody\n ? {\n ...responseObject.headers,\n body: responseObject.body,\n }\n : combinedHeadersAndBody;\n }\n}\n\n/**\n * Take a `FullOperationResponse` and turn it into a flat\n * response object to hand back to the consumer.\n * @param fullResponse - The processed response from the operation request\n * @param responseSpec - The response map from the OperationSpec\n *\n * @internal\n */\nexport function flattenResponse(\n fullResponse: FullOperationResponse,\n responseSpec: OperationResponseMap | undefined,\n): unknown {\n const parsedHeaders = fullResponse.parsedHeaders;\n\n // head methods never have a body, but we return a boolean set to body property\n // to indicate presence/absence of the resource\n if (fullResponse.request.method === \"HEAD\") {\n return {\n ...parsedHeaders,\n body: fullResponse.parsedBody,\n };\n }\n const bodyMapper = responseSpec && responseSpec.bodyMapper;\n const isNullable = Boolean(bodyMapper?.nullable);\n const expectedBodyTypeName = bodyMapper?.type.name;\n\n /** If the body is asked for, we look at the expected body type to handle it */\n if (expectedBodyTypeName === \"Stream\") {\n return {\n ...parsedHeaders,\n blobBody: fullResponse.blobBody,\n readableStreamBody: fullResponse.readableStreamBody,\n };\n }\n\n const modelProperties =\n (expectedBodyTypeName === \"Composite\" &&\n (bodyMapper as CompositeMapper).type.modelProperties) ||\n {};\n const isPageableResponse = Object.keys(modelProperties).some(\n (k) => modelProperties[k].serializedName === \"\",\n );\n if (expectedBodyTypeName === \"Sequence\" || isPageableResponse) {\n const arrayResponse: { [key: string]: unknown } =\n fullResponse.parsedBody ?? ([] as unknown as { [key: string]: unknown });\n\n for (const key of Object.keys(modelProperties)) {\n if (modelProperties[key].serializedName) {\n arrayResponse[key] = fullResponse.parsedBody?.[key];\n }\n }\n\n if (parsedHeaders) {\n for (const key of Object.keys(parsedHeaders)) {\n arrayResponse[key] = parsedHeaders[key];\n }\n }\n return isNullable &&\n !fullResponse.parsedBody &&\n !parsedHeaders &&\n Object.getOwnPropertyNames(modelProperties).length === 0\n ? null\n : arrayResponse;\n }\n\n return handleNullableResponseAndWrappableBody({\n body: fullResponse.parsedBody,\n headers: parsedHeaders,\n hasNullableType: isNullable,\n shouldWrapBody: isPrimitiveBody(fullResponse.parsedBody, expectedBodyTypeName),\n });\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAgBlC,0CAYC;AAUD,gCAEC;AAYD,kCAEC;AAiED,0CA+DC;AA5KD;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAAc,EAAE,cAAuB;IACrE,OAAO,CACL,cAAc,KAAK,WAAW;QAC9B,cAAc,KAAK,YAAY;QAC/B,CAAC,OAAO,KAAK,KAAK,QAAQ;YACxB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,SAAS;YAC1B,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,CAAC,iEAAiE,CAAC;gBACtF,IAAI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C,CAAC;YAC1C,CAAC;QACH,CAAC;QACD,OAAO,UAAU;YACf,CAAC,YAAY,CAAC,UAAU;YACxB,CAAC,aAAa;YACd,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,MAAM,KAAK,CAAC;YACxD,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;IAED,OAAO,sCAAsC,CAAC;QAC5C,IAAI,EAAE,YAAY,CAAC,UAAU;QAC7B,OAAO,EAAE,aAAa;QACtB,eAAe,EAAE,UAAU;QAC3B,cAAc,EAAE,eAAe,CAAC,YAAY,CAAC,UAAU,EAAE,oBAAoB,CAAC;KAC/E,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CompositeMapper, FullOperationResponse, OperationResponseMap } from \"./interfaces.js\";\n\n/**\n * The union of all possible types for a primitive response body.\n * @internal\n */\nexport type BodyPrimitive = number | string | boolean | Date | Uint8Array | undefined | null;\n\n/**\n * A type guard for a primitive response body.\n * @param value - Value to test\n *\n * @internal\n */\nexport function isPrimitiveBody(value: unknown, mapperTypeName?: string): value is BodyPrimitive {\n return (\n mapperTypeName !== \"Composite\" &&\n mapperTypeName !== \"Dictionary\" &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\" ||\n mapperTypeName?.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i) !==\n null ||\n value === undefined ||\n value === null)\n );\n}\n\nconst validateISODuration =\n /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\n/**\n * Returns true if the given string is in ISO 8601 format.\n * @param value - The value to be validated for ISO 8601 duration format.\n * @internal\n */\nexport function isDuration(value: string): boolean {\n return validateISODuration.test(value);\n}\n\nconst validUuidRegex =\n /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;\n\n/**\n * Returns true if the provided uuid is valid.\n *\n * @param uuid - The uuid that needs to be validated.\n *\n * @internal\n */\nexport function isValidUuid(uuid: string): boolean {\n return validUuidRegex.test(uuid);\n}\n\n/**\n * Representation of parsed response headers and body coupled with information\n * about how to map them:\n * - whether the response body should be wrapped (typically if its type is primitive).\n * - whether the response is nullable so it can be null if the combination of\n * the headers and the body is empty.\n */\ninterface ResponseObjectWithMetadata {\n /** whether the mapper allows nullable body */\n hasNullableType: boolean;\n /** whether the response's body should be wrapped */\n shouldWrapBody: boolean;\n /** parsed headers of the response */\n headers:\n | {\n [key: string]: unknown;\n }\n | undefined;\n /** parsed body of the response */\n body: any;\n}\n\n/**\n * Maps the response as follows:\n * - wraps the response body if needed (typically if its type is primitive).\n * - returns null if the combination of the headers and the body is empty.\n * - otherwise, returns the combination of the headers and the body.\n *\n * @param responseObject - a representation of the parsed response\n * @returns the response that will be returned to the user which can be null and/or wrapped\n *\n * @internal\n */\nfunction handleNullableResponseAndWrappableBody(\n responseObject: ResponseObjectWithMetadata,\n): unknown | null {\n const combinedHeadersAndBody = {\n ...responseObject.headers,\n ...responseObject.body,\n };\n if (\n responseObject.hasNullableType &&\n Object.getOwnPropertyNames(combinedHeadersAndBody).length === 0\n ) {\n return responseObject.shouldWrapBody ? { body: null } : null;\n } else {\n return responseObject.shouldWrapBody\n ? {\n ...responseObject.headers,\n body: responseObject.body,\n }\n : combinedHeadersAndBody;\n }\n}\n\n/**\n * Take a `FullOperationResponse` and turn it into a flat\n * response object to hand back to the consumer.\n * @param fullResponse - The processed response from the operation request\n * @param responseSpec - The response map from the OperationSpec\n *\n * @internal\n */\nexport function flattenResponse(\n fullResponse: FullOperationResponse,\n responseSpec: OperationResponseMap | undefined,\n): unknown {\n const parsedHeaders = fullResponse.parsedHeaders;\n\n // head methods never have a body, but we return a boolean set to body property\n // to indicate presence/absence of the resource\n if (fullResponse.request.method === \"HEAD\") {\n return {\n ...parsedHeaders,\n body: fullResponse.parsedBody,\n };\n }\n const bodyMapper = responseSpec && responseSpec.bodyMapper;\n const isNullable = Boolean(bodyMapper?.nullable);\n const expectedBodyTypeName = bodyMapper?.type.name;\n\n /** If the body is asked for, we look at the expected body type to handle it */\n if (expectedBodyTypeName === \"Stream\") {\n return {\n ...parsedHeaders,\n blobBody: fullResponse.blobBody,\n readableStreamBody: fullResponse.readableStreamBody,\n };\n }\n\n const modelProperties =\n (expectedBodyTypeName === \"Composite\" &&\n (bodyMapper as CompositeMapper).type.modelProperties) ||\n {};\n const isPageableResponse = Object.keys(modelProperties).some(\n (k) => modelProperties[k].serializedName === \"\",\n );\n if (expectedBodyTypeName === \"Sequence\" || isPageableResponse) {\n const arrayResponse: { [key: string]: unknown } =\n fullResponse.parsedBody ?? ([] as unknown as { [key: string]: unknown });\n\n for (const key of Object.keys(modelProperties)) {\n if (modelProperties[key].serializedName) {\n arrayResponse[key] = fullResponse.parsedBody?.[key];\n }\n }\n\n if (parsedHeaders) {\n for (const key of Object.keys(parsedHeaders)) {\n arrayResponse[key] = parsedHeaders[key];\n }\n }\n return isNullable &&\n !fullResponse.parsedBody &&\n !parsedHeaders &&\n Object.getOwnPropertyNames(modelProperties).length === 0\n ? null\n : arrayResponse;\n }\n\n return handleNullableResponseAndWrappableBody({\n body: fullResponse.parsedBody,\n headers: parsedHeaders,\n hasNullableType: isNullable,\n shouldWrapBody: isPrimitiveBody(fullResponse.parsedBody, expectedBodyTypeName),\n });\n}\n"]}
@@ -845,7 +845,6 @@ export declare class ServiceClient {
845
845
  readonly pipeline: Pipeline;
846
846
  /**
847
847
  * The ServiceClient constructor
848
- * @param credential - The credentials used for authentication with the service.
849
848
  * @param options - The service client options that govern the behavior of the client.
850
849
  */
851
850
  constructor(options?: ServiceClientOptions);
@@ -63,7 +63,6 @@ export declare class ServiceClient {
63
63
  readonly pipeline: Pipeline;
64
64
  /**
65
65
  * The ServiceClient constructor
66
- * @param credential - The credentials used for authentication with the service.
67
66
  * @param options - The service client options that govern the behavior of the client.
68
67
  */
69
68
  constructor(options?: ServiceClientOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClient.d.ts","sourceRoot":"","sources":["../../src/serviceClient.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAElB,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,QAAQ,EACR,eAAe,EACf,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IAEpC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAS;IAE9C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAU;IAEpD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAEzC;;OAEG;IACH,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAEnC;;;;OAIG;gBACS,OAAO,GAAE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EnC;;;OAGG;gBACS,OAAO,GAAE,oBAAyB;IAwB9C;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAItE;;;;;OAKG;IACG,oBAAoB,CAAC,CAAC,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,CAAC,CAAC;CA8Fd"}
@@ -14,7 +14,6 @@ import { logger } from "./log.js";
14
14
  export class ServiceClient {
15
15
  /**
16
16
  * The ServiceClient constructor
17
- * @param credential - The credentials used for authentication with the service.
18
17
  * @param options - The service client options that govern the behavior of the client.
19
18
  */
20
19
  constructor(options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../src/serviceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAKL,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAqClC;;GAEG;AACH,MAAM,OAAO,aAAa;IA4BxB;;;;OAIG;IACH,YAAY,UAAgC,EAAE;;QAC5C,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,CAAC;QACrD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB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aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,EAAE,CAAC;oBACxB,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;gBACvD,CAAC;YACH,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,OAA6B;IAC1D,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,iBAAiB,GACrB,OAAO,CAAC,UAAU,IAAI,gBAAgB;QACpC,CAAC,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;QACtD,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,oBAAoB,iCACtB,OAAO,KACV,iBAAiB,IACjB,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB,CAAC,OAA6B;IACxD,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,gBAAgB,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,OAAO,GAAG,OAAO,CAAC,QAAQ,WAAW,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,GAAG,OAAO,CAAC,OAAO,WAAW,CAAC;IACvC,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CACb,2JAA2J,CAC5J,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CommonClientOptions,\n OperationArguments,\n OperationRequest,\n OperationSpec,\n} from \"./interfaces.js\";\nimport {\n HttpClient,\n Pipeline,\n PipelineRequest,\n PipelineResponse,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { createClientPipeline } from \"./pipeline.js\";\nimport { flattenResponse } from \"./utils.js\";\nimport { getCachedDefaultHttpClient } from \"./httpClientCache.js\";\nimport { getOperationRequestInfo } from \"./operationHelpers.js\";\nimport { getRequestUrl } from \"./urlHelpers.js\";\nimport { getStreamingResponseStatusCodes } from \"./interfaceHelpers.js\";\nimport { logger } from \"./log.js\";\n\n/**\n * Options to be provided while creating the client.\n */\nexport interface ServiceClientOptions extends CommonClientOptions {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * @deprecated This property is deprecated and will be removed soon, please use endpoint instead\n */\n baseUri?: string;\n /**\n * If specified, this is the endpoint that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * to encourage customer to use endpoint, we mark the baseUri as deprecated.\n */\n endpoint?: string;\n /**\n * If specified, will be used to build the BearerTokenAuthenticationPolicy.\n */\n credentialScopes?: string | string[];\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n requestContentType?: string;\n /**\n * Credential used to authenticate the request.\n */\n credential?: TokenCredential;\n /**\n * A customized pipeline to use, otherwise a default one will be created.\n */\n pipeline?: Pipeline;\n}\n\n/**\n * Initializes a new instance of the ServiceClient.\n */\nexport class ServiceClient {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n */\n private readonly _endpoint?: string;\n\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n private readonly _requestContentType?: string;\n\n /**\n * Set to true if the request is sent over HTTP instead of HTTPS\n */\n private readonly _allowInsecureConnection?: boolean;\n\n /**\n * The HTTP client that will be used to send requests.\n */\n private readonly _httpClient: HttpClient;\n\n /**\n * The pipeline used by this client to make requests\n */\n public readonly pipeline: Pipeline;\n\n /**\n * The ServiceClient constructor\n * @param credential - The credentials used for authentication with the service.\n * @param options - The service client options that govern the behavior of the client.\n */\n constructor(options: ServiceClientOptions = {}) {\n this._requestContentType = options.requestContentType;\n this._endpoint = options.endpoint ?? options.baseUri;\n if (options.baseUri) {\n logger.warning(\n \"The baseUri option for SDK Clients has been deprecated, please use endpoint instead.\",\n );\n }\n this._allowInsecureConnection = options.allowInsecureConnection;\n this._httpClient = options.httpClient || getCachedDefaultHttpClient();\n\n this.pipeline = options.pipeline || createDefaultPipeline(options);\n if (options.additionalPolicies?.length) {\n for (const { policy, position } of options.additionalPolicies) {\n // Sign happens after Retry and is commonly needed to occur\n // before policies that intercept post-retry.\n const afterPhase = position === \"perRetry\" ? \"Sign\" : undefined;\n this.pipeline.addPolicy(policy, {\n afterPhase,\n });\n }\n }\n }\n\n /**\n * Send the provided httpRequest.\n */\n async sendRequest(request: PipelineRequest): Promise<PipelineResponse> {\n return this.pipeline.sendRequest(this._httpClient, request);\n }\n\n /**\n * Send an HTTP request that is populated using the provided OperationSpec.\n * @typeParam T - The typed result of the request, based on the OperationSpec.\n * @param operationArguments - The arguments that the HTTP request's templated values will be populated from.\n * @param operationSpec - The OperationSpec to use to populate the httpRequest.\n */\n async sendOperationRequest<T>(\n operationArguments: OperationArguments,\n operationSpec: OperationSpec,\n ): Promise<T> {\n const endpoint: string | undefined = operationSpec.baseUrl || this._endpoint;\n if (!endpoint) {\n throw new Error(\n \"If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.\",\n );\n }\n\n // Templatized URLs sometimes reference properties on the ServiceClient child class,\n // so we have to pass `this` below in order to search these properties if they're\n // not part of OperationArguments\n const url = getRequestUrl(endpoint, operationSpec, operationArguments, this);\n\n const request: OperationRequest = createPipelineRequest({\n url,\n });\n request.method = operationSpec.httpMethod;\n const operationInfo = getOperationRequestInfo(request);\n operationInfo.operationSpec = operationSpec;\n operationInfo.operationArguments = operationArguments;\n\n const contentType = operationSpec.contentType || this._requestContentType;\n if (contentType && operationSpec.requestBody) {\n request.headers.set(\"Content-Type\", contentType);\n }\n\n const options = operationArguments.options;\n if (options) {\n const requestOptions = options.requestOptions;\n\n if (requestOptions) {\n if (requestOptions.timeout) {\n request.timeout = requestOptions.timeout;\n }\n\n if (requestOptions.onUploadProgress) {\n request.onUploadProgress = requestOptions.onUploadProgress;\n }\n\n if (requestOptions.onDownloadProgress) {\n request.onDownloadProgress = requestOptions.onDownloadProgress;\n }\n\n if (requestOptions.shouldDeserialize !== undefined) {\n operationInfo.shouldDeserialize = requestOptions.shouldDeserialize;\n }\n\n if (requestOptions.allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n }\n\n if (options.abortSignal) {\n request.abortSignal = options.abortSignal;\n }\n\n if (options.tracingOptions) {\n request.tracingOptions = options.tracingOptions;\n }\n }\n\n if (this._allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n\n if (request.streamResponseStatusCodes === undefined) {\n request.streamResponseStatusCodes = getStreamingResponseStatusCodes(operationSpec);\n }\n\n try {\n const rawResponse = await this.sendRequest(request);\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[rawResponse.status],\n ) as T;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse);\n }\n return flatResponse;\n } catch (error: any) {\n if (typeof error === \"object\" && error?.response) {\n const rawResponse = error.response;\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[error.statusCode] || operationSpec.responses[\"default\"],\n );\n error.details = flatResponse;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse, error);\n }\n }\n throw error;\n }\n }\n}\n\nfunction createDefaultPipeline(options: ServiceClientOptions): Pipeline {\n const credentialScopes = getCredentialScopes(options);\n const credentialOptions =\n options.credential && credentialScopes\n ? { credentialScopes, credential: options.credential }\n : undefined;\n\n return createClientPipeline({\n ...options,\n credentialOptions,\n });\n}\n\nfunction getCredentialScopes(options: ServiceClientOptions): string | string[] | undefined {\n if (options.credentialScopes) {\n return options.credentialScopes;\n }\n\n if (options.endpoint) {\n return `${options.endpoint}/.default`;\n }\n\n if (options.baseUri) {\n return `${options.baseUri}/.default`;\n }\n\n if (options.credential && !options.credentialScopes) {\n throw new Error(\n `When using credentials, the ServiceClientOptions must contain either a endpoint or a credentialScopes. Unable to create a bearerTokenAuthenticationPolicy`,\n );\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../src/serviceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAKL,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAqClC;;GAEG;AACH,MAAM,OAAO,aAAa;IA4BxB;;;OAGG;IACH,YAAY,UAAgC,EAAE;;QAC5C,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,CAAC;QACrD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,OAAO,CACZ,sFAAsF,CACvF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC;QAChE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,IAAI,0BAA0B,EAAE,CAAC;QAEtE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,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gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,iBAAiB,GACrB,OAAO,CAAC,UAAU,IAAI,gBAAgB;QACpC,CAAC,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;QACtD,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,oBAAoB,iCACtB,OAAO,KACV,iBAAiB,IACjB,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB,CAAC,OAA6B;IACxD,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,gBAAgB,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,OAAO,GAAG,OAAO,CAAC,QAAQ,WAAW,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,GAAG,OAAO,CAAC,OAAO,WAAW,CAAC;IACvC,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CACb,2JAA2J,CAC5J,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CommonClientOptions,\n OperationArguments,\n OperationRequest,\n OperationSpec,\n} from \"./interfaces.js\";\nimport {\n HttpClient,\n Pipeline,\n PipelineRequest,\n PipelineResponse,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { createClientPipeline } from \"./pipeline.js\";\nimport { flattenResponse } from \"./utils.js\";\nimport { getCachedDefaultHttpClient } from \"./httpClientCache.js\";\nimport { getOperationRequestInfo } from \"./operationHelpers.js\";\nimport { getRequestUrl } from \"./urlHelpers.js\";\nimport { getStreamingResponseStatusCodes } from \"./interfaceHelpers.js\";\nimport { logger } from \"./log.js\";\n\n/**\n * Options to be provided while creating the client.\n */\nexport interface ServiceClientOptions extends CommonClientOptions {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * @deprecated This property is deprecated and will be removed soon, please use endpoint instead\n */\n baseUri?: string;\n /**\n * If specified, this is the endpoint that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * to encourage customer to use endpoint, we mark the baseUri as deprecated.\n */\n endpoint?: string;\n /**\n * If specified, will be used to build the BearerTokenAuthenticationPolicy.\n */\n credentialScopes?: string | string[];\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n requestContentType?: string;\n /**\n * Credential used to authenticate the request.\n */\n credential?: TokenCredential;\n /**\n * A customized pipeline to use, otherwise a default one will be created.\n */\n pipeline?: Pipeline;\n}\n\n/**\n * Initializes a new instance of the ServiceClient.\n */\nexport class ServiceClient {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n */\n private readonly _endpoint?: string;\n\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n private readonly _requestContentType?: string;\n\n /**\n * Set to true if the request is sent over HTTP instead of HTTPS\n */\n private readonly _allowInsecureConnection?: boolean;\n\n /**\n * The HTTP client that will be used to send requests.\n */\n private readonly _httpClient: HttpClient;\n\n /**\n * The pipeline used by this client to make requests\n */\n public readonly pipeline: Pipeline;\n\n /**\n * The ServiceClient constructor\n * @param options - The service client options that govern the behavior of the client.\n */\n constructor(options: ServiceClientOptions = {}) {\n this._requestContentType = options.requestContentType;\n this._endpoint = options.endpoint ?? options.baseUri;\n if (options.baseUri) {\n logger.warning(\n \"The baseUri option for SDK Clients has been deprecated, please use endpoint instead.\",\n );\n }\n this._allowInsecureConnection = options.allowInsecureConnection;\n this._httpClient = options.httpClient || getCachedDefaultHttpClient();\n\n this.pipeline = options.pipeline || createDefaultPipeline(options);\n if (options.additionalPolicies?.length) {\n for (const { policy, position } of options.additionalPolicies) {\n // Sign happens after Retry and is commonly needed to occur\n // before policies that intercept post-retry.\n const afterPhase = position === \"perRetry\" ? \"Sign\" : undefined;\n this.pipeline.addPolicy(policy, {\n afterPhase,\n });\n }\n }\n }\n\n /**\n * Send the provided httpRequest.\n */\n async sendRequest(request: PipelineRequest): Promise<PipelineResponse> {\n return this.pipeline.sendRequest(this._httpClient, request);\n }\n\n /**\n * Send an HTTP request that is populated using the provided OperationSpec.\n * @typeParam T - The typed result of the request, based on the OperationSpec.\n * @param operationArguments - The arguments that the HTTP request's templated values will be populated from.\n * @param operationSpec - The OperationSpec to use to populate the httpRequest.\n */\n async sendOperationRequest<T>(\n operationArguments: OperationArguments,\n operationSpec: OperationSpec,\n ): Promise<T> {\n const endpoint: string | undefined = operationSpec.baseUrl || this._endpoint;\n if (!endpoint) {\n throw new Error(\n \"If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.\",\n );\n }\n\n // Templatized URLs sometimes reference properties on the ServiceClient child class,\n // so we have to pass `this` below in order to search these properties if they're\n // not part of OperationArguments\n const url = getRequestUrl(endpoint, operationSpec, operationArguments, this);\n\n const request: OperationRequest = createPipelineRequest({\n url,\n });\n request.method = operationSpec.httpMethod;\n const operationInfo = getOperationRequestInfo(request);\n operationInfo.operationSpec = operationSpec;\n operationInfo.operationArguments = operationArguments;\n\n const contentType = operationSpec.contentType || this._requestContentType;\n if (contentType && operationSpec.requestBody) {\n request.headers.set(\"Content-Type\", contentType);\n }\n\n const options = operationArguments.options;\n if (options) {\n const requestOptions = options.requestOptions;\n\n if (requestOptions) {\n if (requestOptions.timeout) {\n request.timeout = requestOptions.timeout;\n }\n\n if (requestOptions.onUploadProgress) {\n request.onUploadProgress = requestOptions.onUploadProgress;\n }\n\n if (requestOptions.onDownloadProgress) {\n request.onDownloadProgress = requestOptions.onDownloadProgress;\n }\n\n if (requestOptions.shouldDeserialize !== undefined) {\n operationInfo.shouldDeserialize = requestOptions.shouldDeserialize;\n }\n\n if (requestOptions.allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n }\n\n if (options.abortSignal) {\n request.abortSignal = options.abortSignal;\n }\n\n if (options.tracingOptions) {\n request.tracingOptions = options.tracingOptions;\n }\n }\n\n if (this._allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n\n if (request.streamResponseStatusCodes === undefined) {\n request.streamResponseStatusCodes = getStreamingResponseStatusCodes(operationSpec);\n }\n\n try {\n const rawResponse = await this.sendRequest(request);\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[rawResponse.status],\n ) as T;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse);\n }\n return flatResponse;\n } catch (error: any) {\n if (typeof error === \"object\" && error?.response) {\n const rawResponse = error.response;\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[error.statusCode] || operationSpec.responses[\"default\"],\n );\n error.details = flatResponse;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse, error);\n }\n }\n throw error;\n }\n }\n}\n\nfunction createDefaultPipeline(options: ServiceClientOptions): Pipeline {\n const credentialScopes = getCredentialScopes(options);\n const credentialOptions =\n options.credential && credentialScopes\n ? { credentialScopes, credential: options.credential }\n : undefined;\n\n return createClientPipeline({\n ...options,\n credentialOptions,\n });\n}\n\nfunction getCredentialScopes(options: ServiceClientOptions): string | string[] | undefined {\n if (options.credentialScopes) {\n return options.credentialScopes;\n }\n\n if (options.endpoint) {\n return `${options.endpoint}/.default`;\n }\n\n if (options.baseUri) {\n return `${options.baseUri}/.default`;\n }\n\n if (options.credential && !options.credentialScopes) {\n throw new Error(\n `When using credentials, the ServiceClientOptions must contain either a endpoint or a credentialScopes. Unable to create a bearerTokenAuthenticationPolicy`,\n );\n }\n\n return undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAMzE;;GAEG;AACH,eAAO,MAAM,KAAK;yBACK,QAAQ,gBAAgB,EAAE,oBAAoB,CAAC;CACrE,CAAC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAMzE;;GAEG;AACH,eAAO,MAAM,KAAK,EAAe;IAC/B,mBAAmB,EAAE,OAAO,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;CACtE,CAAC"}
@@ -63,7 +63,6 @@ export declare class ServiceClient {
63
63
  readonly pipeline: Pipeline;
64
64
  /**
65
65
  * The ServiceClient constructor
66
- * @param credential - The credentials used for authentication with the service.
67
66
  * @param options - The service client options that govern the behavior of the client.
68
67
  */
69
68
  constructor(options?: ServiceClientOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClient.d.ts","sourceRoot":"","sources":["../../src/serviceClient.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAElB,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,QAAQ,EACR,eAAe,EACf,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,eAA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AEG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IAEpC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAS;IAE9C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAU;IAEpD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAEzC;;OAEG;IACH,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IAEnC;;;OAGG;gBACS,OAAO,GAAE,oBAAyB;IAwB9C;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAItE;;;;;OAKG;IACG,oBAAoB,CAAC,CAAC,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,CAAC,CAAC;CA8Fd"}
@@ -14,7 +14,6 @@ import { logger } from "./log.js";
14
14
  export class ServiceClient {
15
15
  /**
16
16
  * The ServiceClient constructor
17
- * @param credential - The credentials used for authentication with the service.
18
17
  * @param options - The service client options that govern the behavior of the client.
19
18
  */
20
19
  constructor(options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../src/serviceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAKL,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB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pB,OAAO,GAAG,OAAO,CAAC,OAAO,WAAW,CAAC;IACvC,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CACb,2JAA2J,CAC5J,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CommonClientOptions,\n OperationArguments,\n OperationRequest,\n OperationSpec,\n} from \"./interfaces.js\";\nimport {\n HttpClient,\n Pipeline,\n PipelineRequest,\n PipelineResponse,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { createClientPipeline } from \"./pipeline.js\";\nimport { flattenResponse } from \"./utils.js\";\nimport { getCachedDefaultHttpClient } from \"./httpClientCache.js\";\nimport { getOperationRequestInfo } from \"./operationHelpers.js\";\nimport { getRequestUrl } from \"./urlHelpers.js\";\nimport { getStreamingResponseStatusCodes } from \"./interfaceHelpers.js\";\nimport { logger } from \"./log.js\";\n\n/**\n * Options to be provided while creating the client.\n */\nexport interface ServiceClientOptions extends CommonClientOptions {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * @deprecated This property is deprecated and will be removed soon, please use endpoint instead\n */\n baseUri?: string;\n /**\n * If specified, this is the endpoint that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * to encourage customer to use endpoint, we mark the baseUri as deprecated.\n */\n endpoint?: string;\n /**\n * If specified, will be used to build the BearerTokenAuthenticationPolicy.\n */\n credentialScopes?: string | string[];\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n requestContentType?: string;\n /**\n * Credential used to authenticate the request.\n */\n credential?: TokenCredential;\n /**\n * A customized pipeline to use, otherwise a default one will be created.\n */\n pipeline?: Pipeline;\n}\n\n/**\n * Initializes a new instance of the ServiceClient.\n */\nexport class ServiceClient {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n */\n private readonly _endpoint?: string;\n\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n private readonly _requestContentType?: string;\n\n /**\n * Set to true if the request is sent over HTTP instead of HTTPS\n */\n private readonly _allowInsecureConnection?: boolean;\n\n /**\n * The HTTP client that will be used to send requests.\n */\n private readonly _httpClient: HttpClient;\n\n /**\n * The pipeline used by this client to make requests\n */\n public readonly pipeline: Pipeline;\n\n /**\n * The ServiceClient constructor\n * @param credential - The credentials used for authentication with the service.\n * @param options - The service client options that govern the behavior of the client.\n */\n constructor(options: ServiceClientOptions = {}) {\n this._requestContentType = options.requestContentType;\n this._endpoint = options.endpoint ?? options.baseUri;\n if (options.baseUri) {\n logger.warning(\n \"The baseUri option for SDK Clients has been deprecated, please use endpoint instead.\",\n );\n }\n this._allowInsecureConnection = options.allowInsecureConnection;\n this._httpClient = options.httpClient || getCachedDefaultHttpClient();\n\n this.pipeline = options.pipeline || createDefaultPipeline(options);\n if (options.additionalPolicies?.length) {\n for (const { policy, position } of options.additionalPolicies) {\n // Sign happens after Retry and is commonly needed to occur\n // before policies that intercept post-retry.\n const afterPhase = position === \"perRetry\" ? \"Sign\" : undefined;\n this.pipeline.addPolicy(policy, {\n afterPhase,\n });\n }\n }\n }\n\n /**\n * Send the provided httpRequest.\n */\n async sendRequest(request: PipelineRequest): Promise<PipelineResponse> {\n return this.pipeline.sendRequest(this._httpClient, request);\n }\n\n /**\n * Send an HTTP request that is populated using the provided OperationSpec.\n * @typeParam T - The typed result of the request, based on the OperationSpec.\n * @param operationArguments - The arguments that the HTTP request's templated values will be populated from.\n * @param operationSpec - The OperationSpec to use to populate the httpRequest.\n */\n async sendOperationRequest<T>(\n operationArguments: OperationArguments,\n operationSpec: OperationSpec,\n ): Promise<T> {\n const endpoint: string | undefined = operationSpec.baseUrl || this._endpoint;\n if (!endpoint) {\n throw new Error(\n \"If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.\",\n );\n }\n\n // Templatized URLs sometimes reference properties on the ServiceClient child class,\n // so we have to pass `this` below in order to search these properties if they're\n // not part of OperationArguments\n const url = getRequestUrl(endpoint, operationSpec, operationArguments, this);\n\n const request: OperationRequest = createPipelineRequest({\n url,\n });\n request.method = operationSpec.httpMethod;\n const operationInfo = getOperationRequestInfo(request);\n operationInfo.operationSpec = operationSpec;\n operationInfo.operationArguments = operationArguments;\n\n const contentType = operationSpec.contentType || this._requestContentType;\n if (contentType && operationSpec.requestBody) {\n request.headers.set(\"Content-Type\", contentType);\n }\n\n const options = operationArguments.options;\n if (options) {\n const requestOptions = options.requestOptions;\n\n if (requestOptions) {\n if (requestOptions.timeout) {\n request.timeout = requestOptions.timeout;\n }\n\n if (requestOptions.onUploadProgress) {\n request.onUploadProgress = requestOptions.onUploadProgress;\n }\n\n if (requestOptions.onDownloadProgress) {\n request.onDownloadProgress = requestOptions.onDownloadProgress;\n }\n\n if (requestOptions.shouldDeserialize !== undefined) {\n operationInfo.shouldDeserialize = requestOptions.shouldDeserialize;\n }\n\n if (requestOptions.allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n }\n\n if (options.abortSignal) {\n request.abortSignal = options.abortSignal;\n }\n\n if (options.tracingOptions) {\n request.tracingOptions = options.tracingOptions;\n }\n }\n\n if (this._allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n\n if (request.streamResponseStatusCodes === undefined) {\n request.streamResponseStatusCodes = getStreamingResponseStatusCodes(operationSpec);\n }\n\n try {\n const rawResponse = await this.sendRequest(request);\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[rawResponse.status],\n ) as T;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse);\n }\n return flatResponse;\n } catch (error: any) {\n if (typeof error === \"object\" && error?.response) {\n const rawResponse = error.response;\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[error.statusCode] || operationSpec.responses[\"default\"],\n );\n error.details = flatResponse;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse, error);\n }\n }\n throw error;\n }\n }\n}\n\nfunction createDefaultPipeline(options: ServiceClientOptions): Pipeline {\n const credentialScopes = getCredentialScopes(options);\n const credentialOptions =\n options.credential && credentialScopes\n ? { credentialScopes, credential: options.credential }\n : undefined;\n\n return createClientPipeline({\n ...options,\n credentialOptions,\n });\n}\n\nfunction getCredentialScopes(options: ServiceClientOptions): string | string[] | undefined {\n if (options.credentialScopes) {\n return options.credentialScopes;\n }\n\n if (options.endpoint) {\n return `${options.endpoint}/.default`;\n }\n\n if (options.baseUri) {\n return `${options.baseUri}/.default`;\n }\n\n if (options.credential && !options.credentialScopes) {\n throw new Error(\n `When using credentials, the ServiceClientOptions must contain either a endpoint or a credentialScopes. Unable to create a bearerTokenAuthenticationPolicy`,\n );\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../src/serviceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAKL,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAqClC;;GAEG;AACH,MAAM,OAAO,aAAa;IA4BxB;;;OAGG;IACH,YAAY,UAAgC,EAAE;;QA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yright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CommonClientOptions,\n OperationArguments,\n OperationRequest,\n OperationSpec,\n} from \"./interfaces.js\";\nimport {\n HttpClient,\n Pipeline,\n PipelineRequest,\n PipelineResponse,\n createPipelineRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { createClientPipeline } from \"./pipeline.js\";\nimport { flattenResponse } from \"./utils.js\";\nimport { getCachedDefaultHttpClient } from \"./httpClientCache.js\";\nimport { getOperationRequestInfo } from \"./operationHelpers.js\";\nimport { getRequestUrl } from \"./urlHelpers.js\";\nimport { getStreamingResponseStatusCodes } from \"./interfaceHelpers.js\";\nimport { logger } from \"./log.js\";\n\n/**\n * Options to be provided while creating the client.\n */\nexport interface ServiceClientOptions extends CommonClientOptions {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * @deprecated This property is deprecated and will be removed soon, please use endpoint instead\n */\n baseUri?: string;\n /**\n * If specified, this is the endpoint that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n * to encourage customer to use endpoint, we mark the baseUri as deprecated.\n */\n endpoint?: string;\n /**\n * If specified, will be used to build the BearerTokenAuthenticationPolicy.\n */\n credentialScopes?: string | string[];\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n requestContentType?: string;\n /**\n * Credential used to authenticate the request.\n */\n credential?: TokenCredential;\n /**\n * A customized pipeline to use, otherwise a default one will be created.\n */\n pipeline?: Pipeline;\n}\n\n/**\n * Initializes a new instance of the ServiceClient.\n */\nexport class ServiceClient {\n /**\n * If specified, this is the base URI that requests will be made against for this ServiceClient.\n * If it is not specified, then all OperationSpecs must contain a baseUrl property.\n */\n private readonly _endpoint?: string;\n\n /**\n * The default request content type for the service.\n * Used if no requestContentType is present on an OperationSpec.\n */\n private readonly _requestContentType?: string;\n\n /**\n * Set to true if the request is sent over HTTP instead of HTTPS\n */\n private readonly _allowInsecureConnection?: boolean;\n\n /**\n * The HTTP client that will be used to send requests.\n */\n private readonly _httpClient: HttpClient;\n\n /**\n * The pipeline used by this client to make requests\n */\n public readonly pipeline: Pipeline;\n\n /**\n * The ServiceClient constructor\n * @param options - The service client options that govern the behavior of the client.\n */\n constructor(options: ServiceClientOptions = {}) {\n this._requestContentType = options.requestContentType;\n this._endpoint = options.endpoint ?? options.baseUri;\n if (options.baseUri) {\n logger.warning(\n \"The baseUri option for SDK Clients has been deprecated, please use endpoint instead.\",\n );\n }\n this._allowInsecureConnection = options.allowInsecureConnection;\n this._httpClient = options.httpClient || getCachedDefaultHttpClient();\n\n this.pipeline = options.pipeline || createDefaultPipeline(options);\n if (options.additionalPolicies?.length) {\n for (const { policy, position } of options.additionalPolicies) {\n // Sign happens after Retry and is commonly needed to occur\n // before policies that intercept post-retry.\n const afterPhase = position === \"perRetry\" ? \"Sign\" : undefined;\n this.pipeline.addPolicy(policy, {\n afterPhase,\n });\n }\n }\n }\n\n /**\n * Send the provided httpRequest.\n */\n async sendRequest(request: PipelineRequest): Promise<PipelineResponse> {\n return this.pipeline.sendRequest(this._httpClient, request);\n }\n\n /**\n * Send an HTTP request that is populated using the provided OperationSpec.\n * @typeParam T - The typed result of the request, based on the OperationSpec.\n * @param operationArguments - The arguments that the HTTP request's templated values will be populated from.\n * @param operationSpec - The OperationSpec to use to populate the httpRequest.\n */\n async sendOperationRequest<T>(\n operationArguments: OperationArguments,\n operationSpec: OperationSpec,\n ): Promise<T> {\n const endpoint: string | undefined = operationSpec.baseUrl || this._endpoint;\n if (!endpoint) {\n throw new Error(\n \"If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.\",\n );\n }\n\n // Templatized URLs sometimes reference properties on the ServiceClient child class,\n // so we have to pass `this` below in order to search these properties if they're\n // not part of OperationArguments\n const url = getRequestUrl(endpoint, operationSpec, operationArguments, this);\n\n const request: OperationRequest = createPipelineRequest({\n url,\n });\n request.method = operationSpec.httpMethod;\n const operationInfo = getOperationRequestInfo(request);\n operationInfo.operationSpec = operationSpec;\n operationInfo.operationArguments = operationArguments;\n\n const contentType = operationSpec.contentType || this._requestContentType;\n if (contentType && operationSpec.requestBody) {\n request.headers.set(\"Content-Type\", contentType);\n }\n\n const options = operationArguments.options;\n if (options) {\n const requestOptions = options.requestOptions;\n\n if (requestOptions) {\n if (requestOptions.timeout) {\n request.timeout = requestOptions.timeout;\n }\n\n if (requestOptions.onUploadProgress) {\n request.onUploadProgress = requestOptions.onUploadProgress;\n }\n\n if (requestOptions.onDownloadProgress) {\n request.onDownloadProgress = requestOptions.onDownloadProgress;\n }\n\n if (requestOptions.shouldDeserialize !== undefined) {\n operationInfo.shouldDeserialize = requestOptions.shouldDeserialize;\n }\n\n if (requestOptions.allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n }\n\n if (options.abortSignal) {\n request.abortSignal = options.abortSignal;\n }\n\n if (options.tracingOptions) {\n request.tracingOptions = options.tracingOptions;\n }\n }\n\n if (this._allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n\n if (request.streamResponseStatusCodes === undefined) {\n request.streamResponseStatusCodes = getStreamingResponseStatusCodes(operationSpec);\n }\n\n try {\n const rawResponse = await this.sendRequest(request);\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[rawResponse.status],\n ) as T;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse);\n }\n return flatResponse;\n } catch (error: any) {\n if (typeof error === \"object\" && error?.response) {\n const rawResponse = error.response;\n const flatResponse = flattenResponse(\n rawResponse,\n operationSpec.responses[error.statusCode] || operationSpec.responses[\"default\"],\n );\n error.details = flatResponse;\n if (options?.onResponse) {\n options.onResponse(rawResponse, flatResponse, error);\n }\n }\n throw error;\n }\n }\n}\n\nfunction createDefaultPipeline(options: ServiceClientOptions): Pipeline {\n const credentialScopes = getCredentialScopes(options);\n const credentialOptions =\n options.credential && credentialScopes\n ? { credentialScopes, credential: options.credential }\n : undefined;\n\n return createClientPipeline({\n ...options,\n credentialOptions,\n });\n}\n\nfunction getCredentialScopes(options: ServiceClientOptions): string | string[] | undefined {\n if (options.credentialScopes) {\n return options.credentialScopes;\n }\n\n if (options.endpoint) {\n return `${options.endpoint}/.default`;\n }\n\n if (options.baseUri) {\n return `${options.baseUri}/.default`;\n }\n\n if (options.credential && !options.credentialScopes) {\n throw new Error(\n `When using credentials, the ServiceClientOptions must contain either a endpoint or a credentialScopes. Unable to create a bearerTokenAuthenticationPolicy`,\n );\n }\n\n return undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAMzE;;GAEG;AACH,eAAO,MAAM,KAAK;yBACK,QAAQ,gBAAgB,EAAE,oBAAoB,CAAC;CACrE,CAAC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAMzE;;GAEG;AACH,eAAO,MAAM,KAAK,EAAe;IAC/B,mBAAmB,EAAE,OAAO,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;CACtE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/core-client",
3
- "version": "1.9.3-alpha.20240701.3",
3
+ "version": "1.9.3-alpha.20240705.2",
4
4
  "description": "Core library for interfacing with AutoRest generated code",
5
5
  "sdk-type": "client",
6
6
  "type": "module",
@@ -95,8 +95,8 @@
95
95
  "eslint": "^8.56.0",
96
96
  "playwright": "^1.41.2",
97
97
  "rimraf": "^5.0.5",
98
- "tshy": "^1.13.0",
99
- "typescript": "~5.4.5",
98
+ "tshy": "^1.17.0",
99
+ "typescript": "~5.5.3",
100
100
  "vitest": "^1.3.1"
101
101
  },
102
102
  "//metadata": {
@@ -116,5 +116,6 @@
116
116
  "react-native"
117
117
  ],
118
118
  "selfLink": false
119
- }
119
+ },
120
+ "module": "./dist/esm/index.js"
120
121
  }