hygraph / management-sdk Goto Github PK
View Code? Open in Web Editor NEWGraphCMS Management SDK
License: MIT License
GraphCMS Management SDK
License: MIT License
Hi,
I've noticed that when updating a UnionField to include new models, the existing settings for this union aren't added to the new models.
For example when adding a new model to the union, the apiOnly state is not applied to the new model, but continues to exist on the older models.
As you can see, the visibility on the New one does not include the API Only from the existing one.
client.updateUnionField({
apiId: 'target',
displayName: 'Placement target',
modelApiId: 'DynamicRow',
reverseField: {
modelApiIds: [
<VARIOUS MODELS>,
],
// Here should be an option for visibility, as is done in client.createUnionField.
// This would set the visibility for the reverse fields.
},
visibility: VisibilityTypes.ReadWrite, // This sets the visibitlity for the DynamicRow model.
})
Right now I am trying to update my union field, adding visibility: hidden
for the reverse fields. This is not possible with the current management SDK. Although it is supported in createUnionField()
, I can't delete my model because I would lose all my entries.
Also displayName should be supported for reverseField in updateUnionField()
.
When I use the management SDK to set a field position it doesn't work, it does however place the field at the top of the UI.
It may be better to take an apiId instead of a number value or alternatively take an apiId so I can say e.g "Place this field after X field"
...addSimpleField({
positionAfter: 'example' // String
})
Hi,
I can't run any migrations anymore in my account, when I try while i'm logged in, I get this error message:
missing permission for action: SIDEBAR_ELEMENT_CREATE
I have all management API permissions checked.
Same migration worked fine a couple of weeks ago.
Hi,
I've noticed that updating a validation on field using updateSimpleField
doesn't work. When I try to do that I'm getting an error:
Error: field validations not supported for undefined at extractFieldValidations
From what I was able to find it was happen because updateSimpleField
use extractFieldValidations
which require a type
to work:
But the typescript type definition for the updated model does not allow us to pass it. (This is understandable, we can't pass the type because we can't update it.) :
Temporary workaround is to pass a type in updateSimpleField
and disable warning from typescript. The type must be the same as the field already exists in:
Using the same GH action as the Gatsby source plugin, we should release this package automatically.
Before this is done we need to tag the current version, AND decide how we proceed with schema changes. Are they major or minor releases.
This might come from the latest changes that added the visibility setting.
Up until recently (2 weeks ago it was still ok), the code below was perfectly valid:
schedule.addRelationalField({
apiId: 'zoomedInImage',
displayName: 'Zoomed In Image',
model: 'Asset',
relationType: RelationType.ManyToOne,
reverseField: {
apiId: 'relatedScheduleZoomedInImage',
displayName: 'related Schedule Zoomed In Image',
},
});
However, this now stopped passing TypeScript validation as the field 'isHidden' is missing.
The error states as such:
Argument of type '{ apiId: string; displayName: string; model: string; relationType: RelationType.ManyToOne; reverseField: { apiId: string; displayName: string; }; }' is not assignable to parameter of type 'Omit<PartialBy<RelationalFieldArgs, "reverseField" | "type">, "modelApiId">'.
Property 'isHidden' is missing in type '{ apiId: string; displayName: string; model: string; relationType: RelationType.ManyToOne; reverseField: { apiId: string; displayName: string; }; }' but required in type 'Omit<PartialBy<RelationalFieldArgs, "reverseField" | "type">, "modelApiId">'.ts(2345)
model.d.ts(14, 5): 'isHidden' is declared here.
Even though isHidden is deprecated, it is now compulsory to add it using TypeScript and the SDK.
Adding visibility and not adding isHidden is also not an option for TypeScript.
Hey there, I'm looking to migrate a project to graphcms / hygraph and need to generate my types through the sdk. Everything seems possible except for the components. The schema types seemed to already exist in the generated file, is this possible to add?
I have a model with a simple field I created. In the next migration I wanted to make this field required, however the update was being rejected, even though I was passing a migration value.
When testing I noticed that I had to delete every entry and then I could update the field to be required.
In the UI this isn't an issue as it asks for a migration value. I assume there is some sort of ordering of mutations issue meaning that the migration is rejected?
e.g
model.addSimpleField({
apiId: 'label',
displayName: 'Label',
type: FieldType.String,
isLocalized: true
});
on next run when content has been added (this fails)
model.updateSimpleField({
apiId: 'label',
migrationValue: 'test',
isRequired: true
});
I noticed that from the management sdk it is not possible or at least not documented on how to treat a slug type so that it generates the slug based on other field. e.g: generate slug based on post id or name
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.