Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure-rest/ai-document-intelligence

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure-rest/ai-document-intelligence - npm Package Compare versions

Comparing version 1.0.0-alpha.20240115.1 to 1.0.0-alpha.20240117.1

24

dist-esm/src/documentIntelligence.js

@@ -12,4 +12,5 @@ // Copyright (c) Microsoft Corporation.

export default function createClient(endpoint, credentials, options = {}) {
const baseUrl = options.baseUrl ?? `${endpoint}/documentintelligence`;
options.apiVersion = options.apiVersion ?? "2023-10-31-preview";
var _a, _b, _c, _d, _e, _f, _g, _h;
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}/documentintelligence`;
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2023-10-31-preview";
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0-beta.2`;

@@ -19,15 +20,10 @@ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix

: `${userAgentInfo}`;
options = {
...options,
userAgentOptions: {
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
userAgentPrefix,
},
loggingOptions: {
logger: options.loggingOptions?.logger ?? logger.info,
},
credentials: {
scopes: options.credentials?.scopes ?? ["https://cognitiveservices.azure.com/.default"],
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "Ocp-Apim-Subscription-Key",
},
};
}, loggingOptions: {
logger: (_d = (_c = options.loggingOptions) === null || _c === void 0 ? void 0 : _c.logger) !== null && _d !== void 0 ? _d : logger.info,
}, credentials: {
scopes: (_f = (_e = options.credentials) === null || _e === void 0 ? void 0 : _e.scopes) !== null && _f !== void 0 ? _f : ["https://cognitiveservices.azure.com/.default"],
apiKeyHeaderName: (_h = (_g = options.credentials) === null || _g === void 0 ? void 0 : _g.apiKeyHeaderName) !== null && _h !== void 0 ? _h : "Ocp-Apim-Subscription-Key",
} });
const client = getClient(baseUrl, credentials, options);

@@ -34,0 +30,0 @@ return client;

@@ -31,3 +31,3 @@ // Copyright (c) Microsoft Corporation.

const lroOriginal = response.headers["x-ms-original-url"];
const url = new URL(lroOriginal ?? response.request.url);
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
const method = response.request.method;

@@ -41,2 +41,3 @@ let pathDetails = responseMap[`${method} ${url.pathname}`];

function getParametrizedPathSuccess(method, path) {
var _a, _b, _c, _d;
const pathParts = path.split("/");

@@ -60,4 +61,4 @@ // Traverse list to match the longest candidate

for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
// If the current part of the candidate is a "template" part

@@ -67,3 +68,3 @@ // Try to use the suffix of pattern to match the path

// {guid}:export ==> :export$
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
if (!isMatched) {

@@ -70,0 +71,0 @@ found = false;

@@ -59,3 +59,3 @@ // Copyright (c) Microsoft Corporation.

}
return value ?? [];
return value !== null && value !== void 0 ? value : [];
}

@@ -62,0 +62,0 @@ /**

@@ -5,2 +5,3 @@ // Copyright (c) Microsoft Corporation.

export async function getLongRunningPoller(client, initialResponse, options = {}) {
var _a;
const poller = {

@@ -20,3 +21,3 @@ requestMethod: initialResponse.request.method,

// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();
const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
const lroResponse = getLroResponse(response);

@@ -27,3 +28,3 @@ lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;

};
options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true;
return createHttpPoller(poller, options);

@@ -42,9 +43,5 @@ }

flatResponse: response,
rawResponse: {
...response,
statusCode: Number.parseInt(response.status),
body: response.body,
},
rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
};
}
//# sourceMappingURL=pollingHelper.js.map

@@ -23,4 +23,5 @@ 'use strict';

function createClient(endpoint, credentials, options = {}) {
const baseUrl = options.baseUrl ?? `${endpoint}/documentintelligence`;
options.apiVersion = options.apiVersion ?? "2023-10-31-preview";
var _a, _b, _c, _d, _e, _f, _g, _h;
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}/documentintelligence`;
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2023-10-31-preview";
const userAgentInfo = `azsdk-js-ai-document-intelligence-rest/1.0.0-beta.2`;

@@ -30,15 +31,10 @@ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix

: `${userAgentInfo}`;
options = {
...options,
userAgentOptions: {
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
userAgentPrefix,
},
loggingOptions: {
logger: options.loggingOptions?.logger ?? logger.info,
},
credentials: {
scopes: options.credentials?.scopes ?? ["https://cognitiveservices.azure.com/.default"],
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "Ocp-Apim-Subscription-Key",
},
};
}, loggingOptions: {
logger: (_d = (_c = options.loggingOptions) === null || _c === void 0 ? void 0 : _c.logger) !== null && _d !== void 0 ? _d : logger.info,
}, credentials: {
scopes: (_f = (_e = options.credentials) === null || _e === void 0 ? void 0 : _e.scopes) !== null && _f !== void 0 ? _f : ["https://cognitiveservices.azure.com/.default"],
apiKeyHeaderName: (_h = (_g = options.credentials) === null || _g === void 0 ? void 0 : _g.apiKeyHeaderName) !== null && _h !== void 0 ? _h : "Ocp-Apim-Subscription-Key",
} });
const client = coreClient.getClient(baseUrl, credentials, options);

@@ -78,3 +74,3 @@ return client;

const lroOriginal = response.headers["x-ms-original-url"];
const url = new URL(lroOriginal ?? response.request.url);
const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
const method = response.request.method;

@@ -88,2 +84,3 @@ let pathDetails = responseMap[`${method} ${url.pathname}`];

function getParametrizedPathSuccess(method, path) {
var _a, _b, _c, _d;
const pathParts = path.split("/");

@@ -107,4 +104,4 @@ // Traverse list to match the longest candidate

for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) && ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
// If the current part of the candidate is a "template" part

@@ -114,3 +111,3 @@ // Try to use the suffix of pattern to match the path

// {guid}:export ==> :export$
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
if (!isMatched) {

@@ -200,3 +197,3 @@ found = false;

}
return value ?? [];
return value !== null && value !== void 0 ? value : [];
}

@@ -216,2 +213,3 @@ /**

async function getLongRunningPoller(client, initialResponse, options = {}) {
var _a;
const poller = {

@@ -231,3 +229,3 @@ requestMethod: initialResponse.request.method,

// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();
const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
const lroResponse = getLroResponse(response);

@@ -238,3 +236,3 @@ lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;

};
options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;
options.resolveOnUnsuccessful = (_a = options.resolveOnUnsuccessful) !== null && _a !== void 0 ? _a : true;
return coreLro.createHttpPoller(poller, options);

@@ -253,7 +251,3 @@ }

flatResponse: response,
rawResponse: {
...response,
statusCode: Number.parseInt(response.status),
body: response.body,
},
rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
};

@@ -260,0 +254,0 @@ }

@@ -5,3 +5,3 @@ {

"author": "Microsoft Corporation",
"version": "1.0.0-alpha.20240115.1",
"version": "1.0.0-alpha.20240117.1",
"description": "Azure Document Intelligence Rest Client",

@@ -8,0 +8,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc