Skip to content

Commit

Permalink
chore: revert migrated observation metadata schema changes
Browse files Browse the repository at this point in the history
These changes had bugs and should not be released. Strictly this is a
breaking change, but we have not created a release with updated
comapeo-schema yet.
  • Loading branch information
gmaclennan committed Jan 22, 2025
1 parent 708afe1 commit 8273e51
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 67 deletions.
12 changes: 0 additions & 12 deletions proto/observation/v1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,4 @@ message Observation_1 {
bytes docId = 1;
VersionId_1 versionId = 2;
}

message MigrationMetadata {
bytes originalDocument = 1;
message HypercoreMetadata {
optional string rootHashChecksum = 1;
optional string signature = 2;
optional string coreKey = 3;
optional uint32 blockIndex = 4;
}
optional HypercoreMetadata hypercore = 2;
}
optional MigrationMetadata migrationMetadata = 11;
}
34 changes: 0 additions & 34 deletions schema/observation/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,40 +205,6 @@
}
},
"required": ["docId", "versionId"]
},
"migrationMetadata": {
"description": "Metadata about the migration of this observation from Mapeo Legacy",
"type": "object",
"properties": {
"originalDocument": {
"description": "Hex-encoded raw observation from Mapeo Legacy",
"type": "string"
},
"hypercore": {
"type": "object",
"properties": {
"rootHashChecksum": {
"description": "Checksum of the root hash of the old Hypercore",
"type": "string",
"minLength": 1
},
"signature": {
"description": "Signature of the old Hypercore",
"type": "string",
"minLength": 1
},
"coreKey": {
"description": "Core key of the old Hypercore",
"type": "string",
"minLength": 1
},
"blockIndex": {
"description": "Block index of the document",
"type": "number"
}
}
}
}
}
},
"required": ["schemaName", "tags", "attachments"],
Expand Down
9 changes: 0 additions & 9 deletions src/lib/decode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export const convertObservation: ConvertFunction<'observation'> = (
const {
common,
metadata,
migrationMetadata,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
schemaVersion,
...rest
Expand Down Expand Up @@ -140,14 +139,6 @@ export const convertObservation: ConvertFunction<'observation'> = (
tags: convertTags(message.tags),
metadata: metadata ? removeInvalidPositionMetadata(metadata) : {},
presetRef,
migrationMetadata: migrationMetadata
? {
...migrationMetadata,
originalDocument: migrationMetadata.originalDocument
? JSON.stringify(migrationMetadata.originalDocument)
: undefined,
}
: undefined,
}
return obs
}
Expand Down
12 changes: 0 additions & 12 deletions src/lib/encode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,12 @@ export const convertObservation: ConvertFunction<'observation'> = (
}
}

let migrationMetadata
if (mapeoDoc.migrationMetadata) {
migrationMetadata = {
...mapeoDoc.migrationMetadata,
originalDocument: Buffer.from(
mapeoDoc.migrationMetadata.originalDocument || '',
'hex'
),
}
}

return {
common: convertCommon(mapeoDoc),
...mapeoDoc,
attachments,
tags: convertTags(mapeoDoc.tags),
presetRef,
migrationMetadata,
}
}

Expand Down

0 comments on commit 8273e51

Please sign in to comment.