@azure/ai-form-recognizer 5.0.0-alpha.20250507.1 → 5.1.0-alpha.20250512.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 (70) hide show
  1. package/README.md +20 -0
  2. package/dist/browser/constants.d.ts +20 -2
  3. package/dist/browser/constants.d.ts.map +1 -1
  4. package/dist/browser/constants.js +22 -3
  5. package/dist/browser/constants.js.map +1 -1
  6. package/dist/browser/generated/generatedClient.js +1 -1
  7. package/dist/browser/generated/generatedClient.js.map +1 -1
  8. package/dist/browser/index.d.ts +1 -0
  9. package/dist/browser/index.d.ts.map +1 -1
  10. package/dist/browser/index.js +1 -0
  11. package/dist/browser/index.js.map +1 -1
  12. package/dist/browser/options/FormRecognizerClientOptions.d.ts +24 -0
  13. package/dist/browser/options/FormRecognizerClientOptions.d.ts.map +1 -1
  14. package/dist/browser/options/FormRecognizerClientOptions.js.map +1 -1
  15. package/dist/browser/util.d.ts +2 -1
  16. package/dist/browser/util.d.ts.map +1 -1
  17. package/dist/browser/util.js +7 -2
  18. package/dist/browser/util.js.map +1 -1
  19. package/dist/commonjs/constants.d.ts +20 -2
  20. package/dist/commonjs/constants.d.ts.map +1 -1
  21. package/dist/commonjs/constants.js +23 -4
  22. package/dist/commonjs/constants.js.map +1 -1
  23. package/dist/commonjs/generated/generatedClient.js +1 -1
  24. package/dist/commonjs/generated/generatedClient.js.map +1 -1
  25. package/dist/commonjs/index.d.ts +1 -0
  26. package/dist/commonjs/index.d.ts.map +1 -1
  27. package/dist/commonjs/index.js +3 -1
  28. package/dist/commonjs/index.js.map +1 -1
  29. package/dist/commonjs/options/FormRecognizerClientOptions.d.ts +24 -0
  30. package/dist/commonjs/options/FormRecognizerClientOptions.d.ts.map +1 -1
  31. package/dist/commonjs/options/FormRecognizerClientOptions.js.map +1 -1
  32. package/dist/commonjs/util.d.ts +2 -1
  33. package/dist/commonjs/util.d.ts.map +1 -1
  34. package/dist/commonjs/util.js +6 -1
  35. package/dist/commonjs/util.js.map +1 -1
  36. package/dist/esm/constants.d.ts +20 -2
  37. package/dist/esm/constants.d.ts.map +1 -1
  38. package/dist/esm/constants.js +22 -3
  39. package/dist/esm/constants.js.map +1 -1
  40. package/dist/esm/generated/generatedClient.js +1 -1
  41. package/dist/esm/generated/generatedClient.js.map +1 -1
  42. package/dist/esm/index.d.ts +1 -0
  43. package/dist/esm/index.d.ts.map +1 -1
  44. package/dist/esm/index.js +1 -0
  45. package/dist/esm/index.js.map +1 -1
  46. package/dist/esm/options/FormRecognizerClientOptions.d.ts +24 -0
  47. package/dist/esm/options/FormRecognizerClientOptions.d.ts.map +1 -1
  48. package/dist/esm/options/FormRecognizerClientOptions.js.map +1 -1
  49. package/dist/esm/util.d.ts +2 -1
  50. package/dist/esm/util.d.ts.map +1 -1
  51. package/dist/esm/util.js +7 -2
  52. package/dist/esm/util.js.map +1 -1
  53. package/dist/react-native/constants.d.ts +20 -2
  54. package/dist/react-native/constants.d.ts.map +1 -1
  55. package/dist/react-native/constants.js +22 -3
  56. package/dist/react-native/constants.js.map +1 -1
  57. package/dist/react-native/generated/generatedClient.js +1 -1
  58. package/dist/react-native/generated/generatedClient.js.map +1 -1
  59. package/dist/react-native/index.d.ts +1 -0
  60. package/dist/react-native/index.d.ts.map +1 -1
  61. package/dist/react-native/index.js +1 -0
  62. package/dist/react-native/index.js.map +1 -1
  63. package/dist/react-native/options/FormRecognizerClientOptions.d.ts +24 -0
  64. package/dist/react-native/options/FormRecognizerClientOptions.d.ts.map +1 -1
  65. package/dist/react-native/options/FormRecognizerClientOptions.js.map +1 -1
  66. package/dist/react-native/util.d.ts +2 -1
  67. package/dist/react-native/util.d.ts.map +1 -1
  68. package/dist/react-native/util.js +7 -2
  69. package/dist/react-native/util.js.map +1 -1
  70. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FormRecognizerClientOptions.d.ts","sourceRoot":"","sources":["../../../src/options/FormRecognizerClientOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAErF;;GAEG;AAEH,eAAO,MAAM,eAAe;IAC1B;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;CAEnC,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB;IACxE;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,wCAAyC,SAAQ,mBAAmB;CAAG"}
