Apollo GraphQL Deprecation Warnings - node.js

I am getting lots of deprecation warnings. I am not sure why I am getting it. Could anyone please guide me out.
I have created a boilerplate for apollo graph ql with koa node js frameworks. I am planning to use a graph ql subscription in my next project. However, these warnings or errors making me confused. this is my git https://github.com/sumitbhavra/graphql-koa.git
{
"name": "include",
"description": "Directs the executor to include this field or fragment only when the `if` argument is true.",
"locations": [
"FIELD",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT"
],
"args": [
{
"name": "if",
"description": "Included when true.",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"defaultValue": null
}
]
},
{
"name": "deprecated",
"description": "Marks an element of a GraphQL schema as no longer supported.",
"locations": [
"FIELD_DEFINITION",
"ENUM_VALUE"
],
"args": [
{
"name": "reason",
"description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": "\"No longer supported\""
}
]
}

That is not a deprecation warning. That is an introspection result that includes information about the #deprecated directive, which can be used inside your type definitions to mark individual fields or enum values as deprecated.

Related

Not able to populate all data by Meilisearch pluging using populateEntryRule in my strapi project

I am trying to integrate meilisearch functionality in my Strapi Project. While integrating and testing meilisearch I found that the plugin is failing to fetch all the data, especially when the data is located inside a nested array. The plugin successfully fetches the data from the first level of nested array, rest of the datas are not being fetched by meilisearch plugin. I have tried using the populateEntryRule on plugin.js file which I found from the meilisearch documentation but it's not giving the intended result. When I fire an API call to that particular collection type through Strapi(not through meilisearch) am getting all the data correctly.
Here is my particular schema that I am working with:
{
"kind": "collectionType",
"collectionName": "investors",
"info": {
"singularName": "investor",
"pluralName": "investors",
"displayName": "Investor",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"title": {
"type": "string"
},
"slug": {
"type": "uid",
"targetField": "title"
},
"metaData": {
"type": "component",
"repeatable": false,
"component": "seo.meta-fields"
},
"pageSections": {
"type": "dynamiczone",
"components": [
"sections.hero",
"sections.certification-section",
"sections.community-section",
"sections.content-section",
"sections.home-page-section-2",
"sections.lm-business-modal-section",
"sections.lm-evolving-section",
"sections.lm-leardership-section",
"sections.milestone-section",
"sections.mission-section",
"sections.our-business-section",
"sections.product-hero-section",
"sections.statistics-section",
"sections.team-section",
"sections.value-section",
"sections.vision-section",
"sections.webcast-section",
"sections.chart-section",
"sections.key-financials",
"sections.fixed-deposit",
"sections.financial-performance"
]
},
"Accordion": {
"type": "dynamiczone",
"components": [
"elements.no-dropdown",
"elements.dropdown"
]
}
}
}
My custom meilisearch plugin functionality for populating the required fields in plugin.js file.
module.exports = {
meilisearch: {
config: {
investor: {
populateEntryRule:['dynamiczone.pageSections', 'pageSections']
}
}
}
}
For better understanding am attaching a SS of Strapi API call to an investor's collection type naming Financial Performance.
SS of Meilisearch result for the same.
Any help in resolving this would be highly appreciable

AWS CDK Api Gateway Models Ref Dependency - Model reference must be in canonical form

I am trying to add multiple models in the same time using aws CDK when one of the models is referencing the other one.
Ex:
"Gender": {
"contentType": "application/json",
"modelName": "GenderModel",
"schema": {
"type": "string",
"enum": [
"Not Specified",
"Male",
"Female",
"Non-Binary"
],
"schema": "http://json-schema.org/draft-04/schema#",
"title": "GenderModel"
}
},
and
"Requirements": {
"contentType": "application/json",
"modelName": "RequirementsModel",
"schema": {
"type": "object",
"properties": {
"gender": {
"ref": "https://apigateway.amazonaws.com/restapis/${Token[TOKEN.791]}/models/GenderModel"
}
},
"required": [
"gender",
],
"additionalProperties": false,
"schema": "http://json-schema.org/draft-04/schema#",
"title": "RequirementsModel"
}
},
When i deploy this fails with
Model reference must be in canonical form
From what i can see this fails because the GenderModel does not exists. If i first add the GenderModel in the stack and then i add the RequirementsModel and deploy again it works just fine because the GenderModel was previously created. If i want to create both of the models in the same time it will fail.
I tried to make sure the order of addModel call is correct but it seems it does not work.
Solution Found
Seems like you have to add explicitly specify the dependency.
modelB.node.addDependency(modelA)
This will avoid the error and add the models in the correct order
The problem is https://apigateway.amazonaws.com/restapis/${Token[TOKEN.791]}/models/GenderModel, specifically the ${Token[TOKEN.791]} part. When the API is not created, at CloudFormation synthetisation time, id is not known and placeholder value used - https://docs.aws.amazon.com/cdk/latest/guide/tokens.html
You can use the Ref intristic function to compose model by the reference
const getModelRef = (api: RestApi, model: Model): string =>
Fn.join(
'',
['https://apigateway.amazonaws.com/restapis/',
api.restApiId,
'/models/',
model.modelId]);

Amexon alexa development InvalidIntentSamplePhraseSlot issue

