@acrolinx/sdk
Advanced tools
Comparing version 0.1.2-build.1145 to 0.1.2-build.1211
@@ -25,4 +25,4 @@ "use strict"; | ||
}, | ||
acrolinxUrl: 'https://test-latest-ssl.acrolinx.com' | ||
acrolinxUrl: 'https://test-ssl.acrolinx.com' | ||
}; | ||
//# sourceMappingURL=common.js.map |
@@ -79,3 +79,3 @@ "use strict"; | ||
} | ||
acrolinxEndpoint = new index_1.AcrolinxEndpoint(__assign(__assign({}, common_1.EXAMPLE_ACROLINX_ENDPOINT_PROPS), { acrolinxUrl: 'http://localhost:3000' })); | ||
acrolinxEndpoint = new index_1.AcrolinxEndpoint(__assign({}, common_1.EXAMPLE_ACROLINX_ENDPOINT_PROPS)); | ||
return [4 /*yield*/, acrolinxEndpoint.getCheckingCapabilities(accessToken)]; | ||
@@ -82,0 +82,0 @@ case 1: |
@@ -61,3 +61,5 @@ import { LanguageId } from './common-types'; | ||
*/ | ||
request_text = "extractedText" | ||
request_text = "extractedText", | ||
linguisticDebugInfo = "linguisticDebugInfo", | ||
contentAnalysisDashboard = "contentAnalysisDashboard" | ||
} | ||
@@ -64,0 +66,0 @@ export interface CheckingCapabilities { |
@@ -52,3 +52,5 @@ "use strict"; | ||
ReportType["request_text"] = "extractedText"; | ||
ReportType["linguisticDebugInfo"] = "linguisticDebugInfo"; | ||
ReportType["contentAnalysisDashboard"] = "contentAnalysisDashboard"; | ||
})(ReportType = exports.ReportType || (exports.ReportType = {})); | ||
//# sourceMappingURL=capabilities.js.map |
@@ -230,3 +230,3 @@ "use strict"; | ||
result = _a.sent(); | ||
expect(result.data.user.id).toContain(SSO_USERNAME); | ||
expect(result.data.user.username).toContain(SSO_USERNAME); | ||
return [2 /*return*/]; | ||
@@ -233,0 +233,0 @@ } |
@@ -80,3 +80,5 @@ { | ||
"enum": [ | ||
"contentAnalysisDashboard", | ||
"extractedText", | ||
"linguisticDebugInfo", | ||
"scorecard", | ||
@@ -109,5 +111,11 @@ "termHarvesting" | ||
"properties": { | ||
"contentAnalysisDashboard": { | ||
"$ref": "#/definitions/Report" | ||
}, | ||
"extractedText": { | ||
"$ref": "#/definitions/Report" | ||
}, | ||
"linguisticDebugInfo": { | ||
"$ref": "#/definitions/Report" | ||
}, | ||
"scorecard": { | ||
@@ -114,0 +122,0 @@ "$ref": "#/definitions/Report" |
@@ -24,3 +24,3 @@ /* | ||
}, | ||
acrolinxUrl: 'https://test-latest-ssl.acrolinx.com' | ||
acrolinxUrl: 'https://test-ssl.acrolinx.com' | ||
}; |
@@ -30,4 +30,3 @@ /* | ||
const acrolinxEndpoint = new AcrolinxEndpoint({ | ||
...EXAMPLE_ACROLINX_ENDPOINT_PROPS, | ||
acrolinxUrl: 'http://localhost:3000' | ||
...EXAMPLE_ACROLINX_ENDPOINT_PROPS | ||
}); | ||
@@ -34,0 +33,0 @@ |
{ | ||
"name": "@acrolinx/sdk", | ||
"version": "0.1.2-build.1145", | ||
"version": "0.1.2-build.1211", | ||
"description": "Acrolinx JavaScript SDK for the Acrolinx API", | ||
@@ -27,3 +27,3 @@ "license": "Apache-2.0", | ||
"runExampleCheck": "tsc && node dist/examples/check.js https://test-latest-ssl.acrolinx.com eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcGktanMtdGVzdC11c2VyIiwiYXVkIjoiYWNyb2xpbng6OTk4ODhjZDE1YjM5YTUyMCIsIm5iZiI6MTUxNzgzODc5NywiaXNzIjoiYWNyb2xpbng6OTk4ODhjZDE1YjM5YTUyMDplYzljZGRlMjNiMjUzZGM3IiwiZXhwIjoxNjQ0MDY5MTk3LCJ0b2tlblR5cGUiOiJhcGkiLCJpYXQiOjE1MTc5MjUxOTcsImp0aSI6IjMxY2FhNWI2NjhhNjdiZDk2MDhkMTM4M2RlNzRkNmM5In0.wtiefF9mHqe_N6BzXqT7PucSMWs3lwq2xla_x8KYGWE", | ||
"runExampleCheckMocked": "tsc && node dist/examples/check.js http://localhost:3000 dummyAuthToken", | ||
"runExampleCheckMocked": "tsc && node dist/examples/check.js http://localhost:3000 dummyAccessToken", | ||
"runMockServer": "tsc && node dist/test/test-utils/mock-server-http.js", | ||
@@ -30,0 +30,0 @@ "test": "jest", |
@@ -64,2 +64,6 @@ # Acrolinx JavaScript SDK | ||
## Contributing to this SDK | ||
See: [`CONTRIBUTING.md`](CONTRIBUTING.md) | ||
## License | ||
@@ -66,0 +70,0 @@ |
@@ -17,3 +17,3 @@ /* | ||
import {LanguageId} from './common-types'; | ||
import { LanguageId } from './common-types'; | ||
@@ -58,3 +58,3 @@ export type GoalId = string; | ||
required = 'required', | ||
recommended= 'recommended', | ||
recommended = 'recommended', | ||
} | ||
@@ -92,2 +92,4 @@ | ||
request_text = 'extractedText', | ||
linguisticDebugInfo = 'linguisticDebugInfo', | ||
contentAnalysisDashboard = 'contentAnalysisDashboard' | ||
} | ||
@@ -94,0 +96,0 @@ |
@@ -41,11 +41,11 @@ /* | ||
} from '../../src'; | ||
import {CheckOptions} from '../../src/check'; | ||
import {DocumentDescriptor} from '../../src/document-descriptor'; | ||
import {AcrolinxError, ValidationDetail} from '../../src/errors'; | ||
import {AcrolinxEndpoint, isSigninSuccessResult, SigninSuccessResult} from '../../src/index'; | ||
import {SigninLinksResult} from '../../src/signin'; | ||
import {waitMs} from '../../src/utils/mixed-utils'; | ||
import { CheckOptions } from '../../src/check'; | ||
import { DocumentDescriptor } from '../../src/document-descriptor'; | ||
import { AcrolinxError, ValidationDetail } from '../../src/errors'; | ||
import { AcrolinxEndpoint, isSigninSuccessResult, SigninSuccessResult } from '../../src/index'; | ||
import { SigninLinksResult } from '../../src/signin'; | ||
import { waitMs } from '../../src/utils/mixed-utils'; | ||
import * as checkResultSchema from '../schemas/check-result.json'; | ||
import * as termHarvestingReportSchema from '../schemas/term-harvesting-report.json'; | ||
import {describeIf, expectFailingPromise, testIf} from '../test-utils/utils'; | ||
import { describeIf, expectFailingPromise, testIf } from '../test-utils/utils'; | ||
@@ -60,3 +60,3 @@ dotenv.config(); | ||
const ajv = new Ajv({allErrors: true}); | ||
const ajv = new Ajv({ allErrors: true }); | ||
@@ -94,3 +94,3 @@ function createEndpoint(acrolinxUrl: string) { | ||
expect(error.status).toEqual(404); | ||
expect(error.httpRequest).toEqual({method: 'GET', url: TEST_SERVER_URL + '/not-there'}); | ||
expect(error.httpRequest).toEqual({ method: 'GET', url: TEST_SERVER_URL + '/not-there' }); | ||
} | ||
@@ -103,3 +103,3 @@ expect.hasAssertions(); | ||
await expectFailingPromise(api.getJsonFromPath(DUMMY_PATH), ErrorType.HttpConnectionProblem, | ||
{method: 'GET', url: 'http://non-extisting-server' + DUMMY_PATH}); | ||
{ method: 'GET', url: 'http://non-extisting-server' + DUMMY_PATH }); | ||
}, LONG_TIME_OUT_MS); | ||
@@ -111,3 +111,3 @@ | ||
await expectFailingPromise(api.getJsonFromPath(DUMMY_PATH), ErrorType.HttpConnectionProblem, | ||
{method: 'GET', url: invalidAcrolinxUrl + DUMMY_PATH}); | ||
{ method: 'GET', url: invalidAcrolinxUrl + DUMMY_PATH }); | ||
@@ -132,3 +132,3 @@ }, LONG_TIME_OUT_MS); | ||
it('should return the provided API-Token', async () => { | ||
const result = await api.signin({accessToken: ACROLINX_API_TOKEN}) as SigninSuccessResult; | ||
const result = await api.signin({ accessToken: ACROLINX_API_TOKEN }) as SigninSuccessResult; | ||
expect(result.data.accessToken).toBe(ACROLINX_API_TOKEN); | ||
@@ -139,3 +139,3 @@ expect(result.data.user.username).toBe(ACROLINX_API_USERNAME); | ||
it('should return client properties', async () => { | ||
const result = await api.signin({accessToken: ACROLINX_API_TOKEN}) as SigninSuccessResult; | ||
const result = await api.signin({ accessToken: ACROLINX_API_TOKEN }) as SigninSuccessResult; | ||
expect(Object.keys(result.data.integration.properties).length).toBeGreaterThan(0); | ||
@@ -147,3 +147,3 @@ }); | ||
const signinPollResultPromise = api.pollForSignin({ | ||
data: {interactiveLinkTimeout: 0}, | ||
data: { interactiveLinkTimeout: 0 }, | ||
links: { | ||
@@ -160,7 +160,7 @@ interactive: 'dummy', | ||
const result = await api.signin({ | ||
genericToken: SSO_GENERIC_TOKEN!, | ||
username: SSO_USERNAME!, | ||
} | ||
genericToken: SSO_GENERIC_TOKEN!, | ||
username: SSO_USERNAME!, | ||
} | ||
) as SigninSuccessResult; | ||
expect(result.data.user.id).toContain(SSO_USERNAME); | ||
expect(result.data.user.username).toContain(SSO_USERNAME); | ||
}); | ||
@@ -215,6 +215,6 @@ | ||
if (!checkRequest.document) { | ||
checkRequest.document = {reference: 'filename.txt'}; | ||
checkRequest.document = { reference: 'filename.txt' }; | ||
} | ||
return {content: 'Testt Textt with errror', ...checkRequest}; | ||
return { content: 'Testt Textt with errror', ...checkRequest }; | ||
} | ||
@@ -243,3 +243,3 @@ | ||
async function checkAndWaitUntilFinished(checkOptions?: CheckOptions): Promise<CheckResult> { | ||
const check = await createDummyCheck({checkOptions}); | ||
const check = await createDummyCheck({ checkOptions }); | ||
@@ -263,3 +263,3 @@ let checkResultOrProgress; | ||
beforeEach(async () => { | ||
const result = await api.signin({accessToken: ACROLINX_API_TOKEN}) as SigninSuccessResult; | ||
const result = await api.signin({ accessToken: ACROLINX_API_TOKEN }) as SigninSuccessResult; | ||
user = await api.getUserData(ACROLINX_API_TOKEN, result.data.user.id); | ||
@@ -314,8 +314,8 @@ }); | ||
await expectFailingPromise<AcrolinxError>(api.postServerNotifications(ACROLINX_API_TOKEN, { | ||
title: 'dummyTitle', | ||
body: 'dummyBody', | ||
start: Date.now(), | ||
end: Date.now() + 1000 * 60 | ||
}), ErrorType.InsufficientPrivileges, | ||
{method: 'POST', url: TEST_SERVER_URL + '/api/v1/broadcasts/platform-notifications/'}); | ||
title: 'dummyTitle', | ||
body: 'dummyBody', | ||
start: Date.now(), | ||
end: Date.now() + 1000 * 60 | ||
}), ErrorType.InsufficientPrivileges, | ||
{ method: 'POST', url: TEST_SERVER_URL + '/api/v1/broadcasts/platform-notifications/' }); | ||
}); | ||
@@ -389,3 +389,3 @@ }); | ||
await expectFailingPromise(api.cancelCheck('invalid token', check), ErrorType.Auth, | ||
{method: 'DELETE', url: check.links.cancel}); | ||
{ method: 'DELETE', url: check.links.cancel }); | ||
}); | ||
@@ -405,3 +405,3 @@ | ||
it('exception GuidanceProfileDoesNotExist for unknown id', async () => { | ||
await expectFailingPromise(checkAndWaitUntilFinished({guidanceProfileId: '12345-invalid'}), | ||
await expectFailingPromise(checkAndWaitUntilFinished({ guidanceProfileId: '12345-invalid' }), | ||
ErrorType.GuidanceProfileDoesNotExist); | ||
@@ -411,3 +411,3 @@ }); | ||
it('exception GuidanceProfileDoesNotExist for invalid uuid', async () => { | ||
await expectFailingPromise(checkAndWaitUntilFinished({guidanceProfileId: 'invalid!uuid'}), | ||
await expectFailingPromise(checkAndWaitUntilFinished({ guidanceProfileId: 'invalid!uuid' }), | ||
ErrorType.GuidanceProfileDoesNotExist); | ||
@@ -455,3 +455,3 @@ }); | ||
content: '<tag>test</wrong>', | ||
checkOptions: {contentFormat: 'XML'} | ||
checkOptions: { contentFormat: 'XML' } | ||
})); | ||
@@ -487,4 +487,4 @@ | ||
content: 'This text is nice.', | ||
checkOptions: {batchId}, | ||
document: {reference: 'nice.txt'} | ||
checkOptions: { batchId }, | ||
document: { reference: 'nice.txt' } | ||
})).promise; | ||
@@ -494,4 +494,4 @@ | ||
content: 'Thiss textt iss stupidd', | ||
checkOptions: {batchId}, | ||
document: {reference: 'stupid.txt'} | ||
checkOptions: { batchId }, | ||
document: { reference: 'stupid.txt' } | ||
})).promise; | ||
@@ -577,9 +577,9 @@ | ||
ranges: [{ | ||
original: {begin: 0, end: 1}, extracted: {begin: 0, end: 1}, changed: false | ||
original: { begin: 0, end: 1 }, extracted: { begin: 0, end: 1 }, changed: false | ||
}, { | ||
original: {begin: 4, end: 10}, extracted: {begin: 1, end: 2}, changed: true | ||
original: { begin: 4, end: 10 }, extracted: { begin: 1, end: 2 }, changed: true | ||
}, { | ||
original: {begin: 10, end: 11}, extracted: {begin: 2, end: 3}, changed: false | ||
original: { begin: 10, end: 11 }, extracted: { begin: 2, end: 3 }, changed: false | ||
}, { | ||
original: {begin: 15, end: 18}, extracted: {begin: 3, end: 6}, changed: false | ||
original: { begin: 15, end: 18 }, extracted: { begin: 3, end: 6 }, changed: false | ||
}] | ||
@@ -650,3 +650,3 @@ }); | ||
const tokenVerificationResult2: SuccessResponse<AppAccessTokenValidationResult> = | ||
await fetch(appTokenResult.validationRequest.url, {headers: appTokenResult.validationRequest.headers}) | ||
await fetch(appTokenResult.validationRequest.url, { headers: appTokenResult.validationRequest.headers }) | ||
.then(r => r.json()); | ||
@@ -653,0 +653,0 @@ |
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
538479
168
10498
85