diff --git a/index.ts b/index.ts index 6e441db5..5af1bbcf 100644 --- a/index.ts +++ b/index.ts @@ -1,3 +1,5 @@ +import "react-native-get-random-values"; +export { AbsentSyncableStateEnum } from "./react-native/types/AbsentSyncableStateEnum"; export { Aligned } from "./react-native/components/Aligned"; export { AwaitingPullSyncableStateCollectionItem } from "./react-native/types/AwaitingPullSyncableStateCollectionItem"; export { AwaitingPushSyncableStateCollectionItem } from "./react-native/types/AwaitingPushSyncableStateCollectionItem"; @@ -90,6 +92,7 @@ export { PictureHelperInterface } from "./react-native/types/PictureHelperInterf export { PreflightResponse } from "./react-native/types/PreflightResponse"; export { PreflightResponseCollection } from "./react-native/types/PreflightResponseCollection"; export { PreflightResponseCollectionItem } from "./react-native/types/PreflightResponseCollectionItem"; +export { PreflightResponseEnum } from "./react-native/types/PreflightResponseEnum"; export { PushingSyncableStateCollectionItem } from "./react-native/types/PushingSyncableStateCollectionItem"; export { QueryParameter } from "./react-native/types/QueryParameter"; export { QueryParameters } from "./react-native/types/QueryParameters"; @@ -121,6 +124,7 @@ export { SyncableSchema } from "./react-native/types/SyncableSchema"; export { SyncableState } from "./react-native/types/SyncableState"; export { SyncableStateCollection } from "./react-native/types/SyncableStateCollection"; export { SyncableStateCollectionItem } from "./react-native/types/SyncableStateCollectionItem"; +export { SyncableStateEnum } from "./react-native/types/SyncableStateEnum"; export { SyncableStateHelper } from "./react-native/services/SyncableStateHelper"; export { SyncConfiguration } from "./react-native/types/SyncConfiguration"; export { SyncConfigurationCollection } from "./react-native/types/SyncConfigurationCollection"; @@ -139,10 +143,10 @@ export { UnderlinedTopTabBarStyle } from "./react-native/types/UnderlinedTopTabB export { UnderlinedTopTabBarStyleState } from "./react-native/types/UnderlinedTopTabBarStyleState"; export { unwrapRenderedFunctionComponent } from "./react-native/utilities/unwrapRenderedFunctionComponent"; export { UpToDateSyncableStateCollectionItem } from "./react-native/types/UpToDateSyncableStateCollectionItem"; +export { UpToDateSyncableStateEnum } from "./react-native/types/UpToDateSyncableStateEnum"; export { useBackButton } from "./react-native/hooks/useBackButton"; export { useEventRefresh } from "./react-native/hooks/useEventRefresh"; export { useMeasure } from "./react-native/hooks/useMeasure"; export { useRefresh } from "./react-native/hooks/useRefresh"; export { useSyncFileCleanUpBlocker } from "./react-native/hooks/useSyncFileCleanUpBlocker"; export { useSyncInProgress } from "./react-native/hooks/useSyncInProgress"; -import "react-native-get-random-values"; diff --git a/react-native/services/Sync/index.tsx b/react-native/services/Sync/index.tsx index af1e5032..1d27163c 100644 --- a/react-native/services/Sync/index.tsx +++ b/react-native/services/Sync/index.tsx @@ -16,6 +16,7 @@ import type { SyncConfigurationCollection } from "../../types/SyncConfigurationC import type { FileStoreInterface } from "../../types/FileStoreInterface"; import type { SyncState } from "../../types/SyncState"; import type { SyncInterface } from "../../types/SyncInterface"; +import type { PreflightResponseEnum, SyncableStateEnum } from "../../.."; const camelCaseToKebabCase = (camelCase: string): string => camelCase.replace(/([A-Z])/g, `-$1`).toLowerCase(); @@ -160,232 +161,241 @@ export class Sync< } )[] = []; - for (const collectionKey of this.syncConfiguration.collectionOrder) { - const syncConfigurationCollection = this.syncConfiguration - .collections[collectionKey] as SyncConfigurationCollection< - Json, - TAdditionalCollectionData - >; - - let collection = state.collections[ - collectionKey - ] as SyncableStateCollection; - - const kebabCasedCollectionKey = camelCaseToKebabCase(collectionKey); - - this.logger.debug( - `Searching for changes to push in collection "${collectionKey}"...` - ); - - const uuids = Object.keys(collection).sort(); - - for (const uuid of uuids) { - const item = collection[uuid] as SyncableStateCollectionItem; - - let pushItem: boolean; - - switch (item.status) { - case `awaitingPull`: - this.logger.warning( - `Evidence of previously interrupted sync of "${collectionKey}" "${uuid}" found; another pull attempt will be made following the push phase.` - ); - - pushItem = false; - break; - - case `pushing`: - this.logger.warning( - `Evidence of previously interrupted push of "${collectionKey}" "${uuid}" found; another attempt will be made.` - ); - - pushItem = true; - break; - - case `awaitingPush`: - this.logger.information( - `Change of "${collectionKey}" "${uuid}" will be pushed.` - ); + for (const step of this.syncConfiguration.order) { + switch (step.type) { + case `collection`: { + const syncConfigurationCollection = this.syncConfiguration + .collections[step.key] as SyncConfigurationCollection< + Json, + TAdditionalCollectionData + >; - pushItem = true; - break; + let collection = state.collections[ + step.key + ] as SyncableStateCollection; - case `upToDate`: - this.logger.debug( - `No changes to push for "${collectionKey}" "${uuid}".` - ); + const kebabCasedCollectionKey = camelCaseToKebabCase(step.key); - pushItem = false; - continue; - } + this.logger.debug( + `Searching for changes to push in collection "${step.key}"...` + ); - const referencedFiles = syncConfigurationCollection.listFiles( - uuid, - item.data - ); + const uuids = Object.keys(collection).sort(); - const filesToPush = referencedFiles.filter((file) => - state.addedFileUuids.includes(file.uuid) - ); + for (const uuid of uuids) { + const item = collection[ + uuid + ] as SyncableStateCollectionItem; - if (pushItem) { - pushesAndDeletions.push({ - type: `push`, - beforeLogMessage: `Pushing change of "${collectionKey}" "${uuid}"...`, - syncConfigurationCollection, - completedFiles: null, - totalFiles: filesToPush.length, - execute: async () => { - const statusCode = await this.request.withoutResponse( - `PUT`, - `sync/${kebabCasedCollectionKey}/${uuid}`, - { type: `json`, value: item.data }, - {}, - abortSignal, - [`200`, `404`, `403`] - ); + let pushItem: boolean; - if (this.stateStore.get() === state) { - if (statusCode === `200`) { - collection = { - ...collection, - [uuid]: { - status: `awaitingPull`, - data: item.data, - }, - }; + switch (item.status) { + case `awaitingPull`: + this.logger.warning( + `Evidence of previously interrupted sync of "${step.key}" "${uuid}" found; another pull attempt will be made following the push phase.` + ); - state = { - ...state, - collections: { - ...state.collections, - [collectionKey]: collection, - }, - }; + pushItem = false; + break; - this.stateStore.set(state); + case `pushing`: + this.logger.warning( + `Evidence of previously interrupted push of "${step.key}" "${uuid}" found; another attempt will be made.` + ); - this.logger.information( - `Successfully pushed change of "${collectionKey}" "${uuid}".` - ); + pushItem = true; + break; - return true; - } else { - const collectionCopy = { - ...collection, - }; + case `awaitingPush`: + this.logger.information( + `Change of "${step.key}" "${uuid}" will be pushed.` + ); - delete collectionCopy[uuid]; + pushItem = true; + break; - collection = collectionCopy; + case `upToDate`: + this.logger.debug( + `No changes to push for "${step.key}" "${uuid}".` + ); - const affectedFileUuids = syncConfigurationCollection - .listFiles(uuid, item.data) - .map((file) => file.uuid); + pushItem = false; + continue; + } - state = { - ...state, - collections: { - ...state.collections, - [collectionKey]: collection, - }, - addedFileUuids: state.addedFileUuids.filter( - (fileUuid) => !affectedFileUuids.includes(fileUuid) - ), - }; + const referencedFiles = syncConfigurationCollection.listFiles( + uuid, + item.data + ); - this.stateStore.set(state); + const filesToPush = referencedFiles.filter((file) => + state.addedFileUuids.includes(file.uuid) + ); - this.logger.warning( - `The API returned status code "${statusCode}" during push of "${collectionKey}" "${uuid}", indicating that the user has lost access. The local changes have been lost.` + if (pushItem) { + pushesAndDeletions.push({ + type: `push`, + beforeLogMessage: `Pushing change of "${step.key}" "${uuid}"...`, + syncConfigurationCollection, + completedFiles: null, + totalFiles: filesToPush.length, + execute: async () => { + const statusCode = await this.request.withoutResponse( + `PUT`, + `sync/${kebabCasedCollectionKey}/${uuid}`, + { type: `json`, value: item.data }, + {}, + abortSignal, + [`200`, `404`, `403`] ); - return true; - } - } else { + if (this.stateStore.get() === state) { + if (statusCode === `200`) { + collection = { + ...collection, + [uuid]: { + status: `awaitingPull`, + data: item.data, + }, + }; + + state = { + ...state, + collections: { + ...state.collections, + [step.key]: collection, + }, + }; + + this.stateStore.set(state); + + this.logger.information( + `Successfully pushed change of "${step.key}" "${uuid}".` + ); + + return true; + } else { + const collectionCopy = { + ...collection, + }; + + delete collectionCopy[uuid]; + + collection = collectionCopy; + + const affectedFileUuids = syncConfigurationCollection + .listFiles(uuid, item.data) + .map((file) => file.uuid); + + state = { + ...state, + collections: { + ...state.collections, + [step.key]: collection, + }, + addedFileUuids: state.addedFileUuids.filter( + (fileUuid) => + !affectedFileUuids.includes(fileUuid) + ), + }; + + this.stateStore.set(state); + + this.logger.warning( + `The API returned status code "${statusCode}" during push of "${step.key}" "${uuid}", indicating that the user has lost access. The local changes have been lost.` + ); + + return true; + } + } else { + this.logger.warning( + `The state store changed during push of "${step.key}" "${uuid}"; sync has been interrupted and will need to run again.` + ); + + return false; + } + }, + skip: () => false, + }); + } else { + if (filesToPush.length > 0) { this.logger.warning( - `The state store changed during push of "${collectionKey}" "${uuid}"; sync has been interrupted and will need to run again.` + `File(s) for "${step.key}" "${uuid}" were not pushed during the previous interrupted sync. They will be pushed as part of this sync.` ); - - return false; } - }, - skip: () => false, - }); - } else { - if (filesToPush.length > 0) { - this.logger.warning( - `File(s) for "${collectionKey}" "${uuid}" were not pushed during the previous interrupted sync. They will be pushed as part of this sync.` - ); - } - } - - let completedFiles = 0; + } - for (const file of filesToPush) { - this.logger.information( - `File "${file.uuid}" of "${collectionKey}" "${uuid}" will be pushed.` - ); + let completedFiles = 0; - pushesAndDeletions.push({ - type: `push`, - beforeLogMessage: `Pushing file "${file.uuid}" of "${collectionKey}" "${uuid}"...`, - syncConfigurationCollection, - completedFiles, - totalFiles: filesToPush.length, - execute: async () => { - const statusCode = await this.request.withoutResponse( - `PUT`, - file.route, - { - type: `file`, - fileUri: this.fileStore.generatePath(file.uuid), - }, - {}, - abortSignal, - [`200`, `404`, `403`] + for (const file of filesToPush) { + this.logger.information( + `File "${file.uuid}" of "${step.key}" "${uuid}" will be pushed.` ); - if (this.stateStore.get() === state) { - const addedFileUuids = [...state.addedFileUuids]; - const index = state.addedFileUuids.indexOf(file.uuid); - addedFileUuids.splice(index, 1); - - state = { - ...state, - addedFileUuids, - }; - - this.stateStore.set(state); - - if (statusCode === `200`) { - this.logger.information( - `Successfully pushed file "${file.uuid}" of "${collectionKey}" "${uuid}".` - ); - - return true; - } else { - this.logger.warning( - `The API returned status code "${statusCode}" during push of file "${file.uuid}" of "${collectionKey}" "${uuid}", indicating that the user has lost access. The local changes will temporarily remain locally, but will most likely be lost during the pull phase.` + pushesAndDeletions.push({ + type: `push`, + beforeLogMessage: `Pushing file "${file.uuid}" of "${step.key}" "${uuid}"...`, + syncConfigurationCollection, + completedFiles, + totalFiles: filesToPush.length, + execute: async () => { + const statusCode = await this.request.withoutResponse( + `PUT`, + file.route, + { + type: `file`, + fileUri: this.fileStore.generatePath(file.uuid), + }, + {}, + abortSignal, + [`200`, `404`, `403`] ); - return true; - } - } else { - this.logger.warning( - `The state store changed during push of file "${file.uuid}" of "${collectionKey}" "${uuid}"; sync has been interrupted and will need to run again.` - ); - - return false; - } - }, - skip: () => - !Object.prototype.hasOwnProperty.call( - state.collections[collectionKey], - uuid - ), - }); + if (this.stateStore.get() === state) { + const addedFileUuids = [...state.addedFileUuids]; + const index = state.addedFileUuids.indexOf(file.uuid); + addedFileUuids.splice(index, 1); + + state = { + ...state, + addedFileUuids, + }; + + this.stateStore.set(state); + + if (statusCode === `200`) { + this.logger.information( + `Successfully pushed file "${file.uuid}" of "${step.key}" "${uuid}".` + ); + + return true; + } else { + this.logger.warning( + `The API returned status code "${statusCode}" during push of file "${file.uuid}" of "${step.key}" "${uuid}", indicating that the user has lost access. The local changes will temporarily remain locally, but will most likely be lost during the pull phase.` + ); + + return true; + } + } else { + this.logger.warning( + `The state store changed during push of file "${file.uuid}" of "${step.key}" "${uuid}"; sync has been interrupted and will need to run again.` + ); + + return false; + } + }, + skip: () => + !Object.prototype.hasOwnProperty.call( + state.collections[step.key], + uuid + ), + }); + + completedFiles++; + } + } - completedFiles++; + break; } } } @@ -488,339 +498,510 @@ export class Sync< `200`, ]); - const pulls: { - readonly syncConfigurationCollection: SyncConfigurationCollection< - TSchema[`collections`][keyof TSchema[`collections`]], - TAdditionalCollectionData - >; - readonly preflightResponseCollectionItem: PreflightResponseCollectionItem; - readonly beforeLogMessage: string; - execute(): Promise; - }[] = []; + const pulls: ( + | { + readonly type: `collectionItem`; + readonly syncConfigurationCollection: SyncConfigurationCollection< + TSchema[`collections`][keyof TSchema[`collections`]], + TAdditionalCollectionData + >; + readonly preflightResponseCollectionItem: PreflightResponseCollectionItem; + readonly beforeLogMessage: string; + execute(): Promise; + } + | { + readonly type: `enum`; + readonly beforeLogMessage: string; + execute(): Promise; + } + )[] = []; let completedPulls = 0; this.logger.debug(`Searching for changes to pull...`); - for (const collectionKey of this.syncConfiguration.collectionOrder) { - const syncConfigurationCollection = this.syncConfiguration - .collections[collectionKey] as SyncConfigurationCollection< - Json, - TAdditionalCollectionData - >; - - let stateCollection = state.collections[ - collectionKey - ] as SyncableStateCollection; - - const preflightCollection = preflightResponse.value.collections[ - collectionKey - ] as PreflightResponseCollection; - - const kebabCasedCollectionKey = camelCaseToKebabCase(collectionKey); + for (const step of this.syncConfiguration.order) { + switch (step.type) { + case `enum`: { + const stateEnum = state.enums[ + step.key + ] as SyncableStateEnum; - this.logger.debug( - `Searching for new items to pull in collection "${collectionKey}"...` - ); + const preflightEnum = preflightResponse.value.enums[ + step.key + ] as PreflightResponseEnum; - const pullFiles = async ( - uuid: string, - preflightResponseCollectionItem: PreflightResponseCollectionItem, - data: Json - ): Promise => { - const filesToPull = syncConfigurationCollection - .listFiles(uuid, data) - .filter((file) => !existingFileUuids.includes(file.uuid)); - - let completedFiles = 0; - - for (const file of filesToPull) { - this.logger.information( - `Pulling file "${file.uuid}" of "${collectionKey}" "${uuid}"...` - ); - - this.setState({ - type: `pullingFile`, - syncConfigurationCollection, - completedSteps: completedPulls, - totalSteps: pulls.length, - completedFiles, - totalFiles: filesToPull.length, - preflightResponseCollectionItem, - }); + const kebabCasedEnumKey = camelCaseToKebabCase(step.key); - const statusCode = await this.request.returningFile( - `GET`, - file.route, - { type: `empty` }, - {}, - null, - this.fileStore.generatePath(file.uuid), - [`200`], - [`404`, `403`] - ); + switch (stateEnum.type) { + case `absent`: + this.logger.information( + `New enum "${step.key}" will be pulled.` + ); - if (statusCode === `200`) { - this.logger.information( - `Successfully pulled file "${file.uuid}" of "${collectionKey}" "${uuid}".` - ); + pulls.push({ + type: `enum`, + beforeLogMessage: `Pulling enum "${step.key}"...`, + execute: async () => { + const response = await this.request.returningJson<{ + "200": SyncPullResponse; + }>( + `GET`, + `sync/${kebabCasedEnumKey}`, + { type: `empty` }, + {}, + abortSignal, + [`200`] + ); + if (response.value.version === preflightEnum.version) { + if (this.stateStore.get() === state) { + state = { + ...state, + enums: { + ...state.enums, + [step.key]: { + type: `upToDate`, + version: preflightEnum.version, + values: response.value.data, + }, + }, + }; + + this.stateStore.set(state); + + this.logger.information( + `Successfully pulled new enum "${step.key}".` + ); + + return true; + } else { + this.logger.warning( + `The state store changed during pull of enum "${step.key}"; sync has been interrupted and will need to run again.` + ); + + return false; + } + } else { + this.logger.warning( + `The version of enum "${step.key}" changed from "${preflightEnum.version}" at the time of preflight to "${response.value.version}" at the time of pull; sync has been interrupted and will need to run again.` + ); + + return false; + } + }, + }); + break; - completedFiles++; - } else { - this.logger.warning( - `The API returned status code "${statusCode}" during the pull of file "${file.uuid}" of "${collectionKey}" "${uuid}", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.` - ); + case `upToDate`: + if (preflightEnum.version === stateEnum.version) { + this.logger.debug( + `No pull required of enum "${step.key}" as preflight and state store versions match ("${preflightEnum.version}").` + ); + } else { + this.logger.information( + `Previously pulled enum "${step.key}" will be pulled again as versions do not match between preflight ("${preflightEnum.version}") and state store ("${stateEnum.version}").` + ); - return false; + pulls.push({ + type: `enum`, + beforeLogMessage: `Pulling enum "${step.key}"...`, + execute: async () => { + const response = await this.request.returningJson<{ + "200": SyncPullResponse; + }>( + `GET`, + `sync/${kebabCasedEnumKey}`, + { type: `empty` }, + {}, + abortSignal, + [`200`] + ); + if (response.value.version === preflightEnum.version) { + if (this.stateStore.get() === state) { + state = { + ...state, + enums: { + ...state.enums, + [step.key]: { + type: `upToDate`, + version: preflightEnum.version, + values: response.value.data, + }, + }, + }; + + this.stateStore.set(state); + + this.logger.information( + `Successfully pulled update of enum "${step.key}".` + ); + + return true; + } else { + this.logger.warning( + `The state store changed during pull of enum "${step.key}"; sync has been interrupted and will need to run again.` + ); + + return false; + } + } else { + this.logger.warning( + `The version of enum "${step.key}" changed from "${preflightEnum.version}" at the time of preflight to "${response.value.version}" at the time of pull; sync has been interrupted and will need to run again.` + ); + + return false; + } + }, + }); + } + break; } + + break; } - return true; - }; + case `collection`: { + const syncConfigurationCollection = this.syncConfiguration + .collections[step.key] as SyncConfigurationCollection< + Json, + TAdditionalCollectionData + >; - for (const uuid of Object.keys(preflightCollection) - .filter( - (uuid) => - !Object.prototype.hasOwnProperty.call(stateCollection, uuid) - ) - .sort()) { - const preflightResponseCollectionItem = preflightCollection[ - uuid - ] as PreflightResponseCollectionItem; + let stateCollection = state.collections[ + step.key + ] as SyncableStateCollection; - this.logger.information( - `New "${collectionKey}" "${uuid}" will be pulled.` - ); + const preflightCollection = preflightResponse.value.collections[ + step.key + ] as PreflightResponseCollection; - pulls.push({ - syncConfigurationCollection, - preflightResponseCollectionItem, - beforeLogMessage: `Pulling new "${collectionKey}" "${uuid}"...`, - execute: async () => { - const response = await this.request.returningJson<{ - "200": SyncPullResponse; - "404": Json; - "403": Json; - }>( - `GET`, - `sync/${kebabCasedCollectionKey}/${uuid}`, - { type: `empty` }, - {}, - abortSignal, - [`200`, `404`, `403`] - ); + const kebabCasedCollectionKey = camelCaseToKebabCase(step.key); - if (response.statusCode === "200") { - if ( - response.value.version === - preflightResponseCollectionItem.version - ) { - if ( - !(await pullFiles( - uuid, - preflightResponseCollectionItem, - response.value.data - )) - ) { - return false; - } + this.logger.debug( + `Searching for new items to pull in collection "${step.key}"...` + ); - if (this.stateStore.get() === state) { - stateCollection = { - ...stateCollection, - [uuid]: { - status: `upToDate`, - version: response.value.version, - data: response.value.data, - }, - }; + const pullFiles = async ( + uuid: string, + preflightResponseCollectionItem: PreflightResponseCollectionItem, + data: Json + ): Promise => { + const filesToPull = syncConfigurationCollection + .listFiles(uuid, data) + .filter((file) => !existingFileUuids.includes(file.uuid)); - state = { - ...state, - collections: { - ...state.collections, - [collectionKey]: stateCollection, - }, - }; + let completedFiles = 0; - this.stateStore.set(state); + for (const file of filesToPull) { + this.logger.information( + `Pulling file "${file.uuid}" of "${step.key}" "${uuid}"...` + ); - this.logger.information( - `Successfully pulled new "${collectionKey}" "${uuid}".` - ); + this.setState({ + type: `pullingFile`, + syncConfigurationCollection, + completedSteps: completedPulls, + totalSteps: pulls.length, + completedFiles, + totalFiles: filesToPull.length, + preflightResponseCollectionItem, + }); + + const statusCode = await this.request.returningFile( + `GET`, + file.route, + { type: `empty` }, + {}, + null, + this.fileStore.generatePath(file.uuid), + [`200`], + [`404`, `403`] + ); - return true; - } else { - this.logger.warning( - `The state store changed during pull of "${collectionKey}" "${uuid}"; sync has been interrupted and will need to run again.` - ); + if (statusCode === `200`) { + this.logger.information( + `Successfully pulled file "${file.uuid}" of "${step.key}" "${uuid}".` + ); - return false; - } + completedFiles++; } else { this.logger.warning( - `The version of "${collectionKey}" "${uuid}" changed from "${preflightResponseCollectionItem.version}" at the time of preflight to "${response.value.version}" at the time of pull; sync has been interrupted and will need to run again.` + `The API returned status code "${statusCode}" during the pull of file "${file.uuid}" of "${step.key}" "${uuid}", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.` ); return false; } - } else { - this.logger.warning( - `The API returned status code "${response.statusCode}" during the pull of "${collectionKey}" "${uuid}", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.` - ); - - return false; } - }, - }); - } - - this.logger.debug( - `Searching for updated items to pull in collection "${collectionKey}"...` - ); - - for (const uuid of Object.keys(stateCollection) - .filter((uuid) => - Object.prototype.hasOwnProperty.call(preflightCollection, uuid) - ) - .sort()) { - const stateItem = stateCollection[ - uuid - ] as SyncableStateCollectionItem; - const preflightResponseCollectionItem = preflightCollection[ - uuid - ] as PreflightResponseCollectionItem; - - let beforeLogMessage: string; - - switch (stateItem.status) { - case `upToDate`: - if ( - preflightResponseCollectionItem.version === stateItem.version - ) { - this.logger.debug( - `No pull required of "${collectionKey}" "${uuid}" as preflight and state store versions match ("${preflightResponseCollectionItem.version}").` - ); - continue; - } else { - this.logger.information( - `Previously pulled "${collectionKey}" "${uuid}" will be pulled again as versions do not match between preflight ("${preflightResponseCollectionItem.version}") and state store ("${stateItem.version}").` - ); + return true; + }; - beforeLogMessage = `Pulling updated "${collectionKey}" "${uuid}"...`; - break; - } + for (const uuid of Object.keys(preflightCollection) + .filter( + (uuid) => + !Object.prototype.hasOwnProperty.call(stateCollection, uuid) + ) + .sort()) { + const preflightResponseCollectionItem = preflightCollection[ + uuid + ] as PreflightResponseCollectionItem; - case `awaitingPull`: this.logger.information( - `Previously pushed "${collectionKey}" "${uuid}" will be pulled.` + `New "${step.key}" "${uuid}" will be pulled.` ); - beforeLogMessage = `Pulling previously pushed "${collectionKey}" "${uuid}"...`; - break; - } + pulls.push({ + type: `collectionItem`, + syncConfigurationCollection, + preflightResponseCollectionItem, + beforeLogMessage: `Pulling new "${step.key}" "${uuid}"...`, + execute: async () => { + const response = await this.request.returningJson<{ + "200": SyncPullResponse; + "404": Json; + "403": Json; + }>( + `GET`, + `sync/${kebabCasedCollectionKey}/${uuid}`, + { type: `empty` }, + {}, + abortSignal, + [`200`, `404`, `403`] + ); - pulls.push({ - syncConfigurationCollection, - preflightResponseCollectionItem, - - // This would only be undefined if the item's status were `pushing` or `awaitingPush`; - // neither of which is possible as we've completed the push phase and verified that - // the UI has not made any changes. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - beforeLogMessage: beforeLogMessage!, - execute: async () => { - const response = await this.request.returningJson<{ - "200": SyncPullResponse; - "404": Json; - "403": Json; - }>( - `GET`, - `sync/${kebabCasedCollectionKey}/${uuid}`, - { type: `empty` }, - {}, - abortSignal, - [`200`, `404`, `403`] - ); + if (response.statusCode === "200") { + if ( + response.value.version === + preflightResponseCollectionItem.version + ) { + if ( + !(await pullFiles( + uuid, + preflightResponseCollectionItem, + response.value.data + )) + ) { + return false; + } + + if (this.stateStore.get() === state) { + stateCollection = { + ...stateCollection, + [uuid]: { + status: `upToDate`, + version: response.value.version, + data: response.value.data, + }, + }; + + state = { + ...state, + collections: { + ...state.collections, + [step.key]: stateCollection, + }, + }; + + this.stateStore.set(state); + + this.logger.information( + `Successfully pulled new "${step.key}" "${uuid}".` + ); + + return true; + } else { + this.logger.warning( + `The state store changed during pull of "${step.key}" "${uuid}"; sync has been interrupted and will need to run again.` + ); + + return false; + } + } else { + this.logger.warning( + `The version of "${step.key}" "${uuid}" changed from "${preflightResponseCollectionItem.version}" at the time of preflight to "${response.value.version}" at the time of pull; sync has been interrupted and will need to run again.` + ); + + return false; + } + } else { + this.logger.warning( + `The API returned status code "${response.statusCode}" during the pull of "${step.key}" "${uuid}", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.` + ); - if (response.statusCode === `200`) { - if ( - response.value.version === - preflightResponseCollectionItem.version - ) { - if ( - !(await pullFiles( - uuid, - preflightResponseCollectionItem, - response.value.data - )) - ) { return false; } + }, + }); + } - if (this.stateStore.get() === state) { - stateCollection = { - ...stateCollection, - [uuid]: { - status: `upToDate`, - version: response.value.version, - data: response.value.data, - }, - }; - - state = { - ...state, - collections: { - ...state.collections, - [collectionKey]: stateCollection, - }, - }; + this.logger.debug( + `Searching for updated items to pull in collection "${step.key}"...` + ); - this.stateStore.set(state); + for (const uuid of Object.keys(stateCollection) + .filter((uuid) => + Object.prototype.hasOwnProperty.call( + preflightCollection, + uuid + ) + ) + .sort()) { + const stateItem = stateCollection[ + uuid + ] as SyncableStateCollectionItem; + const preflightResponseCollectionItem = preflightCollection[ + uuid + ] as PreflightResponseCollectionItem; + + let beforeLogMessage: string; + + switch (stateItem.status) { + case `upToDate`: + if ( + preflightResponseCollectionItem.version === + stateItem.version + ) { + this.logger.debug( + `No pull required of "${step.key}" "${uuid}" as preflight and state store versions match ("${preflightResponseCollectionItem.version}").` + ); + continue; + } else { this.logger.information( - `Successfully pulled update of "${collectionKey}" "${uuid}".` + `Previously pulled "${step.key}" "${uuid}" will be pulled again as versions do not match between preflight ("${preflightResponseCollectionItem.version}") and state store ("${stateItem.version}").` ); - return true; + beforeLogMessage = `Pulling updated "${step.key}" "${uuid}"...`; + break; + } + + case `awaitingPull`: + this.logger.information( + `Previously pushed "${step.key}" "${uuid}" will be pulled.` + ); + + beforeLogMessage = `Pulling previously pushed "${step.key}" "${uuid}"...`; + break; + } + + pulls.push({ + type: `collectionItem`, + + syncConfigurationCollection, + preflightResponseCollectionItem, + + // This would only be undefined if the item's status were `pushing` or `awaitingPush`; + // neither of which is possible as we've completed the push phase and verified that + // the UI has not made any changes. + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + beforeLogMessage: beforeLogMessage!, + execute: async () => { + const response = await this.request.returningJson<{ + "200": SyncPullResponse; + "404": Json; + "403": Json; + }>( + `GET`, + `sync/${kebabCasedCollectionKey}/${uuid}`, + { type: `empty` }, + {}, + abortSignal, + [`200`, `404`, `403`] + ); + + if (response.statusCode === `200`) { + if ( + response.value.version === + preflightResponseCollectionItem.version + ) { + if ( + !(await pullFiles( + uuid, + preflightResponseCollectionItem, + response.value.data + )) + ) { + return false; + } + + if (this.stateStore.get() === state) { + stateCollection = { + ...stateCollection, + [uuid]: { + status: `upToDate`, + version: response.value.version, + data: response.value.data, + }, + }; + + state = { + ...state, + collections: { + ...state.collections, + [step.key]: stateCollection, + }, + }; + + this.stateStore.set(state); + + this.logger.information( + `Successfully pulled update of "${step.key}" "${uuid}".` + ); + + return true; + } else { + this.logger.warning( + `The state store changed during pull of "${step.key}" "${uuid}"; sync has been interrupted and will need to run again.` + ); + + return false; + } + } else { + this.logger.warning( + `The version of "${step.key}" "${uuid}" changed from "${preflightResponseCollectionItem.version}" at the time of preflight to "${response.value.version}" at the time of pull; sync has been interrupted and will need to run again.` + ); + + return false; + } } else { this.logger.warning( - `The state store changed during pull of "${collectionKey}" "${uuid}"; sync has been interrupted and will need to run again.` + `The API returned status code "${response.statusCode}" during the pull of "${step.key}" "${uuid}", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.` ); return false; } - } else { - this.logger.warning( - `The version of "${collectionKey}" "${uuid}" changed from "${preflightResponseCollectionItem.version}" at the time of preflight to "${response.value.version}" at the time of pull; sync has been interrupted and will need to run again.` - ); - - return false; - } - } else { - this.logger.warning( - `The API returned status code "${response.statusCode}" during the pull of "${collectionKey}" "${uuid}", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.` - ); + }, + }); + } - return false; - } - }, - }); + break; + } } } for (const pull of pulls) { this.logger.information(pull.beforeLogMessage); - this.setState({ - type: `pulling`, - completedSteps: completedPulls, - totalSteps: pulls.length, - syncConfigurationCollection: pull.syncConfigurationCollection, - preflightResponseCollectionItem: - pull.preflightResponseCollectionItem, - }); + switch (pull.type) { + case `enum`: + this.setState({ + type: `pullingEnum`, + completedSteps: completedPulls, + totalSteps: pulls.length, + }); + break; + + case `collectionItem`: + this.setState({ + type: `pullingCollectionItem`, + completedSteps: completedPulls, + totalSteps: pulls.length, + syncConfigurationCollection: pull.syncConfigurationCollection, + preflightResponseCollectionItem: + pull.preflightResponseCollectionItem, + }); + break; + } if (!(await pull.execute())) { return `needsToRunAgain`; @@ -833,9 +1014,10 @@ export class Sync< const preDeletionState = state; - for (const collectionKey of [ - ...this.syncConfiguration.collectionOrder, - ].reverse()) { + for (const collectionKey of [...this.syncConfiguration.order] + .filter((step) => step.type === `collection`) + .map((step) => step.key) + .reverse()) { const stateCollection = state.collections[ collectionKey ] as SyncableStateCollection; @@ -892,20 +1074,26 @@ export class Sync< const allReferencedFileUuids: string[] = []; - for (const collectionKey of this.syncConfiguration.collectionOrder) { - const syncConfigurationCollection = - this.syncConfiguration.collections[collectionKey]; - - for (const [uuid, syncableStateCollectionItem] of Object.entries( - state.collections[collectionKey] as SyncableStateCollection< - TSchema[`collections`] - > - )) { - for (const file of syncConfigurationCollection.listFiles( - uuid, - syncableStateCollectionItem.data - )) { - allReferencedFileUuids.push(file.uuid); + for (const step of this.syncConfiguration.order) { + switch (step.type) { + case `collection`: { + const syncConfigurationCollection = + this.syncConfiguration.collections[step.key]; + + for (const [uuid, syncableStateCollectionItem] of Object.entries( + state.collections[step.key] as SyncableStateCollection< + TSchema[`collections`] + > + )) { + for (const file of syncConfigurationCollection.listFiles( + uuid, + syncableStateCollectionItem.data + )) { + allReferencedFileUuids.push(file.uuid); + } + } + + break; } } } diff --git a/react-native/services/Sync/unit.tsx b/react-native/services/Sync/unit.tsx index 845daaae..c61abfdd 100644 --- a/react-native/services/Sync/unit.tsx +++ b/react-native/services/Sync/unit.tsx @@ -14,6 +14,28 @@ import type { LoggerInterface } from "../../types/LoggerInterface"; import type { SyncableState } from "../../types/SyncableState"; import type { SyncState } from "../../types/SyncState"; +type EnumAData = + | `Test Enum A Value A` + | `Test Enum A Value B` + | `Test Enum A Value C` + | `Test Enum A Value D` + | `Test Enum A Value E`; + +type EnumBData = + | `Test Enum B Value A` + | `Test Enum B Value B` + | `Test Enum B Value C` + | `Test Enum B Value D` + | `Test Enum B Value E`; + +type EnumCData = + | `Test Enum C Value A` + | `Test Enum C Value B` + | `Test Enum C Value C` + | `Test Enum C Value D` + | `Test Enum C Value E` + | `Test Enum C Value F`; + type CollectionAData = | `Test Collection A Value A` | `Test Collection A Value B` @@ -40,6 +62,11 @@ type CollectionCData = | `Test Collection C Value B`; type TestSchema = { + readonly enums: { + readonly testEnumAKey: EnumAData; + readonly testEnumBKey: EnumBData; + readonly testEnumCKey: EnumCData; + }; readonly collections: { readonly testCollectionAKey: CollectionAData; readonly testCollectionBKey: CollectionBData; @@ -528,10 +555,31 @@ function scenario( request, logger, { - collectionOrder: [ - `testCollectionBKey`, - `testCollectionCKey`, - `testCollectionAKey`, + order: [ + { + type: `collection`, + key: `testCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `testCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `testCollectionAKey`, + }, ], collections: { testCollectionAKey: syncConfigurationCollectionA, @@ -593,6 +641,35 @@ function scenario( scenario( `without changes`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -717,6 +794,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -769,6 +857,16 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -784,6 +882,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -856,6 +959,35 @@ scenario( scenario( `with a change to push without files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -998,6 +1130,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1057,6 +1218,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1109,6 +1281,16 @@ scenario( severity: `information`, text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -1124,6 +1306,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -1148,7 +1335,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -1162,7 +1349,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -1189,6 +1376,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1283,6 +1499,35 @@ scenario( scenario( `with a change to push with files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1430,6 +1675,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1511,6 +1785,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1570,6 +1873,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1622,6 +1936,16 @@ scenario( severity: `information`, text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -1637,6 +1961,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -1661,7 +1990,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -1675,7 +2004,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -1702,6 +2031,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1796,6 +2154,35 @@ scenario( scenario( `with a previously interrupted push without files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1938,6 +2325,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -1997,6 +2413,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2049,6 +2476,16 @@ scenario( severity: `information`, text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -2064,6 +2501,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -2088,7 +2530,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -2102,7 +2544,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -2129,6 +2571,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2223,6 +2694,35 @@ scenario( scenario( `with a previously interrupted push with files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2370,6 +2870,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2451,6 +2980,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2510,6 +3068,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2562,6 +3131,16 @@ scenario( severity: `information`, text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -2577,6 +3156,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -2601,7 +3185,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -2615,7 +3199,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -2642,6 +3226,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2736,6 +3349,35 @@ scenario( scenario( `with a previously interrupted pull where files were not awaiting push and the interrupted record is then deleted`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2859,6 +3501,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -2902,6 +3555,16 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -2917,6 +3580,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -2961,6 +3629,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3038,6 +3735,35 @@ scenario( scenario( `with a previously interrupted pull where files were awaiting push and the interrupted record is then deleted`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3193,6 +3919,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3252,6 +4007,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3298,27 +4064,42 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, @@ -3354,6 +4135,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3431,6 +4241,35 @@ scenario( scenario( `with a previously interrupted pull where files were not awaiting push and the interrupted record is then updated`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3554,6 +4393,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3606,6 +4456,16 @@ scenario( severity: `information`, text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -3621,6 +4481,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -3645,7 +4510,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -3659,7 +4524,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -3686,6 +4551,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3780,6 +4674,35 @@ scenario( scenario( `with a previously interrupted pull where files were awaiting push and the interrupted record is then updated`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3935,6 +4858,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -3994,6 +4946,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -4046,6 +5009,16 @@ scenario( severity: `information`, text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -4061,6 +5034,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -4085,7 +5063,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -4099,7 +5077,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -4126,6 +5104,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -4220,6 +5227,35 @@ scenario( scenario( `with a new item to pull without files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -4344,6 +5380,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -4405,6 +5452,16 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -4420,6 +5477,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -4444,7 +5506,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -4458,7 +5520,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -4485,6 +5547,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -4584,6 +5675,35 @@ scenario( scenario( `with a new item to pull with files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -4708,6 +5828,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -4769,6 +5900,16 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -4784,6 +5925,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -4808,7 +5954,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -4822,7 +5968,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -4955,6 +6101,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5054,6 +6229,35 @@ scenario( scenario( `with an updated item to pull without new files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5178,6 +6382,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5230,6 +6445,16 @@ scenario( severity: `information`, text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -5245,6 +6470,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -5269,7 +6499,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -5283,7 +6513,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -5310,6 +6540,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5404,6 +6663,35 @@ scenario( scenario( `with an updated item to pull with new files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5528,6 +6816,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5580,6 +6879,16 @@ scenario( severity: `information`, text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -5595,6 +6904,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -5619,7 +6933,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -5633,7 +6947,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -5766,6 +7080,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5860,6 +7203,35 @@ scenario( scenario( `with an updated item to pull with deleted files`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -5984,6 +7356,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -6036,6 +7419,16 @@ scenario( severity: `information`, text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -6051,6 +7444,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -6075,7 +7473,7 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -6089,7 +7487,7 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -6116,6 +7514,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -6214,6 +7641,28 @@ scenario( scenario( `with multiple items changing in the same sync`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -6416,6 +7865,28 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -6527,11 +7998,33 @@ scenario( { type: `setState`, to: { - collections: { - testCollectionAKey: { - // Updated. - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, + collections: { + testCollectionAKey: { + // Updated. + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, version: `Test Collection A A Version A`, data: `Test Collection A Value A`, }, @@ -6635,6 +8128,28 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -6740,6 +8255,28 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -6826,6 +8363,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version B`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -6902,6 +8450,16 @@ scenario( severity: `information`, text: `Previously pulled "testCollectionBKey" "ce05f13c-6a36-42ac-bed4-63bbf098eeb8" will be pulled again as versions do not match between preflight ("Test Collection B C Version B") and state store ("Test Collection B C Version A").`, }, + { + type: `log`, + severity: `information`, + text: `New enum "testEnumCKey" will be pulled.`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -6917,6 +8475,11 @@ scenario( severity: `information`, text: `Previously pushed "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" will be pulled.`, }, + { + type: `log`, + severity: `information`, + text: `Previously pulled enum "testEnumAKey" will be pulled again as versions do not match between preflight ("Test Enum A Version B") and state store ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -6932,7 +8495,6 @@ scenario( severity: `information`, text: `Previously pulled "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" will be pulled again as versions do not match between preflight ("Test Collection A A Version B") and state store ("Test Collection A A Version A").`, }, - { type: `log`, severity: `information`, @@ -6942,9 +8504,9 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, - totalSteps: 5, + totalSteps: 7, syncConfigurationCollection: syncConfigurationCollectionB, preflightResponseCollectionItem: { version: `Test Collection B E Version A`, @@ -6956,9 +8518,9 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 0, - totalSteps: 5, + totalSteps: 7, syncConfigurationCollection: syncConfigurationCollectionB, preflightResponseCollectionItem: { version: `Test Collection B E Version A`, @@ -6983,6 +8545,28 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -7061,9 +8645,9 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 1, - totalSteps: 5, + totalSteps: 7, syncConfigurationCollection: syncConfigurationCollectionB, preflightResponseCollectionItem: { version: `Test Collection B B Version C`, @@ -7075,9 +8659,9 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 1, - totalSteps: 5, + totalSteps: 7, syncConfigurationCollection: syncConfigurationCollectionB, preflightResponseCollectionItem: { version: `Test Collection B B Version C`, @@ -7109,7 +8693,7 @@ scenario( to: { type: `pullingFile`, completedSteps: 1, - totalSteps: 5, + totalSteps: 7, completedFiles: 0, totalFiles: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -7125,7 +8709,7 @@ scenario( to: { type: `pullingFile`, completedSteps: 1, - totalSteps: 5, + totalSteps: 7, completedFiles: 0, totalFiles: 1, syncConfigurationCollection: syncConfigurationCollectionB, @@ -7155,6 +8739,28 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -7234,9 +8840,9 @@ scenario( type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 2, - totalSteps: 5, + totalSteps: 7, syncConfigurationCollection: syncConfigurationCollectionB, preflightResponseCollectionItem: { version: `Test Collection B C Version B`, @@ -7248,9 +8854,9 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 2, - totalSteps: 5, + totalSteps: 7, syncConfigurationCollection: syncConfigurationCollectionB, preflightResponseCollectionItem: { version: `Test Collection B C Version B`, @@ -7275,6 +8881,28 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `absent`, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -7348,46 +8976,39 @@ scenario( { type: `log`, severity: `information`, - text: `Pulling previously pushed "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562"...`, + text: `Pulling enum "testEnumCKey"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 3, - totalSteps: 5, - syncConfigurationCollection: syncConfigurationCollectionC, - preflightResponseCollectionItem: { - version: `Test Collection C A Version B`, - testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, - }, + totalSteps: 7, }, }, { type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 3, - totalSteps: 5, - syncConfigurationCollection: syncConfigurationCollectionC, - preflightResponseCollectionItem: { - version: `Test Collection C A Version B`, - testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, - }, + totalSteps: 7, }, }, { type: `pullJson`, method: `GET`, - route: `sync/test-collection-c-key/c2bf5c63-85dc-4797-82db-6136081b1562`, + route: `sync/test-enum-c-key`, requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], + expectedStatusCodes: [`200`], response: { - version: `Test Collection C A Version B`, - data: `Test Collection C Value B`, + version: `Test Enum C Version A`, + data: { + "f2e827fb-5271-4775-8c92-1bea86ad4cc0": `Test Enum C Value E`, + "7d6efd2e-52d5-4cae-b35e-676536a880fc": `Test Enum C Value F`, + }, }, statusCode: `200`, }, @@ -7395,6 +9016,33 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "f2e827fb-5271-4775-8c92-1bea86ad4cc0": `Test Enum C Value E`, + "7d6efd2e-52d5-4cae-b35e-676536a880fc": `Test Enum C Value F`, + }, + }, + }, collections: { testCollectionAKey: { // Updated. @@ -7451,9 +9099,8 @@ scenario( testCollectionCKey: { // Pushed. "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version B`, - data: `Test Collection C Value B`, + status: `awaitingPull`, + data: `Test Collection C Value A`, }, }, }, @@ -7464,25 +9111,24 @@ scenario( { type: `log`, severity: `information`, - text: `Successfully pulled update of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + text: `Successfully pulled new enum "testEnumCKey".`, }, - { type: `log`, severity: `information`, - text: `Pulling updated "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, + text: `Pulling previously pushed "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 4, - totalSteps: 5, - syncConfigurationCollection: syncConfigurationCollectionA, + totalSteps: 7, + syncConfigurationCollection: syncConfigurationCollectionC, preflightResponseCollectionItem: { - version: `Test Collection A A Version B`, - testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + version: `Test Collection C A Version B`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, }, }, }, @@ -7490,26 +9136,26 @@ scenario( type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingCollectionItem`, completedSteps: 4, - totalSteps: 5, - syncConfigurationCollection: syncConfigurationCollectionA, + totalSteps: 7, + syncConfigurationCollection: syncConfigurationCollectionC, preflightResponseCollectionItem: { - version: `Test Collection A A Version B`, - testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + version: `Test Collection C A Version B`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, }, }, }, { type: `pullJson`, method: `GET`, - route: `sync/test-collection-a-key/499b4447-2f9a-49a7-b636-909ace319cd8`, + route: `sync/test-collection-c-key/c2bf5c63-85dc-4797-82db-6136081b1562`, requestBody: { type: `empty` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], response: { - version: `Test Collection A A Version B`, - data: `Test Collection A Value B`, + version: `Test Collection C A Version B`, + data: `Test Collection C Value B`, }, statusCode: `200`, }, @@ -7517,13 +9163,40 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "f2e827fb-5271-4775-8c92-1bea86ad4cc0": `Test Enum C Value E`, + "7d6efd2e-52d5-4cae-b35e-676536a880fc": `Test Enum C Value F`, + }, + }, + }, collections: { testCollectionAKey: { // Updated. "499b4447-2f9a-49a7-b636-909ace319cd8": { status: `upToDate`, - version: `Test Collection A A Version B`, - data: `Test Collection A Value B`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, }, // Deleted. "6ebca435-755c-45ef-a11c-1bcdda74c222": { @@ -7586,54 +9259,97 @@ scenario( { type: `log`, severity: `information`, - text: `Successfully pulled update of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to delete...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting "testCollectionAKey" "6ebca435-755c-45ef-a11c-1bcdda74c222"...`, + text: `Successfully pulled update of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, }, + { type: `log`, severity: `information`, - text: `Deleting "testCollectionAKey" "e999e8d7-9e9c-42f9-a36a-9fe3a2464fe7"...`, + text: `Pulling enum "testEnumAKey"...`, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingEnum`, + completedSteps: 5, + totalSteps: 7, + }, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingEnum`, + completedSteps: 5, + totalSteps: 7, + }, }, { - type: `log`, - severity: `information`, - text: `Deleting "testCollectionBKey" "4c91279d-d35f-4063-afa2-a0c0ec0dcfd3"...`, + type: `pullJson`, + method: `GET`, + route: `sync/test-enum-a-key`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`], + response: { + version: `Test Enum A Version B`, + data: { + "946b8bc8-5a4b-4382-a55c-43df2c2ca4a6": `Test Enum A Value D`, + "76f2d330-c72c-4eb5-b220-72815a65cef1": `Test Enum A Value E`, + }, + }, + statusCode: `200`, }, { type: `getState`, changedExternally: false }, { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version B`, + values: { + "946b8bc8-5a4b-4382-a55c-43df2c2ca4a6": `Test Enum A Value D`, + "76f2d330-c72c-4eb5-b220-72815a65cef1": `Test Enum A Value E`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "f2e827fb-5271-4775-8c92-1bea86ad4cc0": `Test Enum C Value E`, + "7d6efd2e-52d5-4cae-b35e-676536a880fc": `Test Enum C Value F`, + }, + }, + }, collections: { testCollectionAKey: { // Updated. "499b4447-2f9a-49a7-b636-909ace319cd8": { status: `upToDate`, - version: `Test Collection A A Version B`, - data: `Test Collection A Value B`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + // Deleted. + "6ebca435-755c-45ef-a11c-1bcdda74c222": { + status: `upToDate`, + version: `Test Collection A B Version A`, + data: `Test Collection A Value C`, + }, + // Deleted. + "e999e8d7-9e9c-42f9-a36a-9fe3a2464fe7": { + status: `upToDate`, + version: `Test Collection A C Version A`, + data: `Test Collection A Value D`, }, }, testCollectionBKey: { @@ -7655,6 +9371,12 @@ scenario( version: `Test Collection B C Version B`, data: `Test Collection B Value L`, }, + // Deleted. + "4c91279d-d35f-4063-afa2-a0c0ec0dcfd3": { + status: `upToDate`, + version: `Test Collection B D Version A`, + data: `Test Collection B Value J`, + }, // Added. "94576d22-2cbc-451e-9a92-3c50866da564": { status: `upToDate`, @@ -7678,318 +9400,3055 @@ scenario( { type: `log`, severity: `information`, - text: `Deletions applied.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for files to clean up...`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2"...`, - }, - { - type: `deleteFile`, - uuid: `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, - }, - { - type: `deleteFile`, - uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + text: `Successfully pulled update of enum "testEnumAKey".`, }, { type: `log`, severity: `information`, - text: `Sync completed successfully; at least one change was made.`, + text: `Pulling updated "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `notRunning` }, + to: { + type: `pullingCollectionItem`, + completedSteps: 6, + totalSteps: 7, + syncConfigurationCollection: syncConfigurationCollectionA, + preflightResponseCollectionItem: { + version: `Test Collection A A Version B`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `notRunning` }, - }, - ], - `atLeastOneChangeMade` -); - -scenario( - `with a new item to pull but the state store changes during the update`, - { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, + to: { + type: `pullingCollectionItem`, + completedSteps: 6, + totalSteps: 7, + syncConfigurationCollection: syncConfigurationCollectionA, + preflightResponseCollectionItem: { + version: `Test Collection A A Version B`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, }, }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-a-key/499b4447-2f9a-49a7-b636-909ace319cd8`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection A A Version B`, + data: `Test Collection A Value B`, + }, + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version B`, + values: { + "946b8bc8-5a4b-4382-a55c-43df2c2ca4a6": `Test Enum A Value D`, + "76f2d330-c72c-4eb5-b220-72815a65cef1": `Test Enum A Value E`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "f2e827fb-5271-4775-8c92-1bea86ad4cc0": `Test Enum C Value E`, + "7d6efd2e-52d5-4cae-b35e-676536a880fc": `Test Enum C Value F`, + }, + }, + }, + collections: { + testCollectionAKey: { + // Updated. + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version B`, + data: `Test Collection A Value B`, + }, + // Deleted. + "6ebca435-755c-45ef-a11c-1bcdda74c222": { + status: `upToDate`, + version: `Test Collection A B Version A`, + data: `Test Collection A Value C`, + }, + // Deleted. + "e999e8d7-9e9c-42f9-a36a-9fe3a2464fe7": { + status: `upToDate`, + version: `Test Collection A C Version A`, + data: `Test Collection A Value D`, + }, + }, + testCollectionBKey: { + // No interaction. + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + // Pushed. + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version C`, + data: `Test Collection B Value H`, + }, + // Pulled. + "ce05f13c-6a36-42ac-bed4-63bbf098eeb8": { + status: `upToDate`, + version: `Test Collection B C Version B`, + data: `Test Collection B Value L`, + }, + // Deleted. + "4c91279d-d35f-4063-afa2-a0c0ec0dcfd3": { + status: `upToDate`, + version: `Test Collection B D Version A`, + data: `Test Collection B Value J`, + }, + // Added. + "94576d22-2cbc-451e-9a92-3c50866da564": { + status: `upToDate`, + version: `Test Collection B E Version A`, + data: `Test Collection B Value K`, + }, + }, + testCollectionCKey: { + // Pushed. + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version B`, + data: `Test Collection C Value B`, + }, + }, }, + addedFileUuids: [], + deletedFileRoutes: [], }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { + }, + { + type: `log`, + severity: `information`, + text: `Successfully pulled update of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to delete...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting "testCollectionAKey" "6ebca435-755c-45ef-a11c-1bcdda74c222"...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting "testCollectionAKey" "e999e8d7-9e9c-42f9-a36a-9fe3a2464fe7"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting "testCollectionBKey" "4c91279d-d35f-4063-afa2-a0c0ec0dcfd3"...`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version B`, + values: { + "946b8bc8-5a4b-4382-a55c-43df2c2ca4a6": `Test Enum A Value D`, + "76f2d330-c72c-4eb5-b220-72815a65cef1": `Test Enum A Value E`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "f2e827fb-5271-4775-8c92-1bea86ad4cc0": `Test Enum C Value E`, + "7d6efd2e-52d5-4cae-b35e-676536a880fc": `Test Enum C Value F`, + }, + }, + }, + collections: { + testCollectionAKey: { + // Updated. + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version B`, + data: `Test Collection A Value B`, + }, + }, + testCollectionBKey: { + // No interaction. + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + // Pushed. + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version C`, + data: `Test Collection B Value H`, + }, + // Pulled. + "ce05f13c-6a36-42ac-bed4-63bbf098eeb8": { + status: `upToDate`, + version: `Test Collection B C Version B`, + data: `Test Collection B Value L`, + }, + // Added. + "94576d22-2cbc-451e-9a92-3c50866da564": { + status: `upToDate`, + version: `Test Collection B E Version A`, + data: `Test Collection B Value K`, + }, + }, + testCollectionCKey: { + // Pushed. + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version B`, + data: `Test Collection C Value B`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Deletions applied.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting unreferenced existing file "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2"...`, + }, + { + type: `deleteFile`, + uuid: `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + }, + { + type: `deleteFile`, + uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `atLeastOneChangeMade` +); + +scenario( + `with a new item to pull but the state store changes during the update`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `debug`, + text: `Fetching preflight...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + version: `Test Collection A A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + version: `Test Collection B A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + "1901a3dc-980a-4c33-b8bd-ae854e3d7389": { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + version: `Test Collection C A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + }, + }, + }, + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to pull...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `New "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389" will be pulled.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `Pulling new "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/1901a3dc-980a-4c33-b8bd-ae854e3d7389`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B C Version B`, + data: `Test Collection B Value F`, + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `warning`, + text: `The version of "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389" changed from "Test Collection B C Version A" at the time of preflight to "Test Collection B C Version B" at the time of pull; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `with an updated item to pull but the state store changes during the update`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `debug`, + text: `Fetching preflight...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + version: `Test Collection A A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + version: `Test Collection B A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + version: `Test Collection C A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + }, + }, + }, + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to pull...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B B Version C`, + data: `Test Collection B Value F`, + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `warning`, + text: `The version of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" changed from "Test Collection B B Version B" at the time of preflight to "Test Collection B B Version C" at the time of pull; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `awaiting push fails due to unexpected state change`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPush`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `information`, + text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `information`, + text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: true }, + { + type: `log`, + severity: `warning`, + text: `The state store changed during push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `awaiting push file fails due to unexpected state change`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPush`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `information`, + text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `information`, + text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPull`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 1, + totalSteps: 2, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 1, + totalSteps: 2, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `Test Collection B Value B File B Route`, + requestBody: { + type: `file`, + fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, + }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: true }, + { + type: `log`, + severity: `warning`, + text: `The state store changed during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `pushing fails due to unexpected state change`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `pushing`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `warning`, + text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, + }, + { + type: `log`, + severity: `information`, + text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: true }, + { + type: `log`, + severity: `warning`, + text: `The state store changed during push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `pushing file fails due to unexpected state change`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `pushing`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `warning`, + text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, + }, + { + type: `log`, + severity: `information`, + text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPull`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 1, + totalSteps: 2, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 1, + totalSteps: 2, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `Test Collection B Value B File B Route`, + requestBody: { + type: `file`, + fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, + }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: true }, + { + type: `log`, + severity: `warning`, + text: `The state store changed during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `awaiting pull file fails due to unexpected state change`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPull`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `warning`, + text: `Evidence of previously interrupted sync of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another pull attempt will be made following the push phase.`, + }, + { + type: `log`, + severity: `warning`, + text: `File(s) for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" were not pushed during the previous interrupted sync. They will be pushed as part of this sync.`, + }, + { + type: `log`, + severity: `information`, + text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `Test Collection B Value B File B Route`, + requestBody: { + type: `file`, + fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, + }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: true }, + { + type: `log`, + severity: `warning`, + text: `The state store changed during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `files can be deleted`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [ + `Example Deletion Route A`, + `Example Deletion Route B`, + `Example Deletion Route C`, + ], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, + { + type: `log`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], + }, + { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route A"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route A`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [ + `Example Deletion Route B`, + `Example Deletion Route C`, + ], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route A".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route B"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route B`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [`Example Deletion Route C`], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route B".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route C"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route C`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route C".`, + }, + { + type: `log`, + severity: `debug`, + text: `Fetching preflight...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + version: `Test Collection A A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + version: `Test Collection B A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + version: `Test Collection C A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + }, + }, }, }, + statusCode: `200`, }, - addedFileUuids: [], - deletedFileRoutes: [], - }, - [ { type: `log`, - severity: `information`, - text: `Sync is starting...`, + severity: `debug`, + text: `Searching for changes to pull...`, }, { type: `log`, severity: `debug`, - text: `Listing existing files...`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, }, { - type: `listFiles`, - uuids: [ - `f81d2428-9bde-4b1c-823c-86b349c99363`, - `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `52219b25-ac88-4440-bf31-a47df684bdd7`, - ], + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, }, - { type: `getState`, changedExternally: false }, { type: `log`, severity: `debug`, - text: `Searching for changes to push...`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionBKey"...`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Fetching preflight...`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to delete...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Nothing to delete.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + }, + { + type: `log`, + severity: `debug`, + text: `No files to clean up.`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `checkingForChangesToPull` }, + to: { type: `notRunning` }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `checkingForChangesToPull` }, + to: { type: `notRunning` }, }, - { - type: `pullJson`, - method: `GET`, - route: `sync/preflight`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`], - response: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - version: `Test Collection A A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - version: `Test Collection B A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - "1901a3dc-980a-4c33-b8bd-ae854e3d7389": { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - version: `Test Collection C A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, - }, - }, + ], + `atLeastOneChangeMade` +); + +scenario( + `state store changes during file deletion`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, }, }, - statusCode: `200`, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [ + `Example Deletion Route A`, + `Example Deletion Route B`, + `Example Deletion Route C`, + ], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to pull...`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], }, + { type: `getState`, changedExternally: false }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionBKey"...`, + text: `Searching for changes to push...`, }, { - type: `log`, - severity: `information`, - text: `New "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389" will be pulled.`, + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route A"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route A`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, }, + { type: `getState`, changedExternally: false }, { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [ + `Example Deletion Route B`, + `Example Deletion Route C`, + ], + }, }, { type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route A".`, }, { type: `log`, severity: `information`, - text: `Pulling new "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389"...`, + text: `Deleting file "Example Deletion Route B"...`, }, { type: `stateChange`, eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, }, { type: `stateChange`, eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, }, { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/1901a3dc-980a-4c33-b8bd-ae854e3d7389`, + type: `push`, + method: `DELETE`, + route: `Example Deletion Route B`, requestBody: { type: `empty` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B C Version B`, - data: `Test Collection B Value F`, - }, statusCode: `200`, }, + { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The version of "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389" changed from "Test Collection B C Version A" at the time of preflight to "Test Collection B C Version B" at the time of pull; sync has been interrupted and will need to run again.`, + text: `The state store changed during deletion of file "Example Deletion Route B"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -8006,8 +12465,37 @@ scenario( ); scenario( - `with an updated item to pull but the state store changes during the update`, + `state store changes during pull of new`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -8132,6 +12620,35 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -8145,9 +12662,13 @@ scenario( testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version B`, + version: `Test Collection B B Version A`, testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, + "2b5de2bf-22a4-493f-a8f3-c03437b08851": { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -8169,267 +12690,122 @@ scenario( severity: `debug`, text: `Searching for new items to pull in collection "testCollectionBKey"...`, }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionBKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, - }, - { - type: `log`, - severity: `information`, - text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, - }, - { - type: `log`, - severity: `information`, - text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, - }, - { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B B Version C`, - data: `Test Collection B Value F`, - }, - statusCode: `200`, - }, - { - type: `log`, - severity: `warning`, - text: `The version of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" changed from "Test Collection B B Version B" at the time of preflight to "Test Collection B B Version C" at the time of pull; sync has been interrupted and will need to run again.`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `notRunning` }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `notRunning` }, - }, - ], - `needsToRunAgain` -); - -scenario( - `awaiting push fails due to unexpected state change`, - { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPush`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], - deletedFileRoutes: [], - }, - [ { type: `log`, severity: `information`, - text: `Sync is starting...`, + text: `New "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851" will be pulled.`, }, { type: `log`, severity: `debug`, - text: `Listing existing files...`, - }, - { - type: `listFiles`, - uuids: [ - `f81d2428-9bde-4b1c-823c-86b349c99363`, - `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `52219b25-ac88-4440-bf31-a47df684bdd7`, - ], + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, }, - { type: `getState`, changedExternally: false }, { type: `log`, severity: `debug`, - text: `Searching for changes to push...`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionBKey"...`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `information`, - text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `information`, - text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling new "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pushing`, + type: `pullingCollectionItem`, completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, + totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, }, }, { type: `stateChange`, eventHandler: `c`, to: { - type: `pushing`, + type: `pullingCollectionItem`, completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, + totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, }, }, { - type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/2b5de2bf-22a4-493f-a8f3-c03437b08851`, + requestBody: { type: `empty` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B C Version A`, + data: `Test Collection B Value D`, + }, statusCode: `200`, }, { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The state store changed during push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + text: `The state store changed during pull of "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -8446,8 +12822,37 @@ scenario( ); scenario( - `awaiting push file fails due to unexpected state change`, + `state store changes during pull of updated`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -8463,7 +12868,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPush`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -8475,7 +12881,7 @@ scenario( }, }, }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + addedFileUuids: [], deletedFileRoutes: [], }, [ @@ -8525,13 +12931,8 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, - }, - { - type: `log`, - severity: `information`, - text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -8555,294 +12956,204 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], - deletedFileRoutes: [], - }, - }, - { - type: `log`, - severity: `information`, - text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, - }, - { - type: `log`, - severity: `information`, - text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + severity: `debug`, + text: `Fetching preflight...`, }, { type: `stateChange`, eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 1, - totalSteps: 2, - completedFiles: 0, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, + to: { type: `checkingForChangesToPull` }, }, { type: `stateChange`, eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 1, - totalSteps: 2, - completedFiles: 0, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, + to: { type: `checkingForChangesToPull` }, }, { - type: `push`, - method: `PUT`, - route: `Test Collection B Value B File B Route`, - requestBody: { - type: `file`, - fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, - }, + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, + requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: true }, - { - type: `log`, - severity: `warning`, - text: `The state store changed during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `notRunning` }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `notRunning` }, - }, - ], - `needsToRunAgain` -); - -scenario( - `pushing fails due to unexpected state change`, - { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `pushing`, - data: `Test Collection B Value B`, + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + version: `Test Collection A A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + version: `Test Collection B A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + version: `Test Collection C A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + }, + }, }, }, + statusCode: `200`, }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], - deletedFileRoutes: [], - }, - [ { type: `log`, - severity: `information`, - text: `Sync is starting...`, + severity: `debug`, + text: `Searching for changes to pull...`, }, { type: `log`, severity: `debug`, - text: `Listing existing files...`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, }, { - type: `listFiles`, - uuids: [ - `f81d2428-9bde-4b1c-823c-86b349c99363`, - `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `52219b25-ac88-4440-bf31-a47df684bdd7`, - ], + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, }, - { type: `getState`, changedExternally: false }, { type: `log`, severity: `debug`, - text: `Searching for changes to push...`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `information`, + text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionBKey"...`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `information`, - text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pushing`, + type: `pullingCollectionItem`, completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, + totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, }, { type: `stateChange`, eventHandler: `c`, to: { - type: `pushing`, + type: `pullingCollectionItem`, completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, + totalSteps: 1, syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, }, { - type: `push`, - method: `PUT`, + type: `pullJson`, + method: `GET`, route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, + requestBody: { type: `empty` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B B Version B`, + data: `Test Collection B Value C`, + }, statusCode: `200`, }, { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The state store changed during push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -8859,8 +13170,37 @@ scenario( ); scenario( - `pushing file fails due to unexpected state change`, + `state store changes during pull of awaiting push`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -8876,7 +13216,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `pushing`, + status: `awaitingPush`, data: `Test Collection B Value B`, }, }, @@ -8888,7 +13228,7 @@ scenario( }, }, }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + addedFileUuids: [], deletedFileRoutes: [], }, [ @@ -8936,15 +13276,10 @@ scenario( severity: `debug`, text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, - { - type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, - }, { type: `log`, severity: `information`, - text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, }, { type: `log`, @@ -8977,9 +13312,9 @@ scenario( to: { type: `pushing`, completedSteps: 0, - totalSteps: 2, + totalSteps: 1, completedFiles: null, - totalFiles: 1, + totalFiles: 0, syncConfigurationCollection: syncConfigurationCollectionB, }, }, @@ -8989,9 +13324,9 @@ scenario( to: { type: `pushing`, completedSteps: 0, - totalSteps: 2, + totalSteps: 1, completedFiles: null, - totalFiles: 1, + totalFiles: 0, syncConfigurationCollection: syncConfigurationCollectionB, }, }, @@ -9008,6 +13343,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -9035,7 +13399,7 @@ scenario( }, }, }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + addedFileUuids: [], deletedFileRoutes: [], }, }, @@ -9046,224 +13410,186 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + severity: `debug`, + text: `Fetching preflight...`, }, { type: `stateChange`, eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 1, - totalSteps: 2, - completedFiles: 0, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, + to: { type: `checkingForChangesToPull` }, }, { type: `stateChange`, eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 1, - totalSteps: 2, - completedFiles: 0, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, + to: { type: `checkingForChangesToPull` }, }, { - type: `push`, - method: `PUT`, - route: `Test Collection B Value B File B Route`, - requestBody: { - type: `file`, - fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, - }, + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, + requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: true }, - { - type: `log`, - severity: `warning`, - text: `The state store changed during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `notRunning` }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `notRunning` }, - }, - ], - `needsToRunAgain` -); - -scenario( - `awaiting pull file fails due to unexpected state change`, - { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, - data: `Test Collection B Value B`, + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + version: `Test Collection A A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + version: `Test Collection B A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + version: `Test Collection C A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + }, + }, }, }, + statusCode: `200`, }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], - deletedFileRoutes: [], - }, - [ { type: `log`, - severity: `information`, - text: `Sync is starting...`, + severity: `debug`, + text: `Searching for changes to pull...`, }, { type: `log`, severity: `debug`, - text: `Listing existing files...`, - }, - { - type: `listFiles`, - uuids: [ - `f81d2428-9bde-4b1c-823c-86b349c99363`, - `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `52219b25-ac88-4440-bf31-a47df684bdd7`, - ], + text: `Searching for new items to pull in collection "testCollectionBKey"...`, }, - { type: `getState`, changedExternally: false }, { type: `log`, severity: `debug`, - text: `Searching for changes to push...`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `checkingForChangesToPush` }, + type: `log`, + severity: `information`, + text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionBKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted sync of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another pull attempt will be made following the push phase.`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `warning`, - text: `File(s) for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" were not pushed during the previous interrupted sync. They will be pushed as part of this sync.`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `information`, - text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, severity: `information`, - text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pushing`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, - completedFiles: 0, - totalFiles: 1, syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, }, { type: `stateChange`, eventHandler: `c`, to: { - type: `pushing`, + type: `pullingCollectionItem`, completedSteps: 0, totalSteps: 1, - completedFiles: 0, - totalFiles: 1, syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, }, { - type: `push`, - method: `PUT`, - route: `Test Collection B Value B File B Route`, - requestBody: { - type: `file`, - fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, - }, + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `empty` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B B Version C`, + data: `Test Collection B Value C`, + }, statusCode: `200`, }, { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The state store changed during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -9280,8 +13606,37 @@ scenario( ); scenario( - `files can be deleted`, + `state store changes during pull of pushing`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -9297,8 +13652,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `pushing`, data: `Test Collection B Value B`, }, }, @@ -9311,11 +13665,7 @@ scenario( }, }, addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route A`, - `Example Deletion Route B`, - `Example Deletion Route C`, - ], + deletedFileRoutes: [], }, [ { @@ -9364,8 +13714,8 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `warning`, + text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, }, { type: `log`, @@ -9390,156 +13740,37 @@ scenario( { type: `log`, severity: `information`, - text: `Deleting file "Example Deletion Route A"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, - }, - { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route A`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route B`, - `Example Deletion Route C`, - ], - }, - }, - { - type: `log`, - severity: `information`, - text: `Successfully deleted file "Example Deletion Route A".`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route B"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, - }, - { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route B`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [`Example Deletion Route C`], - }, - }, - { - type: `log`, - severity: `information`, - text: `Successfully deleted file "Example Deletion Route B".`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route C"...`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, }, { type: `push`, - method: `DELETE`, - route: `Example Deletion Route C`, - requestBody: { type: `empty` }, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], statusCode: `200`, @@ -9548,6 +13779,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -9563,8 +13823,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `awaitingPull`, data: `Test Collection B Value B`, }, }, @@ -9583,7 +13842,7 @@ scenario( { type: `log`, severity: `information`, - text: `Successfully deleted file "Example Deletion Route C".`, + text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -9608,6 +13867,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -9621,7 +13891,7 @@ scenario( testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version A`, + version: `Test Collection B B Version C`, testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, }, @@ -9657,78 +13927,105 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + severity: `information`, + text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + severity: `information`, + text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { - type: `log`, - severity: `debug`, - text: `Nothing to delete.`, + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `log`, - severity: `debug`, - text: `Searching for files to clean up...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `log`, - severity: `debug`, - text: `No files to clean up.`, + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B B Version C`, + data: `Test Collection B Value C`, + }, + statusCode: `200`, }, + { type: `getState`, changedExternally: true }, { type: `log`, - severity: `information`, - text: `Sync completed successfully; at least one change was made.`, + severity: `warning`, + text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -9741,12 +14038,41 @@ scenario( to: { type: `notRunning` }, }, ], - `atLeastOneChangeMade` + `needsToRunAgain` ); scenario( - `state store changes during file deletion`, + `state store changes during pull of awaiting pull`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -9762,8 +14088,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `awaitingPull`, data: `Test Collection B Value B`, }, }, @@ -9776,11 +14101,7 @@ scenario( }, }, addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route A`, - `Example Deletion Route B`, - `Example Deletion Route C`, - ], + deletedFileRoutes: [], }, [ { @@ -9829,8 +14150,8 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `warning`, + text: `Evidence of previously interrupted sync of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another pull attempt will be made following the push phase.`, }, { type: `log`, @@ -9840,115 +14161,200 @@ scenario( { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `debug`, + text: `Fetching preflight...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPull` }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + version: `Test Collection A A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + version: `Test Collection B A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + version: `Test Collection C A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + }, + }, + }, + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to pull...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, severity: `information`, - text: `Deleting file "Example Deletion Route A"...`, + text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, - }, - { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route A`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, - addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route B`, - `Example Deletion Route C`, - ], }, }, - { - type: `log`, - severity: `information`, - text: `Successfully deleted file "Example Deletion Route A".`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route B"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, - }, { type: `stateChange`, eventHandler: `c`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route B`, + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, requestBody: { type: `empty` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B B Version C`, + data: `Test Collection B Value C`, + }, statusCode: `200`, }, { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The state store changed during deletion of file "Example Deletion Route B"; sync has been interrupted and will need to run again.`, + text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -9965,8 +14371,37 @@ scenario( ); scenario( - `state store changes during pull of new`, + `state store changes during deletion application for up to date`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10091,6 +14526,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10103,14 +14549,6 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - "2b5de2bf-22a4-493f-a8f3-c03437b08851": { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -10134,23 +14572,23 @@ scenario( }, { type: `log`, - severity: `information`, - text: `New "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851" will be pulled.`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -10167,6 +14605,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -10184,55 +14627,34 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Pulling new "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"...`, + severity: `debug`, + text: `Searching for changes to delete...`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/2b5de2bf-22a4-493f-a8f3-c03437b08851`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B C Version A`, - data: `Test Collection B Value D`, - }, - statusCode: `200`, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The state store changed during pull of "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"; sync has been interrupted and will need to run again.`, + text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -10249,8 +14671,37 @@ scenario( ); scenario( - `state store changes during pull of updated`, + `state store changes during deletion application for pushing`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10266,8 +14717,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `pushing`, data: `Test Collection B Value B`, }, }, @@ -10329,8 +14779,8 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `warning`, + text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, }, { type: `log`, @@ -10349,8 +14799,115 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPull`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -10375,6 +14932,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10387,10 +14955,6 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -10424,8 +14988,13 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -10442,6 +15011,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -10459,55 +15033,34 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + severity: `debug`, + text: `Searching for changes to delete...`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B B Version B`, - data: `Test Collection B Value C`, - }, - statusCode: `200`, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -10524,8 +15077,37 @@ scenario( ); scenario( - `state store changes during pull of awaiting push`, + `state store changes during deletion application for awaiting push`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10668,6 +15250,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10727,6 +15338,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10739,10 +15361,6 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -10776,8 +15394,13 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -10794,6 +15417,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -10811,55 +15439,34 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + severity: `debug`, + text: `Searching for changes to delete...`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B B Version C`, - data: `Test Collection B Value C`, - }, - statusCode: `200`, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `getState`, changedExternally: true }, { type: `log`, severity: `warning`, - text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -10876,8 +15483,37 @@ scenario( ); scenario( - `state store changes during pull of pushing`, + `state store changes during deletion application for awaiting pull`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -10893,7 +15529,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `pushing`, + status: `awaitingPull`, data: `Test Collection B Value B`, }, }, @@ -10946,115 +15582,37 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionBKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, - }, - { - type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, - }, - { - type: `log`, - severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, - }, + text: `Searching for changes to push in collection "testCollectionBKey"...`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, - }, + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, { - type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, + type: `log`, + severity: `warning`, + text: `Evidence of previously interrupted sync of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another pull attempt will be made following the push phase.`, }, - { type: `getState`, changedExternally: false }, { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `information`, - text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, @@ -11079,6 +15637,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -11091,10 +15660,6 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -11128,8 +15693,13 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -11146,6 +15716,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -11161,75 +15736,384 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to delete...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, { type: `log`, severity: `information`, - text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { type: `getState`, changedExternally: true }, + { + type: `log`, + severity: `warning`, + text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +test(`throws an error when already running`, async () => { + const stateStore: StateStoreInterface> = { + addListener: jest.fn(), + removeListener: jest.fn(), + load: jest.fn(), + get: jest.fn().mockReturnValue({ + collections: { + testCollectionAKey: {}, + testCollectionBKey: {}, + testCollectionCKey: {}, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }), + set: jest.fn(), + unload: jest.fn(), + }; + + const request: RequestInterface = { + withoutResponse: jest.fn(), + returningJson: jest.fn().mockReturnValue( + new Promise(() => { + // Empty. + }) + ), + returningFile: jest.fn(), + }; + + const logger: LoggerInterface = { + error: jest.fn(), + warning: jest.fn(), + information: jest.fn(), + debug: jest.fn(), + }; + + const fileStore: FileStoreInterface = { + load: jest.fn(), + generatePath: jest.fn(), + delete: jest.fn(), + list: jest.fn(), + unload: jest.fn(), + import: jest.fn(), + }; + + const abortSignal = new AbortController().signal; + + const sync = new Sync< + TestSchema, + TestAdditionalCollectionData, + TestAdditionalCollectionItemData + >( + stateStore, + request, + logger, + { + order: [ + { + type: `collection`, + key: `testCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `testCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `testCollectionAKey`, + }, + ], + collections: { + testCollectionAKey: syncConfigurationCollectionA, + testCollectionBKey: syncConfigurationCollectionB, + testCollectionCKey: syncConfigurationCollectionC, + }, + }, + fileStore + ); + + const eventHandlerA = jest.fn(); + sync.addListener(`stateChange`, eventHandlerA); + + const eventHandlerB = jest.fn(); + sync.addListener(`stateChange`, eventHandlerB); + + const eventHandlerC = jest.fn(); + sync.addListener(`stateChange`, eventHandlerC); + + sync.removeListener(`stateChange`, eventHandlerB); + + sync.run(abortSignal); + + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + + await expect(sync.run(new AbortController().signal)).rejects.toEqual( + new Error(`Sync is already running.`) + ); + + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + + expect(eventHandlerA).toBeCalledTimes(2); + expect(eventHandlerB).not.toHaveBeenCalled(); + expect(eventHandlerC).toBeCalledTimes(2); + expect(stateStore.addListener).not.toHaveBeenCalled(); + expect(stateStore.removeListener).not.toHaveBeenCalled(); + expect(stateStore.load).not.toHaveBeenCalled(); + expect(stateStore.get).toBeCalledTimes(1); + expect(stateStore.set).not.toHaveBeenCalled(); + expect(stateStore.unload).not.toHaveBeenCalled(); + expect(request.withoutResponse).not.toHaveBeenCalled(); + expect(request.returningJson).toBeCalledTimes(1); + expect(request.returningFile).not.toHaveBeenCalled(); + expect(logger.error).not.toHaveBeenCalled(); + expect(logger.warning).not.toHaveBeenCalled(); + expect(logger.information).toBeCalledTimes(1); + expect(logger.debug).toBeCalledTimes(6); + expect(fileStore.load).not.toHaveBeenCalled(); + expect(fileStore.generatePath).not.toHaveBeenCalled(); + expect(fileStore.delete).not.toHaveBeenCalled(); + expect(fileStore.list).toBeCalledTimes(1); + expect(fileStore.unload).not.toHaveBeenCalled(); + expect(fileStore.import).not.toHaveBeenCalled(); +}); + +test(`can run multiple times`, async () => { + const stateStore: StateStoreInterface> = { + addListener: jest.fn(), + removeListener: jest.fn(), + load: jest.fn(), + get: jest.fn().mockReturnValue({ + enums: { + testEnumAKey: { + type: `upToDate`, + version: 0, + values: {}, }, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + testEnumBKey: { + type: `upToDate`, + version: 0, + values: {}, + }, + testEnumCKey: { + type: `upToDate`, + version: 0, + values: {}, }, }, - }, - { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B B Version C`, - data: `Test Collection B Value C`, + collections: { + testCollectionAKey: {}, + testCollectionBKey: {}, + testCollectionCKey: {}, }, + addedFileUuids: [], + deletedFileRoutes: [], + }), + set: jest.fn(), + unload: jest.fn(), + }; + + const request: RequestInterface = { + withoutResponse: jest.fn(), + returningJson: jest.fn().mockResolvedValue({ statusCode: `200`, - }, - { type: `getState`, changedExternally: true }, - { - type: `log`, - severity: `warning`, - text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `notRunning` }, - }, + value: { + enums: { + testEnumAKey: { + version: 0, + }, + testEnumBKey: { + version: 0, + }, + testEnumCKey: { + version: 0, + }, + }, + collections: { + testCollectionAKey: {}, + testCollectionBKey: {}, + testCollectionCKey: {}, + }, + }, + }), + returningFile: jest.fn(), + }; + + const logger: LoggerInterface = { + error: jest.fn(), + warning: jest.fn(), + information: jest.fn(), + debug: jest.fn(), + }; + + const fileStore: FileStoreInterface = { + load: jest.fn(), + generatePath: jest.fn(), + delete: jest.fn(), + list: jest.fn().mockResolvedValue([]), + unload: jest.fn(), + import: jest.fn(), + }; + + const abortSignal = new AbortController().signal; + + const sync = new Sync< + TestSchema, + TestAdditionalCollectionData, + TestAdditionalCollectionItemData + >( + stateStore, + request, + logger, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `notRunning` }, + order: [ + { + type: `collection`, + key: `testCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `testCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `testCollectionAKey`, + }, + ], + collections: { + testCollectionAKey: syncConfigurationCollectionA, + testCollectionBKey: syncConfigurationCollectionB, + testCollectionCKey: syncConfigurationCollectionC, + }, }, - ], - `needsToRunAgain` -); + fileStore + ); + + const eventHandlerA = jest.fn(); + sync.addListener(`stateChange`, eventHandlerA); + + const eventHandlerB = jest.fn(); + sync.addListener(`stateChange`, eventHandlerB); + + const eventHandlerC = jest.fn(); + sync.addListener(`stateChange`, eventHandlerC); + + sync.removeListener(`stateChange`, eventHandlerB); + + await sync.run(abortSignal); + + await sync.run(abortSignal); + + expect(eventHandlerA).toBeCalledTimes(6); + expect(eventHandlerB).not.toHaveBeenCalled(); + expect(eventHandlerC).toBeCalledTimes(6); + expect(stateStore.addListener).not.toHaveBeenCalled(); + expect(stateStore.removeListener).not.toHaveBeenCalled(); + expect(stateStore.load).not.toHaveBeenCalled(); + expect(stateStore.get).toBeCalledTimes(2); + expect(stateStore.set).not.toHaveBeenCalled(); + expect(stateStore.unload).not.toHaveBeenCalled(); + expect(request.withoutResponse).not.toHaveBeenCalled(); + expect(request.returningJson).toBeCalledTimes(2); + expect(request.returningFile).not.toHaveBeenCalled(); + expect(logger.error).not.toHaveBeenCalled(); + expect(logger.warning).not.toHaveBeenCalled(); + expect(logger.information).toBeCalledTimes(4); + expect(logger.debug).toBeCalledTimes(46); + expect(fileStore.load).not.toHaveBeenCalled(); + expect(fileStore.generatePath).not.toHaveBeenCalled(); + expect(fileStore.delete).not.toHaveBeenCalled(); + expect(fileStore.list).toBeCalledTimes(2); + expect(fileStore.unload).not.toHaveBeenCalled(); + expect(fileStore.import).not.toHaveBeenCalled(); +}); scenario( - `state store changes during pull of awaiting pull`, + `deleted following push`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -11245,7 +16129,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, + status: `awaitingPush`, data: `Test Collection B Value B`, }, }, @@ -11307,8 +16191,8 @@ scenario( }, { type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted sync of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another pull attempt will be made following the push phase.`, + severity: `information`, + text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, }, { type: `log`, @@ -11327,8 +16211,115 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPull`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -11353,6 +16344,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -11365,10 +16367,6 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -11402,8 +16400,13 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -11420,6 +16423,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -11435,57 +16443,123 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to delete...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, { type: `log`, severity: `information`, - text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, + { type: `getState`, changedExternally: false }, { - type: `stateChange`, - eventHandler: `a`, + type: `setState`, to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, }, + addedFileUuids: [], + deletedFileRoutes: [], }, }, { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, + type: `log`, + severity: `information`, + text: `Deletions applied.`, }, { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B B Version C`, - data: `Test Collection B Value C`, - }, - statusCode: `200`, + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, }, - { type: `getState`, changedExternally: true }, { type: `log`, - severity: `warning`, - text: `The state store changed during pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"; sync has been interrupted and will need to run again.`, + severity: `information`, + text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, + }, + { + type: `deleteFile`, + uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + }, + { + type: `deleteFile`, + uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -11498,12 +16572,41 @@ scenario( to: { type: `notRunning` }, }, ], - `needsToRunAgain` + `atLeastOneChangeMade` ); scenario( - `state store changes during deletion application for up to date`, + `deleted following an interrupted push`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -11519,8 +16622,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `pushing`, data: `Test Collection B Value B`, }, }, @@ -11582,8 +16684,8 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `warning`, + text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, }, { type: `log`, @@ -11605,6 +16707,113 @@ scenario( severity: `debug`, text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 1, + completedFiles: null, + totalFiles: 0, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `awaitingPull`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, { type: `log`, severity: `debug`, @@ -11628,6 +16837,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -11654,22 +16874,32 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for changes to pull...`, + text: `Searching for changes to pull...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionBKey"...`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -11686,6 +16916,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -11726,11 +16961,98 @@ scenario( severity: `information`, text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, - { type: `getState`, changedExternally: true }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, { type: `log`, - severity: `warning`, - text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, + severity: `information`, + text: `Deletions applied.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, + }, + { + type: `deleteFile`, + uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + }, + { + type: `deleteFile`, + uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -11743,12 +17065,41 @@ scenario( to: { type: `notRunning` }, }, ], - `needsToRunAgain` + `atLeastOneChangeMade` ); scenario( - `state store changes during deletion application for pushing`, + `deleted without changes`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -11764,7 +17115,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `pushing`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -11826,8 +17178,8 @@ scenario( }, { type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -11849,84 +17201,6 @@ scenario( severity: `debug`, text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, - { - type: `log`, - severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, - }, - { - type: `log`, - severity: `information`, - text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, - }, { type: `log`, severity: `debug`, @@ -11950,6 +17224,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -11993,6 +17278,16 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -12008,6 +17303,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -12035,24 +17335,111 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Deletions applied.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + type: `deleteFile`, + uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, }, { type: `log`, severity: `information`, - text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + }, + { + type: `deleteFile`, + uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, }, - { type: `getState`, changedExternally: true }, { type: `log`, - severity: `warning`, - text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -12065,12 +17452,41 @@ scenario( to: { type: `notRunning` }, }, ], - `needsToRunAgain` + `atLeastOneChangeMade` ); scenario( - `state store changes during deletion application for awaiting push`, + `files can be deleted`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -12086,7 +17502,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPush`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -12099,7 +17516,11 @@ scenario( }, }, addedFileUuids: [], - deletedFileRoutes: [], + deletedFileRoutes: [ + `Example Deletion Route A`, + `Example Deletion Route B`, + `Example Deletion Route C`, + ], }, [ { @@ -12148,8 +17569,8 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -12174,37 +17595,214 @@ scenario( { type: `log`, severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Deleting file "Example Deletion Route A"...`, }, { type: `stateChange`, eventHandler: `a`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route A`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [ + `Example Deletion Route B`, + `Example Deletion Route C`, + ], }, }, + { + type: `log`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route A".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route B"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + }, { type: `stateChange`, eventHandler: `c`, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route B`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [`Example Deletion Route C`], }, }, + { + type: `log`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route B".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route C"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + }, { type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, + method: `DELETE`, + route: `Example Deletion Route C`, + requestBody: { type: `empty` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], statusCode: `200`, @@ -12213,6 +17811,35 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -12228,7 +17855,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -12247,7 +17875,7 @@ scenario( { type: `log`, severity: `information`, - text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + text: `Successfully deleted file "Example Deletion Route C".`, }, { type: `log`, @@ -12272,6 +17900,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -12284,6 +17923,10 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -12315,6 +17958,21 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, { type: `log`, severity: `debug`, @@ -12330,6 +17988,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -12358,23 +18021,32 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Nothing to delete.`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + text: `Searching for files to clean up...`, }, { type: `log`, - severity: `information`, - text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + severity: `debug`, + text: `No files to clean up.`, }, - { type: `getState`, changedExternally: true }, { type: `log`, - severity: `warning`, - text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -12387,12 +18059,41 @@ scenario( to: { type: `notRunning` }, }, ], - `needsToRunAgain` + `atLeastOneChangeMade` ); scenario( - `state store changes during deletion application for awaiting pull`, + `file clean-up temporarily blocked`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -12408,7 +18109,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -12438,7 +18140,9 @@ scenario( type: `listFiles`, uuids: [ `f81d2428-9bde-4b1c-823c-86b349c99363`, + `569213c5-0d73-4049-9136-6fba8617b78f`, `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `9f2d4d9a-5da7-411c-8c0b-726a66d29d7a`, `52219b25-ac88-4440-bf31-a47df684bdd7`, ], }, @@ -12470,8 +18174,8 @@ scenario( }, { type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted sync of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another pull attempt will be made following the push phase.`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -12516,6 +18220,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -12528,6 +18243,10 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -12562,317 +18281,144 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, - severity: `information`, - text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + severity: `debug`, + text: `Searching for changes to delete...`, }, - { type: `getState`, changedExternally: true }, { type: `log`, - severity: `warning`, - text: `The state store changed before deletions could be applied; sync has been interrupted and will need to run again.`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `notRunning` }, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `notRunning` }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, - ], - `needsToRunAgain` -); - -test(`throws an error when already running`, async () => { - const stateStore: StateStoreInterface> = { - addListener: jest.fn(), - removeListener: jest.fn(), - load: jest.fn(), - get: jest.fn().mockReturnValue({ - collections: { - testCollectionAKey: {}, - testCollectionBKey: {}, - testCollectionCKey: {}, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }), - set: jest.fn(), - unload: jest.fn(), - }; - - const request: RequestInterface = { - withoutResponse: jest.fn(), - returningJson: jest.fn().mockReturnValue( - new Promise(() => { - // Empty. - }) - ), - returningFile: jest.fn(), - }; - - const logger: LoggerInterface = { - error: jest.fn(), - warning: jest.fn(), - information: jest.fn(), - debug: jest.fn(), - }; - - const fileStore: FileStoreInterface = { - load: jest.fn(), - generatePath: jest.fn(), - delete: jest.fn(), - list: jest.fn(), - unload: jest.fn(), - import: jest.fn(), - }; - - const abortSignal = new AbortController().signal; - - const sync = new Sync< - TestSchema, - TestAdditionalCollectionData, - TestAdditionalCollectionItemData - >( - stateStore, - request, - logger, { - collectionOrder: [ - `testCollectionBKey`, - `testCollectionCKey`, - `testCollectionAKey`, - ], - collections: { - testCollectionAKey: syncConfigurationCollectionA, - testCollectionBKey: syncConfigurationCollectionB, - testCollectionCKey: syncConfigurationCollectionC, - }, - }, - fileStore - ); - - const eventHandlerA = jest.fn(); - sync.addListener(`stateChange`, eventHandlerA); - - const eventHandlerB = jest.fn(); - sync.addListener(`stateChange`, eventHandlerB); - - const eventHandlerC = jest.fn(); - sync.addListener(`stateChange`, eventHandlerC); - - sync.removeListener(`stateChange`, eventHandlerB); - - sync.run(abortSignal); - - await new Promise((resolve) => { - setTimeout(resolve, 100); - }); - - await expect(sync.run(new AbortController().signal)).rejects.toEqual( - new Error(`Sync is already running.`) - ); - - await new Promise((resolve) => { - setTimeout(resolve, 100); - }); - - expect(eventHandlerA).toBeCalledTimes(2); - expect(eventHandlerB).not.toHaveBeenCalled(); - expect(eventHandlerC).toBeCalledTimes(2); - expect(stateStore.addListener).not.toHaveBeenCalled(); - expect(stateStore.removeListener).not.toHaveBeenCalled(); - expect(stateStore.load).not.toHaveBeenCalled(); - expect(stateStore.get).toBeCalledTimes(1); - expect(stateStore.set).not.toHaveBeenCalled(); - expect(stateStore.unload).not.toHaveBeenCalled(); - expect(request.withoutResponse).not.toHaveBeenCalled(); - expect(request.returningJson).toBeCalledTimes(1); - expect(request.returningFile).not.toHaveBeenCalled(); - expect(logger.error).not.toHaveBeenCalled(); - expect(logger.warning).not.toHaveBeenCalled(); - expect(logger.information).toBeCalledTimes(1); - expect(logger.debug).toBeCalledTimes(6); - expect(fileStore.load).not.toHaveBeenCalled(); - expect(fileStore.generatePath).not.toHaveBeenCalled(); - expect(fileStore.delete).not.toHaveBeenCalled(); - expect(fileStore.list).toBeCalledTimes(1); - expect(fileStore.unload).not.toHaveBeenCalled(); - expect(fileStore.import).not.toHaveBeenCalled(); -}); - -test(`can run multiple times`, async () => { - const stateStore: StateStoreInterface> = { - addListener: jest.fn(), - removeListener: jest.fn(), - load: jest.fn(), - get: jest.fn().mockReturnValue({ - collections: { - testCollectionAKey: {}, - testCollectionBKey: {}, - testCollectionCKey: {}, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }), - set: jest.fn(), - unload: jest.fn(), - }; - - const request: RequestInterface = { - withoutResponse: jest.fn(), - returningJson: jest.fn().mockResolvedValue({ - statusCode: `200`, - value: { - collections: { - testCollectionAKey: {}, - testCollectionBKey: {}, - testCollectionCKey: {}, - }, - }, - }), - returningFile: jest.fn(), - }; - - const logger: LoggerInterface = { - error: jest.fn(), - warning: jest.fn(), - information: jest.fn(), - debug: jest.fn(), - }; - - const fileStore: FileStoreInterface = { - load: jest.fn(), - generatePath: jest.fn(), - delete: jest.fn(), - list: jest.fn().mockResolvedValue([]), - unload: jest.fn(), - import: jest.fn(), - }; - - const abortSignal = new AbortController().signal; - - const sync = new Sync< - TestSchema, - TestAdditionalCollectionData, - TestAdditionalCollectionItemData - >( - stateStore, - request, - logger, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, + }, { - collectionOrder: [ - `testCollectionBKey`, - `testCollectionCKey`, - `testCollectionAKey`, - ], - collections: { - testCollectionAKey: syncConfigurationCollectionA, - testCollectionBKey: syncConfigurationCollectionB, - testCollectionCKey: syncConfigurationCollectionC, - }, + type: `log`, + severity: `debug`, + text: `Nothing to delete.`, }, - fileStore - ); - - const eventHandlerA = jest.fn(); - sync.addListener(`stateChange`, eventHandlerA); - - const eventHandlerB = jest.fn(); - sync.addListener(`stateChange`, eventHandlerB); - - const eventHandlerC = jest.fn(); - sync.addListener(`stateChange`, eventHandlerC); - - sync.removeListener(`stateChange`, eventHandlerB); - - await sync.run(abortSignal); - - await sync.run(abortSignal); - - expect(eventHandlerA).toBeCalledTimes(6); - expect(eventHandlerB).not.toHaveBeenCalled(); - expect(eventHandlerC).toBeCalledTimes(6); - expect(stateStore.addListener).not.toHaveBeenCalled(); - expect(stateStore.removeListener).not.toHaveBeenCalled(); - expect(stateStore.load).not.toHaveBeenCalled(); - expect(stateStore.get).toBeCalledTimes(2); - expect(stateStore.set).not.toHaveBeenCalled(); - expect(stateStore.unload).not.toHaveBeenCalled(); - expect(request.withoutResponse).not.toHaveBeenCalled(); - expect(request.returningJson).toBeCalledTimes(2); - expect(request.returningFile).not.toHaveBeenCalled(); - expect(logger.error).not.toHaveBeenCalled(); - expect(logger.warning).not.toHaveBeenCalled(); - expect(logger.information).toBeCalledTimes(4); - expect(logger.debug).toBeCalledTimes(40); - expect(fileStore.load).not.toHaveBeenCalled(); - expect(fileStore.generatePath).not.toHaveBeenCalled(); - expect(fileStore.delete).not.toHaveBeenCalled(); - expect(fileStore.list).toBeCalledTimes(2); - expect(fileStore.unload).not.toHaveBeenCalled(); - expect(fileStore.import).not.toHaveBeenCalled(); -}); + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + nextFileCleanUpBlockers: 1, + }, + { + type: `log`, + severity: `warning`, + text: `Files to clean up were found, but file clean-up has been temporarily blocked (it is likely that the user interface has added files to disk which are not yet referenced within the state store).`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; no changes were made.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `noChangesMade` +); scenario( - `deleted following push`, + `files requiring push but not existing`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, + status: `awaitingPush`, data: `Test Collection A Value A`, }, }, @@ -12883,7 +18429,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPush`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -12895,7 +18442,11 @@ scenario( }, }, }, - addedFileUuids: [], + addedFileUuids: [ + `189d50bd-d3e3-4775-b147-c74a28070a34`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `9ce916b4-d745-446f-897c-b2e352afdcb4`, + ], deletedFileRoutes: [], }, [ @@ -12918,6 +18469,79 @@ scenario( ], }, { type: `getState`, changedExternally: false }, + { + type: `log`, + severity: `warning`, + text: `The state store lists file UUID "189d50bd-d3e3-4775-b147-c74a28070a34" as requiring push, but no such file exists on disk. It is most likely that the application closed before state could be written back to disk after successfully pushing a deleted record, but this may indicate the presence of a bug.`, + }, + { + type: `log`, + severity: `warning`, + text: `The state store lists file UUID "9ce916b4-d745-446f-897c-b2e352afdcb4" as requiring push, but no such file exists on disk. It is most likely that the application closed before state could be written back to disk after successfully pushing a deleted record, but this may indicate the presence of a bug.`, + }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `awaitingPush`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`], + deletedFileRoutes: [], + }, + }, { type: `log`, severity: `debug`, @@ -12945,8 +18569,8 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, @@ -12965,13 +18589,18 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + severity: `information`, + text: `Change of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" will be pushed.`, }, { type: `log`, severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `File "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2" of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" will be pushed.`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, }, { type: `stateChange`, @@ -12979,10 +18608,117 @@ scenario( to: { type: `pushing`, completedSteps: 0, - totalSteps: 1, + totalSteps: 2, completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionA, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionA, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-a-key/499b4447-2f9a-49a7-b636-909ace319cd8`, + requestBody: { type: `json`, value: `Test Collection A Value A` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `awaitingPull`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [`a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully pushed change of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Pushing file "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2" of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 1, + totalSteps: 2, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionA, }, }, { @@ -12990,18 +18726,21 @@ scenario( eventHandler: `c`, to: { type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, + completedSteps: 1, + totalSteps: 2, + completedFiles: 0, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionA, }, }, { type: `push`, method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, + route: `Test Collection A Value A File A Route`, + requestBody: { + type: `file`, + fileUri: `Example File Path For Uuid a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2 Generated By File Store`, + }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], statusCode: `200`, @@ -13010,11 +18749,39 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, + status: `awaitingPull`, data: `Test Collection A Value A`, }, }, @@ -13025,7 +18792,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -13044,7 +18812,7 @@ scenario( { type: `log`, severity: `information`, - text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + text: `Successfully pushed file "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2" of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, @@ -13069,10 +18837,21 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { - version: `Test Collection A A Version A`, + version: `Test Collection A A Version B`, testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, }, }, @@ -13081,6 +18860,10 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -13115,68 +18898,138 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + severity: `information`, + text: `Previously pushed "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" will be pulled.`, }, { type: `log`, severity: `information`, - text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling previously pushed "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionA, + preflightResponseCollectionItem: { + version: `Test Collection A A Version B`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionA, + preflightResponseCollectionItem: { + version: `Test Collection A A Version B`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-a-key/499b4447-2f9a-49a7-b636-909ace319cd8`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection A A Version B`, + data: `Test Collection A Value E`, + }, + statusCode: `200`, }, { type: `getState`, changedExternally: false }, { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, + version: `Test Collection A A Version B`, + data: `Test Collection A Value E`, }, }, testCollectionBKey: { @@ -13185,6 +19038,11 @@ scenario( version: `Test Collection B A Version A`, data: `Test Collection B Value A`, }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -13201,30 +19059,42 @@ scenario( { type: `log`, severity: `information`, - text: `Deletions applied.`, + text: `Successfully pulled update of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, severity: `debug`, - text: `Searching for files to clean up...`, + text: `Searching for changes to delete...`, }, { type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, }, { - type: `deleteFile`, - uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, { type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, }, { - type: `deleteFile`, - uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + type: `log`, + severity: `debug`, + text: `Nothing to delete.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + }, + { + type: `log`, + severity: `debug`, + text: `No files to clean up.`, }, { type: `log`, @@ -13246,8 +19116,37 @@ scenario( ); scenario( - `deleted following an interrupted push`, + `handles a non-200 pull`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -13263,7 +19162,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `pushing`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -13323,108 +19223,30 @@ scenario( severity: `debug`, text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, - { - type: `log`, - severity: `warning`, - text: `Evidence of previously interrupted push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" found; another attempt will be made.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, - }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, - }, - { - type: `log`, - severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 1, - completedFiles: null, - totalFiles: 0, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, + text: `Searching for changes to push in collection "testCollectionCKey"...`, }, { type: `log`, - severity: `information`, - text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, @@ -13449,6 +19271,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -13461,6 +19294,14 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + "1901a3dc-980a-4c33-b8bd-ae854e3d7389": { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -13482,6 +19323,11 @@ scenario( severity: `debug`, text: `Searching for new items to pull in collection "testCollectionBKey"...`, }, + { + type: `log`, + severity: `information`, + text: `New "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389" will be pulled.`, + }, { type: `log`, severity: `debug`, @@ -13495,121 +19341,100 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, severity: `information`, - text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling new "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389"...`, }, - { type: `getState`, changedExternally: false }, { - type: `setState`, + type: `stateChange`, + eventHandler: `a`, to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, }, - addedFileUuids: [], - deletedFileRoutes: [], }, }, { - type: `log`, - severity: `information`, - text: `Deletions applied.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for files to clean up...`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, - }, - { - type: `deleteFile`, - uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, }, { - type: `deleteFile`, - uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/1901a3dc-980a-4c33-b8bd-ae854e3d7389`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: {}, + statusCode: `403`, }, { type: `log`, - severity: `information`, - text: `Sync completed successfully; at least one change was made.`, + severity: `warning`, + text: `The API returned status code "403" during the pull of "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -13622,12 +19447,41 @@ scenario( to: { type: `notRunning` }, }, ], - `atLeastOneChangeMade` + `needsToRunAgain` ); scenario( - `deleted without changes`, + `handles a non-200 update`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -13752,6 +19606,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -13764,6 +19629,10 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -13797,122 +19666,101 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + severity: `information`, + text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, severity: `information`, - text: `Deleting "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, - { type: `getState`, changedExternally: false }, { - type: `setState`, + type: `stateChange`, + eventHandler: `a`, to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, - addedFileUuids: [], - deletedFileRoutes: [], }, }, { - type: `log`, - severity: `information`, - text: `Deletions applied.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for files to clean up...`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, - }, - { - type: `deleteFile`, - uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `deleteFile`, - uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: {}, + statusCode: `403`, }, { type: `log`, - severity: `information`, - text: `Sync completed successfully; at least one change was made.`, + severity: `warning`, + text: `The API returned status code "403" during the pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -13925,12 +19773,41 @@ scenario( to: { type: `notRunning` }, }, ], - `atLeastOneChangeMade` + `needsToRunAgain` ); scenario( - `files can be deleted`, + `handles a non-200 file pull in a new item`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -13960,11 +19837,7 @@ scenario( }, }, addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route A`, - `Example Deletion Route B`, - `Example Deletion Route C`, - ], + deletedFileRoutes: [], }, [ { @@ -14038,201 +19911,389 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route A"...`, + severity: `debug`, + text: `Fetching preflight...`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + to: { type: `checkingForChangesToPull` }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + to: { type: `checkingForChangesToPull` }, }, { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route A`, + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, }, }, testCollectionBKey: { "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + "2b5de2bf-22a4-493f-a8f3-c03437b08851": { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, }, }, }, - addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route B`, - `Example Deletion Route C`, - ], + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to pull...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `information`, + text: `New "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851" will be pulled.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `Pulling new "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, + }, + { + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/2b5de2bf-22a4-493f-a8f3-c03437b08851`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B C Version A`, + data: `Test Collection B Value E`, + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `information`, + text: `Pulling file "dab5ac6d-0ecc-4af9-9022-dda2414bf8b6" of "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingFile`, + completedSteps: 0, + totalSteps: 1, + completedFiles: 0, + totalFiles: 2, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingFile`, + completedSteps: 0, + totalSteps: 1, + completedFiles: 0, + totalFiles: 2, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B C Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + }, + }, + }, + { + type: `pullFile`, + method: `GET`, + route: `Test Collection B Value E File A Route`, + requestBody: { type: `empty` }, + queryParameters: {}, + fileUri: `Example File Path For Uuid dab5ac6d-0ecc-4af9-9022-dda2414bf8b6 Generated By File Store`, + successfulStatusCodes: [`200`], + failureStatusCodes: [`404`, `403`], + statusCode: `403`, + }, + { + type: `log`, + severity: `warning`, + text: `The API returned status code "403" during the pull of file "dab5ac6d-0ecc-4af9-9022-dda2414bf8b6" of "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `notRunning` }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `notRunning` }, + }, + ], + `needsToRunAgain` +); + +scenario( + `handles a non-200 file pull for an existing item`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, }, }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + [ { type: `log`, severity: `information`, - text: `Successfully deleted file "Example Deletion Route A".`, + text: `Sync is starting...`, }, { type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route B"...`, + severity: `debug`, + text: `Listing existing files...`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], }, + { type: `getState`, changedExternally: false }, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + type: `log`, + severity: `debug`, + text: `Searching for changes to push...`, }, { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route B`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPush` }, }, - { type: `getState`, changedExternally: false }, { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [`Example Deletion Route C`], - }, + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPush` }, }, { type: `log`, - severity: `information`, - text: `Successfully deleted file "Example Deletion Route B".`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, }, { type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route C"...`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, }, { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route C`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, }, - { type: `getState`, changedExternally: false }, { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, }, { type: `log`, - severity: `information`, - text: `Successfully deleted file "Example Deletion Route C".`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, @@ -14257,6 +20318,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -14270,7 +20342,7 @@ scenario( testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version A`, + version: `Test Collection B B Version B`, testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, }, @@ -14304,10 +20376,20 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, + { + type: `log`, + severity: `information`, + text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, + }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -14324,6 +20406,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -14341,43 +20428,102 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `Searching for changes to delete...`, + severity: `information`, + text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + type: `pullJson`, + method: `GET`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + response: { + version: `Test Collection B B Version B`, + data: `Test Collection B Value F`, + }, + statusCode: `200`, }, { type: `log`, - severity: `debug`, - text: `Nothing to delete.`, + severity: `information`, + text: `Pulling file "40d92d2c-631f-4a42-ba5e-a70a82bea897" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingFile`, + completedSteps: 0, + totalSteps: 1, + completedFiles: 0, + totalFiles: 2, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `log`, - severity: `debug`, - text: `Searching for files to clean up...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingFile`, + completedSteps: 0, + totalSteps: 1, + completedFiles: 0, + totalFiles: 2, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { - type: `log`, - severity: `debug`, - text: `No files to clean up.`, + type: `pullFile`, + method: `GET`, + route: `Test Collection B Value F File B Route`, + requestBody: { type: `empty` }, + queryParameters: {}, + fileUri: `Example File Path For Uuid 40d92d2c-631f-4a42-ba5e-a70a82bea897 Generated By File Store`, + successfulStatusCodes: [`200`], + failureStatusCodes: [`404`, `403`], + statusCode: `403`, }, { type: `log`, - severity: `information`, - text: `Sync completed successfully; at least one change was made.`, + severity: `warning`, + text: `The API returned status code "403" during the pull of file "40d92d2c-631f-4a42-ba5e-a70a82bea897" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -14390,12 +20536,41 @@ scenario( to: { type: `notRunning` }, }, ], - `atLeastOneChangeMade` + `needsToRunAgain` ); scenario( - `file clean-up temporarily blocked`, + `handles a non-200 push`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -14411,8 +20586,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `awaitingPush`, data: `Test Collection B Value B`, }, }, @@ -14424,7 +20598,7 @@ scenario( }, }, }, - addedFileUuids: [], + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], deletedFileRoutes: [], }, [ @@ -14442,9 +20616,7 @@ scenario( type: `listFiles`, uuids: [ `f81d2428-9bde-4b1c-823c-86b349c99363`, - `569213c5-0d73-4049-9136-6fba8617b78f`, `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `9f2d4d9a-5da7-411c-8c0b-726a66d29d7a`, `52219b25-ac88-4440-bf31-a47df684bdd7`, ], }, @@ -14476,8 +20648,13 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `information`, + text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `information`, + text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, }, { type: `log`, @@ -14499,6 +20676,109 @@ scenario( severity: `debug`, text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, + { + type: `log`, + severity: `information`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pushing`, + completedSteps: 0, + totalSteps: 2, + completedFiles: null, + totalFiles: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + }, + }, + { + type: `push`, + method: `PUT`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `403`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + }, + { + type: `log`, + severity: `warning`, + text: `The API returned status code "403" during push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access. The local changes have been lost.`, + }, { type: `log`, severity: `debug`, @@ -14522,6 +20802,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -14534,10 +20825,6 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -14572,7 +20859,12 @@ scenario( { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -14589,6 +20881,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -14633,17 +20930,29 @@ scenario( type: `log`, severity: `debug`, text: `Searching for files to clean up...`, - nextFileCleanUpBlockers: 1, }, { type: `log`, - severity: `warning`, - text: `Files to clean up were found, but file clean-up has been temporarily blocked (it is likely that the user interface has added files to disk which are not yet referenced within the state store).`, + severity: `information`, + text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, + }, + { + type: `deleteFile`, + uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, }, { type: `log`, severity: `information`, - text: `Sync completed successfully; no changes were made.`, + text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + }, + { + type: `deleteFile`, + uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -14656,16 +20965,46 @@ scenario( to: { type: `notRunning` }, }, ], - `noChangesMade` + `atLeastOneChangeMade` ); scenario( - `files requiring push but not existing`, + `handles a non-200 file push`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `awaitingPush`, + status: `upToDate`, + version: `Test Collection A A Version A`, data: `Test Collection A Value A`, }, }, @@ -14676,8 +21015,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `awaitingPush`, data: `Test Collection B Value B`, }, }, @@ -14689,11 +21027,7 @@ scenario( }, }, }, - addedFileUuids: [ - `189d50bd-d3e3-4775-b147-c74a28070a34`, - `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `9ce916b4-d745-446f-897c-b2e352afdcb4`, - ], + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], deletedFileRoutes: [], }, [ @@ -14705,61 +21039,17 @@ scenario( { type: `log`, severity: `debug`, - text: `Listing existing files...`, - }, - { - type: `listFiles`, - uuids: [ - `f81d2428-9bde-4b1c-823c-86b349c99363`, - `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `52219b25-ac88-4440-bf31-a47df684bdd7`, - ], - }, - { type: `getState`, changedExternally: false }, - { - type: `log`, - severity: `warning`, - text: `The state store lists file UUID "189d50bd-d3e3-4775-b147-c74a28070a34" as requiring push, but no such file exists on disk. It is most likely that the application closed before state could be written back to disk after successfully pushing a deleted record, but this may indicate the presence of a bug.`, - }, - { - type: `log`, - severity: `warning`, - text: `The state store lists file UUID "9ce916b4-d745-446f-897c-b2e352afdcb4" as requiring push, but no such file exists on disk. It is most likely that the application closed before state could be written back to disk after successfully pushing a deleted record, but this may indicate the presence of a bug.`, - }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `awaitingPush`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [`a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`], - deletedFileRoutes: [], - }, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], }, + { type: `getState`, changedExternally: false }, { type: `log`, severity: `debug`, @@ -14787,8 +21077,13 @@ scenario( }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + severity: `information`, + text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, + }, + { + type: `log`, + severity: `information`, + text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, }, { type: `log`, @@ -14807,18 +21102,13 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Change of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" will be pushed.`, - }, - { - type: `log`, - severity: `information`, - text: `File "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2" of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" will be pushed.`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, severity: `information`, - text: `Pushing change of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, + text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `stateChange`, @@ -14829,7 +21119,7 @@ scenario( totalSteps: 2, completedFiles: null, totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionA, + syncConfigurationCollection: syncConfigurationCollectionB, }, }, { @@ -14841,14 +21131,14 @@ scenario( totalSteps: 2, completedFiles: null, totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionA, + syncConfigurationCollection: syncConfigurationCollectionB, }, }, { type: `push`, method: `PUT`, - route: `sync/test-collection-a-key/499b4447-2f9a-49a7-b636-909ace319cd8`, - requestBody: { type: `json`, value: `Test Collection A Value A` }, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, + requestBody: { type: `json`, value: `Test Collection B Value B` }, queryParameters: {}, expectedStatusCodes: [`200`, `404`, `403`], statusCode: `200`, @@ -14857,10 +21147,40 @@ scenario( { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `awaitingPull`, + status: `upToDate`, + version: `Test Collection A A Version A`, data: `Test Collection A Value A`, }, }, @@ -14871,8 +21191,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `awaitingPull`, data: `Test Collection B Value B`, }, }, @@ -14884,19 +21203,19 @@ scenario( }, }, }, - addedFileUuids: [`a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`], + addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], deletedFileRoutes: [], }, }, { type: `log`, severity: `information`, - text: `Successfully pushed change of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, severity: `information`, - text: `Pushing file "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2" of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, + text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `stateChange`, @@ -14907,7 +21226,7 @@ scenario( totalSteps: 2, completedFiles: 0, totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionA, + syncConfigurationCollection: syncConfigurationCollectionB, }, }, { @@ -14919,222 +21238,60 @@ scenario( totalSteps: 2, completedFiles: 0, totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionA, + syncConfigurationCollection: syncConfigurationCollectionB, }, }, { type: `push`, method: `PUT`, - route: `Test Collection A Value A File A Route`, + route: `Test Collection B Value B File B Route`, requestBody: { type: `file`, - fileUri: `Example File Path For Uuid a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2 Generated By File Store`, - }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `awaitingPull`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, - }, - { - type: `log`, - severity: `information`, - text: `Successfully pushed file "a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2" of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, - }, - { - type: `log`, - severity: `debug`, - text: `Fetching preflight...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `checkingForChangesToPull` }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `checkingForChangesToPull` }, - }, - { - type: `pullJson`, - method: `GET`, - route: `sync/preflight`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`], - response: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - version: `Test Collection A A Version B`, - testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - version: `Test Collection B A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - version: `Test Collection C A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, - }, - }, - }, - }, - statusCode: `200`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to pull...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionBKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionBKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, - }, - { - type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, - }, - { - type: `log`, - severity: `information`, - text: `Previously pushed "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" will be pulled.`, - }, - { - type: `log`, - severity: `information`, - text: `Pulling previously pushed "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionA, - preflightResponseCollectionItem: { - version: `Test Collection A A Version B`, - testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, - }, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionA, - preflightResponseCollectionItem: { - version: `Test Collection A A Version B`, - testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, - }, - }, - }, - { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-a-key/499b4447-2f9a-49a7-b636-909ace319cd8`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection A A Version B`, - data: `Test Collection A Value E`, + fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, }, - statusCode: `200`, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `403`, }, { type: `getState`, changedExternally: false }, { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { status: `upToDate`, - version: `Test Collection A A Version B`, - data: `Test Collection A Value E`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, }, }, testCollectionBKey: { @@ -15144,8 +21301,7 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, + status: `awaitingPull`, data: `Test Collection B Value B`, }, }, @@ -15163,328 +21319,295 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Successfully pulled update of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + severity: `warning`, + text: `The API returned status code "403" during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access. The local changes will temporarily remain locally, but will most likely be lost during the pull phase.`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `Fetching preflight...`, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + type: `stateChange`, + eventHandler: `a`, + to: { type: `checkingForChangesToPull` }, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + type: `stateChange`, + eventHandler: `c`, + to: { type: `checkingForChangesToPull` }, }, { - type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + version: `Test Collection A A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + version: `Test Collection B A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + version: `Test Collection C A Version A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + }, + }, + }, + }, + statusCode: `200`, }, { type: `log`, severity: `debug`, - text: `Nothing to delete.`, + text: `Searching for changes to pull...`, }, { type: `log`, severity: `debug`, - text: `Searching for files to clean up...`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, }, { type: `log`, severity: `debug`, - text: `No files to clean up.`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, }, { type: `log`, - severity: `information`, - text: `Sync completed successfully; at least one change was made.`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `notRunning` }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `notRunning` }, - }, - ], - `atLeastOneChangeMade` -); - -scenario( - `handles a non-200 pull`, - { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, - addedFileUuids: [], - deletedFileRoutes: [], - }, - [ { type: `log`, severity: `information`, - text: `Sync is starting...`, + text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, }, { type: `log`, severity: `debug`, - text: `Listing existing files...`, - }, - { - type: `listFiles`, - uuids: [ - `f81d2428-9bde-4b1c-823c-86b349c99363`, - `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, - `52219b25-ac88-4440-bf31-a47df684bdd7`, - ], + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, - { type: `getState`, changedExternally: false }, { type: `log`, severity: `debug`, - text: `Searching for changes to push...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { type: `checkingForChangesToPush` }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { type: `checkingForChangesToPush` }, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionBKey"...`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, - severity: `debug`, - text: `Fetching preflight...`, + severity: `information`, + text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `checkingForChangesToPull` }, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `checkingForChangesToPull` }, + to: { + type: `pullingCollectionItem`, + completedSteps: 0, + totalSteps: 1, + syncConfigurationCollection: syncConfigurationCollectionB, + preflightResponseCollectionItem: { + version: `Test Collection B B Version C`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, + }, }, { type: `pullJson`, method: `GET`, - route: `sync/preflight`, + route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`], + expectedStatusCodes: [`200`, `404`, `403`], response: { + version: `Test Collection B B Version C`, + data: `Test Collection B Value C`, + }, + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, version: `Test Collection A A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, + data: `Test Collection A Value A`, }, }, testCollectionBKey: { "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, version: `Test Collection B A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, + data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - "1901a3dc-980a-4c33-b8bd-ae854e3d7389": { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + status: `upToDate`, + version: `Test Collection B B Version C`, + data: `Test Collection B Value C`, }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, version: `Test Collection C A Version A`, - testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, + data: `Test Collection C Value A`, }, }, - }, - }, - statusCode: `200`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to pull...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionBKey"...`, - }, - { - type: `log`, - severity: `information`, - text: `New "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389" will be pulled.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, }, { type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + severity: `information`, + text: `Successfully pulled update of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + text: `Searching for changes to delete...`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Nothing to delete.`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `Searching for files to clean up...`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `No files to clean up.`, }, { type: `log`, severity: `information`, - text: `Pulling new "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, - }, - { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/1901a3dc-980a-4c33-b8bd-ae854e3d7389`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: {}, - statusCode: `403`, - }, - { - type: `log`, - severity: `warning`, - text: `The API returned status code "403" during the pull of "testCollectionBKey" "1901a3dc-980a-4c33-b8bd-ae854e3d7389", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -15497,12 +21620,41 @@ scenario( to: { type: `notRunning` }, }, ], - `needsToRunAgain` + `atLeastOneChangeMade` ); scenario( - `handles a non-200 update`, + `handles a non-200 file deletion`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -15532,7 +21684,11 @@ scenario( }, }, addedFileUuids: [], - deletedFileRoutes: [], + deletedFileRoutes: [ + `Example Deletion Route A`, + `Example Deletion Route B`, + `Example Deletion Route C`, + ], }, [ { @@ -15595,14 +21751,299 @@ scenario( text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, }, { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route A"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route A`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [ + `Example Deletion Route B`, + `Example Deletion Route C`, + ], + }, + }, + { + type: `log`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route A".`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route B"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route B`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `403`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [`Example Deletion Route C`], + }, + }, + { + type: `log`, + severity: `warning`, + text: `The API returned status code "403" during deletion of file "Example Deletion Route B", indicating that the user has lost access. Another attempt will not be made.`, + }, + { + type: `log`, + severity: `information`, + text: `Deleting file "Example Deletion Route C"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + }, + { + type: `push`, + method: `DELETE`, + route: `Example Deletion Route C`, + requestBody: { type: `empty` }, + queryParameters: {}, + expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, + }, + { type: `getState`, changedExternally: false }, + { + type: `setState`, + to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, + }, + addedFileUuids: [], + deletedFileRoutes: [], + }, }, { type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, + severity: `information`, + text: `Successfully deleted file "Example Deletion Route C".`, }, { type: `log`, @@ -15627,6 +22068,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -15640,7 +22092,7 @@ scenario( testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version B`, + version: `Test Collection B B Version A`, testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, }, @@ -15676,8 +22128,18 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumBKey" as preflight and state store versions match ("Test Enum B Version A").`, }, { type: `log`, @@ -15694,6 +22156,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -15711,51 +22178,43 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + severity: `debug`, + text: `Searching for changes to delete...`, }, { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, }, { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pulling`, - completedSteps: 0, - totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, { - type: `pullJson`, - method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: {}, - statusCode: `403`, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, }, { type: `log`, - severity: `warning`, - text: `The API returned status code "403" during the pull of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, + severity: `debug`, + text: `Nothing to delete.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + }, + { + type: `log`, + severity: `debug`, + text: `No files to clean up.`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -15768,12 +22227,36 @@ scenario( to: { type: `notRunning` }, }, ], - `needsToRunAgain` + `atLeastOneChangeMade` ); scenario( - `handles a non-200 file pull in a new item`, + `enum pulled as new`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -15898,6 +22381,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -15914,10 +22408,6 @@ scenario( version: `Test Collection B B Version A`, testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, - "2b5de2bf-22a4-493f-a8f3-c03437b08851": { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -15939,11 +22429,6 @@ scenario( severity: `debug`, text: `Searching for new items to pull in collection "testCollectionBKey"...`, }, - { - type: `log`, - severity: `information`, - text: `New "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851" will be pulled.`, - }, { type: `log`, severity: `debug`, @@ -15959,6 +22444,16 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `New enum "testEnumBKey" will be pulled.`, + }, { type: `log`, severity: `debug`, @@ -15974,6 +22469,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -15992,101 +22492,154 @@ scenario( { type: `log`, severity: `information`, - text: `Pulling new "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"...`, + text: `Pulling enum "testEnumBKey"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 0, totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, }, }, { type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 0, totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, }, }, { type: `pullJson`, + route: `sync/test-enum-b-key`, + expectedStatusCodes: [`200`], method: `GET`, - route: `sync/test-collection-b-key/2b5de2bf-22a4-493f-a8f3-c03437b08851`, requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, response: { - version: `Test Collection B C Version A`, - data: `Test Collection B Value E`, + version: `Test Enum B Version A`, + data: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, }, - statusCode: `200`, }, { - type: `log`, - severity: `information`, - text: `Pulling file "dab5ac6d-0ecc-4af9-9022-dda2414bf8b6" of "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851"...`, + type: `getState`, + changedExternally: false, }, { - type: `stateChange`, - eventHandler: `a`, + type: `setState`, to: { - type: `pullingFile`, - completedSteps: 0, - totalSteps: 1, - completedFiles: 0, - totalFiles: 2, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, + }, + }, }, + addedFileUuids: [], + deletedFileRoutes: [], }, }, { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pullingFile`, - completedSteps: 0, - totalSteps: 1, - completedFiles: 0, - totalFiles: 2, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B C Version A`, - testAdditionalCollectionDataItemKey: `Test Collection B C Additional Item Value`, - }, - }, + type: `log`, + severity: `information`, + text: `Successfully pulled new enum "testEnumBKey".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to delete...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionCKey"...`, }, { - type: `pullFile`, - method: `GET`, - route: `Test Collection B Value E File A Route`, - requestBody: { type: `empty` }, - queryParameters: {}, - fileUri: `Example File Path For Uuid dab5ac6d-0ecc-4af9-9022-dda2414bf8b6 Generated By File Store`, - successfulStatusCodes: [`200`], - failureStatusCodes: [`404`, `403`], - statusCode: `403`, + type: `log`, + severity: `debug`, + text: `Searching for items to delete from collection "testCollectionBKey"...`, }, { type: `log`, - severity: `warning`, - text: `The API returned status code "403" during the pull of file "dab5ac6d-0ecc-4af9-9022-dda2414bf8b6" of "testCollectionBKey" "2b5de2bf-22a4-493f-a8f3-c03437b08851", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, + severity: `debug`, + text: `Nothing to delete.`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for files to clean up...`, + }, + { + type: `log`, + severity: `debug`, + text: `No files to clean up.`, + }, + { + type: `log`, + severity: `information`, + text: `Sync completed successfully; at least one change was made.`, }, { type: `stateChange`, @@ -16099,12 +22652,36 @@ scenario( to: { type: `notRunning` }, }, ], - `needsToRunAgain` + `atLeastOneChangeMade` ); scenario( - `handles a non-200 file pull for an existing item`, + `enum pulled as new state store change`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -16229,6 +22806,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -16242,7 +22830,7 @@ scenario( testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version B`, + version: `Test Collection B B Version A`, testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, }, @@ -16276,10 +22864,20 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, { type: `log`, severity: `information`, - text: `Previously pulled "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled again as versions do not match between preflight ("Test Collection B B Version B") and state store ("Test Collection B B Version A").`, + text: `New enum "testEnumBKey" will be pulled.`, }, { type: `log`, @@ -16296,6 +22894,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -16314,101 +22917,50 @@ scenario( { type: `log`, severity: `information`, - text: `Pulling updated "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling enum "testEnumBKey"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 0, totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, }, { type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 0, totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, }, { type: `pullJson`, + route: `sync/test-enum-b-key`, + expectedStatusCodes: [`200`], method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - response: { - version: `Test Collection B B Version B`, - data: `Test Collection B Value F`, - }, statusCode: `200`, - }, - { - type: `log`, - severity: `information`, - text: `Pulling file "40d92d2c-631f-4a42-ba5e-a70a82bea897" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pullingFile`, - completedSteps: 0, - totalSteps: 1, - completedFiles: 0, - totalFiles: 2, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pullingFile`, - completedSteps: 0, - totalSteps: 1, - completedFiles: 0, - totalFiles: 2, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version B`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + response: { + version: `Test Enum B Version A`, + data: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, }, }, }, { - type: `pullFile`, - method: `GET`, - route: `Test Collection B Value F File B Route`, - requestBody: { type: `empty` }, - queryParameters: {}, - fileUri: `Example File Path For Uuid 40d92d2c-631f-4a42-ba5e-a70a82bea897 Generated By File Store`, - successfulStatusCodes: [`200`], - failureStatusCodes: [`404`, `403`], - statusCode: `403`, + type: `getState`, + changedExternally: true, }, { type: `log`, severity: `warning`, - text: `The API returned status code "403" during the pull of file "40d92d2c-631f-4a42-ba5e-a70a82bea897" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access since the time of preflight; sync has been interrupted and will need to run again.`, + text: `The state store changed during pull of enum "testEnumBKey"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -16425,8 +22977,32 @@ scenario( ); scenario( - `handles a non-200 push`, + `enum pulled as new version mismatch`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -16442,7 +23018,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPush`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -16454,7 +23031,7 @@ scenario( }, }, }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + addedFileUuids: [], deletedFileRoutes: [], }, [ @@ -16498,113 +23075,34 @@ scenario( text: `Searching for changes to push in collection "testCollectionBKey"...`, }, { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, - }, - { - type: `log`, - severity: `information`, - text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, - }, - { - type: `log`, - severity: `information`, - text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, - }, - { - type: `log`, - severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `403`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, { type: `log`, - severity: `warning`, - text: `The API returned status code "403" during push of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access. The local changes have been lost.`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, @@ -16629,6 +23127,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version A`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -16641,6 +23150,10 @@ scenario( version: `Test Collection B A Version A`, testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + version: `Test Collection B B Version A`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, + }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { @@ -16675,85 +23188,96 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + severity: `information`, + text: `New enum "testEnumBKey" will be pulled.`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Nothing to delete.`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for files to clean up...`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, severity: `information`, - text: `Deleting unreferenced existing file "f81d2428-9bde-4b1c-823c-86b349c99363"...`, + text: `Pulling enum "testEnumBKey"...`, }, { - type: `deleteFile`, - uuid: `f81d2428-9bde-4b1c-823c-86b349c99363`, + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingEnum`, + completedSteps: 0, + totalSteps: 1, + }, }, { - type: `log`, - severity: `information`, - text: `Deleting unreferenced existing file "52219b25-ac88-4440-bf31-a47df684bdd7"...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingEnum`, + completedSteps: 0, + totalSteps: 1, + }, }, { - type: `deleteFile`, - uuid: `52219b25-ac88-4440-bf31-a47df684bdd7`, + type: `pullJson`, + route: `sync/test-enum-b-key`, + expectedStatusCodes: [`200`], + method: `GET`, + requestBody: { type: `empty` }, + queryParameters: {}, + statusCode: `200`, + response: { + version: `Test Enum B Version B`, + data: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, }, { type: `log`, - severity: `information`, - text: `Sync completed successfully; at least one change was made.`, + severity: `warning`, + text: `The version of enum "testEnumBKey" changed from "Test Enum B Version A" at the time of preflight to "Test Enum B Version B" at the time of pull; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -16766,12 +23290,41 @@ scenario( to: { type: `notRunning` }, }, ], - `atLeastOneChangeMade` + `needsToRunAgain` ); scenario( - `handles a non-200 file push`, + `enum pulled as updated`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -16787,7 +23340,8 @@ scenario( data: `Test Collection B Value A`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPush`, + status: `upToDate`, + version: `Test Collection B B Version A`, data: `Test Collection B Value B`, }, }, @@ -16799,7 +23353,7 @@ scenario( }, }, }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], + addedFileUuids: [], deletedFileRoutes: [], }, [ @@ -16847,194 +23401,30 @@ scenario( severity: `debug`, text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, - { - type: `log`, - severity: `information`, - text: `Change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, - }, - { - type: `log`, - severity: `information`, - text: `File "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pushed.`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionCKey"...`, - }, - { - type: `log`, - severity: `debug`, - text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, - }, - { - type: `log`, - severity: `debug`, - text: `Searching for changes to push in collection "testCollectionAKey"...`, - }, { type: `log`, severity: `debug`, - text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, - }, - { - type: `log`, - severity: `information`, - text: `Pushing change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 0, - totalSteps: 2, - completedFiles: null, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `push`, - method: `PUT`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, - requestBody: { type: `json`, value: `Test Collection B Value B` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [`f81d2428-9bde-4b1c-823c-86b349c99363`], - deletedFileRoutes: [], - }, - }, - { - type: `log`, - severity: `information`, - text: `Successfully pushed change of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, - }, - { - type: `log`, - severity: `information`, - text: `Pushing file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, - }, - { - type: `stateChange`, - eventHandler: `a`, - to: { - type: `pushing`, - completedSteps: 1, - totalSteps: 2, - completedFiles: 0, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, - }, - { - type: `stateChange`, - eventHandler: `c`, - to: { - type: `pushing`, - completedSteps: 1, - totalSteps: 2, - completedFiles: 0, - totalFiles: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - }, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, }, - { - type: `push`, - method: `PUT`, - route: `Test Collection B Value B File B Route`, - requestBody: { - type: `file`, - fileUri: `Example File Path For Uuid f81d2428-9bde-4b1c-823c-86b349c99363 Generated By File Store`, - }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `403`, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, }, - { type: `getState`, changedExternally: false }, { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `awaitingPull`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, }, { type: `log`, - severity: `warning`, - text: `The API returned status code "403" during push of file "f81d2428-9bde-4b1c-823c-86b349c99363" of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6", indicating that the user has lost access. The local changes will temporarily remain locally, but will most likely be lost during the pull phase.`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, @@ -17059,6 +23449,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version B`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -17072,7 +23473,7 @@ scenario( testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - version: `Test Collection B B Version C`, + version: `Test Collection B B Version A`, testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, }, @@ -17106,10 +23507,20 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, { type: `log`, severity: `information`, - text: `Previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" will be pulled.`, + text: `Previously pulled enum "testEnumBKey" will be pulled again as versions do not match between preflight ("Test Enum B Version B") and state store ("Test Enum B Version A").`, }, { type: `log`, @@ -17126,6 +23537,11 @@ scenario( severity: `debug`, text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, { type: `log`, severity: `debug`, @@ -17144,53 +23560,80 @@ scenario( { type: `log`, severity: `information`, - text: `Pulling previously pushed "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6"...`, + text: `Pulling enum "testEnumBKey"...`, }, { type: `stateChange`, eventHandler: `a`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 0, totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, }, { type: `stateChange`, eventHandler: `c`, to: { - type: `pulling`, + type: `pullingEnum`, completedSteps: 0, totalSteps: 1, - syncConfigurationCollection: syncConfigurationCollectionB, - preflightResponseCollectionItem: { - version: `Test Collection B B Version C`, - testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, - }, }, }, { type: `pullJson`, + route: `sync/test-enum-b-key`, + expectedStatusCodes: [`200`], method: `GET`, - route: `sync/test-collection-b-key/8dde71a5-6106-4ebb-b2da-7c7d129a1ba6`, requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], + statusCode: `200`, response: { - version: `Test Collection B B Version C`, - data: `Test Collection B Value C`, + version: `Test Enum B Version B`, + data: { + "85aa8b0a-a7f8-433b-92b3-94e89cc08a30": `Test Enum B Value C`, + "cfd53b82-f37b-45ec-9eae-05a939dfcc23": `Test Enum B Value D`, + "a8737449-93dc-4901-b74d-5672f1e1005b": `Test Enum B Value E`, + }, }, - statusCode: `200`, }, - { type: `getState`, changedExternally: false }, + { + type: `getState`, + changedExternally: false, + }, { type: `setState`, to: { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version B`, + values: { + "85aa8b0a-a7f8-433b-92b3-94e89cc08a30": `Test Enum B Value C`, + "cfd53b82-f37b-45ec-9eae-05a939dfcc23": `Test Enum B Value D`, + "a8737449-93dc-4901-b74d-5672f1e1005b": `Test Enum B Value E`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -17207,8 +23650,8 @@ scenario( }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { status: `upToDate`, - version: `Test Collection B B Version C`, - data: `Test Collection B Value C`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, }, }, testCollectionCKey: { @@ -17226,7 +23669,7 @@ scenario( { type: `log`, severity: `information`, - text: `Successfully pulled update of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + text: `Successfully pulled update of enum "testEnumBKey".`, }, { type: `log`, @@ -17283,8 +23726,37 @@ scenario( ); scenario( - `handles a non-200 file deletion`, + `enum pulled as updated version mismatch`, { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -17314,11 +23786,7 @@ scenario( }, }, addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route A`, - `Example Deletion Route B`, - `Example Deletion Route C`, - ], + deletedFileRoutes: [], }, [ { @@ -17392,201 +23860,326 @@ scenario( }, { type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route A"...`, + severity: `debug`, + text: `Fetching preflight...`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + to: { type: `checkingForChangesToPull` }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `deleting`, completedSteps: 0, totalSteps: 3 }, + to: { type: `checkingForChangesToPull` }, }, { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route A`, + type: `pullJson`, + method: `GET`, + route: `sync/preflight`, requestBody: { type: `empty` }, queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, - }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { + expectedStatusCodes: [`200`], + response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version B`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, + testAdditionalCollectionDataItemKey: `Test Collection A A Additional Item Value`, }, }, testCollectionBKey: { "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, + testAdditionalCollectionDataItemKey: `Test Collection B A Additional Item Value`, }, "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, + testAdditionalCollectionDataItemKey: `Test Collection B B Additional Item Value`, }, }, testCollectionCKey: { "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, + testAdditionalCollectionDataItemKey: `Test Collection C A Additional Item Value`, }, }, }, - addedFileUuids: [], - deletedFileRoutes: [ - `Example Deletion Route B`, - `Example Deletion Route C`, - ], + }, + statusCode: `200`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to pull...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionBKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc" as preflight and state store versions match ("Test Collection B A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6" as preflight and state store versions match ("Test Collection B B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `Previously pulled enum "testEnumBKey" will be pulled again as versions do not match between preflight ("Test Enum B Version B") and state store ("Test Enum B Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + }, + { + type: `log`, + severity: `information`, + text: `Pulling enum "testEnumBKey"...`, + }, + { + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingEnum`, + completedSteps: 0, + totalSteps: 1, + }, + }, + { + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingEnum`, + completedSteps: 0, + totalSteps: 1, + }, + }, + { + type: `pullJson`, + route: `sync/test-enum-b-key`, + expectedStatusCodes: [`200`], + method: `GET`, + requestBody: { type: `empty` }, + queryParameters: {}, + statusCode: `200`, + response: { + version: `Test Enum B Version C`, + data: { + "85aa8b0a-a7f8-433b-92b3-94e89cc08a30": `Test Enum B Value C`, + "cfd53b82-f37b-45ec-9eae-05a939dfcc23": `Test Enum B Value D`, + "a8737449-93dc-4901-b74d-5672f1e1005b": `Test Enum B Value E`, + }, }, }, { type: `log`, - severity: `information`, - text: `Successfully deleted file "Example Deletion Route A".`, - }, - { - type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route B"...`, + severity: `warning`, + text: `The version of enum "testEnumBKey" changed from "Test Enum B Version B" at the time of preflight to "Test Enum B Version C" at the time of pull; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + to: { type: `notRunning` }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `deleting`, completedSteps: 1, totalSteps: 3 }, + to: { type: `notRunning` }, }, - { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route B`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `403`, + ], + `needsToRunAgain` +); + +scenario( + `enum pulled as updated`, + { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `upToDate`, + version: `Test Enum B Version A`, + values: { + "5898cc60-3293-479f-b751-2005695cc7ff": `Test Enum B Value A`, + "560e6435-7891-465d-a2fe-1689088c3648": `Test Enum B Value B`, + }, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, }, - { type: `getState`, changedExternally: false }, - { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, + collections: { + testCollectionAKey: { + "499b4447-2f9a-49a7-b636-909ace319cd8": { + status: `upToDate`, + version: `Test Collection A A Version A`, + data: `Test Collection A Value A`, + }, + }, + testCollectionBKey: { + "47fe4216-a7db-43e0-8039-fced83de97cc": { + status: `upToDate`, + version: `Test Collection B A Version A`, + data: `Test Collection B Value A`, + }, + "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { + status: `upToDate`, + version: `Test Collection B B Version A`, + data: `Test Collection B Value B`, + }, + }, + testCollectionCKey: { + "c2bf5c63-85dc-4797-82db-6136081b1562": { + status: `upToDate`, + version: `Test Collection C A Version A`, + data: `Test Collection C Value A`, }, - addedFileUuids: [], - deletedFileRoutes: [`Example Deletion Route C`], }, }, + addedFileUuids: [], + deletedFileRoutes: [], + }, + [ + { + type: `log`, + severity: `information`, + text: `Sync is starting...`, + }, { type: `log`, - severity: `warning`, - text: `The API returned status code "403" during deletion of file "Example Deletion Route B", indicating that the user has lost access. Another attempt will not be made.`, + severity: `debug`, + text: `Listing existing files...`, + }, + { + type: `listFiles`, + uuids: [ + `f81d2428-9bde-4b1c-823c-86b349c99363`, + `a62a2fc4-6d1b-4289-94e1-373d4ebf5cd2`, + `52219b25-ac88-4440-bf31-a47df684bdd7`, + ], }, + { type: `getState`, changedExternally: false }, { type: `log`, - severity: `information`, - text: `Deleting file "Example Deletion Route C"...`, + severity: `debug`, + text: `Searching for changes to push...`, }, { type: `stateChange`, eventHandler: `a`, - to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + to: { type: `checkingForChangesToPush` }, }, { type: `stateChange`, eventHandler: `c`, - to: { type: `deleting`, completedSteps: 2, totalSteps: 3 }, + to: { type: `checkingForChangesToPush` }, }, { - type: `push`, - method: `DELETE`, - route: `Example Deletion Route C`, - requestBody: { type: `empty` }, - queryParameters: {}, - expectedStatusCodes: [`200`, `404`, `403`], - statusCode: `200`, + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionBKey"...`, }, - { type: `getState`, changedExternally: false }, { - type: `setState`, - to: { - collections: { - testCollectionAKey: { - "499b4447-2f9a-49a7-b636-909ace319cd8": { - status: `upToDate`, - version: `Test Collection A A Version A`, - data: `Test Collection A Value A`, - }, - }, - testCollectionBKey: { - "47fe4216-a7db-43e0-8039-fced83de97cc": { - status: `upToDate`, - version: `Test Collection B A Version A`, - data: `Test Collection B Value A`, - }, - "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6": { - status: `upToDate`, - version: `Test Collection B B Version A`, - data: `Test Collection B Value B`, - }, - }, - testCollectionCKey: { - "c2bf5c63-85dc-4797-82db-6136081b1562": { - status: `upToDate`, - version: `Test Collection C A Version A`, - data: `Test Collection C Value A`, - }, - }, - }, - addedFileUuids: [], - deletedFileRoutes: [], - }, + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "47fe4216-a7db-43e0-8039-fced83de97cc".`, }, { type: `log`, - severity: `information`, - text: `Successfully deleted file "Example Deletion Route C".`, + severity: `debug`, + text: `No changes to push for "testCollectionBKey" "8dde71a5-6106-4ebb-b2da-7c7d129a1ba6".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionCKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562".`, + }, + { + type: `log`, + severity: `debug`, + text: `Searching for changes to push in collection "testCollectionAKey"...`, + }, + { + type: `log`, + severity: `debug`, + text: `No changes to push for "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8".`, }, { type: `log`, @@ -17611,6 +24204,17 @@ scenario( queryParameters: {}, expectedStatusCodes: [`200`], response: { + enums: { + testEnumAKey: { + version: `Test Enum A Version A`, + }, + testEnumBKey: { + version: `Test Enum B Version B`, + }, + testEnumCKey: { + version: `Test Enum C Version A`, + }, + }, collections: { testCollectionAKey: { "499b4447-2f9a-49a7-b636-909ace319cd8": { @@ -17666,72 +24270,96 @@ scenario( { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionCKey"...`, + text: `No pull required of enum "testEnumCKey" as preflight and state store versions match ("Test Enum C Version A").`, }, { type: `log`, - severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionCKey"...`, + severity: `information`, + text: `Previously pulled enum "testEnumBKey" will be pulled again as versions do not match between preflight ("Test Enum B Version B") and state store ("Test Enum B Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, + text: `Searching for new items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for new items to pull in collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionCKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for updated items to pull in collection "testCollectionAKey"...`, + text: `No pull required of "testCollectionCKey" "c2bf5c63-85dc-4797-82db-6136081b1562" as preflight and state store versions match ("Test Collection C A Version A").`, }, { type: `log`, severity: `debug`, - text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, + text: `No pull required of enum "testEnumAKey" as preflight and state store versions match ("Test Enum A Version A").`, }, { type: `log`, severity: `debug`, - text: `Searching for changes to delete...`, + text: `Searching for new items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionAKey"...`, + text: `Searching for updated items to pull in collection "testCollectionAKey"...`, }, { type: `log`, severity: `debug`, - text: `Searching for items to delete from collection "testCollectionCKey"...`, + text: `No pull required of "testCollectionAKey" "499b4447-2f9a-49a7-b636-909ace319cd8" as preflight and state store versions match ("Test Collection A A Version A").`, }, { type: `log`, - severity: `debug`, - text: `Searching for items to delete from collection "testCollectionBKey"...`, + severity: `information`, + text: `Pulling enum "testEnumBKey"...`, }, { - type: `log`, - severity: `debug`, - text: `Nothing to delete.`, + type: `stateChange`, + eventHandler: `a`, + to: { + type: `pullingEnum`, + completedSteps: 0, + totalSteps: 1, + }, }, { - type: `log`, - severity: `debug`, - text: `Searching for files to clean up...`, + type: `stateChange`, + eventHandler: `c`, + to: { + type: `pullingEnum`, + completedSteps: 0, + totalSteps: 1, + }, }, { - type: `log`, - severity: `debug`, - text: `No files to clean up.`, + type: `pullJson`, + route: `sync/test-enum-b-key`, + expectedStatusCodes: [`200`], + method: `GET`, + requestBody: { type: `empty` }, + queryParameters: {}, + statusCode: `200`, + response: { + version: `Test Enum B Version B`, + data: { + "85aa8b0a-a7f8-433b-92b3-94e89cc08a30": `Test Enum B Value C`, + "cfd53b82-f37b-45ec-9eae-05a939dfcc23": `Test Enum B Value D`, + "a8737449-93dc-4901-b74d-5672f1e1005b": `Test Enum B Value E`, + }, + }, + }, + { + type: `getState`, + changedExternally: true, }, { type: `log`, - severity: `information`, - text: `Sync completed successfully; at least one change was made.`, + severity: `warning`, + text: `The state store changed during pull of enum "testEnumBKey"; sync has been interrupted and will need to run again.`, }, { type: `stateChange`, @@ -17744,5 +24372,5 @@ scenario( to: { type: `notRunning` }, }, ], - `atLeastOneChangeMade` + `needsToRunAgain` ); diff --git a/react-native/services/SyncableStateHelper/unit.tsx b/react-native/services/SyncableStateHelper/unit.tsx index ec9d368d..a384fd08 100644 --- a/react-native/services/SyncableStateHelper/unit.tsx +++ b/react-native/services/SyncableStateHelper/unit.tsx @@ -3,6 +3,18 @@ import type { SyncableState, SyncConfiguration } from "../../.."; test(`upserts when new`, () => { type ExampleSchema = { + readonly enums: { + readonly testEnumAKey: + | `Test Enum A Value A` + | `Test Enum A Value B` + | `Test Enum A Value C`; + readonly testEnumBKey: `Test Enum B Value A` | `Test Enum B Value B`; + readonly testEnumCKey: + | `Test Enum C Value A` + | `Test Enum C Value B` + | `Test Enum C Value C` + | `Test Enum C Value D`; + }; readonly collections: { readonly exampleCollectionAKey: `Example Collection A Data`; readonly exampleCollectionBKey: @@ -33,10 +45,31 @@ test(`upserts when new`, () => { ExampleSchema, ExampleAdditionalCollectionData > = { - collectionOrder: [ - `exampleCollectionCKey`, - `exampleCollectionBKey`, - `exampleCollectionAKey`, + order: [ + { + type: `collection`, + key: `exampleCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `exampleCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `exampleCollectionAKey`, + }, ], collections: { exampleCollectionAKey: { @@ -56,6 +89,30 @@ test(`upserts when new`, () => { const syncableStateHelper = new SyncableStateHelper(syncConfiguration); const setState = jest.fn(); const state: SyncableState = { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -107,6 +164,30 @@ test(`upserts when new`, () => { expect(listFilesC).not.toHaveBeenCalled(); expect(setState).toBeCalledTimes(1); expect(setState).toBeCalledWith({ + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -150,6 +231,18 @@ test(`upserts when new`, () => { test(`upserts when existing as up to date`, () => { type ExampleSchema = { + readonly enums: { + readonly testEnumAKey: + | `Test Enum A Value A` + | `Test Enum A Value B` + | `Test Enum A Value C`; + readonly testEnumBKey: `Test Enum B Value A` | `Test Enum B Value B`; + readonly testEnumCKey: + | `Test Enum C Value A` + | `Test Enum C Value B` + | `Test Enum C Value C` + | `Test Enum C Value D`; + }; readonly collections: { readonly exampleCollectionAKey: `Example Collection A Data`; readonly exampleCollectionBKey: @@ -206,10 +299,31 @@ test(`upserts when existing as up to date`, () => { ExampleSchema, ExampleAdditionalCollectionData > = { - collectionOrder: [ - `exampleCollectionCKey`, - `exampleCollectionBKey`, - `exampleCollectionAKey`, + order: [ + { + type: `collection`, + key: `exampleCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `exampleCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `exampleCollectionAKey`, + }, ], collections: { exampleCollectionAKey: { @@ -229,6 +343,30 @@ test(`upserts when existing as up to date`, () => { const syncableStateHelper = new SyncableStateHelper(syncConfiguration); const setState = jest.fn(); const state: SyncableState = { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -289,6 +427,30 @@ test(`upserts when existing as up to date`, () => { expect(listFilesC).not.toHaveBeenCalled(); expect(setState).toBeCalledTimes(1); expect(setState).toBeCalledWith({ + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -332,6 +494,18 @@ test(`upserts when existing as up to date`, () => { test(`upserts when existing as awaiting push`, () => { type ExampleSchema = { + readonly enums: { + readonly testEnumAKey: + | `Test Enum A Value A` + | `Test Enum A Value B` + | `Test Enum A Value C`; + readonly testEnumBKey: `Test Enum B Value A` | `Test Enum B Value B`; + readonly testEnumCKey: + | `Test Enum C Value A` + | `Test Enum C Value B` + | `Test Enum C Value C` + | `Test Enum C Value D`; + }; readonly collections: { readonly exampleCollectionAKey: `Example Collection A Data`; readonly exampleCollectionBKey: @@ -388,10 +562,31 @@ test(`upserts when existing as awaiting push`, () => { ExampleSchema, ExampleAdditionalCollectionData > = { - collectionOrder: [ - `exampleCollectionCKey`, - `exampleCollectionBKey`, - `exampleCollectionAKey`, + order: [ + { + type: `collection`, + key: `exampleCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `exampleCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `exampleCollectionAKey`, + }, ], collections: { exampleCollectionAKey: { @@ -411,6 +606,30 @@ test(`upserts when existing as awaiting push`, () => { const syncableStateHelper = new SyncableStateHelper(syncConfiguration); const setState = jest.fn(); const state: SyncableState = { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -470,6 +689,30 @@ test(`upserts when existing as awaiting push`, () => { expect(listFilesC).not.toHaveBeenCalled(); expect(setState).toBeCalledTimes(1); expect(setState).toBeCalledWith({ + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -513,6 +756,18 @@ test(`upserts when existing as awaiting push`, () => { test(`upserts when existing as pushing`, () => { type ExampleSchema = { + readonly enums: { + readonly testEnumAKey: + | `Test Enum A Value A` + | `Test Enum A Value B` + | `Test Enum A Value C`; + readonly testEnumBKey: `Test Enum B Value A` | `Test Enum B Value B`; + readonly testEnumCKey: + | `Test Enum C Value A` + | `Test Enum C Value B` + | `Test Enum C Value C` + | `Test Enum C Value D`; + }; readonly collections: { readonly exampleCollectionAKey: `Example Collection A Data`; readonly exampleCollectionBKey: @@ -569,10 +824,31 @@ test(`upserts when existing as pushing`, () => { ExampleSchema, ExampleAdditionalCollectionData > = { - collectionOrder: [ - `exampleCollectionCKey`, - `exampleCollectionBKey`, - `exampleCollectionAKey`, + order: [ + { + type: `collection`, + key: `exampleCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `exampleCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `exampleCollectionAKey`, + }, ], collections: { exampleCollectionAKey: { @@ -592,6 +868,30 @@ test(`upserts when existing as pushing`, () => { const syncableStateHelper = new SyncableStateHelper(syncConfiguration); const setState = jest.fn(); const state: SyncableState = { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -651,6 +951,30 @@ test(`upserts when existing as pushing`, () => { expect(listFilesC).not.toHaveBeenCalled(); expect(setState).toBeCalledTimes(1); expect(setState).toBeCalledWith({ + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -694,6 +1018,18 @@ test(`upserts when existing as pushing`, () => { test(`upserts when existing as awaiting pull`, () => { type ExampleSchema = { + readonly enums: { + readonly testEnumAKey: + | `Test Enum A Value A` + | `Test Enum A Value B` + | `Test Enum A Value C`; + readonly testEnumBKey: `Test Enum B Value A` | `Test Enum B Value B`; + readonly testEnumCKey: + | `Test Enum C Value A` + | `Test Enum C Value B` + | `Test Enum C Value C` + | `Test Enum C Value D`; + }; readonly collections: { readonly exampleCollectionAKey: `Example Collection A Data`; readonly exampleCollectionBKey: @@ -750,10 +1086,31 @@ test(`upserts when existing as awaiting pull`, () => { ExampleSchema, ExampleAdditionalCollectionData > = { - collectionOrder: [ - `exampleCollectionCKey`, - `exampleCollectionBKey`, - `exampleCollectionAKey`, + order: [ + { + type: `collection`, + key: `exampleCollectionCKey`, + }, + { + type: `enum`, + key: `testEnumAKey`, + }, + { + type: `collection`, + key: `exampleCollectionBKey`, + }, + { + type: `enum`, + key: `testEnumCKey`, + }, + { + type: `enum`, + key: `testEnumBKey`, + }, + { + type: `collection`, + key: `exampleCollectionAKey`, + }, ], collections: { exampleCollectionAKey: { @@ -773,6 +1130,30 @@ test(`upserts when existing as awaiting pull`, () => { const syncableStateHelper = new SyncableStateHelper(syncConfiguration); const setState = jest.fn(); const state: SyncableState = { + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { @@ -832,6 +1213,30 @@ test(`upserts when existing as awaiting pull`, () => { expect(listFilesC).not.toHaveBeenCalled(); expect(setState).toBeCalledTimes(1); expect(setState).toBeCalledWith({ + enums: { + testEnumAKey: { + type: `upToDate`, + version: `Test Enum A Version A`, + values: { + "02c1ea8b-9332-4359-8094-db30da4a1a48": `Test Enum A Value A`, + "58c0c0e8-90cd-45b5-be6c-55ad1113db4a": `Test Enum A Value B`, + "4cdccf5d-b4fd-4ef9-97f7-d5d023d58f8a": `Test Enum A Value C`, + }, + }, + testEnumBKey: { + type: `absent`, + }, + testEnumCKey: { + type: `upToDate`, + version: `Test Enum C Version A`, + values: { + "facfe4b1-cff2-43cd-8a70-bf1565ea57fe": `Test Enum C Value A`, + "2314dfdd-7c51-4ff2-a700-dfb162fd6fc0": `Test Enum C Value B`, + "ed2c8187-e4b8-4229-bdce-fd2bd111ffa6": `Test Enum C Value C`, + "1292dfab-f3ed-47ac-9464-b981a24ecb21": `Test Enum C Value D`, + }, + }, + }, collections: { exampleCollectionAKey: { "b990662b-9f09-4b77-94a1-da75595dd6a3": { diff --git a/react-native/types/AbsentSyncableStateEnum/index.tsx b/react-native/types/AbsentSyncableStateEnum/index.tsx new file mode 100644 index 00000000..79800f39 --- /dev/null +++ b/react-native/types/AbsentSyncableStateEnum/index.tsx @@ -0,0 +1,9 @@ +/** + * Represents an enum which could be synced, but has not yet been pulled down. + */ +export type AbsentSyncableStateEnum = { + /** + * Indicates the state of the enum. + */ + readonly type: `absent`; +}; diff --git a/react-native/types/AbsentSyncableStateEnum/readme.md b/react-native/types/AbsentSyncableStateEnum/readme.md new file mode 100644 index 00000000..58aac429 --- /dev/null +++ b/react-native/types/AbsentSyncableStateEnum/readme.md @@ -0,0 +1,13 @@ +# `react-native-app-helpers/AbsentSyncableStateEnum` + +Represents an enum which could be synced, but has not yet been pulled down. + +## Usage + +```tsx +import type { AbsentSyncableStateEnum } from "react-native-app-helpers"; + +const example: AbsentSyncableStateEnum = { + type: `absent`, +}; +``` diff --git a/react-native/types/PreflightResponse/index.tsx b/react-native/types/PreflightResponse/index.tsx index fc400201..9db41a36 100644 --- a/react-native/types/PreflightResponse/index.tsx +++ b/react-native/types/PreflightResponse/index.tsx @@ -1,5 +1,6 @@ import type { Json } from "../Json"; import type { PreflightResponseCollection } from "../PreflightResponseCollection"; +import type { PreflightResponseEnum } from "../PreflightResponseEnum"; import type { SyncableSchema } from "../SyncableSchema"; /** @@ -14,6 +15,13 @@ export type PreflightResponse< TSchema extends SyncableSchema, TAdditionalCollectionItemData extends Record > = { + /** + * The enums available to be synced. + */ + readonly enums: { + readonly [TKey in keyof TSchema[`enums`]]: PreflightResponseEnum; + }; + /** * The collections available to be synced. */ diff --git a/react-native/types/PreflightResponse/readme.md b/react-native/types/PreflightResponse/readme.md index 50a53d3c..565f0c79 100644 --- a/react-native/types/PreflightResponse/readme.md +++ b/react-native/types/PreflightResponse/readme.md @@ -8,6 +8,14 @@ The response to a successful preflight request. import type { PreflightResponseCollection } from "react-native-app-helpers"; type ExampleSchema = { + readonly enums: { + readonly exampleEnumAKey: { + readonly exampleDataAKey: boolean; + }; + readonly exampleEnumBKey: { + readonly exampleDataBKey: number; + }; + }; readonly collections: { readonly exampleCollectionAKey: { readonly exampleDataAKey: boolean; @@ -25,7 +33,15 @@ type ExampleAdditionalCollectionItemData = { readonly exampleAdditionalCollectionItemDataKey: string; }; -const exampleWithNumberVersion: PreflightResponse = { +const example: PreflightResponse = { + enums: { + exampleEnumAKey: { + version: 1234, + }, + exampleEnumBKey: { + version: `Example Version`, + }, + }, collections: { exampleCollectionAKey: { "0f4dc56b-6a5f-4146-8b88-360d35927186": { diff --git a/react-native/types/PreflightResponseCollectionItem/index.tsx b/react-native/types/PreflightResponseCollectionItem/index.tsx index 3e2718fa..f5ceb597 100644 --- a/react-native/types/PreflightResponseCollectionItem/index.tsx +++ b/react-native/types/PreflightResponseCollectionItem/index.tsx @@ -12,8 +12,7 @@ export type PreflightResponseCollectionItem< > = { /** * The current version of the item. If the record either does not exist - * locally or has a different (non-null) version number, it is to be - * pulled down. + * locally or has a different version number, it is to be pulled down. */ readonly version: string | number; } & TAdditionalCollectionItemData; diff --git a/react-native/types/PreflightResponseEnum/index.tsx b/react-native/types/PreflightResponseEnum/index.tsx new file mode 100644 index 00000000..076409bd --- /dev/null +++ b/react-native/types/PreflightResponseEnum/index.tsx @@ -0,0 +1,10 @@ +/** + * An enum within a response to a successful preflight request. + */ +export type PreflightResponseEnum = { + /** + * The current version of the enum. If the enum either does not exist locally + * or has a different version number, it is to be pulled down. + */ + readonly version: string | number; +}; diff --git a/react-native/types/PreflightResponseEnum/readme.md b/react-native/types/PreflightResponseEnum/readme.md new file mode 100644 index 00000000..2f3ef256 --- /dev/null +++ b/react-native/types/PreflightResponseEnum/readme.md @@ -0,0 +1,17 @@ +# `react-native-app-helpers/PreflightResponseCollection` + +An enum within a response to a successful preflight request. + +## Usage + +```tsx +import type { PreflightResponseEnum } from "react-native-app-helpers"; + +const exampleWithNumberVersion: PreflightResponseEnum = { + version: 1234, +}; + +const exampleWithStringVersion: PreflightResponseEnum = { + version: `Example Version`, +}; +``` diff --git a/react-native/types/SyncConfiguration/index.ts b/react-native/types/SyncConfiguration/index.ts index c353854f..8091099b 100644 --- a/react-native/types/SyncConfiguration/index.ts +++ b/react-native/types/SyncConfiguration/index.ts @@ -13,11 +13,20 @@ export type SyncConfiguration< TAdditionalCollectionData extends Record > = { /** - * The order in which collections which are to be synced. This order will be - * followed for additions and updates, then reversed for deletions in a - * subsequent pass. + * The order in which enums and collections which are to be synced. This + * order will be followed for additions and updates, then reversed for + * deletions in a subsequent pass. */ - readonly collectionOrder: ReadonlyArray; + readonly order: ReadonlyArray< + | { + readonly type: `enum`; + readonly key: keyof TSchema[`enums`]; + } + | { + readonly type: `collection`; + readonly key: keyof TSchema[`collections`]; + } + >; /** * The collections which are to be synced. diff --git a/react-native/types/SyncConfiguration/readme.md b/react-native/types/SyncConfiguration/readme.md index 81cd445f..38fa67f6 100644 --- a/react-native/types/SyncConfiguration/readme.md +++ b/react-native/types/SyncConfiguration/readme.md @@ -8,6 +8,14 @@ Describes implementation details of a sync process. import type { SyncConfiguration } from "react-native-app-helpers"; type ExampleSchema = { + readonly enums: { + readonly exampleEnumAKey: { + readonly exampleDataAKey: boolean; + }; + readonly exampleEnumBKey: { + readonly exampleDataBKey: number; + }; + }; readonly collections: { readonly exampleCollectionAKey: { readonly exampleDataAKey: boolean; @@ -26,10 +34,27 @@ type ExampleAdditionalCollectionData = { }; const example: SyncConfiguration = { - collectionOrder: [ - `exampleCollectionBKey`, - `exampleCollectionCKey`, - `exampleCollectionAKey`, + order: [ + { + type: `collection`; + key: `exampleCollectionBKey`; + }, + { + type: `enum`; + key: `exampleEnumAKey`; + }, + { + type: `collection`; + key: `exampleCollectionCKey`; + }, + { + type: `enum`; + key: `exampleEnumBKey`; + }, + { + type: `collection`; + key: `exampleCollectionAKey`; + }, ] collections: { exampleCollectionBKey: { diff --git a/react-native/types/SyncState/index.tsx b/react-native/types/SyncState/index.tsx index 7dfa5611..6a6a5eea 100644 --- a/react-native/types/SyncState/index.tsx +++ b/react-native/types/SyncState/index.tsx @@ -96,7 +96,23 @@ export type SyncState< /** * Indicates the type of sync status. */ - readonly type: `pulling`; + readonly type: `pullingEnum`; + + /** + * The number of items pulled so far (not including the item in progress). + */ + readonly completedSteps: number; + + /** + * The number of items which will be pulled should sync succeed. + */ + readonly totalSteps: number; + } + | { + /** + * Indicates the type of sync status. + */ + readonly type: `pullingCollectionItem`; /** * The number of items pulled so far (not including the item in progress). diff --git a/react-native/types/SyncableSchema/index.tsx b/react-native/types/SyncableSchema/index.tsx index 4abc2b99..dfe0fa8c 100644 --- a/react-native/types/SyncableSchema/index.tsx +++ b/react-native/types/SyncableSchema/index.tsx @@ -4,6 +4,13 @@ import type { Json } from "../Json"; * The schema of information which can be synced. */ export type SyncableSchema = { + /** + * The enums which can be synced. + */ + readonly enums: { + readonly [key: string]: Json; + }; + /** * The collections which can be synced. */ diff --git a/react-native/types/SyncableSchema/readme.md b/react-native/types/SyncableSchema/readme.md index 8c8ebe5d..ee7a7f3c 100644 --- a/react-native/types/SyncableSchema/readme.md +++ b/react-native/types/SyncableSchema/readme.md @@ -8,6 +8,14 @@ The schema of information which can be synced. import type { SyncableSchema } from "react-native-app-helpers"; const example: SyncableSchema = { + readonly enums: { + readonly exampleEnumAKey: { + readonly exampleDataAKey: boolean; + }; + readonly exampleEnumBKey: { + readonly exampleDataBKey: number; + }; + }; collections: { exampleCollectionAKey: { exampleDataKey: `Example Data Value`, diff --git a/react-native/types/SyncableState/index.tsx b/react-native/types/SyncableState/index.tsx index 4e4b0cbf..87a11aaa 100644 --- a/react-native/types/SyncableState/index.tsx +++ b/react-native/types/SyncableState/index.tsx @@ -1,11 +1,19 @@ import type { SyncableSchema } from "../SyncableSchema"; import type { SyncableStateCollection } from "../SyncableStateCollection"; +import type { SyncableStateEnum } from "../SyncableStateEnum"; /** * Represents a local mirror of data which can be synced. * @template T The schema of the data. */ export type SyncableState = { + /** + * The enums within the syncable state. + */ + readonly enums: { + readonly [TKey in keyof T[`enums`]]: SyncableStateEnum; + }; + /** * The collections within the syncable state. */ diff --git a/react-native/types/SyncableState/readme.md b/react-native/types/SyncableState/readme.md index f0570dc2..8092d173 100644 --- a/react-native/types/SyncableState/readme.md +++ b/react-native/types/SyncableState/readme.md @@ -8,6 +8,14 @@ Represents a local mirror of data which can be synced. import type { SyncableState } from "react-native-app-helpers"; type ExampleSchema = { + readonly enums: { + readonly exampleEnumAKey: { + readonly exampleDataAKey: boolean; + }; + readonly exampleEnumBKey: { + readonly exampleDataBKey: number; + }; + }; readonly collections: { readonly exampleCollectionAKey: { readonly exampleDataAKey: boolean; @@ -22,6 +30,23 @@ type ExampleSchema = { }; const example: SyncableState = { + enums: { + exampleEnumAKey: { + type: `absent`, + }, + exampleEnumBKey: { + type: `upToDate`, + version: `Example Version`, + items: { + "5a82bfb8-35ef-4cd6-92d7-efcb532e5fd1": { + exampleDataBKey: 1234, + }, + "459ef49b-59a2-4f1b-a055-3577b8f974dd": { + exampleDataBKey: 5678, + }, + }, + }, + }, collections: { exampleCollectionAKey: { "5a82bfb8-35ef-4cd6-92d7-efcb532e5fd1": { diff --git a/react-native/types/SyncableStateEnum/index.tsx b/react-native/types/SyncableStateEnum/index.tsx new file mode 100644 index 00000000..0b5ea492 --- /dev/null +++ b/react-native/types/SyncableStateEnum/index.tsx @@ -0,0 +1,11 @@ +import type { AbsentSyncableStateEnum } from "../AbsentSyncableStateEnum"; +import type { Json } from "../Json"; +import type { UpToDateSyncableStateEnum } from "../UpToDateSyncableStateEnum"; + +/** + * Represents an enum which can be synced. + * @template TData The data within an item. + */ +export type SyncableStateEnum = + | AbsentSyncableStateEnum + | UpToDateSyncableStateEnum; diff --git a/react-native/types/SyncableStateEnum/readme.md b/react-native/types/SyncableStateEnum/readme.md new file mode 100644 index 00000000..0e3eeeee --- /dev/null +++ b/react-native/types/SyncableStateEnum/readme.md @@ -0,0 +1,30 @@ +# `react-native-app-helpers/SyncableStateEnum` + +Represents an enum which can be synced. + +## Usage + +```tsx +import type { SyncableStateEnum } from "react-native-app-helpers"; + +type ExampleData = { + readonly exampleDataAKey: boolean; +}; + +const absentExample: SyncableStateEnum = { + type: `absent`, +}; + +const upToDateExample: SyncableStateEnum = { + type: `upToDate`, + version: `Example Version`, + items: { + "5a82bfb8-35ef-4cd6-92d7-efcb532e5fd1": { + exampleDataAKey: true, + }, + "459ef49b-59a2-4f1b-a055-3577b8f974dd": { + exampleDataAKey: false, + }, + }, +}; +``` diff --git a/react-native/types/UpToDateSyncableStateEnum/index.tsx b/react-native/types/UpToDateSyncableStateEnum/index.tsx new file mode 100644 index 00000000..1b264613 --- /dev/null +++ b/react-native/types/UpToDateSyncableStateEnum/index.tsx @@ -0,0 +1,25 @@ +import type { Json } from "../Json"; + +/** + * Represents an enum which has been synced + * @template TData The data within an item. + */ +export type UpToDateSyncableStateEnum = { + /** + * Indicates the state of the enum. + */ + readonly type: `upToDate`; + + /** + * A server-generated value which can be compared with the equivalent in the + * preflight response to determine whether there are any changes to pull. + */ + readonly version: number | string; + + /** + * The values which have been synced. + */ + readonly values: { + readonly [uuid: string]: TData; + }; +}; diff --git a/react-native/types/UpToDateSyncableStateEnum/readme.md b/react-native/types/UpToDateSyncableStateEnum/readme.md new file mode 100644 index 00000000..8552fc52 --- /dev/null +++ b/react-native/types/UpToDateSyncableStateEnum/readme.md @@ -0,0 +1,25 @@ +# `react-native-app-helpers/UpToDateSyncableStateEnum` + +Represents an enum which can be synced. + +## Usage + +```tsx +import type { UpToDateSyncableStateEnum } from "react-native-app-helpers"; + +type ExampleData = { + readonly exampleDataAKey: boolean; +}; +const example: UpToDateSyncableStateEnum = { + type: `upToDate`, + version: `Example Version`, + items: { + "5a82bfb8-35ef-4cd6-92d7-efcb532e5fd1": { + exampleDataAKey: true, + }, + "459ef49b-59a2-4f1b-a055-3577b8f974dd": { + exampleDataAKey: false, + }, + }, +}; +``` diff --git a/readme.md b/readme.md index 5c3782d6..1133f94b 100644 --- a/readme.md +++ b/readme.md @@ -96,6 +96,7 @@ import { createTextComponent } from "react-native-app-helpers"; #### Types +- [AbsentSyncableStateEnum](./react-native/types/AbsentSyncableStateEnum/readme.md) - [AwaitingPullSyncableStateCollectionItem](./react-native/types/AwaitingPullSyncableStateCollectionItem/readme.md) - [AwaitingPushSyncableStateCollectionItem](./react-native/types/AwaitingPushSyncableStateCollectionItem/readme.md) - [BasicTableColumn](./react-native/types/BasicTableColumn/readme.md) @@ -130,6 +131,7 @@ import { createTextComponent } from "react-native-app-helpers"; - [PreflightResponse](./react-native/types/PreflightResponse/readme.md) - [PreflightResponseCollection](./react-native/types/PreflightResponseCollection/readme.md) - [PreflightResponseCollectionItem](./react-native/types/PreflightResponseCollectionItem/readme.md) +- [PreflightResponseEnum](./react-native/types/PreflightResponseEnum/readme.md) - [PushingSyncableStateCollectionItem](./react-native/types/PushingSyncableStateCollectionItem/readme.md) - [QueryParameter](./react-native/types/QueryParameter/readme.md) - [QueryParameters](./react-native/types/QueryParameters/readme.md) @@ -141,8 +143,8 @@ import { createTextComponent } from "react-native-app-helpers"; - [SplitButtonStateStyle](./react-native/types/SplitButtonStateStyle/readme.md) - [SplitButtonStyle](./react-native/types/SplitButtonStyle/readme.md) - [SplitButtonTypeStyle](./react-native/types/SplitButtonTypeStyle/readme.md) -- [StackRouterState](./react-native/types/StackRouterState/readme.md) - [StackRoute](./react-native/types/StackRoute/readme.md) +- [StackRouterState](./react-native/types/StackRouterState/readme.md) - [StackRouteTable](./react-native/types/StackRouteTable/readme.md) - StateStoreInterface - [StatusPillStyle](./react-native/types/StatusPillStyle/readme.md) @@ -152,6 +154,7 @@ import { createTextComponent } from "react-native-app-helpers"; - [SyncableState](./react-native/types/SyncableState/readme.md) - [SyncableStateCollection](./react-native/types/SyncableStateCollection/readme.md) - [SyncableStateCollectionItem](./react-native/types/SyncableStateCollectionItem/readme.md) +- [SyncableStateEnum](./react-native/types/SyncableStateEnum/readme.md) - [SyncConfiguration](./react-native/types/SyncConfiguration/readme.md) - [SyncConfigurationCollection](./react-native/types/SyncConfigurationCollection/readme.md) - SyncInterface @@ -168,6 +171,7 @@ import { createTextComponent } from "react-native-app-helpers"; - [UnderlinedTopTabBarStyle](./react-native/types/UnderlinedTopTabBarStyle/readme.md) - [UnderlinedTopTabBarStyleState](./react-native/types/UnderlinedTopTabBarStyleState/readme.md) - [UpToDateSyncableStateCollectionItem](./react-native/types/UpToDateSyncableStateCollectionItem/readme.md) +- [UpToDateSyncableStateEnum](./react-native/types/UpToDateSyncableStateEnum/readme.md) #### Utilities