I'm getting an error: cannot include both a phrase slot and another intent slot. Error code: InvalidIntentSamplePhraseSlot while building Alexa skill.
Sample JSON is as follows,
{
"name": "HackathonListIntent",
"slots": [
{
"name": "resultCount",
"type": "AMAZON.NUMBER"
},
{
"name": "search1",
"type": "AMAZON.SearchQuery"
},
{
"name": "search2",
"type": "AMAZON.SearchQuery"
}
],
"samples": [
"{resultCount} for {search1} from {search2}",
]}
resultCount: skill fetch thousands of result from backend this parameter will restrict result length as per users convenience.
search1 and search2 are different independent search parameter which user may ask.
FYI: I have tried this
For the InvalidIntentSamplePhraseSlot issue, according to Amazon's documentation, you can only use one AMAZON.SearchQuery slot per intent.
"Make sure that your skill uses no more than one AMAZON.SearchQuery slot per intent."
https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#amazonsearchquery
Also, for your sample entry make sure the array with one item does not include a comma. It will cause an Invalid JSON error.
"samples": [
"{resultCount} for {search1} from {search2}"
]}
AMAZON.SearchQuery are limited to 1 slot per intent and also it will need a phrase along with the slot. I would suggest you to use AMAZON.Person as it can take any value and dose not need a phrase.
{
"name": "HackathonListIntent",
"slots": [
{
"name": "resultCount",
"type": "AMAZON.NUMBER"
},
{
"name": "search2",
"type": "AMAZON.Person"
},
{
"name": "search2",
"type": "AMAZON.Person"
}
],
"samples": [
"{resultCount} for {search1} from {search2}"
]
}

ARM When using reference() in an copy iterator, arm template parser seems to break

I have written a ARM template that dynamically builds out the app settings based on a JSON object parameter. This allows for adding any app setting without having to modify the template:
parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"app_settings": {
"value": {
"keyvalue_pairs": [
{
"name": "appsetting1",
"value": "value"
},
{
"name": "ApplicationInsights:InstrumentationKey",
"value": ""
}
]
}
}
}
}
chopped down working template.json file
"resources": [
{
"comments": "",
"type": "microsoft.insights/components",
"kind": "web",
"name": "[variables('app_service_name')]",
"apiVersion": "2014-04-01",
"location": "[resourceGroup().location]",
"tags": {
"[variables('hiddenlink_app_service')]": "Resource"
},
"scale": null,
"properties": {
"ApplicationId": "[variables('app_service_name')]"
}
},
{
"apiVersion": "2015-08-01",
"name": "[concat(variables('app_service_name'),'/stage-slot')]",
"type": "Microsoft.Web/sites/slots",
"tags": {
"displayName": "stage-slot"
},
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('app_service_name'))]"
],
"properties": {
"clientAffinityEnabled": false,
"siteConfig": {
"copy": [
{
"name": "appSettings",
"count": "[length(parameters('app_settings').keyvalue_pairs)]",
"input": {
"name": "[parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].name]",
"value": "[parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].value]"
}
}
]
}
}
}
I now try and conditionally reference the app insights instrumentation key on my app settings hoping to override the app insights instrumentationkey from the resource.
"siteConfig": {
"copy": [
{
"name": "appSettings",
"count": "[length(parameters('app_settings').keyvalue_pairs)]",
"input": {
"name": "[parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].name]",
"value": "[if(equals(parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].name,'ApplicationInsights:InstrumentationKey'),reference(variables('appInsightsResource')).InstrumentationKey,parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].value)]"
}
}
]
}
This started throwing errors saying the if statement needs a boolean first parameter, but I didnt see anything wrong with it so I tried the following snippet and it worked so it leads me to believe that the use of the "reference()" inside a conditional isnt valid:
"siteConfig": {
"copy": [
{
"name": "appSettings",
"count": "[length(parameters('app_settings').keyvalue_pairs)]",
"input": {
"name": "[parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].name]",
"value": "[if(equals(parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].name,'ApplicationInsights:InstrumentationKey'),'testvalue',parameters('app_settings').keyvalue_pairs[copyIndex('appSettings')].value)]"
}
}
]
}
Additionally if I remove the whole "if()" and explicitly put "reference(variables('appInsightsResource')).InstrumentationKey" into the value, it outputs the right value so I know that this reference() call works but seems to break down when added inside an "if()" conditional statement.
The question is, is there any way to get this to work? I am trying to dynamically set the Instrumentation key while keeping in tact the ability to pass in a JSON object for my app settings
I'm seeing extremely confusing results with copy properties construct in general. most of the times is blows up with absolutely cryptic errors.
You won’t be able to use the reference() function in the count property – the copy loop is expanded at compile time – reference is evaluated at run-time. also, today I cant reproduce my working example, but i had a working example of reference function working in a copy properties, without if() though. You might want to create a bare minimum example showing how this doesnt work (so only 1 resource ideally). If that doesnt work you might want to raise an issue on github and\or azure feedback
You might be able to work around this by using nested deployments. but generally using properties copy in a clever way is a bit of a pain, due to compile\runtime issues.

How to expand the output of List resources API in AzureRM

According to this answer I try to list resources using this API ,
https://management.azure.com/subscriptions/{subscriptionId}/resources?$filter=resourceType eq 'Microsoft.Compute/virtualmachines'&$top=10&api-version={apiVersion}
It gives me output like his
{
"value": [
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vm}",
"name": "{vm}",
"type": "Microsoft.Compute/virtualMachines",
"location": "{location}"
},
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vm}",
"name": "{vm}",
"type": "Microsoft.Compute/virtualMachines",
"location": "{location}"
}
]}
I need an expanded Output of each {value} in this call, How to add filter to expand the values ?
can someone throw some spark on this ?

Resources