diff --git a/client/request/consts.go b/client/request/consts.go index 3aef04156c..b50e3d113e 100644 --- a/client/request/consts.go +++ b/client/request/consts.go @@ -42,11 +42,12 @@ const ( LatestCommitsName = "latestCommits" CommitsName = "commits" - CommitTypeName = "Commit" - LinksFieldName = "links" - HeightFieldName = "height" - CidFieldName = "cid" - DeltaFieldName = "delta" + CommitTypeName = "Commit" + LinksFieldName = "links" + HeightFieldName = "height" + CidFieldName = "cid" + SchemaVersionIDFieldName = "schemaVersionId" + DeltaFieldName = "delta" LinksNameFieldName = "name" LinksCidFieldName = "cid" @@ -85,6 +86,7 @@ var ( VersionFields = []string{ HeightFieldName, CidFieldName, + SchemaVersionIDFieldName, DeltaFieldName, } diff --git a/core/crdt/lwwreg.go b/core/crdt/lwwreg.go index ecafe34c2a..264316a00b 100644 --- a/core/crdt/lwwreg.go +++ b/core/crdt/lwwreg.go @@ -34,9 +34,10 @@ var ( // LWWRegDelta is a single delta operation for an LWWRegister // @todo: Expand delta metadata (investigate if needed) type LWWRegDelta struct { - Priority uint64 - Data []byte - DocKey []byte + SchemaVersionID string + Priority uint64 + Data []byte + DocKey []byte } // GetPriority gets the current priority for this delta. @@ -56,10 +57,11 @@ func (delta *LWWRegDelta) Marshal() ([]byte, error) { buf := bytes.NewBuffer(nil) enc := codec.NewEncoder(buf, h) err := enc.Encode(struct { - Priority uint64 - Data []byte - DocKey []byte - }{delta.Priority, delta.Data, delta.DocKey}) + SchemaVersionID string + Priority uint64 + Data []byte + DocKey []byte + }{delta.SchemaVersionID, delta.Priority, delta.Data, delta.DocKey}) if err != nil { return nil, err } @@ -74,12 +76,22 @@ func (delta *LWWRegDelta) Value() any { // of an arbitrary data type that ensures convergence. type LWWRegister struct { baseCRDT + + // schemaVersionKey is the schema version datastore key at the time of commit. + // + // It can be used to identify the collection datastructure state at time of commit. + schemaVersionKey core.CollectionSchemaVersionKey } // NewLWWRegister returns a new instance of the LWWReg with the given ID. -func NewLWWRegister(store datastore.DSReaderWriter, key core.DataStoreKey) LWWRegister { +func NewLWWRegister( + store datastore.DSReaderWriter, + schemaVersionKey core.CollectionSchemaVersionKey, + key core.DataStoreKey, +) LWWRegister { return LWWRegister{ - baseCRDT: newBaseCRDT(store, key), + baseCRDT: newBaseCRDT(store, key), + schemaVersionKey: schemaVersionKey, // id: id, // data: data, // ts: ts, @@ -105,8 +117,9 @@ func (reg LWWRegister) Value(ctx context.Context) ([]byte, error) { func (reg LWWRegister) Set(value []byte) *LWWRegDelta { // return NewLWWRegister(reg.id, value, reg.clock.Apply(), reg.clock) return &LWWRegDelta{ - Data: value, - DocKey: reg.key.Bytes(), + Data: value, + DocKey: reg.key.Bytes(), + SchemaVersionID: reg.schemaVersionKey.SchemaVersionId, } } diff --git a/core/crdt/lwwreg_test.go b/core/crdt/lwwreg_test.go index 887a155424..e9c78ec5c7 100644 --- a/core/crdt/lwwreg_test.go +++ b/core/crdt/lwwreg_test.go @@ -33,7 +33,7 @@ func newMockStore() datastore.DSReaderWriter { func setupLWWRegister() LWWRegister { store := newMockStore() key := core.DataStoreKey{DocKey: "AAAA-BBBB"} - return NewLWWRegister(store, key) + return NewLWWRegister(store, core.CollectionSchemaVersionKey{}, key) } func setupLoadedLWWRegster(ctx context.Context) LWWRegister { diff --git a/docs/data_format_changes/i1006-commits-schema-v-id.md b/docs/data_format_changes/i1006-commits-schema-v-id.md new file mode 100644 index 0000000000..c2046ccc0e --- /dev/null +++ b/docs/data_format_changes/i1006-commits-schema-v-id.md @@ -0,0 +1,3 @@ +# Add schema version id to commit queries + +The field commit block gained a new schema version id property and this caused the cids to change. diff --git a/merkle/clock/clock_test.go b/merkle/clock/clock_test.go index 8a22fc1ece..bea641adcb 100644 --- a/merkle/clock/clock_test.go +++ b/merkle/clock/clock_test.go @@ -32,7 +32,7 @@ func newTestMerkleClock() *MerkleClock { rw := datastore.AsDSReaderWriter(s) multistore := datastore.MultiStoreFrom(rw) - reg := crdt.NewLWWRegister(rw, core.DataStoreKey{}) + reg := crdt.NewLWWRegister(rw, core.CollectionSchemaVersionKey{}, core.DataStoreKey{}) return NewMerkleClock(multistore.Headstore(), multistore.DAGstore(), core.HeadStoreKey{DocKey: "dockey", FieldId: "1"}, reg).(*MerkleClock) } @@ -40,7 +40,7 @@ func TestNewMerkleClock(t *testing.T) { s := newDS() rw := datastore.AsDSReaderWriter(s) multistore := datastore.MultiStoreFrom(rw) - reg := crdt.NewLWWRegister(rw, core.DataStoreKey{}) + reg := crdt.NewLWWRegister(rw, core.CollectionSchemaVersionKey{}, core.DataStoreKey{}) clk := NewMerkleClock(multistore.Headstore(), multistore.DAGstore(), core.HeadStoreKey{}, reg).(*MerkleClock) if clk.headstore != multistore.Headstore() { diff --git a/merkle/crdt/lwwreg.go b/merkle/crdt/lwwreg.go index 925a82b639..e1495326ee 100644 --- a/merkle/crdt/lwwreg.go +++ b/merkle/crdt/lwwreg.go @@ -25,12 +25,13 @@ import ( var ( lwwFactoryFn = MerkleCRDTFactory( - func(mstore datastore.MultiStore, _ core.CollectionSchemaVersionKey, _ events.UpdateChannel) MerkleCRDTInitFn { + func(mstore datastore.MultiStore, schemaID core.CollectionSchemaVersionKey, _ events.UpdateChannel) MerkleCRDTInitFn { return func(key core.DataStoreKey) MerkleCRDT { return NewMerkleLWWRegister( mstore.Datastore(), mstore.Headstore(), mstore.DAGstore(), + schemaID, core.DataStoreKey{}, key, ) @@ -60,9 +61,10 @@ func NewMerkleLWWRegister( datastore datastore.DSReaderWriter, headstore datastore.DSReaderWriter, dagstore datastore.DAGStore, + schemaVersionKey core.CollectionSchemaVersionKey, ns, key core.DataStoreKey, ) *MerkleLWWRegister { - register := corecrdt.NewLWWRegister(datastore, key /* stuff like namespace and ID */) + register := corecrdt.NewLWWRegister(datastore, schemaVersionKey, key /* stuff like namespace and ID */) clk := clock.NewMerkleClock(headstore, dagstore, key.ToHeadStoreKey(), register) // newBaseMerkleCRDT(clock, register) diff --git a/merkle/crdt/merklecrdt_test.go b/merkle/crdt/merklecrdt_test.go index 939493146a..d214aed289 100644 --- a/merkle/crdt/merklecrdt_test.go +++ b/merkle/crdt/merklecrdt_test.go @@ -34,7 +34,7 @@ func newTestBaseMerkleCRDT() (*baseMerkleCRDT, datastore.DSReaderWriter) { rw := datastore.AsDSReaderWriter(s) multistore := datastore.MultiStoreFrom(rw) - reg := corecrdt.NewLWWRegister(multistore.Datastore(), core.DataStoreKey{}) + reg := corecrdt.NewLWWRegister(multistore.Datastore(), core.CollectionSchemaVersionKey{}, core.DataStoreKey{}) clk := clock.NewMerkleClock(multistore.Headstore(), multistore.DAGstore(), core.HeadStoreKey{}, reg) return &baseMerkleCRDT{clock: clk, crdt: reg}, rw } diff --git a/planner/commit.go b/planner/commit.go index c03b83b600..d8bb5560b8 100644 --- a/planner/commit.go +++ b/planner/commit.go @@ -285,6 +285,11 @@ func (n *dagScanNode) dagBlockToNodeDoc(block blocks.Block) (core.Doc, []*ipld.L return core.Doc{}, nil, ErrDeltaMissingPriority } + schemaVersionId, ok := delta["SchemaVersionID"].(string) + if ok { + n.parsed.DocumentMapping.SetFirstOfName(&commit, "schemaVersionId", schemaVersionId) + } + n.parsed.DocumentMapping.SetFirstOfName(&commit, "height", int64(prio)) n.parsed.DocumentMapping.SetFirstOfName(&commit, "delta", delta["Data"]) diff --git a/planner/mapper/commitSelect.go b/planner/mapper/commitSelect.go index c4190eb272..d938855051 100644 --- a/planner/mapper/commitSelect.go +++ b/planner/mapper/commitSelect.go @@ -30,6 +30,9 @@ type CommitSelect struct { // The parent Cid for which commit information has been requested. Cid immutable.Option[string] + + // The SchemaVersionID at the time of commit. + SchemaVersionID immutable.Option[string] } func (s *CommitSelect) CloneTo(index int) Requestable { diff --git a/request/graphql/schema/manager.go b/request/graphql/schema/manager.go index dc31d23974..a21aa2b539 100644 --- a/request/graphql/schema/manager.go +++ b/request/graphql/schema/manager.go @@ -16,17 +16,6 @@ import ( schemaTypes "github.com/sourcenetwork/defradb/request/graphql/schema/types" ) -var ( - QueryLatestCommits = &gql.Field{ - Name: "latestCommits", - Type: gql.NewList(schemaTypes.CommitObject), - Args: gql.FieldConfigArgument{ - "dockey": schemaTypes.NewArgConfig(gql.NewNonNull(gql.ID)), - "field": schemaTypes.NewArgConfig(gql.String), - }, - } -) - // SchemaManager creates an instanced management point // for schema intake/outtake, and updates. type SchemaManager struct { diff --git a/request/graphql/schema/types/commits.go b/request/graphql/schema/types/commits.go index 821e0a685d..b7dd74817f 100644 --- a/request/graphql/schema/types/commits.go +++ b/request/graphql/schema/types/commits.go @@ -29,6 +29,7 @@ var ( // type Commit { // Height: Int // CID: String + // SchemaVersionID: String // Delta: String // Previous: [Commit] // Links: [Commit] @@ -45,6 +46,9 @@ var ( "cid": &gql.Field{ Type: gql.String, }, + "schemaVersionId": &gql.Field{ + Type: gql.String, + }, "delta": &gql.Field{ Type: gql.String, }, diff --git a/tests/integration/events/simple/with_update_test.go b/tests/integration/events/simple/with_update_test.go index 5d3dbb5bd7..b67bf31bee 100644 --- a/tests/integration/events/simple/with_update_test.go +++ b/tests/integration/events/simple/with_update_test.go @@ -64,14 +64,14 @@ func TestEventsSimpleWithUpdate(t *testing.T) { ExpectedUpdates: []testUtils.ExpectedUpdate{ { DocKey: immutable.Some(docKey1), - Cid: immutable.Some("bafybeidmgh5m52lo5ht5r6emiisdwf46s2sfrlx47fy5guz76ueh3znxze"), + Cid: immutable.Some("bafybeigpig5csogxswqwdkawjprfcqqumvkra43rwoebh2ugvx7hns3d7e"), }, { DocKey: immutable.Some(docKey2), }, { DocKey: immutable.Some(docKey1), - Cid: immutable.Some("bafybeibsvh46szrpx67z4rohjylcjb2p6mlhulv2yfp5a4wrz7xzwaolgq"), + Cid: immutable.Some("bafybeid74gzm5rpglto6yviav4gcl5dfoijttl2oj3dvlofsxwqfxek7eu"), }, }, } diff --git a/tests/integration/mutation/simple/create/with_version_test.go b/tests/integration/mutation/simple/create/with_version_test.go index bb433992df..9430df0ce9 100644 --- a/tests/integration/mutation/simple/create/with_version_test.go +++ b/tests/integration/mutation/simple/create/with_version_test.go @@ -31,7 +31,7 @@ func TestMutationCreateSimpleReturnVersionCID(t *testing.T) { { "_version": []map[string]any{ { - "cid": "bafybeidfn4vxabyimc4xqq7ipkr4pbr65agr6f6vt2nmjwt72zd425pc6e", + "cid": "bafybeidzfrcnjm35ftztl44rskyeroysm3alwluirks5zabx6we55ysqcy", }, }, }, diff --git a/tests/integration/query/commits/simple_test.go b/tests/integration/query/commits/simple_test.go index 6ea0d56415..81f3b4ea66 100644 --- a/tests/integration/query/commits/simple_test.go +++ b/tests/integration/query/commits/simple_test.go @@ -34,13 +34,13 @@ func TestQueryCommits(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", }, }, } @@ -70,22 +70,58 @@ func TestQueryCommitsMultipleDocs(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidsa74vl7xvw6tzgt5gmux5ts7lxldxculzgpxl5xura45ckf7e5i", + "cid": "bafybeibmprk2bxsv2nj2sf5ofmu7yuqe7dz2dze546nxkzwwylxyzpruoy", }, { - "cid": "bafybeibek4lmrb5gtmahgsv33njmk3efty53n7z2rac7fuup7mwpho5zqa", + "cid": "bafybeidbb4dv2smuzmeodcrbt2dk6loqj7i3a6fofl32ejbx2gtinxguye", }, { - "cid": "bafybeibnwzoekenlil5sdltgmkmfngoifd5uwcpgzzry7rokrd5qurgdve", + "cid": "bafybeifmifbksnwuwxhkwjqdojbddw2274f7wzd4jamllaoud3llunm5xu", }, { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", + }, + }, + } + + executeTestCase(t, test) +} + +func TestQueryCommitsWithSchemaVersionIdField(t *testing.T) { + test := testUtils.RequestTestCase{ + Description: "Simple commits query yielding schemaVersionId", + Request: `query { + commits { + cid + schemaVersionId + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "John", + "Age": 21 + }`, + }, + }, + Results: []map[string]any{ + { + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", + "schemaVersionId": "bafkreihaqmvbjvm2q4iwkjnuafavvsakiaztlqnridiybxystfm27uwlde", + }, + { + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", + "schemaVersionId": "bafkreihaqmvbjvm2q4iwkjnuafavvsakiaztlqnridiybxystfm27uwlde", + }, + { + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", + "schemaVersionId": "bafkreihaqmvbjvm2q4iwkjnuafavvsakiaztlqnridiybxystfm27uwlde", }, }, } diff --git a/tests/integration/query/commits/with_cid_test.go b/tests/integration/query/commits/with_cid_test.go index 219f6ff2ba..c559bf78b9 100644 --- a/tests/integration/query/commits/with_cid_test.go +++ b/tests/integration/query/commits/with_cid_test.go @@ -21,7 +21,7 @@ func TestQueryCommitsWithCid(t *testing.T) { Description: "Simple all commits query with cid", Request: `query { commits( - cid: "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq" + cid: "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq" ) { cid } @@ -45,7 +45,7 @@ func TestQueryCommitsWithCid(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", }, }, } @@ -59,7 +59,7 @@ func TestQueryCommitsWithCidForFieldCommit(t *testing.T) { Description: "Simple all commits query with cid", Request: `query { commits( - cid: "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a" + cid: "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny" ) { cid } @@ -74,7 +74,7 @@ func TestQueryCommitsWithCidForFieldCommit(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, }, } diff --git a/tests/integration/query/commits/with_depth_test.go b/tests/integration/query/commits/with_depth_test.go index 3b6ead2612..e55d0d220a 100644 --- a/tests/integration/query/commits/with_depth_test.go +++ b/tests/integration/query/commits/with_depth_test.go @@ -34,13 +34,13 @@ func TestQueryCommitsWithDepth1(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", }, }, } @@ -76,17 +76,17 @@ func TestQueryCommitsWithDepth1WithUpdate(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "height": int64(2), }, { // "Name" field head (unchanged from create) - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "height": int64(1), }, { // "Age" field head - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", "height": int64(2), }, }, @@ -127,27 +127,27 @@ func TestQueryCommitsWithDepth2WithUpdate(t *testing.T) { Results: []map[string]any{ { // Composite head - "cid": "bafybeiaxjhz6dna7fyf7tqo5hooilwvaezswd5xfsmb2lfgcy7tpzklikm", + "cid": "bafybeiho5z6seahwxgbdyobylzyarrdschgzmood7rkdtp4qpd2uxebaxy", "height": int64(3), }, { // Composite head -1 - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "height": int64(2), }, { // "Name" field head (unchanged from create) - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "height": int64(1), }, { // "Age" field head - "cid": "bafybeia6yl5mfn4wwmvxu6ectnei6xgo2jr7esus54dbx2igb4y3kpypba", + "cid": "bafybeib6yxcmbg2gz5ss6d67u5mu6wcatfjtdp2rv44difyznp3rqlyu4m", "height": int64(3), }, { // "Age" field head -1 - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", "height": int64(2), }, }, @@ -178,22 +178,22 @@ func TestQueryCommitsWithDepth1AndMultipleDocs(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", }, { - "cid": "bafybeiajhlicqju3thdnyemvparx35kg6vfb6sr3vuemhw7zjrulx2tkom", + "cid": "bafybeifzqn3n6unmfd4kabhxermcbrp564nu2ms3uh6m73i26b3zwvjrku", }, { - "cid": "bafybeifl4q2htt4sozl5dnxjqkpstpqbpkurgqc56dnn2bvtsora3srl2q", + "cid": "bafybeieicf7so27bdrrarhwxi4wzzs5yyxku2wtea555gcrgz4kmpjgdvu", }, { - "cid": "bafybeibsooknzqfq4u277chnvag6lxc3q6uz4mj6525hwxofwqfbzyudvm", + "cid": "bafybeig2efgh5jy5kbknnvxkgbtz66kn75ixr5pcrrreve6t46e7ba3l3y", }, }, } diff --git a/tests/integration/query/commits/with_dockey_cid_test.go b/tests/integration/query/commits/with_dockey_cid_test.go index cf08129f16..f47136a44b 100644 --- a/tests/integration/query/commits/with_dockey_cid_test.go +++ b/tests/integration/query/commits/with_dockey_cid_test.go @@ -81,7 +81,7 @@ func TestQueryCommitsWithDockeyAndCid(t *testing.T) { Request: `query { commits( dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f", - cid: "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq" + cid: "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq" ) { cid } @@ -105,7 +105,7 @@ func TestQueryCommitsWithDockeyAndCid(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", }, }, } diff --git a/tests/integration/query/commits/with_dockey_count_test.go b/tests/integration/query/commits/with_dockey_count_test.go index 130cb886fc..3b17290658 100644 --- a/tests/integration/query/commits/with_dockey_count_test.go +++ b/tests/integration/query/commits/with_dockey_count_test.go @@ -35,15 +35,15 @@ func TestQueryCommitsWithDockeyAndLinkCount(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "_count": 0, }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "_count": 0, }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "_count": 2, }, }, diff --git a/tests/integration/query/commits/with_dockey_field_test.go b/tests/integration/query/commits/with_dockey_field_test.go index 4ec1875a77..fbe71d2338 100644 --- a/tests/integration/query/commits/with_dockey_field_test.go +++ b/tests/integration/query/commits/with_dockey_field_test.go @@ -104,7 +104,7 @@ func TestQueryCommitsWithDockeyAndFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, }, } @@ -132,7 +132,7 @@ func TestQueryCommitsWithDockeyAndCompositeFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", }, }, } diff --git a/tests/integration/query/commits/with_dockey_limit_offset_test.go b/tests/integration/query/commits/with_dockey_limit_offset_test.go index 625d09e6cf..00c7fdcea1 100644 --- a/tests/integration/query/commits/with_dockey_limit_offset_test.go +++ b/tests/integration/query/commits/with_dockey_limit_offset_test.go @@ -49,10 +49,10 @@ func TestQueryCommitsWithDockeyAndLimitAndOffset(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeiaxjhz6dna7fyf7tqo5hooilwvaezswd5xfsmb2lfgcy7tpzklikm", + "cid": "bafybeiho5z6seahwxgbdyobylzyarrdschgzmood7rkdtp4qpd2uxebaxy", }, { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", }, }, } diff --git a/tests/integration/query/commits/with_dockey_limit_test.go b/tests/integration/query/commits/with_dockey_limit_test.go index edb32182a4..d65db1c7b0 100644 --- a/tests/integration/query/commits/with_dockey_limit_test.go +++ b/tests/integration/query/commits/with_dockey_limit_test.go @@ -46,10 +46,10 @@ func TestQueryCommitsWithDockeyAndLimit(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeiaxjhz6dna7fyf7tqo5hooilwvaezswd5xfsmb2lfgcy7tpzklikm", + "cid": "bafybeiho5z6seahwxgbdyobylzyarrdschgzmood7rkdtp4qpd2uxebaxy", }, { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", }, }, } diff --git a/tests/integration/query/commits/with_dockey_order_limit_offset_test.go b/tests/integration/query/commits/with_dockey_order_limit_offset_test.go index 8b1f271437..7ccdee9fad 100644 --- a/tests/integration/query/commits/with_dockey_order_limit_offset_test.go +++ b/tests/integration/query/commits/with_dockey_order_limit_offset_test.go @@ -50,11 +50,11 @@ func TestQueryCommitsWithDockeyAndOrderAndLimitAndOffset(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", "height": int64(2), }, { - "cid": "bafybeiaxjhz6dna7fyf7tqo5hooilwvaezswd5xfsmb2lfgcy7tpzklikm", + "cid": "bafybeiho5z6seahwxgbdyobylzyarrdschgzmood7rkdtp4qpd2uxebaxy", "height": int64(3), }, }, diff --git a/tests/integration/query/commits/with_dockey_order_test.go b/tests/integration/query/commits/with_dockey_order_test.go index fe83ef5831..71b14f0eb0 100644 --- a/tests/integration/query/commits/with_dockey_order_test.go +++ b/tests/integration/query/commits/with_dockey_order_test.go @@ -44,23 +44,23 @@ func TestQueryCommitsWithDockeyAndOrderHeightDesc(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", "height": int64(2), }, { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "height": int64(2), }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "height": int64(1), }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "height": int64(1), }, { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "height": int64(1), }, }, @@ -97,23 +97,23 @@ func TestQueryCommitsWithDockeyAndOrderHeightAsc(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "height": int64(1), }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "height": int64(1), }, { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "height": int64(1), }, { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", "height": int64(2), }, { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "height": int64(2), }, }, @@ -150,23 +150,23 @@ func TestQueryCommitsWithDockeyAndOrderCidDesc(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "height": int64(1), }, { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", - "height": int64(2), + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", + "height": int64(1), }, { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", - "height": int64(1), + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", + "height": int64(2), }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "height": int64(1), }, { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "height": int64(2), }, }, @@ -203,23 +203,23 @@ func TestQueryCommitsWithDockeyAndOrderCidAsc(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "height": int64(2), }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "height": int64(1), }, { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", - "height": int64(1), + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", + "height": int64(2), }, { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", - "height": int64(2), + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", + "height": int64(1), }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "height": int64(1), }, }, diff --git a/tests/integration/query/commits/with_dockey_test.go b/tests/integration/query/commits/with_dockey_test.go index fbd28a712a..652a881508 100644 --- a/tests/integration/query/commits/with_dockey_test.go +++ b/tests/integration/query/commits/with_dockey_test.go @@ -56,13 +56,13 @@ func TestQueryCommitsWithDockey(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", }, }, } @@ -92,22 +92,22 @@ func TestQueryCommitsWithDockeyAndLinks(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "links": []map[string]any{}, }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "links": []map[string]any{}, }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "links": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "name": "Age", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "name": "Name", }, }, @@ -146,23 +146,23 @@ func TestQueryCommitsWithDockeyAndUpdate(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "height": int64(2), }, { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "height": int64(1), }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "height": int64(1), }, { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", "height": int64(2), }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "height": int64(1), }, }, @@ -205,44 +205,44 @@ func TestQueryCommitsWithDockeyAndUpdateAndLinks(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "links": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "name": "_head", }, }, }, { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "links": []map[string]any{}, }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "links": []map[string]any{}, }, { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", "links": []map[string]any{ { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", "name": "Age", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "name": "_head", }, }, }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "links": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "name": "Age", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "name": "Name", }, }, diff --git a/tests/integration/query/commits/with_dockey_typename_test.go b/tests/integration/query/commits/with_dockey_typename_test.go index bb3727611e..ab15d9c613 100644 --- a/tests/integration/query/commits/with_dockey_typename_test.go +++ b/tests/integration/query/commits/with_dockey_typename_test.go @@ -35,15 +35,15 @@ func TestQueryCommitsWithDockeyWithTypeName(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "__typename": "Commit", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "__typename": "Commit", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "__typename": "Commit", }, }, diff --git a/tests/integration/query/commits/with_field_test.go b/tests/integration/query/commits/with_field_test.go index b171c85fec..a55f061bd9 100644 --- a/tests/integration/query/commits/with_field_test.go +++ b/tests/integration/query/commits/with_field_test.go @@ -60,7 +60,7 @@ func TestQueryCommitsWithFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, }, } @@ -88,7 +88,37 @@ func TestQueryCommitsWithCompositeFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", + }, + }, + } + + executeTestCase(t, test) +} + +// This test is for documentation reasons only. This is not +// desired behaviour (users should not be specifying field ids). +func TestQueryCommitsWithCompositeFieldIdWithReturnedSchemaVersionId(t *testing.T) { + test := testUtils.RequestTestCase{ + Description: "Simple all commits query with dockey and field id", + Request: `query { + commits(field: "C") { + cid + schemaVersionId + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "John", + "Age": 21 + }`, + }, + }, + Results: []map[string]any{ + { + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", + "schemaVersionId": "bafkreihaqmvbjvm2q4iwkjnuafavvsakiaztlqnridiybxystfm27uwlde", }, }, } diff --git a/tests/integration/query/commits/with_group_test.go b/tests/integration/query/commits/with_group_test.go index 08129c55a3..130daa6f8b 100644 --- a/tests/integration/query/commits/with_group_test.go +++ b/tests/integration/query/commits/with_group_test.go @@ -87,10 +87,10 @@ func TestQueryCommitsWithGroupByHeightWithChild(t *testing.T) { "height": int64(2), "_group": []map[string]any{ { - "cid": "bafybeicvef4ugls2dl7j4hibt2ahxss2i2i4bbgps7tkjiaoybp6q73mca", + "cid": "bafybeiacqac6scm7pmtlvqptvtljmoroevnoedku42qi5bmfdpaelcu5fm", }, { - "cid": "bafybeigz4lfwqqunimseeok4w222e2vsje6dr53gpw3mtk7muuxkja3oiq", + "cid": "bafybeibz3vbkt75siz3zogke6tlzvpcxttpiy4xivjvgyeaorjz6wsbguq", }, }, }, @@ -98,13 +98,13 @@ func TestQueryCommitsWithGroupByHeightWithChild(t *testing.T) { "height": int64(1), "_group": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", }, }, }, @@ -136,7 +136,7 @@ func TestQueryCommitsWithGroupByCidWithChild(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "_group": []map[string]any{ { "height": int64(1), @@ -144,7 +144,7 @@ func TestQueryCommitsWithGroupByCidWithChild(t *testing.T) { }, }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "_group": []map[string]any{ { "height": int64(1), @@ -152,7 +152,7 @@ func TestQueryCommitsWithGroupByCidWithChild(t *testing.T) { }, }, { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "_group": []map[string]any{ { "height": int64(1), diff --git a/tests/integration/query/latest_commits/with_dockey_field_test.go b/tests/integration/query/latest_commits/with_dockey_field_test.go index d2aa3cd738..20cbc15349 100644 --- a/tests/integration/query/latest_commits/with_dockey_field_test.go +++ b/tests/integration/query/latest_commits/with_dockey_field_test.go @@ -68,7 +68,7 @@ func TestQueryLatestCommitsWithDocKeyAndFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "links": []map[string]any{}, }, }, @@ -101,14 +101,14 @@ func TestQueryLatestCommitsWithDocKeyAndCompositeFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "links": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "name": "Age", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "name": "Name", }, }, diff --git a/tests/integration/query/latest_commits/with_dockey_test.go b/tests/integration/query/latest_commits/with_dockey_test.go index a57f4d8b3a..eb6e5ce66a 100644 --- a/tests/integration/query/latest_commits/with_dockey_test.go +++ b/tests/integration/query/latest_commits/with_dockey_test.go @@ -38,14 +38,14 @@ func TestQueryLatestCommitsWithDocKey(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafybeid2b6a5vbqzxyxrzvwvkakqlzgcdpcdpkpmufthy4hnasu4zcyzua", + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", "links": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeigju7dgicfq3fxvtlxtjao7won4xc7kusykkvumngjfx5i2c7ibny", "name": "Age", }, { - "cid": "bafybeihhypcsqt7blkrqtcmpl43eo3yunrog5pchox5naji6hisdme4swm", + "cid": "bafybeiaqarrcayyoly2gdiam6mhh72ls4azwa7brozxxc3q2srnggkkqkq", "name": "Name", }, }, @@ -55,3 +55,31 @@ func TestQueryLatestCommitsWithDocKey(t *testing.T) { executeTestCase(t, test) } + +func TestQueryLatestCommitsWithDocKeyWithSchemaVersionIdField(t *testing.T) { + test := testUtils.RequestTestCase{ + Description: "Simple latest commits query with dockey and schema versiion id field", + Request: `query { + latestCommits(dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f") { + cid + schemaVersionId + } + }`, + Docs: map[int][]string{ + 0: { + `{ + "Name": "John", + "Age": 21 + }`, + }, + }, + Results: []map[string]any{ + { + "cid": "bafybeid5l577igkgcn6wjqjeqxlta4dcc3a3iykwkborf4fklaenjuctoq", + "schemaVersionId": "bafkreihaqmvbjvm2q4iwkjnuafavvsakiaztlqnridiybxystfm27uwlde", + }, + }, + } + + executeTestCase(t, test) +} diff --git a/tests/integration/query/one_to_many/with_cid_dockey_test.go b/tests/integration/query/one_to_many/with_cid_dockey_test.go index 0ea7ffbd32..a25ea3f9b3 100644 --- a/tests/integration/query/one_to_many/with_cid_dockey_test.go +++ b/tests/integration/query/one_to_many/with_cid_dockey_test.go @@ -68,7 +68,7 @@ func TestQueryOneToManyWithCidAndDocKey(t *testing.T) { Description: "One-to-many relation query from one side with cid and dockey", Request: `query { book ( - cid: "bafybeieksacgcauuyvmw4oscbe3ztfneauf4ldhramt7f6d7ubrqvio2uy", + cid: "bafybeiefrwsqguhuyznwd3o2i7yi3xuskulgtparhfvgi2pnlnciplxlme", dockey: "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" ) { name @@ -117,7 +117,7 @@ func TestQueryOneToManyWithChildUpdateAndFirstCidAndDocKey(t *testing.T) { Description: "One-to-many relation query from one side with child update and parent cid and dockey", Request: `query { book ( - cid: "bafybeieksacgcauuyvmw4oscbe3ztfneauf4ldhramt7f6d7ubrqvio2uy", + cid: "bafybeiefrwsqguhuyznwd3o2i7yi3xuskulgtparhfvgi2pnlnciplxlme", dockey: "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" ) { name @@ -173,7 +173,7 @@ func TestQueryOneToManyWithParentUpdateAndFirstCidAndDocKey(t *testing.T) { Description: "One-to-many relation query from one side with parent update and parent cid and dockey", Request: `query { book ( - cid: "bafybeieksacgcauuyvmw4oscbe3ztfneauf4ldhramt7f6d7ubrqvio2uy", + cid: "bafybeiefrwsqguhuyznwd3o2i7yi3xuskulgtparhfvgi2pnlnciplxlme", dockey: "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" ) { name @@ -229,7 +229,7 @@ func TestQueryOneToManyWithParentUpdateAndLastCidAndDocKey(t *testing.T) { Description: "One-to-many relation query from one side with parent update and parent cid and dockey", Request: `query { book ( - cid: "bafybeighcqaur67r6a4m3dvvkgwldkyqp2jtak5wvyhtz64co7vqt7oihm", + cid: "bafybeigmbd3m5fhhvyg2bxitzlj5jmtuartu6lpvxn42jls5vpbig3u2na", dockey: "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" ) { name diff --git a/tests/integration/query/simple/with_cid_dockey_test.go b/tests/integration/query/simple/with_cid_dockey_test.go index 3b9e73e002..d841403aa6 100644 --- a/tests/integration/query/simple/with_cid_dockey_test.go +++ b/tests/integration/query/simple/with_cid_dockey_test.go @@ -73,7 +73,7 @@ func TestQuerySimpleWithCidAndDocKey(t *testing.T) { Description: "Simple query with cid and dockey", Request: `query { users ( - cid: "bafybeicm4rzm2ep7turu26t5oynzt3s44zsxwwofzgsljooctuxd2gi3ke", + cid: "bafybeihmtkwi4ff2e5deo4xycxbbnqthlahuzgd5d72ggtytct2ibrndau", dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" ) { Name @@ -102,7 +102,7 @@ func TestQuerySimpleWithUpdateAndFirstCidAndDocKey(t *testing.T) { Description: "Simple query with (first) cid and dockey", Request: `query { users ( - cid: "bafybeicm4rzm2ep7turu26t5oynzt3s44zsxwwofzgsljooctuxd2gi3ke", + cid: "bafybeihmtkwi4ff2e5deo4xycxbbnqthlahuzgd5d72ggtytct2ibrndau", dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" ) { Name @@ -143,7 +143,7 @@ func TestQuerySimpleWithUpdateAndLastCidAndDocKey(t *testing.T) { Description: "Simple query with (last) cid and dockey", Request: `query { users ( - cid: "bafybeihwmsezmrjilghh7htzwanblldfcircgvigeb7vr24oylckk4oeh4", + cid: "bafybeig5v3krjz2gujjins4p5xhmj72b4o4ijejvzzxgkzkle7gi6ue3ya", dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" ) { Name @@ -184,7 +184,7 @@ func TestQuerySimpleWithUpdateAndMiddleCidAndDocKey(t *testing.T) { Description: "Simple query with (middle) cid and dockey", Request: `query { users ( - cid: "bafybeigass6axw56yh4gojiunlfm7ea3zqi3gwhksl2jp5rair6kaq3amm", + cid: "bafybeiaouhizdrm3go4mprtnnxpkyrj2audqyilhabx35mpogor6zp2uf4", dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" ) { Name diff --git a/tests/integration/query/simple/with_version_test.go b/tests/integration/query/simple/with_version_test.go index 0e15401e2f..9b70f7e09d 100644 --- a/tests/integration/query/simple/with_version_test.go +++ b/tests/integration/query/simple/with_version_test.go @@ -46,14 +46,14 @@ func TestQuerySimpleWithEmbeddedLatestCommit(t *testing.T) { "Age": uint64(21), "_version": []map[string]any{ { - "cid": "bafybeicm4rzm2ep7turu26t5oynzt3s44zsxwwofzgsljooctuxd2gi3ke", + "cid": "bafybeihmtkwi4ff2e5deo4xycxbbnqthlahuzgd5d72ggtytct2ibrndau", "links": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeihaytnuf3mzzgpwea54dyr5dstppeh7myrq4rt34c7vc72wwgj5j4", "name": "Age", }, { - "cid": "bafybeicabeba6ve745cusbcgo72ugwvnzflgwg7lij642jv6tgis4u2gni", + "cid": "bafybeibfnvmb5n7tmaalib5khp2fhay4lp3n2yb7beiq2l6s556ezmyzfq", "name": "Name", }, }, @@ -99,14 +99,14 @@ func TestQuerySimpleWithMultipleAliasedEmbeddedLatestCommit(t *testing.T) { "Age": uint64(21), "_version": []map[string]any{ { - "cid": "bafybeicm4rzm2ep7turu26t5oynzt3s44zsxwwofzgsljooctuxd2gi3ke", + "cid": "bafybeihmtkwi4ff2e5deo4xycxbbnqthlahuzgd5d72ggtytct2ibrndau", "L1": []map[string]any{ { - "cid": "bafybeidst2mzxhdoh4ayjdjoh4vibo7vwnuoxk3xgyk5mzmep55jklni2a", + "cid": "bafybeihaytnuf3mzzgpwea54dyr5dstppeh7myrq4rt34c7vc72wwgj5j4", "name": "Age", }, { - "cid": "bafybeicabeba6ve745cusbcgo72ugwvnzflgwg7lij642jv6tgis4u2gni", + "cid": "bafybeibfnvmb5n7tmaalib5khp2fhay4lp3n2yb7beiq2l6s556ezmyzfq", "name": "Name", }, },