Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API v2024-07 support #6

Merged
merged 30 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6cd4035
renaming old order concept to dataset
Maldris Aug 12, 2024
483519c
boiler plate for new types
Maldris Aug 13, 2024
efa4842
mocking new order endpoints and path scheme
Maldris Aug 13, 2024
d8e60e0
updating documentation comments for endpoint documentation references
Maldris Aug 13, 2024
f12dee4
updating list endpoints to have new pagination structure
Maldris Aug 13, 2024
cb6ef76
adding pagination to list endpoints
Maldris Aug 13, 2024
95c0d88
separating list parsing into utility
Maldris Aug 13, 2024
5d012a5
campaign get datasets getter (and retrieve from endpoint
Maldris Aug 13, 2024
c7dffc8
caching campaign datasets
Maldris Aug 13, 2024
0cc59f3
decoding campaign datasets in from json
Maldris Aug 13, 2024
db043d7
providing campaign and dataset list getters for orders
Maldris Aug 13, 2024
da7e204
fixing path's in order sub list calls
Maldris Aug 13, 2024
2a7b7b7
order endpoints now return the new order structure
Maldris Aug 13, 2024
48203d9
handling new search response structure
Maldris Aug 13, 2024
34cdbd9
moving order structure back into archive
Maldris Aug 13, 2024
c3d7894
implementing order structures for tasking in the tasking package
Maldris Aug 13, 2024
a6e1b7e
updating references in archive tests
Maldris Aug 13, 2024
b36ec68
updating tasking test references
Maldris Aug 13, 2024
cfd5a4b
cleanup order endpoint errors before adding new endpoints
Maldris Aug 13, 2024
f165ee1
fixing type specifier in sub list debug message
Maldris Aug 14, 2024
762ed74
adding missing manual order status
Maldris Aug 14, 2024
658e2a4
handle custom datasets potentially not having a datetime
Maldris Aug 14, 2024
19dc788
dataset self load points to wrong endpoint
Maldris Aug 14, 2024
a495d7c
fixing wrong field name in tasking response decode
Maldris Aug 14, 2024
16ab604
updating environment variable references
Maldris Aug 14, 2024
1723648
updating order api test suite for new endpoints
Maldris Aug 14, 2024
d1802b6
fixing field name in priority encoding
Maldris Aug 15, 2024
6f17760
fixing status code checking of tasking orders
Maldris Aug 15, 2024
89aecb2
adding new env config for test environment
Maldris Aug 15, 2024
53611d3
adding other missing secret values and fixing name-spacing of secrets
Maldris Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
test_order_bundle: ${{ secrets.test_order_bundle }}
test_order_eula: ${{ secrets.test_order_eula }}
test_order_id: ${{ secrets.test_order_id }}
test_campaign_id: ${{ secrets.test_campaign_id }}
test_dataset_id: ${{ secrets.test_dataset_id }}
test_resource_id: ${{ secrets.test_resource_id }}
test_resource_file1: ${{ secrets.test_resource_file1 }}
test_resource_file2: ${{ secrets.test_resource_file2 }}
Expand All @@ -25,6 +27,8 @@ jobs:
test_tasking_order_key2: ${{ secrets.test_tasking_order_key2 }}
test_tasking_order_eula: ${{ secrets.test_tasking_order_eula }}
test_tasking_order_bundle: ${{ secrets.test_tasking_order_bundle }}
test_tasking_order_priority: ${{ secrets.test_tasking_order_priority }}
test_tasking_order_cloud: ${{ secrets.test_tasking_order_cloud }}
build:
needs: test
runs-on: ubuntu-latest
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
required: true
test_order_id:
required: true
test_campaign_id:
required: true
test_dataset_id:
required: true
test_resource_id:
required: true
test_resource_file1:
Expand All @@ -41,6 +45,10 @@ on:
required: true
test_tasking_order_bundle:
required: true
test_tasking_order_priority:
required: true
test_tasking_order_cloud:
required: true
pull_request:
types: [opened,edited,synchronize,reopened,ready_for_review,review_requested,]
jobs:
Expand All @@ -64,6 +72,8 @@ jobs:
order_bundle: ${{ secrets.test_order_bundle }}
order_eula: ${{ secrets.test_order_eula }}
order_id: ${{ secrets.test_order_id }}
campaign_id: ${{ secrets.test_campaign_id }}
dataset_id: ${{ secrets.test_dataset_id }}
resource_id: ${{ secrets.test_resource_id }}
resource_file1: ${{ secrets.test_resource_file1 }}
resource_file2: ${{ secrets.test_resource_file2 }}
Expand All @@ -73,4 +83,6 @@ jobs:
tasking_order_key: ${{ secrets.test_tasking_order_key }}
tasking_order_key2: ${{ secrets.test_tasking_order_key2 }}
tasking_order_eula: ${{ secrets.test_tasking_order_eula }}
tasking_order_bundle: ${{ secrets.test_tasking_order_bundle }}
tasking_order_bundle: ${{ secrets.test_tasking_order_bundle }}
tasking_order_priority: ${{ secrets.test_tasking_order_priority }}
tasking_order_cloud: ${{ secrets.test_tasking_order_cloud }}
20 changes: 11 additions & 9 deletions e2e/archive/batch-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Arlula from "../../dist";
import OrderRequest from "../../dist/orders/order-request";
import BatchOrderRequest from "../../dist/orders/batch-order";
import Order, { OrderStatus } from "../../dist/orders/order";
import OrderRequest from "../../dist/archive/order-request";
import BatchOrderRequest from "../../dist/archive/batch-order";
import Order from "../../dist/orders/order";
import { StatusCode } from "../../dist/orders/status";

const tests = [
test1,
Expand All @@ -26,22 +27,23 @@ function test1(client: Arlula) {
req.addOrder(new OrderRequest(process.env.order_key || "", process.env.order_eula || "", process.env.order_bundle || "default"));
req.addOrder(new OrderRequest(process.env.order_key2 || "", process.env.order_eula || "", process.env.order_bundle || "default"));
return client.archive().batchOrder(req)
.then((resp) => {
if (resp.length != 2) {
.then(async (resp) => {
const ds = await resp.datasets;
if (ds.length != 2) {
console.error("archive batch 1 - Response to batch order does not match request length");
return Promise.reject("archive batch 1 - Response to batch order does not match request length");
}
for (let i=0; i<resp.length; i++) {
if (!resp[i].id) {
for (let i=0; i<ds.length; i++) {
if (!ds[i].id) {
console.error("archive batch 1 - Receives batch order without ID");
return Promise.reject("archive batch 1 - Receives batch order without ID");
}
// pre defined landsat order, will be complete and have resource results
if (resp[i].status !== OrderStatus.Complete) {
if (ds[i].status !== StatusCode.Complete) {
console.error("archive batch 1 - batch order not complete");
return Promise.reject("archive batch 1 - batch order not complete");
}
if (!resp[i].resources) {
if (!ds[i].resources) {
console.error("archive batch 1 - Landsat batch order with no resources");
return Promise.reject("archive batch 1 - Landsat batch order with no resources");
}
Expand Down
42 changes: 27 additions & 15 deletions e2e/archive/order-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Arlula from "../../dist";
import OrderRequest from "../../dist/orders/order-request";
import OrderRequest from "../../dist/archive/order-request";
import SearchRequest from "../../dist/archive/search-request";
import SearchResult from "../../dist/archive/search/result";
import Order, { OrderStatus } from "../../dist/orders/order";
import Order from "../../dist/orders/order";
import { StatusCode } from "../../dist/orders/status";

const tests = [
test1,
Expand All @@ -25,17 +26,22 @@ function test1(client: Arlula) {
console.log("archive order 1");
const req = new OrderRequest(process.env.order_key || "", process.env.order_eula || "", process.env.order_bundle || "default");
return client.archive().order(req)
.then((resp) => {
.then(async (resp) => {
if (!resp.id) {
console.error("archive order 1 - Receives order without ID");
return Promise.reject("archive order 1 - Receives order without ID");
}
// pre defined landsat order, will be complete and have resource results
if (resp.status !== OrderStatus.Complete) {
if (resp.status !== StatusCode.Complete) {
console.error("archive order 1 - order not complete");
return Promise.reject("archive order 1 - order not complete");
}
if (!resp.resources) {
const ds = await resp.datasets;
if (!ds) {
console.error("archive order 1 - Landsat order with no datasets");
return Promise.reject("archive order 1 - Landsat order with no datasets");
}
if (!ds[0].resources) {
console.error("archive order 1 - Landsat order with no resources");
return Promise.reject("archive order 1 - Landsat order with no resources");
}
Expand All @@ -56,7 +62,7 @@ function test2(client: Arlula) {
sceneLoop:
for (let i=0; i<resp.results.length; i++) {
for (let j=0; j<resp.results[i].licenses.length; j++) {
if (resp.results[i].bundles[j].price == 0 && resp.results[i].licenses[j].href == (process.env.order_eula || "")) {
if (resp.results[i].bundles[0].price == 0 && resp.results[i].licenses[j].href == (process.env.order_eula || "")) {
scene = resp.results[i];
break sceneLoop;
}
Expand All @@ -66,20 +72,26 @@ function test2(client: Arlula) {
console.error("archive order 2 - no valid orders found");
return Promise.reject("archive order 2 - no valid orders found");
}
const req = new OrderRequest(process.env.order_key || "", process.env.order_eula || "", process.env.order_bundle || "default");
const req = new OrderRequest(scene, process.env.order_eula || "", process.env.order_bundle || "default");
return client.archive().order(req)
})
.then((resp) => {
.then(async (resp) => {
if (!resp.id) {
console.error("archive order 2 - Receives order without ID");
return Promise.reject("archive order 2 - Receives order without ID");
}
// pre defined landsat order, will be complete and have resource results
if (resp.status !== OrderStatus.Complete) {
if (resp.status !== StatusCode.Complete) {
console.error("archive order 2 - order not complete");
return Promise.reject("archive order 2 - order not complete");
}
if (!resp.resources) {
const ds = await resp.datasets;
if (!ds) {
console.error("archive order 2 - Landsat order with no datasets");
return Promise.reject("archive order 2 - Landsat order with no datasets");
}

if (!ds[0].resources) {
console.error("archive order 2 - Landsat order with no resources");
return Promise.reject("archive order 2 - Landsat order with no resources");
}
Expand All @@ -100,7 +112,7 @@ function testError1(client: Arlula) {
console.error("archive order error 1 - unexpected error: ", e);
return Promise.reject("archive order error 1 - "+e);
}
if (!e.startsWith("Invalid ordering ID")) {
if (!e.startsWith("Invalid `id`")) {
console.error("archive order error 1 - Unexpected error response: ", e)
return Promise.reject("archive order error 1 - "+e);
}
Expand All @@ -117,7 +129,7 @@ function testError2(client: Arlula) {
console.error("archive order error 2 - unexpected error: ", e);
return Promise.reject("archive order error 2 - "+e);
}
if (!e.startsWith("You must confirm acceptance of the EULA")) {
if (!e.startsWith("Invalid `eula`")) {
console.error("archive order error 2 - Unexpected error response: ", e)
return Promise.reject("archive order error 2 - "+e);
}
Expand All @@ -134,7 +146,7 @@ function testError3(client: Arlula) {
console.error("archive order error 3 - unexpected error: ", e);
return Promise.reject("archive order error 3 - "+e);
}
if (!e.startsWith("Selected bundle is not an available option of this order")) {
if (!e.startsWith("Invalid `bundleKey`")) {
console.error("archive order error 3 - Unexpected error response: ", e)
return Promise.reject("archive order error 3 - "+e);
}
Expand All @@ -144,8 +156,8 @@ function testError3(client: Arlula) {

function exceptionHandler(label: string) {
return function (e: string) {
console.error("Error executing " + label + ": ", JSON.stringify(e));
return Promise.reject(label+": "+JSON.stringify(e));
console.error("Error executing " + label + ": ", e);
return Promise.reject(label+": "+e);
}
}

Expand Down
10 changes: 5 additions & 5 deletions e2e/collections/item-cud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export default function runItemCUDTests(client: Arlula): Promise<unknown> {

function test1ItemAdd(client: Arlula) {
console.log("item-cud 1 - add");
return client.collections().itemAdd(process.env.collection_id || "", process.env.order_id || "")
return client.collections().itemAdd(process.env.collection_id || "", process.env.dataset_id || "")
.then(async () => {
await new Promise((resolve, reject) => {
setTimeout(() => {
client.collections().itemGet(process.env.collection_id || "", process.env.order_id || "")
client.collections().itemGet(process.env.collection_id || "", process.env.dataset_id || "")
.then((resp) => {
if (!resp) {
console.log("collection item cud 1 - add: empty response");
Expand All @@ -29,7 +29,7 @@ function test1ItemAdd(client: Arlula) {
console.log("collection item cud 1 - add: no id");
reject("collection item cud 1 - add: no id");
}
if (resp.id != process.env.order_id) {
if (resp.id != process.env.dataset_id) {
console.log("collection item cud 1 - add: unexpected id");
reject("collection item cud 1 - add: unexpected id");
}
Expand All @@ -44,12 +44,12 @@ function test1ItemAdd(client: Arlula) {

function test2ItemRm(client: Arlula) {
console.log("item-cud 2 - rm");
return client.collections().itemAdd(process.env.collection_id || "", process.env.order_id || "")
return client.collections().itemAdd(process.env.collection_id || "", process.env.dataset_id || "")
.then(async () => {
// TODO: establish the cache duration before uncommenting this
// await new Promise((resolve, reject) => {
// setTimeout(() => {
// client.collections().itemGet(process.env.collection_id || "", process.env.order_id || "")
// client.collections().itemGet(process.env.collection_id || "", process.env.dataset_id || "")
// .then((resp) => {
// if (resp) {
// console.log("collection item cud 2 - rm: response to removed item");
Expand Down
Loading
Loading