@azure-rest/ai-document-intelligence 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/LICENSE +4 -4
  3. package/README.md +169 -94
  4. package/dist/browser/audience.d.ts +19 -0
  5. package/dist/browser/audience.d.ts.map +1 -0
  6. package/dist/browser/audience.js +22 -0
  7. package/dist/browser/audience.js.map +1 -0
  8. package/dist/browser/documentIntelligence.d.ts.map +1 -1
  9. package/dist/browser/documentIntelligence.js +7 -2
  10. package/dist/browser/documentIntelligence.js.map +1 -1
  11. package/dist/browser/index.d.ts +1 -0
  12. package/dist/browser/index.d.ts.map +1 -1
  13. package/dist/browser/index.js +1 -0
  14. package/dist/browser/index.js.map +1 -1
  15. package/dist/commonjs/audience.d.ts +19 -0
  16. package/dist/commonjs/audience.d.ts.map +1 -0
  17. package/dist/commonjs/audience.js +25 -0
  18. package/dist/commonjs/audience.js.map +1 -0
  19. package/dist/commonjs/documentIntelligence.d.ts.map +1 -1
  20. package/dist/commonjs/documentIntelligence.js +7 -2
  21. package/dist/commonjs/documentIntelligence.js.map +1 -1
  22. package/dist/commonjs/index.d.ts +1 -0
  23. package/dist/commonjs/index.d.ts.map +1 -1
  24. package/dist/commonjs/index.js +3 -0
  25. package/dist/commonjs/index.js.map +1 -1
  26. package/dist/commonjs/tsdoc-metadata.json +1 -1
  27. package/dist/esm/audience.d.ts +19 -0
  28. package/dist/esm/audience.d.ts.map +1 -0
  29. package/dist/esm/audience.js +22 -0
  30. package/dist/esm/audience.js.map +1 -0
  31. package/dist/esm/documentIntelligence.d.ts.map +1 -1
  32. package/dist/esm/documentIntelligence.js +7 -2
  33. package/dist/esm/documentIntelligence.js.map +1 -1
  34. package/dist/esm/index.d.ts +1 -0
  35. package/dist/esm/index.d.ts.map +1 -1
  36. package/dist/esm/index.js +1 -0
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/react-native/audience.d.ts +19 -0
  39. package/dist/react-native/audience.d.ts.map +1 -0
  40. package/dist/react-native/audience.js +22 -0
  41. package/dist/react-native/audience.js.map +1 -0
  42. package/dist/react-native/documentIntelligence.d.ts.map +1 -1
  43. package/dist/react-native/documentIntelligence.js +7 -2
  44. package/dist/react-native/documentIntelligence.js.map +1 -1
  45. package/dist/react-native/index.d.ts +1 -0
  46. package/dist/react-native/index.d.ts.map +1 -1
  47. package/dist/react-native/index.js +1 -0
  48. package/dist/react-native/index.js.map +1 -1
  49. package/package.json +34 -38
  50. package/review/ai-document-intelligence.api.md +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAE3B,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAElE,eAAe,oBAAoB,CAAC"}
@@ -11,5 +11,6 @@ export * from "./outputModels.js";
11
11
  export * from "./paginateHelper.js";
12
12
  export * from "./pollingHelper.js";
13
13
  export * from "./utils.js";
