Skip to content

Commit

Permalink
feat(api-graphql): observeQuery (#12397)
Browse files Browse the repository at this point in the history
* checkpoint

* checkpoint; paged queried observequery tests passing

* checkpoint

* checkpoint

* checkpoint; wip, but no longer death spiraling

* pretty much working; still adding tests

* add missing nextToken from list selection set

* add missing nextToken arg in list op params, vars

* clarified cleanup comment

* clarified search function comment

* established pattern for testing delayed initial observeQuery list result

* added cases for onUpdate, onDeletes that arrive prior to sync completion

* lite refactor for util functions in observequery

* fix missing license headers

* refactor: cleanup cruft, more clear message receiver function
  • Loading branch information
svidgen committed Oct 24, 2023
1 parent 9493d4d commit 01b2bb8
Show file tree
Hide file tree
Showing 9 changed files with 940 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,67 @@ const amplifyConfig = {
sortKeyFieldNames: [],
},
},
ThingWithCustomPk: {
name: 'ThingWithCustomPk',
fields: {
cpk_cluster_key: {
name: 'cpk_cluster_key',
isArray: false,
type: 'String',
isRequired: true,
attributes: [],
},
cpk_sort_key: {
name: 'cpk_sort_key',
isArray: false,
type: 'String',
isRequired: true,
attributes: [],
},
otherField: {
name: 'otherField',
isArray: false,
type: 'String',
isRequired: false,
attributes: [],
},
createdAt: {
name: 'createdAt',
isArray: false,
type: 'AWSDateTime',
isRequired: false,
attributes: [],
isReadOnly: true,
},
updatedAt: {
name: 'updatedAt',
isArray: false,
type: 'AWSDateTime',
isRequired: false,
attributes: [],
isReadOnly: true,
},
},
syncable: true,
pluralName: 'ThingWithCustomPks',
attributes: [
{
type: 'model',
properties: {},
},
{
type: 'key',
properties: {
fields: ['cpk_cluster_key', 'cpk_sort_key'],
},
},
],
primaryKeyInfo: {
isCustomPrimaryKey: true,
primaryKeyFieldName: 'cpk_cluster_key',
sortKeyFieldNames: ['cpk_sort_key'],
},
},
},
enums: {},
nonModels: {},
Expand Down
7 changes: 7 additions & 0 deletions packages/api-graphql/__tests__/fixtures/modeled/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ const schema = a.schema({
id: a.id(),
description: a.string(),
}),
ThingWithCustomPk: a
.model({
cpk_cluster_key: a.string().required(),
cpk_sort_key: a.string().required(),
otherField: a.string(),
})
.identifier(['cpk_cluster_key', 'cpk_sort_key']),
});

export type Schema = ClientSchema<typeof schema>;
Loading

0 comments on commit 01b2bb8

Please sign in to comment.