Skip to content

Commit

Permalink
feat: Add extra meta for collection-reference.ts and `document-re…
Browse files Browse the repository at this point in the history
…ference.ts` with migrate old versions

This commit adds the `extra` property to the `StoreFileMeta` interface in the `collection-reference.ts` and `document-reference.ts` files. The `extra` property is an empty object that can be used to store additional metadata or custom data related to the store file. This change aligns with the recent refactoring of other properties in the `StoreFileMeta` interface. The addition of the `extra` property provides flexibility for future enhancements and customization of the store file metadata.

BREAKING CHANGE: The `StoreFileMeta` interface has been updated to include the `extra` property. Developers should update their code to handle the new property.
  • Loading branch information
alimd committed Sep 2, 2024
1 parent 5cdb573 commit 8182369
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/reference/src/collection-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class CollectionReference<TItem extends JsonifiableObject = JsonifiableOb
type: StoreFileType.Collection,
extension: StoreFileExtension.Json,
fv: CollectionReference.fileFormatVersion,
extra: {},
},
data: initialData ?? {},
};
Expand Down Expand Up @@ -142,6 +143,7 @@ export class CollectionReference<TItem extends JsonifiableObject = JsonifiableOb
this.context__.meta.schemaVer = 1
}
delete (this.context__.meta as Dictionary)['ver'];
this.context__.meta.extra ??= {};
this.context__.meta.fv = 3;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/reference/src/document-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class DocumentReference<TDoc extends JsonifiableObject = JsonifiableObjec
type: StoreFileType.Document,
extension: StoreFileExtension.Json,
fv: DocumentReference.fileFormatVersion,
extra: {},
},
data: initialData,
};
Expand Down Expand Up @@ -131,6 +132,7 @@ export class DocumentReference<TDoc extends JsonifiableObject = JsonifiableObjec
this.context__.meta.schemaVer = 1
}
delete (this.context__.meta as Dictionary)['ver'];
this.context__.meta.extra ??= {};
this.context__.meta.fv = 3;
}

Expand Down

0 comments on commit 8182369

Please sign in to comment.