14
+ export { KnownDocumentIntelligenceAudience } from "./audience.js";
14
15
  export default DocumentIntelligence;
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAE3B,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\n\nexport default DocumentIntelligence;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAElE,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\nexport { KnownDocumentIntelligenceAudience } from \"./audience.js\";\n\nexport default DocumentIntelligence;\n"]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Defines the known cloud audiences for Document Intelligence.
3
+ *
4
+ * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)
5
+ * environment, provide the appropriate value below as the `audience` option when creating a
6
+ * `Document Intelligence` client.
7
+ *
8
+ * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value
9
+ * is only required to use Document Intelligence in a different cloud environment.
10
+ */
11
+ export declare enum KnownDocumentIntelligenceAudience {
12
+ /** Azure China */
13
+ AzureChina = "https://cognitiveservices.azure.cn",
14
+ /** Azure Government */
15
+ AzureGovernment = "https://cognitiveservices.azure.us",
16
+ /** Azure Public Cloud */
17
+ AzurePublicCloud = "https://cognitiveservices.azure.com"
18
+ }
19
+ //# sourceMappingURL=audience.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../../src/audience.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,oBAAY,iCAAiC;IAC3C,kBAAkB;IAClB,UAAU,uCAAuC;IACjD,uBAAuB;IACvB,eAAe,uCAAuC;IACtD,yBAAyB;IACzB,gBAAgB,wCAAwC;CACzD"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.KnownDocumentIntelligenceAudience = void 0;
6
+ /**
7
+ * Defines the known cloud audiences for Document Intelligence.
8
+ *
9
+ * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)
10
+ * environment, provide the appropriate value below as the `audience` option when creating a
11
+ * `Document Intelligence` client.
12
+ *
13
+ * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value
14
+ * is only required to use Document Intelligence in a different cloud environment.
15
+ */
16
+ var KnownDocumentIntelligenceAudience;
17
+ (function (KnownDocumentIntelligenceAudience) {
18
+ /** Azure China */
19
+ KnownDocumentIntelligenceAudience["AzureChina"] = "https://cognitiveservices.azure.cn";
20
+ /** Azure Government */
21
+ KnownDocumentIntelligenceAudience["AzureGovernment"] = "https://cognitiveservices.azure.us";
22
+ /** Azure Public Cloud */
23
+ KnownDocumentIntelligenceAudience["AzurePublicCloud"] = "https://cognitiveservices.azure.com";
24
+ })(KnownDocumentIntelligenceAudience || (exports.KnownDocumentIntelligenceAudience = KnownDocumentIntelligenceAudience = {}));
25
+ //# sourceMappingURL=audience.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audience.js","sourceRoot":"","sources":["../../src/audience.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC;;;;;;;;;GASG;AACH,IAAY,iCAOX;AAPD,WAAY,iCAAiC;IAC3C,kBAAkB;IAClB,sFAAiD,CAAA;IACjD,uBAAuB;IACvB,2FAAsD,CAAA;IACtD,yBAAyB;IACzB,6FAAwD,CAAA;AAC1D,CAAC,EAPW,iCAAiC,iDAAjC,iCAAiC,QAO5C","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Defines the known cloud audiences for Document Intelligence.\n *\n * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)\n * environment, provide the appropriate value below as the `audience` option when creating a\n * `Document Intelligence` client.\n *\n * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value\n * is only required to use Document Intelligence in a different cloud environment.\n */\nexport enum KnownDocumentIntelligenceAudience {\n /** Azure China */\n AzureChina = \"https://cognitiveservices.azure.cn\",\n /** Azure Government */\n AzureGovernment = \"https://cognitiveservices.azure.us\",\n /** Azure Public Cloud */\n AzurePublicCloud = \"https://cognitiveservices.azure.com\",\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"documentIntelligence.d.ts","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,6CAA6C;AAC7C,MAAM,WAAW,iCAAkC,SAAQ,aAAa;IACtE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,GAAG,aAAa,EAC5C,EAAE,UAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,iCAAsC,GAChF,0BAA0B,CAyC5B"}
1
+ {"version":3,"file":"documentIntelligence.d.ts","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGzE,6CAA6C;AAC7C,MAAM,WAAW,iCAAkC,SAAQ,aAAa;IACtE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,GAAG,aAAa,EAC5C,EAAE,UAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,iCAAsC,GAChF,0BAA0B,CA8C5B"}
@@ -6,6 +6,7 @@ exports.default = createClient;
6
6
  const tslib_1 = require("tslib");
7
7
  const core_client_1 = require("@azure-rest/core-client");
8
8
  const logger_js_1 = require("./logger.js");
