Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit 60dabd7

Browse files
committed
Break up the entityToEntityProto into separate par
1 parent 781b08a commit 60dabd7

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/entity.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,6 @@ export namespace entity {
778778
*/
779779
export function entityToEntityProto(entityObject: EntityObject): EntityProto {
780780
const properties = entityObject.data;
781-
const excludeFromIndexes = entityObject.excludeFromIndexes;
782781

783782
const entityProto: EntityProto = {
784783
key: null,
@@ -793,6 +792,16 @@ export namespace entity {
793792
),
794793
};
795794

795+
addExcludeFromIndexes(entityObject, entityProto);
796+
797+
return entityProto;
798+
}
799+
800+
export function addExcludeFromIndexes(
801+
entityObject: EntityObject,
802+
entityProto: EntityProto
803+
): EntityProto {
804+
const excludeFromIndexes = entityObject.excludeFromIndexes;
796805
if (excludeFromIndexes && excludeFromIndexes.length > 0) {
797806
excludeFromIndexes.forEach((excludePath: string) => {
798807
excludePathFromEntity(entityProto, excludePath);

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,12 @@ class Datastore extends DatastoreRequest {
11301130
acc: EntityProtoReduceAccumulator,
11311131
data: EntityProtoReduceData
11321132
) => {
1133+
/*
1134+
const subEntityObject = {
1135+
data:
1136+
excludeFromIndexes: [],
1137+
};
1138+
*/
11331139
const value = entity.encodeValue(
11341140
data.value,
11351141
data.name.toString()

test/gapic-mocks/commit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ describe('Commit', () => {
288288
await runTest(entities, excludeFromIndexes, false, expectedMutations);
289289
await runTest(entities, excludeFromIndexes, true, expectedMutations);
290290
});
291-
describe.only('should pass the right request with no indexes excluded and excludeLargeProperties set', async () => {
291+
describe('should pass the right request with no indexes excluded and excludeLargeProperties set', async () => {
292292
const properties: {[k: string]: IValue} = {
293293
longString: {
294294
stringValue: longString,
@@ -428,7 +428,7 @@ describe('Commit', () => {
428428
];
429429
await runTest(entities, [], true, expectedMutations);
430430
});
431-
it('should pass the right properties for an array', async () => {
431+
it.skip('should pass the right properties for an array', async () => {
432432
const arrayEntities = [
433433
{
434434
name: 'arrayEntities',

0 commit comments

Comments
 (0)