Skip to content

Commit

Permalink
v1.8.6 (#38)
Browse files Browse the repository at this point in the history
* Added support for very large OCR documents

* #37 - rename contentUrl to contentUrls

* #31 - Add FormKiQ Version to CloudFormation description
  • Loading branch information
mfriesen authored Sep 5, 2022
1 parent 6fe588e commit 58e5ed6
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 37 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ The following are AWS CloudFormation scripts that can be used to install FormKiQ

| AWS Region | Install Link |
| ------------- | -------------|
| us-east-1 | [Install FormKiQ Core in US-EAST-1 region](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-us-east-1.s3.amazonaws.com/1.8.4/template.yaml)
| us-east-2 | [Install FormKiQ Core in US-EAST-2 region](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-us-east-2.s3.amazonaws.com/1.8.4/template.yaml)
| ca-central-1| [Install FormKiQ Core in CA-CENTRAL-1 region](https://console.aws.amazon.com/cloudformation/home?region=ca-central-1#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-ca-central-1.s3.amazonaws.com/1.8.4/template.yaml)
| eu-central-1| [Install FormKiQ Core in EU-CENTRAL-1 region](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-eu-central-1.s3.amazonaws.com/1.8.4/template.yaml)
| us-east-1 | [Install FormKiQ Core in US-EAST-1 region](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-us-east-1.s3.amazonaws.com/1.8.6/template.yaml)
| us-east-2 | [Install FormKiQ Core in US-EAST-2 region](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-us-east-2.s3.amazonaws.com/1.8.6/template.yaml)
| ca-central-1| [Install FormKiQ Core in CA-CENTRAL-1 region](https://console.aws.amazon.com/cloudformation/home?region=ca-central-1#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-ca-central-1.s3.amazonaws.com/1.8.6/template.yaml)
| eu-central-1| [Install FormKiQ Core in EU-CENTRAL-1 region](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/new?stackName=formkiq-core-prod&templateURL=https://formkiq-core-distribution-eu-central-1.s3.amazonaws.com/1.8.6/template.yaml)

## Architecture

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def moduleName = "formkiq-core"
repositories { mavenCentral() }

allprojects {
version = '1.8.5'
version = '1.8.6'
ext.awsCognitoVersion = '1.4.1'
group = 'com.formkiq.stacks'

Expand Down
2 changes: 1 addition & 1 deletion fkq-test-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies {
implementation project(':aws-dynamodb')
implementation group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.12.281'
implementation group: 'com.amazonaws', name: 'aws-lambda-java-core', version: '1.2.1'
implementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.2'
implementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.6'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.1'
implementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version:'5.9.0'
implementation group: 'org.testcontainers', name: 'testcontainers', version: '1.17.3'
Expand Down
2 changes: 1 addition & 1 deletion lambda-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {

implementation group: 'com.formkiq', name: 'lambda-runtime-graalvm', version:'2.3.1'
implementation group: 'com.formkiq', name: 'graalvm-annotations', version: '1.1.0'
implementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.2'
implementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.6'

implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ApiRequestHandlerResponse delete(final LambdaLogger logger,
ApiMapResponse resp = new ApiMapResponse();
return new ApiRequestHandlerResponse(SC_PAYMENT, resp);
}

@Override
public ApiRequestHandlerResponse get(final LambdaLogger logger,
final ApiGatewayRequestEvent event, final ApiAuthorizer authorizer,
Expand Down
8 changes: 5 additions & 3 deletions lambda-api/src/main/resources/cloudformation/api-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Resources:
title:
Fn::Sub: "${AWS::StackName} IAM API - ${AppEnvironment}"
description: "FormKiQ IAM API"
version: "1.8.5"
version: "1.8.6"
paths:
/version:
get:
Expand Down Expand Up @@ -2287,8 +2287,10 @@ Resources:
content:
type: "string"
description: "Document content"
contentUrl:
type: "string"
contentUrls:
type: "array"
items:
type: "string"
description: "Url which contains Document content"
FulltextUpdateBody:
type: object
Expand Down
8 changes: 5 additions & 3 deletions lambda-api/src/main/resources/cloudformation/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Resources:
title:
Fn::Sub: "${AWS::StackName} HTTP API - ${AppEnvironment}"
description: "FormKiQ HTTP API"
version: "1.8.5"
version: "1.8.6"
paths:
/version:
get:
Expand Down Expand Up @@ -2287,8 +2287,10 @@ Resources:
content:
type: "string"
description: "Document content"
contentUrl:
type: "string"
contentUrls:
type: "array"
items:
type: "string"
description: "Url which contains Document content"
FulltextUpdateBody:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void testHandleGetDocumentFulltext01() throws Exception {
assertEquals(getHeaders(), "\"headers\":" + GsonUtil.getInstance().toJson(m.get("headers")));
}
}

/**
* PUT /documents/{documentId}/fulltext request.
*
Expand Down
2 changes: 1 addition & 1 deletion lambda-s3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {

implementation group: 'com.formkiq', name: 'lambda-runtime-graalvm', version:'2.3.1'
implementation group: 'com.formkiq', name: 'graalvm-annotations', version: '1.1.0'
implementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.3'
implementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.6'

implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
testImplementation project(':fkq-test-utils')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ private String buildWebhookBody(final String siteId, final String documentId,
*
* @param siteId {@link String}
* @param documentId {@link String}
* @return {@link String}
* @return {@link List} {@link String}
* @throws InterruptedException InterruptedException
* @throws IOException IOException
*/
@SuppressWarnings("unchecked")
private String findContentUrl(final String siteId, final String documentId)
private List<String> findContentUrls(final String siteId, final String documentId)
throws IOException, InterruptedException {

String url = null;
List<String> urls = null;
DocumentItem item = this.documentService.findDocument(siteId, documentId);
String s3Key = SiteIdKeyGenerator.createS3Key(siteId, documentId);

Expand All @@ -231,7 +231,9 @@ private String findContentUrl(final String siteId, final String documentId)

String bucket =
MimeType.isPlainText(item.getContentType()) ? this.documentsBucket : this.ocrBucket;
url = this.s3Service.presignGetUrl(bucket, s3Key, Duration.ofHours(1), null).toString();
String url =
this.s3Service.presignGetUrl(bucket, s3Key, Duration.ofHours(1), null).toString();
urls = Arrays.asList(url);

} else {

Expand All @@ -242,16 +244,16 @@ private String findContentUrl(final String siteId, final String documentId)
req.addQueryParameter("text", "true");

HttpResponse<String> response = this.formkiqClient.getDocumentOcrAsHttpResponse(req);
Map<String, String> map = this.gson.fromJson(response.body(), Map.class);
Map<String, Object> map = this.gson.fromJson(response.body(), Map.class);

if (map.containsKey("contentUrl")) {
url = map.get("contentUrl");
if (map.containsKey("contentUrls")) {
urls = (List<String>) map.get("contentUrls");
} else {
throw new IOException("Cannot find 'contentUrl' from OCR request");
throw new IOException("Cannot find 'contentUrls' from OCR request");
}
}

return url;
return urls;
}
}

Expand Down Expand Up @@ -324,9 +326,9 @@ private void processAction(final String siteId, final String documentId, final A

} else if (ActionType.FULLTEXT.equals(action.type())) {

String contentUrl = findContentUrl(siteId, documentId);
List<String> contentUrls = findContentUrls(siteId, documentId);

SetDocumentFulltext fulltext = new SetDocumentFulltext().contentUrl(contentUrl);
SetDocumentFulltext fulltext = new SetDocumentFulltext().contentUrls(contentUrls);
SetDocumentFulltextRequest req =
new SetDocumentFulltextRequest().siteId(siteId).documentId(documentId).document(fulltext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void testHandle02() throws IOException, URISyntaxException {
HttpRequest lastRequest = callback.getLastRequest();
assertTrue(lastRequest.getPath().toString().endsWith("/fulltext"));
Map<String, Object> resultmap = gson.fromJson(lastRequest.getBodyAsString(), Map.class);
assertNotNull(resultmap.get("contentUrl").toString());
assertNotNull(resultmap.get("contentUrls").toString());
}
}

Expand Down Expand Up @@ -278,7 +278,7 @@ public void testHandle03() throws IOException, URISyntaxException {
HttpRequest lastRequest = callback.getLastRequest();
assertTrue(lastRequest.getPath().toString().endsWith("/fulltext"));
Map<String, Object> resultmap = gson.fromJson(lastRequest.getBodyAsString(), Map.class);
assertNotNull(resultmap.get("contentUrl").toString());
assertNotNull(resultmap.get("contentUrls").toString());
}
}

Expand Down
8 changes: 5 additions & 3 deletions openapi-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
info:
title: FormKiQ IAM API
description: FormKiQ IAM API
version: 1.8.5
version: 1.8.6
paths:
/version:
get:
Expand Down Expand Up @@ -2280,8 +2280,10 @@
content:
type: string
description: Document content
contentUrl:
type: string
contentUrls:
type: array
items:
type: string
description: Url which contains Document content
FulltextUpdateBody:
type: object
Expand Down
8 changes: 5 additions & 3 deletions openapi-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
info:
title: FormKiQ HTTP API
description: FormKiQ HTTP API
version: 1.8.5
version: 1.8.6
paths:
/version:
get:
Expand Down Expand Up @@ -2280,8 +2280,10 @@
content:
type: string
description: Document content
contentUrl:
type: string
contentUrls:
type: array
items:
type: string
description: Url which contains Document content
FulltextUpdateBody:
type: object
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/cloudformation/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: FormKiQ Core
Description: #@ "FormKiQ Core " + data.values.version or assert.fail("missing version")

Parameters:

Expand Down
2 changes: 1 addition & 1 deletion websocket-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies {
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.9.1'
testImplementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.5.3'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
testImplementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.2'
testImplementation group: 'com.formkiq.stacks', name: 'client', version:'1.8.6'
}

test {
Expand Down

0 comments on commit 58e5ed6

Please sign in to comment.