9
+ const audience_js_1 = require("./audience.js");
9
10
  /**
10
11
  * Initialize a new instance of `DocumentIntelligenceClient`
11
12
  * @param endpointParam - The Document Intelligence service endpoint.
@@ -16,7 +17,7 @@ function createClient(endpointParam, credentials, _a = {}) {
16
17
  var _b, _c, _d, _e, _f, _g, _h, _j;
17
18
  var { apiVersion = "2024-11-30" } = _a, options = tslib_1.__rest(_a, ["apiVersion"]);
18
19
  const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}/documentintelligence`;
19
- const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`;
20
+ const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.1.0`;
20
21
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
21
22
  ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
22
23
  : `${userAgentInfo}`;
@@ -25,7 +26,11 @@ function createClient(endpointParam, credentials, _a = {}) {
25
26
  }, loggingOptions: {
26
27
  logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger_js_1.logger.info,
27
28
  }, credentials: {
28
- scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : ["https://cognitiveservices.azure.com/.default"],
29
+ scopes: ((_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : [audience_js_1.KnownDocumentIntelligenceAudience.AzurePublicCloud]).map((scope) => {
30
+ if (scope.endsWith("/.default"))
31
+ return scope;
32
+ return `${scope}/.default`;
33
+ }),
29
34
  apiKeyHeaderName: (_j = (_h = options.credentials) === null || _h === void 0 ? void 0 : _h.apiKeyHeaderName) !== null && _j !== void 0 ? _j : "Ocp-Apim-Subscription-Key",
30
35
  } });
31
36
  const client = (0, core_client_1.getClient)(endpointUrl, credentials, options);
@@ -1 +1 @@
1
- {"version":3,"file":"documentIntelligence.js","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoBlC,+BA6CC;;AA9DD,yDAAoD;AACpD,2CAAqC;AAUrC;;;;;GAKG;AACH,SAAwB,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,KAA+E,EAAE;;QAAjF,EAAE,UAAU,GAAG,YAAY,OAAsD,EAAjD,OAAO,sBAAvC,cAAyC,CAAF;IAEvC,MAAM,WAAW,GACf,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,uBAAuB,CAAC;IACjF,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,kBAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,8CAA8C,CAAC;YACvF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IACF,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA+B,CAAC;IAE1F,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { DocumentIntelligenceClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface DocumentIntelligenceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `DocumentIntelligenceClient`\n * @param endpointParam - The Document Intelligence service endpoint.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-11-30\", ...options }: DocumentIntelligenceClientOptions = {},\n): DocumentIntelligenceClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `${endpointParam}/documentintelligence`;\n const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://cognitiveservices.azure.com/.default\"],\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n const client = getClient(endpointUrl, credentials, options) as DocumentIntelligenceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"documentIntelligence.js","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqBlC,+BAkDC;;AApED,yDAAoD;AACpD,2CAAqC;AAGrC,+CAAkE;AAQlE;;;;;GAKG;AACH,SAAwB,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,KAA+E,EAAE;;QAAjF,EAAE,UAAU,GAAG,YAAY,OAAsD,EAAjD,OAAO,sBAAvC,cAAyC,CAAF;IAEvC,MAAM,WAAW,GACf,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,uBAAuB,CAAC;IACjF,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,kBAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,CACN,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,+CAAiC,CAAC,gBAAgB,CAAC,CACpF,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACd,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAC9C,OAAO,GAAG,KAAK,WAAW,CAAC;YAC7B,CAAC,CAAC;YACF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IACF,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA+B,CAAC;IAE1F,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { DocumentIntelligenceClient } from \"./clientDefinitions.js\";\nimport { KnownDocumentIntelligenceAudience } from \"./audience.js\";\n\n/** The optional parameters for the client */\nexport interface DocumentIntelligenceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `DocumentIntelligenceClient`\n * @param endpointParam - The Document Intelligence service endpoint.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-11-30\", ...options }: DocumentIntelligenceClientOptions = {},\n): DocumentIntelligenceClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `${endpointParam}/documentintelligence`;\n const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.1.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: (\n options.credentials?.scopes ?? [KnownDocumentIntelligenceAudience.AzurePublicCloud]\n ).map((scope) => {\n if (scope.endsWith(\"/.default\")) return scope;\n return `${scope}/.default`;\n }),\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n const client = getClient(endpointUrl, credentials, options) as DocumentIntelligenceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
@@ -9,5 +9,6 @@ export * from "./outputModels.js";
9
9
  export * from "./paginateHelper.js";
10
10
  export * from "./pollingHelper.js";
11
11
  export * from "./utils.js";
12
+ export { KnownDocumentIntelligenceAudience } from "./audience.js";
12
13
  export default DocumentIntelligence;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAE3B,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAElE,eAAe,oBAAoB,CAAC"}