1
+ {"version":3,"file":"FormRecognizerClientOptions.d.ts","sourceRoot":"","sources":["../../../src/options/FormRecognizerClientOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAErF;;GAEG;AAEH,eAAO,MAAM,eAAe;IAC1B;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;CAEnC,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB;IACxE;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,wCAAyC,SAAQ,mBAAmB;IACnF;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormRecognizerClientOptions.js","sourceRoot":"","sources":["../../../src/options/FormRecognizerClientOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;;OAEG;IACH,aAAa,EAAE,eAAe;IAC9B;;OAEG;IACH,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,eAAe,EAAE,eAAe,CAAC,aAAa;CACtC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\n\n/**\n * Valid string index types supported by the Form Recognizer service and SDK clients.\n */\nexport type StringIndexType = (typeof StringIndexType)[keyof typeof StringIndexType];\n\n/**\n * Supported values of StringIndexType.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const StringIndexType = {\n /**\n * UTF-16 code units\n */\n Utf16CodeUnit: \"utf16CodeUnit\",\n /**\n * Unicode code points\n */\n UnicodeCodePoint: \"unicodeCodePoint\",\n} as const;\n\n/**\n * Default settings for Form Recognizer clients.\n *\n * @internal\n */\nexport const DEFAULT_GENERATED_CLIENT_OPTIONS = {\n stringIndexType: StringIndexType.Utf16CodeUnit,\n} as const;\n\n/**\n * Configurable options for DocumentAnalysisClient.\n */\nexport interface DocumentAnalysisClientOptions extends CommonClientOptions {\n /**\n * The unit of string offset/length values that the service returns.\n *\n * In JavaScript, strings are indexed by UTF-16 code units. Do _NOT_ set this value unless you are certain you need\n * Unicode code-point units instead.\n *\n * Default: \"utf16CodeUnit\"\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Configurable options for DocumentModelAdministrationClient.\n */\nexport interface DocumentModelAdministrationClientOptions extends CommonClientOptions {}\n"]}
1
+ {"version":3,"file":"FormRecognizerClientOptions.js","sourceRoot":"","sources":["../../../src/options/FormRecognizerClientOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;;OAEG;IACH,aAAa,EAAE,eAAe;IAC9B;;OAEG;IACH,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,eAAe,EAAE,eAAe,CAAC,aAAa;CACtC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\n\n/**\n * Valid string index types supported by the Form Recognizer service and SDK clients.\n */\nexport type StringIndexType = (typeof StringIndexType)[keyof typeof StringIndexType];\n\n/**\n * Supported values of StringIndexType.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const StringIndexType = {\n /**\n * UTF-16 code units\n */\n Utf16CodeUnit: \"utf16CodeUnit\",\n /**\n * Unicode code points\n */\n UnicodeCodePoint: \"unicodeCodePoint\",\n} as const;\n\n/**\n * Default settings for Form Recognizer clients.\n *\n * @internal\n */\nexport const DEFAULT_GENERATED_CLIENT_OPTIONS = {\n stringIndexType: StringIndexType.Utf16CodeUnit,\n} as const;\n\n/**\n * Configurable options for DocumentAnalysisClient.\n */\nexport interface DocumentAnalysisClientOptions extends CommonClientOptions {\n /**\n * The unit of string offset/length values that the service returns.\n *\n * In JavaScript, strings are indexed by UTF-16 code units. Do _NOT_ set this value unless you are certain you need\n * Unicode code-point units instead.\n *\n * Default: \"utf16CodeUnit\"\n */\n stringIndexType?: StringIndexType;\n /**\n * The audience (scope) to use for authentication with Azure Active Directory.\n *\n * Setting this option is only necessary\n * - if you are using Entra Id\n * (and)\n * - if you are using a cloud other than the `AzurePublicCloud` (\"https://cognitiveservices.azure.com\")\n *\n * The authentication scope will be set from this audience.\n * See {@link KnownFormRecognizerAudience} for known audience values.\n */\n audience?: string;\n}\n\n/**\n * Configurable options for DocumentModelAdministrationClient.\n */\nexport interface DocumentModelAdministrationClientOptions extends CommonClientOptions {\n /**\n * The audience (scope) to use for authentication with Azure Active Directory.\n *\n * Setting this option is only necessary\n * - if you are using Entra Id\n * (and)\n * - if you are using a cloud other than the `AzurePublicCloud` (\"https://cognitiveservices.azure.com\")\n *\n * The authentication scope will be set from this audience.\n * See {@link KnownFormRecognizerAudience} for known audience values.\n */\n audience?: string;\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { KeyCredential, TokenCredential } from "@azure/core-auth";
2
2
  import type { GeneratedClientOptionalParams } from "./generated/index.js";
3
3
  import { GeneratedClient } from "./generated/index.js";
4
+ import { type DocumentAnalysisClientOptions } from "./options/FormRecognizerClientOptions.js";
4
5
  import * as Mappers from "./generated/models/mappers.js";
5
6
  export { Mappers };
6
7
  export declare const SERIALIZER: import("@azure/core-client").Serializer;
@@ -28,5 +29,5 @@ export declare const maybemap: <T1, T2>(value: T1 | undefined, f: (v: T1) => T2)
28
29
  * Create a GeneratedClient.
29
30
  * @internal
30
31
  */
31
- export declare function makeServiceClient(endpoint: string, credential: KeyCredential | TokenCredential, options: GeneratedClientOptionalParams): GeneratedClient;
32
+ export declare function makeServiceClient(endpoint: string, credential: KeyCredential | TokenCredential, options: GeneratedClientOptionalParams & Pick<DocumentAnalysisClientOptions, "audience">): GeneratedClient;
32
33
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,CAAC;AAGnB,eAAO,MAAM,UAAU,yCAAmC,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,YAAY,CAAC,CAAC,CACX,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,KAAG,UAAU,CAAC,CAAC,CACJ,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,KAAG,OAEvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAG,EAAE,GAAG,SACpC,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C,OAAO,EAAE,6BAA6B,GACrC,eAAe,CAiBjB"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,CAAC;AAGnB,eAAO,MAAM,UAAU,yCAAmC,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,YAAY,CAAC,CAAC,CACX,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,KAAG,UAAU,CAAC,CAAC,CACJ,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,KAAG,OAEvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAG,EAAE,GAAG,SACpC,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAAC,6BAA6B,EAAE,UAAU,CAAC,GACvF,eAAe,CAoBjB"}
@@ -5,7 +5,7 @@ import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
5
5
  import { createFormRecognizerAzureKeyCredentialPolicy } from "./azureKeyCredentialPolicy.js";
6
6
  import { DEFAULT_COGNITIVE_SCOPE, FORM_RECOGNIZER_API_VERSION } from "./constants.js";
7
7
  import { GeneratedClient } from "./generated/index.js";
8
- import { DEFAULT_GENERATED_CLIENT_OPTIONS } from "./options/FormRecognizerClientOptions.js";
8
+ import { DEFAULT_GENERATED_CLIENT_OPTIONS, } from "./options/FormRecognizerClientOptions.js";
9
9
  import * as Mappers from "./generated/models/mappers.js";
10
10
  import { createSerializer } from "@azure/core-client";
11
11
  export { Mappers };
@@ -38,11 +38,16 @@ export const maybemap = (value, f) => value === undefined ? undefined : f(value)
38
38
  * @internal
39
39
  */
40
40
  export function makeServiceClient(endpoint, credential, options) {
41
+ var _a;
41
42
  const client = new GeneratedClient(endpoint === null || endpoint === void 0 ? void 0 : endpoint.replace(/\/$/, ""), Object.assign(Object.assign(Object.assign({}, DEFAULT_GENERATED_CLIENT_OPTIONS), options), { apiVersion: FORM_RECOGNIZER_API_VERSION }));
42
43
  const authPolicy = isTokenCredential(credential)
43
44
  ? bearerTokenAuthenticationPolicy({
44
45
  credential,
45
- scopes: DEFAULT_COGNITIVE_SCOPE,
46
+ scopes: [(_a = options.audience) !== null && _a !== void 0 ? _a : DEFAULT_COGNITIVE_SCOPE].map((scope) => {
47
+ if (scope.endsWith("/.default"))
48
+ return scope;
49
+ return `${scope}/.default`;
50
+ }),
46
51
  })
47
52
  : createFormRecognizerAzureKeyCredentialPolicy(credential);
48
53
  client.pipeline.addPolicy(authPolicy);
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAE5F,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,2CAA2C;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAA4B,CAAS,EAAmB,EAAE,CACpF,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAoB,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAA4B,CAAI,EAAiB,EAAE,CAC3E,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAkB,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAW,EAAE;IAChD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAS,KAAqB,EAAE,CAAgB,EAAkB,EAAE,CAC1F,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,UAA2C,EAC3C,OAAsC;IAEtC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,gDAC1D,gCAAgC,GAChC,OAAO,KACV,UAAU,EAAE,2BAA2B,IACvC,CAAC;IAEH,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAC9C,CAAC,CAAC,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,uBAAuB;SAChC,CAAC;QACJ,CAAC,CAAC,4CAA4C,CAAC,UAAU,CAAC,CAAC;IAE7D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createFormRecognizerAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport { DEFAULT_COGNITIVE_SCOPE, FORM_RECOGNIZER_API_VERSION } from \"./constants.js\";\nimport type { GeneratedClientOptionalParams } from \"./generated/index.js\";\nimport { GeneratedClient } from \"./generated/index.js\";\nimport { DEFAULT_GENERATED_CLIENT_OPTIONS } from \"./options/FormRecognizerClientOptions.js\";\n\nimport * as Mappers from \"./generated/models/mappers.js\";\nimport { createSerializer } from \"@azure/core-client\";\nexport { Mappers };\n\n// This is used for URL request processing.\nexport const SERIALIZER = createSerializer(Mappers, false);\n\n/**\n * Type-strong uncapitalization.\n * @internal\n */\nexport const uncapitalize = <S extends string = string>(s: string): Uncapitalize<S> =>\n (s.substring(0, 1).toLowerCase() + s.substring(1)) as Uncapitalize<S>;\n\n/**\n * Type-strong capitalization\n * @internal\n */\nexport const capitalize = <S extends string = string>(s: S): Capitalize<S> =>\n (s.substring(0, 1).toUpperCase() + s.substring(1)) as Capitalize<S>;\n\n/**\n * Tests if a string looks like it begins with an acronym, i.e. it starts with two capital letters.\n * @internal\n */\nexport const isAcronymic = (s: string): boolean => {\n return /^[A-Z][A-Z]/.test(s);\n};\n\n/**\n * Map an optional value through a function\n * @internal\n */\nexport const maybemap = <T1, T2>(value: T1 | undefined, f: (v: T1) => T2): T2 | undefined =>\n value === undefined ? undefined : f(value);\n\n/**\n * Create a GeneratedClient.\n * @internal\n */\nexport function makeServiceClient(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options: GeneratedClientOptionalParams,\n): GeneratedClient {\n const client = new GeneratedClient(endpoint?.replace(/\\/$/, \"\"), {\n ...DEFAULT_GENERATED_CLIENT_OPTIONS,\n ...options,\n apiVersion: FORM_RECOGNIZER_API_VERSION,\n });\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({\n credential,\n scopes: DEFAULT_COGNITIVE_SCOPE,\n })\n : createFormRecognizerAzureKeyCredentialPolicy(credential);\n\n client.pipeline.addPolicy(authPolicy);\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,gCAAgC,GAEjC,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,2CAA2C;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAA4B,CAAS,EAAmB,EAAE,CACpF,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAoB,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAA4B,CAAI,EAAiB,EAAE,CAC3E,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAkB,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAW,EAAE;IAChD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAS,KAAqB,EAAE,CAAgB,EAAkB,EAAE,CAC1F,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,UAA2C,EAC3C,OAAwF;;IAExF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,gDAC1D,gCAAgC,GAChC,OAAO,KACV,UAAU,EAAE,2BAA2B,IACvC,CAAC;IAEH,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAC9C,CAAC,CAAC,+BAA+B,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,CAAC,MAAA,OAAO,CAAC,QAAQ,mCAAI,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBAClE,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAC9C,OAAO,GAAG,KAAK,WAAW,CAAC;YAC7B,CAAC,CAAC;SACH,CAAC;QACJ,CAAC,CAAC,4CAA4C,CAAC,UAAU,CAAC,CAAC;IAE7D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createFormRecognizerAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport { DEFAULT_COGNITIVE_SCOPE, FORM_RECOGNIZER_API_VERSION } from \"./constants.js\";\nimport type { GeneratedClientOptionalParams } from \"./generated/index.js\";\nimport { GeneratedClient } from \"./generated/index.js\";\nimport {\n DEFAULT_GENERATED_CLIENT_OPTIONS,\n type DocumentAnalysisClientOptions,\n} from \"./options/FormRecognizerClientOptions.js\";\n\nimport * as Mappers from \"./generated/models/mappers.js\";\nimport { createSerializer } from \"@azure/core-client\";\nexport { Mappers };\n\n// This is used for URL request processing.\nexport const SERIALIZER = createSerializer(Mappers, false);\n\n/**\n * Type-strong uncapitalization.\n * @internal\n */\nexport const uncapitalize = <S extends string = string>(s: string): Uncapitalize<S> =>\n (s.substring(0, 1).toLowerCase() + s.substring(1)) as Uncapitalize<S>;\n\n/**\n * Type-strong capitalization\n * @internal\n */\nexport const capitalize = <S extends string = string>(s: S): Capitalize<S> =>\n (s.substring(0, 1).toUpperCase() + s.substring(1)) as Capitalize<S>;\n\n/**\n * Tests if a string looks like it begins with an acronym, i.e. it starts with two capital letters.\n * @internal\n */\nexport const isAcronymic = (s: string): boolean => {\n return /^[A-Z][A-Z]/.test(s);\n};\n\n/**\n * Map an optional value through a function\n * @internal\n */\nexport const maybemap = <T1, T2>(value: T1 | undefined, f: (v: T1) => T2): T2 | undefined =>\n value === undefined ? undefined : f(value);\n\n/**\n * Create a GeneratedClient.\n * @internal\n */\nexport function makeServiceClient(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options: GeneratedClientOptionalParams & Pick<DocumentAnalysisClientOptions, \"audience\">,\n): GeneratedClient {\n const client = new GeneratedClient(endpoint?.replace(/\\/$/, \"\"), {\n ...DEFAULT_GENERATED_CLIENT_OPTIONS,\n ...options,\n apiVersion: FORM_RECOGNIZER_API_VERSION,\n });\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({\n credential,\n scopes: [options.audience ?? DEFAULT_COGNITIVE_SCOPE].map((scope) => {\n if (scope.endsWith(\"/.default\")) return scope;\n return `${scope}/.default`;\n }),\n })\n : createFormRecognizerAzureKeyCredentialPolicy(credential);\n\n client.pipeline.addPolicy(authPolicy);\n\n return client;\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic client library for the Azure Document Intelligence service.",
6
- "version": "5.0.0-alpha.20250507.1",
6
+ "version": "5.1.0-alpha.20250512.2",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",