diff --git a/concourse/update-content/script.bash b/concourse/update-content/script.bash index 9fca2d9582..33788f151e 100755 --- a/concourse/update-content/script.bash +++ b/concourse/update-content/script.bash @@ -11,13 +11,19 @@ fi # this is here so the creds don't get pasted to the output set -e; if [ -n "$DEBUG" ]; then set -x; fi -approved_books_default_branch=$(curl -s https://api.github.com/repos/openstax/content-manager-approved-books | jq -r .default_branch) rex_default_branch=$(curl -s https://api.github.com/repos/openstax/rex-web | jq -r .default_branch) -data=$(curl -sL "https://github.com/openstax/content-manager-approved-books/raw/$approved_books_default_branch/approved-book-list.json") - -# script will return a JSON object with book ids and new versions only for books that doesn't mach current config -book_ids_and_versions=$(node script/entry.js transform-approved-books-data --data "$data") +# consumer: Limit entries to those where consumer == +# code_version: Limit entries to those where code_version <= +archive_version="$(jq -r '.REACT_APP_ARCHIVE' "src/config.archive-url.json")" +search="consumer=REX&code_version=$archive_version" +abl_url="https://corgi.ce.openstax.org/api/abl/?$search" + +book_ids_and_versions="$( + bash script/transform-approved-books-data.bash \ + <(curl -sL --fail --show-error "$abl_url") \ + "src/config.books.json" +)" book_entries=$(echo "$book_ids_and_versions" | jq -c 'to_entries | .[]') git remote set-branches origin 'update-content-*' diff --git a/script/transform-approved-books-data.bash b/script/transform-approved-books-data.bash new file mode 100755 index 0000000000..bc04b29943 --- /dev/null +++ b/script/transform-approved-books-data.bash @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e + +: "${1:?'First argument should be a file containing CORGI ABL array'}" +: "${2:?'Second argument should be a file containing configured books object'}" + +jq --slurp --compact-output ' +.[0] as $corgi_abl | +.[1] as $configured_books | +$corgi_abl | +if (type != "array") then error("Bad ABL data") else . end | +$configured_books | +if (type != "object") then error("Bad book config") else . end | +[ + # Get the newest version of each book + $corgi_abl | group_by(.uuid) | .[] | sort_by(.commited_at) | .[-1] | + + # Store information about the entry (uuid and short sha) + .uuid as $uuid | + (.commit_sha | .[0:7]) as $commit_sha | + + # Select entries that do not match configured books + select($configured_books | .[$uuid] | .defaultVersion != $commit_sha) | + { key: .uuid, value: $commit_sha } +] | from_entries +' "$@" diff --git a/script/transform-approved-books-data.ts b/script/transform-approved-books-data.ts deleted file mode 100644 index e52c425502..0000000000 --- a/script/transform-approved-books-data.ts +++ /dev/null @@ -1,314 +0,0 @@ -import semverSort from 'semver-sort'; -import { argv } from 'yargs'; -import { assertNotNull } from '../src/app/utils'; -import { REACT_APP_ARCHIVE_URL } from '../src/config'; -import configuredBooks from '../src/config.books'; - -// Example archive code version: 20210224.204120 -const archiveVersion = assertNotNull( - REACT_APP_ARCHIVE_URL.match(/[0-9]+\.[0-9]+/), - 'REACT_APP_ARCHIVE_URL does not contain valid code version' -)[0]; - -interface BookData { - uuid: string; - slug: string; -} - -const isBookData = (something: any): something is BookData => { - return typeof something.uuid === 'string' && typeof something.slug === 'string'; -}; - -interface ApprovedBooksDataVer1 { - style: string; - tutor_only: boolean; - books: BookData[]; -} - -const isApprovedBooksDataVer1 = (something: any): something is ApprovedBooksDataVer1 => { - return typeof something.style === 'string' - && typeof something.tutor_only === 'boolean' - && Array.isArray(something.books) - && something.books.every(isBookData); -}; - -interface ApprovedCollectionVer1 extends ApprovedBooksDataVer1 { - collection_id: string; - server: string; -} - -const isApprovedCollectionVer1 = (something: any): something is ApprovedCollectionVer1 => { - return typeof something.collection_id === 'string' - && typeof something.server === 'string' - && isApprovedBooksDataVer1(something); -}; - -interface ApprovedRepoVer1 extends ApprovedBooksDataVer1 { - repository_name: string; -} - -const isApprovedRepoVer1 = (something: any): something is ApprovedRepoVer1 => { - return typeof something.repository_name === 'string' && isApprovedBooksDataVer1(something); -}; - -interface ApprovedVersionVer1 { - content_version: string; - min_code_version: string; -} - -const isApprovedVersionVer1 = (something: any): something is ApprovedVersionVer1 => { - return typeof something.content_version === 'string' && typeof something.min_code_version === 'string'; -}; - -interface ApprovedVersionCollectionVer1 extends ApprovedVersionVer1 { - collection_id: string; -} - -const isApprovedVersionCollectionVer1 = (something: any): something is ApprovedVersionCollectionVer1 => { - return typeof something.collection_id === 'string' && isApprovedVersionVer1(something); -}; - -interface ApprovedVersionRepoVer1 extends ApprovedVersionVer1 { - repository_name: string; -} - -const isApprovedVersionRepoVer1 = (something: any): something is ApprovedVersionRepoVer1 => { - return typeof something.repository_name === 'string' && isApprovedVersionVer1(something); -}; - -interface ApprovedBooksAndVersionsVer1 { - approved_books: Array; - approved_versions: Array; -} - -const isApprovedBooksAndVersionsVer1 = (something: any): something is ApprovedBooksAndVersionsVer1 => { - return Array.isArray(something.approved_books) - && something.approved_books.every( - (element: any) => isApprovedCollectionVer1(element) || isApprovedRepoVer1(element)) - && something.approved_versions.every( - (element: any) => isApprovedVersionCollectionVer1(element) || isApprovedVersionRepoVer1(element)); -}; - -enum ApprovedPlatformKindVer2 { - REX = 'REX', - Tutor = 'TUTOR', -} - -type ApprovedPlatformVer2 = ApprovedPlatformKindVer2.REX | ApprovedPlatformKindVer2.Tutor; - -const isApprovedPlatformVer2 = (str: string) => { - return str === ApprovedPlatformKindVer2.REX || str === ApprovedPlatformKindVer2.Tutor; -}; - -interface ApprovedRepoVer2 { - repository_name: string; - platforms: ApprovedPlatformVer2[]; - versions: ApprovedRepoVersionVer2[]; -} - -const isApprovedRepoVer2 = (something: any): something is ApprovedRepoVer2 => { - return typeof something.repository_name === 'string' - && Array.isArray(something.platforms) - && something.platforms.every( - (element: any) => isApprovedPlatformVer2(element) - ) - && Array.isArray(something.versions) - && something.versions.every( - (element: any) => isApprovedRepoVersionVer2(element) - ); -}; -interface ApprovedRepoVersionVer2 { - min_code_version: string; // TODO: Since everyone is treating this as a number should this just become a number? - edition: number; - commit_sha: string; - commit_metadata: { - committed_at: string, - books: ApprovedRepoVersionBookVer2[] - }; -} - -const isApprovedRepoVersionVer2 = (something: any): something is ApprovedRepoVersionVer2 => { - return typeof something.min_code_version === 'string' - && typeof something.edition === 'number' - && typeof something.commit_sha === 'string' - && typeof something.commit_metadata === 'object' - && typeof something.commit_metadata.committed_at === 'string' - && Array.isArray(something.commit_metadata.books) - && something.commit_metadata.books.every( - (element: any) => isApprovedRepoVersionBookVer2(element) - ); -}; - -interface ApprovedRepoVersionBookVer2 { - style: string; - uuid: string; - slug: string; -} - -const isApprovedRepoVersionBookVer2 = (something: any): something is ApprovedRepoVersionBookVer2 => { - return typeof something.style === 'string' - && typeof something.uuid === 'string' - && typeof something.slug === 'string'; -}; - -interface ApprovedBooksAndVersionsVer2 { - api_version: 2; - approved_books: Array; - approved_versions: ApprovedVersionCollectionVer1[]; -} - -const isApprovedBooksAndVersionsVer2 = (something: any): something is ApprovedBooksAndVersionsVer2 => { - return something.api_version === 2 - && Array.isArray(something.approved_books) - && something.approved_books.every( - (element: any) => isApprovedRepoVer2(element) || isApprovedCollectionVer1(element) - ) - && Array.isArray(something.approved_versions) - && something.approved_versions.every( - (element: any) => isApprovedVersionVer1(element) - ); -}; - -const matchRepoVersionVer1 = (repoData: ApprovedRepoVer1) => - (versionData: ApprovedVersionCollectionVer1 | ApprovedVersionRepoVer1): versionData is ApprovedVersionRepoVer1 => { - if (archiveVersion && versionData.min_code_version > archiveVersion) { return false; } - return isApprovedVersionRepoVer1(versionData) && versionData.repository_name === repoData.repository_name; -}; - -const matchCollectionVersionVer1 = (collectionData: ApprovedCollectionVer1) => - (versionData: ApprovedVersionCollectionVer1 | ApprovedVersionRepoVer1): - versionData is ApprovedVersionCollectionVer1 => { - if (archiveVersion && versionData.min_code_version > archiveVersion) { return false; } - return isApprovedVersionCollectionVer1(versionData) && versionData.collection_id === collectionData.collection_id; -}; - -const getDesiredVersionVer1 = ( - approvedVersions: Array, - colOrRepo: ApprovedRepoVer1 | ApprovedCollectionVer1 -): string | undefined => { - const [filter, transformVersion, sortFunction] = isApprovedCollectionVer1(colOrRepo) - ? [ - matchCollectionVersionVer1(colOrRepo), - (version: string) => version.slice(2), - semverSort.desc, - ] - : [ - matchRepoVersionVer1(colOrRepo), - (version: string) => version, - (array: string[]) => array.sort().reverse(), - ]; - - // only versions for current repo / collection and current archive code version - const filteredVersions = approvedVersions - .filter(filter) - .map((data) => data.content_version); - - // sorted from the highest to the lowest version - const sorted = sortFunction(filteredVersions); - - // collections are using semantic versioning so we are removing first 2 characters - const transformed = sorted.map(transformVersion); - - // we want the most recent one - return transformed[0]; -}; - -const transformDataVer1 = (data: ApprovedBooksAndVersionsVer1): { [key: string]: string } => { - const results: { [key: string]: string } = {}; - - const { approved_books, approved_versions } = data; - - for (const collectionOrRepo of approved_books) { - if ( - collectionOrRepo.tutor_only - || (isApprovedCollectionVer1(collectionOrRepo) && collectionOrRepo.server !== 'cnx.org') - ) { - continue; - } - - const books = collectionOrRepo.books; - const desiredVersion = getDesiredVersionVer1(approved_versions, collectionOrRepo); - - if (!desiredVersion) { - // Skip if we couldn't find the version matching currently used archive version - continue; - } - - for (const book of books) { - if (!configuredBooks[book.uuid] || configuredBooks[book.uuid].defaultVersion !== desiredVersion) { - results[book.uuid] = desiredVersion; - } - } - } - - return results; -}; - -const transformDataVer2 = (data: ApprovedBooksAndVersionsVer2) => { - // get all the v1 archive entries - const v1Data: ApprovedBooksAndVersionsVer1 = { - approved_books: data.approved_books.filter((b) => isApprovedCollectionVer1(b)) as ApprovedCollectionVer1[], - approved_versions: data.approved_versions, - }; - const results = transformDataVer1(v1Data); - - // Add the v2 git entries - const approvedRepos = data.approved_books.filter((b) => isApprovedRepoVer2(b)) as ApprovedRepoVer2[]; - for (const repo of approvedRepos) { - if (!repo.platforms.includes(ApprovedPlatformKindVer2.REX)) { - continue; - } - const versions = repo.versions.sort( - (a, b) => Date.parse(a.commit_metadata.committed_at) - Date.parse(b.commit_metadata.committed_at) - ); - - for (const version of versions) { - if (archiveVersion && version.min_code_version > archiveVersion) { continue; } - - for (const book of version.commit_metadata.books) { - let sha = version.commit_sha; - if (version.commit_sha.length > 7) { - sha = version.commit_sha.substr(0, 7); - } - if (configuredBooks[book.uuid] && configuredBooks[book.uuid].defaultVersion === sha) { - // we are not interested in the currentVersion or any book versions older than that - delete results[book.uuid]; - } else { - results[book.uuid] = sha; - } - } - } - } - - return results; -}; - -const transformData = () => { - const { data } = argv as { data?: string }; - - if (!data) { - throw new Error('data argument is missing'); - } - - let parsed: ApprovedBooksAndVersionsVer1; - let results; - try { - parsed = JSON.parse(data); - if (isApprovedBooksAndVersionsVer2(parsed)) { - results = transformDataVer2(parsed); - } else if (isApprovedBooksAndVersionsVer1(parsed)) { - results = transformDataVer1(parsed); - } else { - throw new Error('Data is valid JSON, but has wrong structure. See ApprovedBooksAndVersions interface.'); - } - } catch (e) { - throw new Error(`Error while parsing data. Details: ${e}`); - } - - // this script is used in the update-content/script.bash - // so we write results to the terminal to assign them to a variable - process.stdout.write(JSON.stringify(results)); - return results; -}; - -transformData(); diff --git a/script/validate-abl-import/test.bash b/script/validate-abl-import/test.bash index 44f6a35de8..e8a08c0594 100755 --- a/script/validate-abl-import/test.bash +++ b/script/validate-abl-import/test.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e @@ -26,9 +26,10 @@ for input_file in "$my_dir"/*.input.json; do # ------------------------- # Actual test goes here # ------------------------- - json=$(cat "$input_file") - node "$my_dir/../entry.js" transform-approved-books-data --data "$json" > "$output_file" + bash "$my_dir/../transform-approved-books-data.bash" \ + <(jq -e '.abl_data' "$input_file") \ + <(jq -e '.configured_books' "$input_file") > "$output_file" diff "$snapshot_file" "$output_file" diff --git a/script/validate-abl-import/v1-archive.input.json b/script/validate-abl-import/v1-archive.input.json deleted file mode 100644 index 60a44cd0c0..0000000000 --- a/script/validate-abl-import/v1-archive.input.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "approved_books": [ - { - "collection_id": "col33604", - "server": "cnx.org", - "style": "u-physics", - "tutor_only": false, - "books": [ - { - "uuid": "da02605d-6d69-447c-a9b9-caf06dc4f413", - "slug": "física-universitaria-volumen-2" - } - ] - } - ], - "approved_versions": [ - { - "collection_id": "col33604", - "content_version": "99999.99.99", - "min_code_version": "20210823.155019" - } - ] -} diff --git a/script/validate-abl-import/v1-archive.snapshot.json b/script/validate-abl-import/v1-archive.snapshot.json deleted file mode 100644 index d3afc60ece..0000000000 --- a/script/validate-abl-import/v1-archive.snapshot.json +++ /dev/null @@ -1 +0,0 @@ -{"da02605d-6d69-447c-a9b9-caf06dc4f413":"999.99.99"} \ No newline at end of file diff --git a/script/validate-abl-import/v1-empty.input.json b/script/validate-abl-import/v1-empty.input.json deleted file mode 100644 index fec1bac2f9..0000000000 --- a/script/validate-abl-import/v1-empty.input.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "approved_books": [], - "approved_versions": [] -} diff --git a/script/validate-abl-import/v1-empty.snapshot.json b/script/validate-abl-import/v1-empty.snapshot.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/script/validate-abl-import/v1-empty.snapshot.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/script/validate-abl-import/v1-git.input.json b/script/validate-abl-import/v1-git.input.json deleted file mode 100644 index 76885dc43a..0000000000 --- a/script/validate-abl-import/v1-git.input.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "approved_books": [ - { - "repository_name": "osbooks-writing-guide", - "style": "english-composition", - "tutor_only": false, - "books": [ - { - "uuid": "ee7ce46b-0972-4b2c-bc6e-8998c785cd57", - "slug": "writing-guide" - } - ] - } - ], - "approved_versions": [ - { - "repository_name": "osbooks-writing-guide", - "content_version": "1", - "min_code_version": "000.000" - } - ] -} \ No newline at end of file diff --git a/script/validate-abl-import/v1-git.snapshot.json b/script/validate-abl-import/v1-git.snapshot.json deleted file mode 100644 index 70dde16605..0000000000 --- a/script/validate-abl-import/v1-git.snapshot.json +++ /dev/null @@ -1 +0,0 @@ -{"ee7ce46b-0972-4b2c-bc6e-8998c785cd57":"1"} \ No newline at end of file diff --git a/script/validate-abl-import/v2-git-multiversion.input.json b/script/validate-abl-import/v2-git-multiversion.input.json deleted file mode 100644 index 2fed32f7d3..0000000000 --- a/script/validate-abl-import/v2-git-multiversion.input.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "api_version": 2, - "approved_books": [ - { - "repository_name": "osbooks-college-algebra-bundle", - "platforms": [ "REX" ], - "versions": [ - { - "min_code_version": "00000000.000000", - "edition": 1, - "commit_sha": "b32463c3eed4f25be9b91e74c014c57ddc865a3d", - "commit_metadata": { - "committed_at": "2021-09-21T18:42:06+00:00", - "books": [ - { - "style": "precalculus", - "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", - "slug": "algebra-and-trigonometry" - }, - { - "style": "precalculus", - "uuid": "9b08c294-057f-4201-9f48-5d6ad992740d", - "slug": "college-algebra" - }, - { - "style": "precalculus", - "uuid": "fd53eae1-fa23-47c7-bb1b-972349835c3c", - "slug": "precalculus" - }, - { - "style": "precalculus-coreq", - "uuid": "507feb1e-cfff-4b54-bc07-d52636cecfe3", - "slug": "college-algebra-corequisite-support" - } - ] - } - }, - { - "min_code_version": "99999999.99999999", - "edition": 2, - "commit_sha": "bad-sha-too-new", - "commit_metadata": { - "committed_at": "2021-12-06T15:03:16+00:00", - "books": [ - { - "style": "precalculus", - "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", - "slug": "algebra-and-trigonometry-2e" - }, - { - "style": "precalculus", - "uuid": "9b08c294-057f-4201-9f48-5d6ad992740d", - "slug": "college-algebra-2e" - }, - { - "style": "precalculus", - "uuid": "fd53eae1-fa23-47c7-bb1b-972349835c3c", - "slug": "precalculus-2e" - }, - { - "style": "precalculus-coreq", - "uuid": "507feb1e-cfff-4b54-bc07-d52636cecfe3", - "slug": "college-algebra-corequisite-support-2e" - } - ] - } - } - ] - } - ], - "approved_versions": [] -} \ No newline at end of file diff --git a/script/validate-abl-import/v2-git-multiversion.snapshot.json b/script/validate-abl-import/v2-git-multiversion.snapshot.json deleted file mode 100644 index 075d72b340..0000000000 --- a/script/validate-abl-import/v2-git-multiversion.snapshot.json +++ /dev/null @@ -1 +0,0 @@ -{"13ac107a-f15f-49d2-97e8-60ab2e3b519c":"b32463c","9b08c294-057f-4201-9f48-5d6ad992740d":"b32463c","fd53eae1-fa23-47c7-bb1b-972349835c3c":"b32463c","507feb1e-cfff-4b54-bc07-d52636cecfe3":"b32463c"} \ No newline at end of file diff --git a/script/validate-abl-import/v2-git-simple.input.json b/script/validate-abl-import/v2-git-simple.input.json deleted file mode 100644 index ee42c05391..0000000000 --- a/script/validate-abl-import/v2-git-simple.input.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "api_version": 2, - "approved_books": [ - { - "repository_name": "osbooks-writing-guide", - "platforms": ["REX"], - "versions": [{ - "min_code_version": "00000000.000000", - "edition": 1, - "commit_sha": "c3f7f0a3aca2f342294c1befdaffb6ec93486e2b", - "commit_metadata": { - "committed_at": "2021-12-02T10:47:06+00:00", - "books": [{ - "style": "english-composition", - "uuid": "ee7ce46b-0972-4b2c-bc6e-8998c785cd57", - "slug": "writing-guide" - }] - } - }] - } - ], - "approved_versions": [] -} diff --git a/script/validate-abl-import/v2-git-simple.snapshot.json b/script/validate-abl-import/v2-git-simple.snapshot.json deleted file mode 100644 index 29075728c0..0000000000 --- a/script/validate-abl-import/v2-git-simple.snapshot.json +++ /dev/null @@ -1 +0,0 @@ -{"ee7ce46b-0972-4b2c-bc6e-8998c785cd57":"c3f7f0a"} \ No newline at end of file diff --git a/script/validate-abl-import/v2-git-with-archive.input.json b/script/validate-abl-import/v2-git-with-archive.input.json deleted file mode 100644 index a49b9c9942..0000000000 --- a/script/validate-abl-import/v2-git-with-archive.input.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "api_version": 2, - "approved_books": [ - { - "collection_id": "col33604", - "server": "cnx.org", - "style": "u-physics", - "tutor_only": false, - "books": [ - { - "uuid": "da02605d-6d69-447c-a9b9-caf06dc4f413", - "slug": "física-universitaria-volumen-2" - } - ] - }, - { - "repository_name": "osbooks-college-algebra-bundle", - "platforms": [ "REX" ], - "versions": [ - { - "min_code_version": "00000000.000000", - "edition": 1, - "commit_sha": "b32463c3eed4f25be9b91e74c014c57ddc865a3d", - "commit_metadata": { - "committed_at": "2021-09-21T18:42:06+00:00", - "books": [ - { - "style": "precalculus", - "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", - "slug": "algebra-and-trigonometry" - }, - { - "style": "precalculus", - "uuid": "9b08c294-057f-4201-9f48-5d6ad992740d", - "slug": "college-algebra" - }, - { - "style": "precalculus", - "uuid": "fd53eae1-fa23-47c7-bb1b-972349835c3c", - "slug": "precalculus" - }, - { - "style": "precalculus-coreq", - "uuid": "507feb1e-cfff-4b54-bc07-d52636cecfe3", - "slug": "college-algebra-corequisite-support" - } - ] - } - }, - { - "min_code_version": "99999999.99999999", - "edition": 2, - "commit_sha": "bad-sha-too-new", - "commit_metadata": { - "committed_at": "2021-12-06T15:03:16+00:00", - "books": [ - { - "style": "precalculus", - "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", - "slug": "algebra-and-trigonometry-2e" - }, - { - "style": "precalculus", - "uuid": "9b08c294-057f-4201-9f48-5d6ad992740d", - "slug": "college-algebra-2e" - }, - { - "style": "precalculus", - "uuid": "fd53eae1-fa23-47c7-bb1b-972349835c3c", - "slug": "precalculus-2e" - }, - { - "style": "precalculus-coreq", - "uuid": "507feb1e-cfff-4b54-bc07-d52636cecfe3", - "slug": "college-algebra-corequisite-support-2e" - } - ] - } - } - ] - } - ], - "approved_versions": [ - { - "collection_id": "col33604", - "content_version": "99999.99.99", - "min_code_version": "20210823.155019" - } - ] -} \ No newline at end of file diff --git a/script/validate-abl-import/v2-git-with-archive.snapshot.json b/script/validate-abl-import/v2-git-with-archive.snapshot.json deleted file mode 100644 index 940330ed80..0000000000 --- a/script/validate-abl-import/v2-git-with-archive.snapshot.json +++ /dev/null @@ -1 +0,0 @@ -{"da02605d-6d69-447c-a9b9-caf06dc4f413":"999.99.99","13ac107a-f15f-49d2-97e8-60ab2e3b519c":"b32463c","9b08c294-057f-4201-9f48-5d6ad992740d":"b32463c","fd53eae1-fa23-47c7-bb1b-972349835c3c":"b32463c","507feb1e-cfff-4b54-bc07-d52636cecfe3":"b32463c"} \ No newline at end of file diff --git a/script/validate-abl-import/v3-git-diff-20240226.174525-limited.input.json b/script/validate-abl-import/v3-git-diff-20240226.174525-limited.input.json new file mode 100644 index 0000000000..3ef7f72543 --- /dev/null +++ b/script/validate-abl-import/v3-git-diff-20240226.174525-limited.input.json @@ -0,0 +1,333 @@ +{ + "abl_data": [ + { + "commit_sha": "247752b30f009818f9ae90b0e6fe1a0b0fdbac4e", + "uuid": "02040312-72c8-441e-a685-20e9333f3e1d", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.771759", + "committed_at": "2022-02-09T20:30:37", + "repository_name": "osbooks-introduction-sociology", + "slug": "introduction-sociology-2e", + "consumer": "REX" + }, + { + "commit_sha": "eb2e29d69a6af78e64788c1239c3081555b2cefd", + "uuid": "02776133-d49d-49cb-bfaa-67c7f61b25a1", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.778992", + "committed_at": "2022-02-09T19:59:17", + "repository_name": "osbooks-prealgebra-bundle", + "slug": "intermediate-algebra", + "consumer": "REX" + }, + { + "commit_sha": "1aa3e7a901c0f0ddc37d34f890055d61a7476946", + "uuid": "031da8d3-b525-429c-80cf-6c8ed997733a", + "code_version": "20220411.192702", + "created_at": "2024-05-06T22:13:27.787006", + "committed_at": "2022-03-03T22:30:52", + "repository_name": "osbooks-college-physics-bundle", + "slug": "college-physics", + "consumer": "REX" + }, + { + "commit_sha": "1c16cb9a91dde855a8a2d6f6618231a8144a7908", + "uuid": "052b8372-0c5e-4ff6-8fd3-326377e9e91f", + "code_version": "20220228.174637", + "created_at": "2024-05-06T22:13:27.796131", + "committed_at": "2024-01-08T19:05:00", + "repository_name": "osbooks-principles-finance", + "slug": "principles-finance", + "consumer": "REX" + }, + { + "commit_sha": "eafe3108d09f49be0e6d579fc99635a651123047", + "uuid": "06aba565-9432-40f6-97ee-b8a361f118a8", + "code_version": "20220509.174553", + "created_at": "2024-05-06T22:13:27.806717", + "committed_at": "2024-01-06T01:09:12", + "repository_name": "osbooks-psychology", + "slug": "psychology-2e", + "consumer": "REX" + }, + { + "commit_sha": "eb2e29d69a6af78e64788c1239c3081555b2cefd", + "uuid": "0889907c-f0ef-496a-bcb8-2a5bb121717f", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.812499", + "committed_at": "2022-02-09T19:59:17", + "repository_name": "osbooks-prealgebra-bundle", + "slug": "elementary-algebra", + "consumer": "REX" + }, + { + "commit_sha": "ebc5beb15766e5a72d4d5085c1d470ae868007fb", + "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.818943", + "committed_at": "2021-12-08T15:52:59", + "repository_name": "osbooks-college-algebra-bundle", + "slug": "algebra-and-trigonometry", + "consumer": "REX" + }, + { + "commit_sha": "ccce7805ec4d5fb209a5b48327ffd2ac0e2edc88", + "uuid": "14fb4ad7-39a1-4eee-ab6e-3ef2482e3e22", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.824574", + "committed_at": "2022-01-27T17:52:49", + "repository_name": "osbooks-anatomy-physiology", + "slug": "anatomy-and-physiology", + "consumer": "REX" + }, + { + "commit_sha": "0cd082f5b1f2317b760783f54621704444842c08", + "uuid": "16ab5b96-4598-45f9-993c-b8d78d82b0c6", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.831062", + "committed_at": "2022-09-21T10:27:19", + "repository_name": "osbooks-fizyka-bundle", + "slug": "fizyka-dla-szkół-wyższych-tom-2", + "consumer": "REX" + }, + { + "commit_sha": "9281eb634a3cdd2557cf2c797d7231c5b548321c", + "uuid": "175c88b6-f89b-4eba-9514-bc45e2139a1d", + "code_version": "20210823.155019", + "created_at": "2024-05-06T22:13:27.841009", + "committed_at": "2022-04-13T20:20:33", + "repository_name": "osbooks-fisica-universitaria-bundle", + "slug": "física-universitaria-volumen-1", + "consumer": "REX" + }, + { + "commit_sha": "e989ec347d89ce8acc03487d801ff4851325fe53", + "uuid": "185cbf87-c72e-48f5-b51e-f14f21b5eabd", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.847867", + "committed_at": "2022-02-14T20:38:05", + "repository_name": "osbooks-biology-bundle", + "slug": "biology", + "consumer": "REX" + }, + { + "commit_sha": "be114384439f2b443be1fdcc6fb5685c065cfc2b", + "uuid": "1b4ee0ce-ee89-44fa-a5e7-a0db9f0c94b1", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.856094", + "committed_at": "2023-03-31T19:10:56", + "repository_name": "osbooks-introduction-intellectual-property", + "slug": "introduction-intellectual-property", + "consumer": "REX" + }, + { + "commit_sha": "3dd0a5c763c526a3bc5b8b7b843b9ab5bbf32275", + "uuid": "1d39a348-071f-4537-85b6-c98912458c3c", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.862277", + "committed_at": "2024-02-05T20:09:17", + "repository_name": "osbooks-calculus-bundle", + "slug": "calculus-volume-2", + "consumer": "REX" + }, + { + "commit_sha": "da492e7d1d0cab75aeca41f08b5c88fd2132a5f9", + "uuid": "21b1d0df-a716-4205-8e86-0d0787b2c991", + "code_version": "20220228.174637", + "created_at": "2024-05-06T22:13:27.868109", + "committed_at": "2022-03-02T20:06:21", + "repository_name": "osbooks-calculo-bundle", + "slug": "cálculo-volumen-3", + "consumer": "REX" + }, + { + "commit_sha": "059cfc90e49b315c277a509828152f2238273ef7", + "uuid": "2731eee8-0eb1-4d80-ae83-01b4af642ff6", + "code_version": "20221219.191545", + "created_at": "2024-05-06T22:13:27.876341", + "committed_at": "2024-01-09T00:07:54", + "repository_name": "osbooks-principles-marketing", + "slug": "principles-marketing", + "consumer": "REX" + }, + { + "commit_sha": "a6dd6c50f231bbc95e5bbccb2a3520a258bb4e6e", + "uuid": "27f59064-990e-48f1-b604-5188b9086c29", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.889738", + "committed_at": "2022-06-15T20:12:25", + "repository_name": "osbooks-principles-economics-bundle", + "slug": "principles-macroeconomics-2e", + "consumer": "REX" + }, + { + "commit_sha": "fc1c69bf570191c823ee64ff253906ca2c7d215f", + "uuid": "2d941ab9-ac5b-4eb8-b21c-965d36a4f296", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.896148", + "committed_at": "2024-01-09T00:05:47", + "repository_name": "osbooks-principles-of-management-bundle", + "slug": "organizational-behavior", + "consumer": "REX" + }, + { + "commit_sha": "faae451497734eb5aeda1dfee47005c257acd57c", + "uuid": "2e737be8-ea65-48c3-aa0a-9f35b4c6a966", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.902392", + "committed_at": "2022-01-28T13:56:12", + "repository_name": "osbooks-astronomy", + "slug": "astronomy", + "consumer": "REX" + }, + { + "commit_sha": "1d2397028421d06fb045bba8be7621133831497b", + "uuid": "30189442-6998-4686-ac05-ed152b91b9de", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.909973", + "committed_at": "2022-06-23T18:00:34", + "repository_name": "osbooks-introductory-statistics-bundle", + "slug": "introductory-statistics", + "consumer": "REX" + }, + { + "commit_sha": "a48fde53c720db62b1dde7439805d2a4ce7c639b", + "uuid": "30e47181-f52c-4a91-9c11-33380c428268", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.916145", + "committed_at": "2024-01-05T16:30:28", + "repository_name": "osbooks-american-government", + "slug": "american-government-3e", + "consumer": "REX" + }, + { + "commit_sha": "444e84e333a10b4d5fca63c2d166331c4a5794f2", + "uuid": "33076054-ec1d-4417-8824-ce354efe42d0", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.922088", + "committed_at": "2022-01-31T16:01:17", + "repository_name": "osbooks-principles-economics-bundle", + "slug": "principles-macroeconomics-ap-courses", + "consumer": "REX" + }, + { + "commit_sha": "8608bfb8fd1e6b9fc11fc6f9e4c79de7a3e5c148", + "uuid": "35d7cce2-48dd-4403-b6a5-e828cb5a17da", + "code_version": "20211111.153520", + "created_at": "2024-05-06T22:13:27.931897", + "committed_at": "2024-01-09T17:11:34", + "repository_name": "osbooks-college-algebra-bundle", + "slug": "college-algebra-2e", + "consumer": "REX" + }, + { + "commit_sha": "c85bf38081665afaf221297a3781a99981b1faf7", + "uuid": "394a1101-fd8f-4875-84fa-55f15b06ba66", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.937679", + "committed_at": "2024-01-23T17:36:23", + "repository_name": "osbooks-statistics", + "slug": "statistics", + "consumer": "REX" + }, + { + "commit_sha": "b6c3469b1d633c7313f36c703ae609e746525ff7", + "uuid": "3d2454dc-2735-4e24-a7e0-f89a79893699", + "code_version": "20231109.173216", + "created_at": "2024-05-06T22:13:27.947907", + "committed_at": "2024-01-03T20:03:40", + "repository_name": "osbooks-workplace-software-skills", + "slug": "workplace-software-skills", + "consumer": "REX" + }, + { + "commit_sha": "444e84e333a10b4d5fca63c2d166331c4a5794f2", + "uuid": "4061c832-098e-4b3c-a1d9-7eb593a2cb31", + "code_version": "20210224.204120", + "created_at": "2024-05-06T22:13:27.954716", + "committed_at": "2022-01-31T16:01:17", + "repository_name": "osbooks-principles-economics-bundle", + "slug": "principles-macroeconomics", + "consumer": "REX" + } + ], + "configured_books": { + "02040312-72c8-441e-a685-20e9333f3e1d": { + "defaultVersion": "247752b" + }, + "02776133-d49d-49cb-bfaa-67c7f61b25a1": { + "defaultVersion": "eb2e29d" + }, + "031da8d3-b525-429c-80cf-6c8ed997733a": { + "defaultVersion": "1aa3e7a" + }, + "052b8372-0c5e-4ff6-8fd3-326377e9e91f": { + "defaultVersion": "1c16cb9" + }, + "06aba565-9432-40f6-97ee-b8a361f118a8": { + "defaultVersion": "eafe310" + }, + "0889907c-f0ef-496a-bcb8-2a5bb121717f": { + "defaultVersion": "eb2e29d" + }, + "13ac107a-f15f-49d2-97e8-60ab2e3b519c": { + "defaultVersion": "ebc5beb" + }, + "14fb4ad7-39a1-4eee-ab6e-3ef2482e3e22": { + "defaultVersion": "ccce780" + }, + "16ab5b96-4598-45f9-993c-b8d78d82b0c6": { + "defaultVersion": "0cd082f" + }, + "175c88b6-f89b-4eba-9514-bc45e2139a1d": { + "defaultVersion": "9281eb6" + }, + "185cbf87-c72e-48f5-b51e-f14f21b5eabd": { + "defaultVersion": "e989ec3" + }, + "1b4ee0ce-ee89-44fa-a5e7-a0db9f0c94b1": { + "defaultVersion": "be11438" + }, + "1d39a348-071f-4537-85b6-c98912458c3c": { + "defaultVersion": "3dd0a5c" + }, + "21b1d0df-a716-4205-8e86-0d0787b2c991": { + "defaultVersion": "da492e7" + }, + "2731eee8-0eb1-4d80-ae83-01b4af642ff6": { + "defaultVersion": "059cfc9" + }, + "27f59064-990e-48f1-b604-5188b9086c29": { + "defaultVersion": "a6dd6c5" + }, + "2d941ab9-ac5b-4eb8-b21c-965d36a4f296": { + "defaultVersion": "fc1c69b" + }, + "2e737be8-ea65-48c3-aa0a-9f35b4c6a966": { + "defaultVersion": "faae451" + }, + "30189442-6998-4686-ac05-ed152b91b9de": { + "defaultVersion": "1d23970" + }, + "30e47181-f52c-4a91-9c11-33380c428268": { + "defaultVersion": "a48fde5" + }, + "33076054-ec1d-4417-8824-ce354efe42d0": { + "defaultVersion": "444e84e", + "retired": true + }, + "35d7cce2-48dd-4403-b6a5-e828cb5a17da": { + "defaultVersion": "8608bfb" + }, + "394a1101-fd8f-4875-84fa-55f15b06ba66": { + "defaultVersion": "c85bf38" + }, + "3d2454dc-2735-4e24-a7e0-f89a79893699": { + "defaultVersion": "b6c3469" + }, + "4061c832-098e-4b3c-a1d9-7eb593a2cb31": { + "defaultVersion": "444e84e", + "retired": true + } + } +} diff --git a/script/validate-abl-import/v3-git-diff-20240226.174525-limited.snapshot.json b/script/validate-abl-import/v3-git-diff-20240226.174525-limited.snapshot.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/script/validate-abl-import/v3-git-diff-20240226.174525-limited.snapshot.json @@ -0,0 +1 @@ +{} diff --git a/script/validate-abl-import/v3-git-diff-config.input.json b/script/validate-abl-import/v3-git-diff-config.input.json new file mode 100644 index 0000000000..80e54f5378 --- /dev/null +++ b/script/validate-abl-import/v3-git-diff-config.input.json @@ -0,0 +1,67 @@ +{ + "abl_data": [ + { + "repository_name": "osbooks-writing-guide", + "code_version": "00000000.000000", + "uuid": "ee7ce46b-0972-4b2c-bc6e-8998c785cd57", + "slug": "writing-guide", + "committed_at": "2021-12-02T10:47:06+00:00", + "consumer": "REX", + "commit_sha": "c3f7f0a3aca2f342294c1befdaffb6ec93486e2b", + "test_case": "Existing book where version differs (in output)" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", + "slug": "algebra-and-trigonometry", + "committed_at": "2021-09-20T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "test_case": "New book older than same new book (not in output)" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", + "slug": "algebra-and-trigonometry", + "committed_at": "2021-09-21T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "test_case": "Newest version of new book (in output)" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "eaefdaf1-bda0-4ada-a9fe-f1c065bfcc4e", + "slug": "algebra-and-trigonometry-2e", + "committed_at": "2023-06-22T21:35:16+00:00", + "consumer": "REX", + "commit_sha": "8608bfb8fd1e6b9fc11fc6f9e4c79de7a3e5c148", + "test_case": "Existing book where version is the same (not in output)" + } + ], + "configured_books": { + "eaefdaf1-bda0-4ada-a9fe-f1c065bfcc4e": { + "defaultVersion": "8608bfb" + }, + "35d7cce2-48dd-4403-b6a5-e828cb5a17da": { + "defaultVersion": "8608bfb" + }, + "59024a63-2b1a-4631-94c5-ae275a77b587": { + "defaultVersion": "8608bfb" + }, + "f021395f-fd63-46cd-ab95-037c6f051730": { + "defaultVersion": "8608bfb" + }, + "ee7ce46b-0972-4b2c-bc6e-8998c785cd57": { + "defaultVersion": "bafaaf8" + }, + "e53d6c8b-fd9e-4a28-8930-c564ca6fd77d": { + "defaultVersion": "dc4550b" + }, + "f346fe75-ae39-4d11-ad32-d80c03df58cb": { + "defaultVersion": "dc4550b" + } + } +} diff --git a/script/validate-abl-import/v3-git-diff-config.snapshot.json b/script/validate-abl-import/v3-git-diff-config.snapshot.json new file mode 100644 index 0000000000..96d39ac154 --- /dev/null +++ b/script/validate-abl-import/v3-git-diff-config.snapshot.json @@ -0,0 +1 @@ +{"13ac107a-f15f-49d2-97e8-60ab2e3b519c":"bbbbbbb","ee7ce46b-0972-4b2c-bc6e-8998c785cd57":"c3f7f0a"} diff --git a/script/validate-abl-import/v3-git-multiversion.input.json b/script/validate-abl-import/v3-git-multiversion.input.json new file mode 100644 index 0000000000..c90314f387 --- /dev/null +++ b/script/validate-abl-import/v3-git-multiversion.input.json @@ -0,0 +1,77 @@ +{ + "abl_data": [ + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", + "slug": "algebra-and-trigonometry", + "committed_at": "2021-09-20T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "9b08c294-057f-4201-9f48-5d6ad992740d", + "slug": "college-algebra", + "committed_at": "2021-09-20T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "fd53eae1-fa23-47c7-bb1b-972349835c3c", + "slug": "precalculus", + "committed_at": "2021-09-20T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "507feb1e-cfff-4b54-bc07-d52636cecfe3", + "slug": "college-algebra-corequisite-support", + "committed_at": "2021-09-20T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "13ac107a-f15f-49d2-97e8-60ab2e3b519c", + "slug": "algebra-and-trigonometry", + "committed_at": "2021-09-21T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "9b08c294-057f-4201-9f48-5d6ad992740d", + "slug": "college-algebra", + "committed_at": "2021-09-21T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "fd53eae1-fa23-47c7-bb1b-972349835c3c", + "slug": "precalculus", + "committed_at": "2021-09-21T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + }, + { + "repository_name": "osbooks-college-algebra-bundle", + "code_version": "00000000.000000", + "uuid": "507feb1e-cfff-4b54-bc07-d52636cecfe3", + "slug": "college-algebra-corequisite-support", + "committed_at": "2021-09-21T18:42:06+00:00", + "consumer": "REX", + "commit_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + } + ], + "configured_books": {} +} diff --git a/script/validate-abl-import/v3-git-multiversion.snapshot.json b/script/validate-abl-import/v3-git-multiversion.snapshot.json new file mode 100644 index 0000000000..dcab4f5408 --- /dev/null +++ b/script/validate-abl-import/v3-git-multiversion.snapshot.json @@ -0,0 +1 @@ +{"13ac107a-f15f-49d2-97e8-60ab2e3b519c":"bbbbbbb","507feb1e-cfff-4b54-bc07-d52636cecfe3":"bbbbbbb","9b08c294-057f-4201-9f48-5d6ad992740d":"bbbbbbb","fd53eae1-fa23-47c7-bb1b-972349835c3c":"bbbbbbb"} diff --git a/script/validate-abl-import/v3-git-simple.input.json b/script/validate-abl-import/v3-git-simple.input.json new file mode 100644 index 0000000000..8f66995b42 --- /dev/null +++ b/script/validate-abl-import/v3-git-simple.input.json @@ -0,0 +1,14 @@ +{ + "abl_data": [ + { + "repository_name": "osbooks-writing-guide", + "code_version": "00000000.000000", + "uuid": "ee7ce46b-0972-4b2c-bc6e-8998c785cd57", + "slug": "writing-guide", + "committed_at": "2021-12-02T10:47:06+00:00", + "consumer": "REX", + "commit_sha": "c3f7f0a3aca2f342294c1befdaffb6ec93486e2b" + } + ], + "configured_books": {} +} diff --git a/script/validate-abl-import/v3-git-simple.snapshot.json b/script/validate-abl-import/v3-git-simple.snapshot.json new file mode 100644 index 0000000000..9e595d5da1 --- /dev/null +++ b/script/validate-abl-import/v3-git-simple.snapshot.json @@ -0,0 +1 @@ +{"ee7ce46b-0972-4b2c-bc6e-8998c785cd57":"c3f7f0a"}