@@ -2,6 +2,7 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.KnownDocumentIntelligenceAudience = void 0;
5
6
  const tslib_1 = require("tslib");
6
7
  const documentIntelligence_js_1 = tslib_1.__importDefault(require("./documentIntelligence.js"));
7
8
  tslib_1.__exportStar(require("./documentIntelligence.js"), exports);
@@ -14,5 +15,7 @@ tslib_1.__exportStar(require("./outputModels.js"), exports);
14
15
  tslib_1.__exportStar(require("./paginateHelper.js"), exports);
15
16
  tslib_1.__exportStar(require("./pollingHelper.js"), exports);
16
17
  tslib_1.__exportStar(require("./utils.js"), exports);
18
+ var audience_js_1 = require("./audience.js");
19
+ Object.defineProperty(exports, "KnownDocumentIntelligenceAudience", { enumerable: true, get: function () { return audience_js_1.KnownDocumentIntelligenceAudience; } });
17
20
  exports.default = documentIntelligence_js_1.default;
18
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,gGAA6D;AAE7D,oEAA0C;AAC1C,0DAAgC;AAChC,yDAA+B;AAC/B,iEAAuC;AACvC,4DAAkC;AAClC,sDAA4B;AAC5B,4DAAkC;AAClC,8DAAoC;AACpC,6DAAmC;AACnC,qDAA2B;AAE3B,kBAAe,iCAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\n\nexport default DocumentIntelligence;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,gGAA6D;AAE7D,oEAA0C;AAC1C,0DAAgC;AAChC,yDAA+B;AAC/B,iEAAuC;AACvC,4DAAkC;AAClC,sDAA4B;AAC5B,4DAAkC;AAClC,8DAAoC;AACpC,6DAAmC;AACnC,qDAA2B;AAC3B,6CAAkE;AAAzD,gIAAA,iCAAiC,OAAA;AAE1C,kBAAe,iCAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\nexport { KnownDocumentIntelligenceAudience } from \"./audience.js\";\n\nexport default DocumentIntelligence;\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.48.0"
8
+ "packageVersion": "7.52.7"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Defines the known cloud audiences for Document Intelligence.
3
+ *
4
+ * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)
5
+ * environment, provide the appropriate value below as the `audience` option when creating a
6
+ * `Document Intelligence` client.
7
+ *
8
+ * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value
9
+ * is only required to use Document Intelligence in a different cloud environment.
10
+ */
11
+ export declare enum KnownDocumentIntelligenceAudience {
12
+ /** Azure China */
13
+ AzureChina = "https://cognitiveservices.azure.cn",
14
+ /** Azure Government */
15
+ AzureGovernment = "https://cognitiveservices.azure.us",
16
+ /** Azure Public Cloud */
17
+ AzurePublicCloud = "https://cognitiveservices.azure.com"
18
+ }
19
+ //# sourceMappingURL=audience.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../../src/audience.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,oBAAY,iCAAiC;IAC3C,kBAAkB;IAClB,UAAU,uCAAuC;IACjD,uBAAuB;IACvB,eAAe,uCAAuC;IACtD,yBAAyB;IACzB,gBAAgB,wCAAwC;CACzD"}
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * Defines the known cloud audiences for Document Intelligence.
5
+ *
6
+ * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)
7
+ * environment, provide the appropriate value below as the `audience` option when creating a
8
+ * `Document Intelligence` client.
9
+ *
10
+ * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value
11
+ * is only required to use Document Intelligence in a different cloud environment.
12
+ */
13
+ export var KnownDocumentIntelligenceAudience;
14
+ (function (KnownDocumentIntelligenceAudience) {
15
+ /** Azure China */
16
+ KnownDocumentIntelligenceAudience["AzureChina"] = "https://cognitiveservices.azure.cn";
17
+ /** Azure Government */
18
+ KnownDocumentIntelligenceAudience["AzureGovernment"] = "https://cognitiveservices.azure.us";
19
+ /** Azure Public Cloud */
20
+ KnownDocumentIntelligenceAudience["AzurePublicCloud"] = "https://cognitiveservices.azure.com";
21
+ })(KnownDocumentIntelligenceAudience || (KnownDocumentIntelligenceAudience = {}));
22
+ //# sourceMappingURL=audience.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audience.js","sourceRoot":"","sources":["../../src/audience.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,iCAOX;AAPD,WAAY,iCAAiC;IAC3C,kBAAkB;IAClB,sFAAiD,CAAA;IACjD,uBAAuB;IACvB,2FAAsD,CAAA;IACtD,yBAAyB;IACzB,6FAAwD,CAAA;AAC1D,CAAC,EAPW,iCAAiC,KAAjC,iCAAiC,QAO5C","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Defines the known cloud audiences for Document Intelligence.\n *\n * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)\n * environment, provide the appropriate value below as the `audience` option when creating a\n * `Document Intelligence` client.\n *\n * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value\n * is only required to use Document Intelligence in a different cloud environment.\n */\nexport enum KnownDocumentIntelligenceAudience {\n /** Azure China */\n AzureChina = \"https://cognitiveservices.azure.cn\",\n /** Azure Government */\n AzureGovernment = \"https://cognitiveservices.azure.us\",\n /** Azure Public Cloud */\n AzurePublicCloud = \"https://cognitiveservices.azure.com\",\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"documentIntelligence.d.ts","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,6CAA6C;AAC7C,MAAM,WAAW,iCAAkC,SAAQ,aAAa;IACtE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,GAAG,aAAa,EAC5C,EAAE,UAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,iCAAsC,GAChF,0BAA0B,CAyC5B"}
1
+ {"version":3,"file":"documentIntelligence.d.ts","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGzE,6CAA6C;AAC7C,MAAM,WAAW,iCAAkC,SAAQ,aAAa;IACtE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,GAAG,aAAa,EAC5C,EAAE,UAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,iCAAsC,GAChF,0BAA0B,CA8C5B"}
@@ -3,6 +3,7 @@
3
3
  import { __rest } from "tslib";
4
4
  import { getClient } from "@azure-rest/core-client";
5
5
  import { logger } from "./logger.js";
6
+ import { KnownDocumentIntelligenceAudience } from "./audience.js";
6
7
  /**
7
8
  * Initialize a new instance of `DocumentIntelligenceClient`
8
9
  * @param endpointParam - The Document Intelligence service endpoint.
@@ -13,7 +14,7 @@ export default function createClient(endpointParam, credentials, _a = {}) {
13
14
  var _b, _c, _d, _e, _f, _g, _h, _j;
14
15
  var { apiVersion = "2024-11-30" } = _a, options = __rest(_a, ["apiVersion"]);
15
16
  const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}/documentintelligence`;
16
- const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`;
17
+ const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.1.0`;
17
18
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
18
19
  ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
19
20
  : `${userAgentInfo}`;
@@ -22,7 +23,11 @@ export default function createClient(endpointParam, credentials, _a = {}) {
22
23
  }, loggingOptions: {
23
24
  logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
24
25
  }, credentials: {
25
- scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : ["https://cognitiveservices.azure.com/.default"],
26
+ scopes: ((_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : [KnownDocumentIntelligenceAudience.AzurePublicCloud]).map((scope) => {
27
+ if (scope.endsWith("/.default"))
28
+ return scope;
29
+ return `${scope}/.default`;
30
+ }),
26
31
  apiKeyHeaderName: (_j = (_h = options.credentials) === null || _h === void 0 ? void 0 : _h.apiKeyHeaderName) !== null && _j !== void 0 ? _j : "Ocp-Apim-Subscription-Key",
27
32
  } });
28
33
  const client = getClient(endpointUrl, credentials, options);
@@ -1 +1 @@
1
- {"version":3,"file":"documentIntelligence.js","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,KAA+E,EAAE;;QAAjF,EAAE,UAAU,GAAG,YAAY,OAAsD,EAAjD,OAAO,cAAvC,cAAyC,CAAF;IAEvC,MAAM,WAAW,GACf,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,uBAAuB,CAAC;IACjF,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,8CAA8C,CAAC;YACvF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA+B,CAAC;IAE1F,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { DocumentIntelligenceClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface DocumentIntelligenceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `DocumentIntelligenceClient`\n * @param endpointParam - The Document Intelligence service endpoint.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-11-30\", ...options }: DocumentIntelligenceClientOptions = {},\n): DocumentIntelligenceClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `${endpointParam}/documentintelligence`;\n const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://cognitiveservices.azure.com/.default\"],\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n const client = getClient(endpointUrl, credentials, options) as DocumentIntelligenceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"documentIntelligence.js","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAQlE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,KAA+E,EAAE;;QAAjF,EAAE,UAAU,GAAG,YAAY,OAAsD,EAAjD,OAAO,cAAvC,cAAyC,CAAF;IAEvC,MAAM,WAAW,GACf,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,uBAAuB,CAAC;IACjF,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,CACN,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,iCAAiC,CAAC,gBAAgB,CAAC,CACpF,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACd,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAC9C,OAAO,GAAG,KAAK,WAAW,CAAC;YAC7B,CAAC,CAAC;YACF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA+B,CAAC;IAE1F,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { DocumentIntelligenceClient } from \"./clientDefinitions.js\";\nimport { KnownDocumentIntelligenceAudience } from \"./audience.js\";\n\n/** The optional parameters for the client */\nexport interface DocumentIntelligenceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `DocumentIntelligenceClient`\n * @param endpointParam - The Document Intelligence service endpoint.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-11-30\", ...options }: DocumentIntelligenceClientOptions = {},\n): DocumentIntelligenceClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `${endpointParam}/documentintelligence`;\n const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.1.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: (\n options.credentials?.scopes ?? [KnownDocumentIntelligenceAudience.AzurePublicCloud]\n ).map((scope) => {\n if (scope.endsWith(\"/.default\")) return scope;\n return `${scope}/.default`;\n }),\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n const client = getClient(endpointUrl, credentials, options) as DocumentIntelligenceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
@@ -9,5 +9,6 @@ export * from "./outputModels.js";
9
9
  export * from "./paginateHelper.js";
10
10
  export * from "./pollingHelper.js";
11
11
  export * from "./utils.js";
12
+ export { KnownDocumentIntelligenceAudience } from "./audience.js";
12
13
  export default DocumentIntelligence;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAE3B,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAElE,eAAe,oBAAoB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -11,5 +11,6 @@ export * from "./outputModels.js";
11
11
  export * from "./paginateHelper.js";
12
12
  export * from "./pollingHelper.js";
13
13
  export * from "./utils.js";
14
+ export { KnownDocumentIntelligenceAudience } from "./audience.js";
14
15
  export default DocumentIntelligence;
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAE3B,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\n\nexport default DocumentIntelligence;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAElE,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\nexport { KnownDocumentIntelligenceAudience } from \"./audience.js\";\n\nexport default DocumentIntelligence;\n"]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Defines the known cloud audiences for Document Intelligence.
3
+ *
4
+ * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)
5
+ * environment, provide the appropriate value below as the `audience` option when creating a
6
+ * `Document Intelligence` client.
7
+ *
8
+ * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value
9
+ * is only required to use Document Intelligence in a different cloud environment.
10
+ */
11
+ export declare enum KnownDocumentIntelligenceAudience {
12
+ /** Azure China */
13
+ AzureChina = "https://cognitiveservices.azure.cn",
14
+ /** Azure Government */
15
+ AzureGovernment = "https://cognitiveservices.azure.us",
16
+ /** Azure Public Cloud */
17
+ AzurePublicCloud = "https://cognitiveservices.azure.com"
18
+ }
19
+ //# sourceMappingURL=audience.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../../src/audience.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,oBAAY,iCAAiC;IAC3C,kBAAkB;IAClB,UAAU,uCAAuC;IACjD,uBAAuB;IACvB,eAAe,uCAAuC;IACtD,yBAAyB;IACzB,gBAAgB,wCAAwC;CACzD"}
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * Defines the known cloud audiences for Document Intelligence.
5
+ *
6
+ * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)
7
+ * environment, provide the appropriate value below as the `audience` option when creating a
8
+ * `Document Intelligence` client.
9
+ *
10
+ * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value
11
+ * is only required to use Document Intelligence in a different cloud environment.
12
+ */
13
+ export var KnownDocumentIntelligenceAudience;
14
+ (function (KnownDocumentIntelligenceAudience) {
15
+ /** Azure China */
16
+ KnownDocumentIntelligenceAudience["AzureChina"] = "https://cognitiveservices.azure.cn";
17
+ /** Azure Government */
18
+ KnownDocumentIntelligenceAudience["AzureGovernment"] = "https://cognitiveservices.azure.us";
19
+ /** Azure Public Cloud */
20
+ KnownDocumentIntelligenceAudience["AzurePublicCloud"] = "https://cognitiveservices.azure.com";
21
+ })(KnownDocumentIntelligenceAudience || (KnownDocumentIntelligenceAudience = {}));
22
+ //# sourceMappingURL=audience.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audience.js","sourceRoot":"","sources":["../../src/audience.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,iCAOX;AAPD,WAAY,iCAAiC;IAC3C,kBAAkB;IAClB,sFAAiD,CAAA;IACjD,uBAAuB;IACvB,2FAAsD,CAAA;IACtD,yBAAyB;IACzB,6FAAwD,CAAA;AAC1D,CAAC,EAPW,iCAAiC,KAAjC,iCAAiC,QAO5C","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Defines the known cloud audiences for Document Intelligence.\n *\n * To authenticate with Entra Id (using a `TokenCredential`) in a [Sovereign Cloud](https://learn.microsoft.com/en-us/entra/identity-platform/authentication-national-cloud)\n * environment, provide the appropriate value below as the `audience` option when creating a\n * `Document Intelligence` client.\n *\n * The default value is suitable for Document Intelligence resources created in the Azure Public Cloud, so this value\n * is only required to use Document Intelligence in a different cloud environment.\n */\nexport enum KnownDocumentIntelligenceAudience {\n /** Azure China */\n AzureChina = \"https://cognitiveservices.azure.cn\",\n /** Azure Government */\n AzureGovernment = \"https://cognitiveservices.azure.us\",\n /** Azure Public Cloud */\n AzurePublicCloud = \"https://cognitiveservices.azure.com\",\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"documentIntelligence.d.ts","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,6CAA6C;AAC7C,MAAM,WAAW,iCAAkC,SAAQ,aAAa;IACtE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,GAAG,aAAa,EAC5C,EAAE,UAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,iCAAsC,GAChF,0BAA0B,CAyC5B"}
1
+ {"version":3,"file":"documentIntelligence.d.ts","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGzE,6CAA6C;AAC7C,MAAM,WAAW,iCAAkC,SAAQ,aAAa;IACtE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,GAAG,aAAa,EAC5C,EAAE,UAAyB,EAAE,GAAG,OAAO,EAAE,GAAE,iCAAsC,GAChF,0BAA0B,CA8C5B"}
@@ -3,6 +3,7 @@
3
3
  import { __rest } from "tslib";
4
4
  import { getClient } from "@azure-rest/core-client";
5
5
  import { logger } from "./logger.js";
6
+ import { KnownDocumentIntelligenceAudience } from "./audience.js";
6
7
  /**
7
8
  * Initialize a new instance of `DocumentIntelligenceClient`
8
9
  * @param endpointParam - The Document Intelligence service endpoint.
@@ -13,7 +14,7 @@ export default function createClient(endpointParam, credentials, _a = {}) {
13
14
  var _b, _c, _d, _e, _f, _g, _h, _j;
14
15
  var { apiVersion = "2024-11-30" } = _a, options = __rest(_a, ["apiVersion"]);
15
16
  const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}/documentintelligence`;
16
- const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`;
17
+ const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.1.0`;
17
18
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
18
19
  ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
19
20
  : `${userAgentInfo}`;
@@ -22,7 +23,11 @@ export default function createClient(endpointParam, credentials, _a = {}) {
22
23
  }, loggingOptions: {
23
24
  logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
24
25
  }, credentials: {
25
- scopes: (_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : ["https://cognitiveservices.azure.com/.default"],
26
+ scopes: ((_g = (_f = options.credentials) === null || _f === void 0 ? void 0 : _f.scopes) !== null && _g !== void 0 ? _g : [KnownDocumentIntelligenceAudience.AzurePublicCloud]).map((scope) => {
27
+ if (scope.endsWith("/.default"))
28
+ return scope;
29
+ return `${scope}/.default`;
30
+ }),
26
31
  apiKeyHeaderName: (_j = (_h = options.credentials) === null || _h === void 0 ? void 0 : _h.apiKeyHeaderName) !== null && _j !== void 0 ? _j : "Ocp-Apim-Subscription-Key",
27
32
  } });
28
33
  const client = getClient(endpointUrl, credentials, options);
@@ -1 +1 @@
1
- {"version":3,"file":"documentIntelligence.js","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,KAA+E,EAAE;;QAAjF,EAAE,UAAU,GAAG,YAAY,OAAsD,EAAjD,OAAO,cAAvC,cAAyC,CAAF;IAEvC,MAAM,WAAW,GACf,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,uBAAuB,CAAC;IACjF,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,8CAA8C,CAAC;YACvF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA+B,CAAC;IAE1F,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { DocumentIntelligenceClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface DocumentIntelligenceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `DocumentIntelligenceClient`\n * @param endpointParam - The Document Intelligence service endpoint.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-11-30\", ...options }: DocumentIntelligenceClientOptions = {},\n): DocumentIntelligenceClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `${endpointParam}/documentintelligence`;\n const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://cognitiveservices.azure.com/.default\"],\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n const client = getClient(endpointUrl, credentials, options) as DocumentIntelligenceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"documentIntelligence.js","sourceRoot":"","sources":["../../src/documentIntelligence.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAQlE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAqB,EACrB,WAA4C,EAC5C,KAA+E,EAAE;;QAAjF,EAAE,UAAU,GAAG,YAAY,OAAsD,EAAjD,OAAO,cAAvC,cAAyC,CAAF;IAEvC,MAAM,WAAW,GACf,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,uBAAuB,CAAC;IACjF,MAAM,aAAa,GAAG,8CAA8C,CAAC;IACrE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,EACD,WAAW,EAAE;YACX,MAAM,EAAE,CACN,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,iCAAiC,CAAC,gBAAgB,CAAC,CACpF,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACd,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAC9C,OAAO,GAAG,KAAK,WAAW,CAAC;YAC7B,CAAC,CAAC;YACF,gBAAgB,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,gBAAgB,mCAAI,2BAA2B;SACvF,GACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAA+B,CAAC;IAE1F,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential, KeyCredential } from \"@azure/core-auth\";\nimport type { DocumentIntelligenceClient } from \"./clientDefinitions.js\";\nimport { KnownDocumentIntelligenceAudience } from \"./audience.js\";\n\n/** The optional parameters for the client */\nexport interface DocumentIntelligenceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `DocumentIntelligenceClient`\n * @param endpointParam - The Document Intelligence service endpoint.\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n credentials: TokenCredential | KeyCredential,\n { apiVersion = \"2024-11-30\", ...options }: DocumentIntelligenceClientOptions = {},\n): DocumentIntelligenceClient {\n const endpointUrl =\n options.endpoint ?? options.baseUrl ?? `${endpointParam}/documentintelligence`;\n const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.1.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: (\n options.credentials?.scopes ?? [KnownDocumentIntelligenceAudience.AzurePublicCloud]\n ).map((scope) => {\n if (scope.endsWith(\"/.default\")) return scope;\n return `${scope}/.default`;\n }),\n apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? \"Ocp-Apim-Subscription-Key\",\n },\n };\n const client = getClient(endpointUrl, credentials, options) as DocumentIntelligenceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}
@@ -9,5 +9,6 @@ export * from "./outputModels.js";
9
9
  export * from "./paginateHelper.js";
10
10
  export * from "./pollingHelper.js";
11
11
  export * from "./utils.js";
12
+ export { KnownDocumentIntelligenceAudience } from "./audience.js";
12
13
  export default DocumentIntelligence;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAE3B,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAElE,eAAe,oBAAoB,CAAC"}
@@ -11,5 +11,6 @@ export * from "./outputModels.js";
11
11
  export * from "./paginateHelper.js";
12
12
  export * from "./pollingHelper.js";
13
13
  export * from "./utils.js";
14
+ export { KnownDocumentIntelligenceAudience } from "./audience.js";
14
15
  export default DocumentIntelligence;
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAE3B,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\n\nexport default DocumentIntelligence;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAElE,eAAe,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport DocumentIntelligence from \"./documentIntelligence.js\";\n\nexport * from \"./documentIntelligence.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./paginateHelper.js\";\nexport * from \"./pollingHelper.js\";\nexport * from \"./utils.js\";\nexport { KnownDocumentIntelligenceAudience } from \"./audience.js\";\n\nexport default DocumentIntelligence;\n"]}