In NeoVim/Coc, where to put prettier.arrowParens in coc-settings.json? - prettier

I have a global installation of prettier (yarn classic) and I have a coc-settings.json like below for NeoVim. I 've copied the entire content here, because someone's gonna ask eventually anyway, if can copy the whole thing here.
At the end there's the entry "prettier.arrowParens": "always" which isn't recognized by Prettier.
Is it located in the wrong section?
"html.filetypes": ["hbs", "handlebars", "html"],
"eslint.packageManager": "yarn",
"eslint.alwaysShowStatus": true,
"eslint.validate": ["svelte"],
"eslint.options": {
"overrideConfig": {
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"node": true
},
"plugins": ["import", "svelte3"],
"extends": ["eslint:recommended", "plugin:import/recommended"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"overrides": [
{
"files": ["*.svelte"],
"processor": "svelte3/svelte3"
}
],
"rules": {
"svelte3/no-invalid-interp": "error",
"svelte3/no-unknown-binding": "error",
"svelte3/no-unknown-export": "error",
"svelte3/no-unknown-import": "error",
"svelte3/no-unused-components": "error",
"svelte3/no-unused-css": "error",
"svelte3/no-unused-globals": "error",
"svelte3/no-unused-mixins": "error",
"svelte3/no-unused-store-definitions": "error",
"no-unused-vars": [
"error",
{ "vars": "all", "args": "after-used", "ignoreRestSiblings": false }
],
"svelte3/no-void-component": "error",
"svelte3/no-void-elements": "error",
"svelte3/no-void-import": "error",
"svelte3/no-void-return": "error",
"svelte3/no-void-tag": "error",
"svelte3/no-void-template": "error",
"svelte3/no-void-text": "error",
"svelte3/no-void-text-content": "error",
"svelte3/no-void-text-content-single": "error",
"svelte3/no-void-text-content-single-line": "error",
"svelte3/no-void-text-content-single-line-no-space": "error"
}
}
},
"solargraph.useBundler": false,
"solargraph.commandPath": "~/.rbenv/shims/solargraph",
"solargraph.bundlerPath": "~/.rbenv/shims/bundle",
"solargraph.formatting": true,
"solargraph.diagnostics": true,
"solargraph.checkGemVersion": true,
"svelte.enable-ts-plugin": true,
"prettier.onlyUseLocalVersion": false,
"prettier.singleQuote": true,
"prettier.arrowParens": "always"
}

Related

AWS EventBridge Rule pattern "anything-but" with "prefix"

I'm trying to setup an AWS EventBridge rule that will filter all Okta user events with rawUserAgent as "anything-but" with the "prefix" libwww-perl. My question is that is there a way to chain AWS rule syntax on the same field in the event? I tried something like this, but it didn't work -
{
"detail": {
"eventType": [{
"prefix": "user.session.start"
}],
"outcome": {
"result": [{
"prefix": "FAILURE"
}]
},
"client": {
"userAgent": {
"rawUserAgent": [{
"anything-but": [{"prefix": "libwww-perl"}]
}]
}
}
}
}
Any suggestions on how I can achieve this?
Here's a sample event:
{
"version": "0",
"id": "123",
"detail-type": "SystemLog",
"source": "okta",
"account": "123",
"time": "2022-06-24T13:07:02Z",
"region": "us-east-1",
"resources": [],
"detail": {
"uuid": "123",
"published": "2022-06-24T13:07:02.586Z",
"eventType": "user.session.start",
"version": "0",
"displayMessage": "User login to Okta",
"severity": "INFO",
"client": {
"userAgent": {
"rawUserAgent": "libwww-perl/6.15",
"os": "Unknown",
"browser": "UNKNOWN"
},
"zone": "null",
"device": "Unknown",
"id": null,
"ipAddress": "192.168.1.1",
"geographicalContext": {
"city": null,
"state": null,
"country": "United States",
"postalCode": null,
"geolocation": {
"lat": 37.751,
"lon": -97.822
}
},
"ipChain": [
{
"ip": "192.168.1.1.",
"geographicalContext": {
"city": null,
"state": null
"country": "Canada",
"postalCode": null,
"geolocation": {
"lat": 37.751,
"lon": -97.822
}
},
"version": "V4",
"source": null
}
]
},
"device": null,
"actor": {
"id": "unknown",
"type": "User",
"alternateId": "abc#gmail.com",
"displayName": "unknown",
"detailEntry": null
},
"outcome": {
"result": "FAILURE",
"reason": "VERIFICATION_ERROR"
},
"target": null,
"transaction": {
"type": "WEB",
"id": "YrW29nCfOE-MgiNf6-1UkQAAA8I",
"detail": {}
},
"debugContext": {
"debugData": {
"loginResult": "VERIFICATION_ERROR",
"requestId": "abcd",
"threatSuspected": "true",
"requestUri": "",
"url": ""
}
},
"legacyEventType": "core.user_auth.login_failed",
"authenticationContext": {
"authenticationProvider": null,
"credentialProvider": null,
"credentialType": null,
"issuer": null,
"authenticationStep": 0,
"externalSessionId": "unknown",
"interface": null
},
"securityContext": {
"asNumber": 11174,
"asOrg": "qwerty",
"isp": "qwerty",
"domain": "qwerty.com",
"isProxy": false
},
"insertionTimestamp": null
}
}
You can use this pattern:
{
"detail": {
"eventType": [{
"prefix": "user.session.start"
}],
"client": {
"userAgent": {
"rawUserAgent": [{
"anything-but": {
"prefix": "libwww-perl"
}
}]
}
},
"outcome": {
"result": [{
"prefix": "FAILURE"
}]
}
}
}

Getting Django to log errors to a file and everything else to the console

Given the following logging config:
settings.py
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"filters": {
"require_debug_false": {"()": "django.utils.log.RequireDebugFalse",},
"require_debug_true": {"()": "django.utils.log.RequireDebugTrue",},
},
"formatters": {
"django.server": {
"()": "django.utils.log.ServerFormatter",
"format": "[{server_time}] {message}",
"style": "{",
}
},
"handlers": {
"console": {"level": "INFO", "filters": ["require_debug_true"], "class": "logging.StreamHandler",},
"file": {
"level": "ERROR",
"filters": ["require_debug_false"],
"class": "logging.FileHandler",
"filename": BASE_DIR / "debug.log",
},
"django.server": {"level": "INFO", "class": "logging.StreamHandler", "formatter": "django.server",},
"mail_admins": {
"level": "ERROR",
"filters": ["require_debug_false"],
"class": "django.utils.log.AdminEmailHandler",
},
},
"loggers": {
"django": {"handlers": ["file", "console"], "level": "INFO",},
"django.server": {"handlers": ["django.server"], "level": "INFO", "propagate": False,},
},
}
Present Output
Console logs information- and warning-level alerts to the console
Log file debug.log is created
Compilation errors are not printed to the log file in production
What about this config does not allow errors to be sent to the log file?

SSRS Subscription using REST API

Can we create/modify SSRS Subscription using REST API as SQL Server Reporting services 2017 supports REST API calls?
here is an online swagger example they built, but some properties are invalid or missing. Ex: Schedule property is missing and ExtensionSettings.ParameterValues is an array instead of an object
https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0#/Subscriptions/GetSubscriptions
here is an example of a body message that works for me when posting:
{ "DataQuery": null, "DeliveryExtension": "Report Server Email", "Description": "test3", "EventType": "TimedSubscription", "ExtensionSettings": { "Extension": "Report Server Email", "ParameterValues": [ { "IsValueFieldReference": false, "Name": "TO", "Value": "userName" }, { "IsValueFieldReference": false, "Name": "IncludeReport", "Value": "True" }, { "IsValueFieldReference": false, "Name": "RenderFormat", "Value": "PDF" }, { "IsValueFieldReference": false, "Name": "Subject", "Value": "#ReportName was executed at #ExecutionTime" }, { "IsValueFieldReference": false, "Name": "IncludeLink", "Value": "True" }, { "IsValueFieldReference": false, "Name": "Priority", "Value": "NORMAL" } ] }, "IsActive": true, "IsDataDriven": false, "LastRunTime": null, "LastStatus": "New Subscription", "LocalizedDeliveryExtensionName": "E-Mail", "ModifiedBy": "userName", "ModifiedDate": "2020-09-04T13:45:51.343-05:00", "Owner": "userName", "ParameterValues": [], "Report": "/Folder Name/Report Name", "Schedule": { "Definition": { "EndDate": "0001-01-01T00:00:00Z", "EndDateSpecified": false, "Recurrence": { "DailyRecurrence": { "DaysInterval": 1 }, "MinuteRecurrence": null, "MonthlyDOWRecurrence": null, "MonthlyRecurrence": null, "WeeklyRecurrence": null }, "StartDateTime": "2020-09-04T02:00:00-05:00" }, "ScheduleID": null }, "ScheduleDescription": "At 2:00 AM every day, starting 9/4/2020" }

the (find, findbyid, create) method has not been setup loopback

I'm trying to setup loopback and so far I've created a db connection to mysql, a model, and am now using the api explorer to test it but I keep getting this error on any call:
"The find method has not been setup loopback. The PersistedModel has not been correctly attached to a DataSource!
Here is the complete response:
{
"error": {
"name": "Error",
"status": 500,
"message": "Cannot call EaAssets.find(). The find method has not been setup. The PersistedModel has not been correctly attached to a DataSource!",
"stack": "Error: Cannot call EaAssets.find(). The find method has not been setup. The PersistedModel has not been correctly attached to a DataSource!\n at throwNotAttached (C:\\cmdb\\node_modules\\loopback\\lib\\persisted-model.js:62:11)\n at Function.find (C:\\cmdb\\node_modules\\loopback\\lib\\persisted-model.js:210:5)\n at SharedMethod.invoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\shared-method.js:252:25)\n at HttpContext.invoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\http-context.js:384:12)\n at phaseInvoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\remote-objects.js:645:9)\n at runHandler (C:\\cmdb\\node_modules\\loopback-phase\\lib\\phase.js:135:5)\n at iterate (C:\\cmdb\\node_modules\\async\\lib\\async.js:146:13)\n at Object.async.eachSeries (C:\\cmdb\\node_modules\\async\\lib\\async.js:162:9)\n at runHandlers (C:\\cmdb\\node_modules\\loopback-phase\\lib\\phase.js:144:13)\n at iterate (C:\\cmdb\\node_modules\\async\\lib\\async.js:146:13)"
}
}
here is my model-config.json
{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../common/mixins",
"./mixins"
]
},
"User": {
"dataSource": "db"
},
"AccessToken": {
"dataSource": "db",
"public": false
},
"ACL": {
"dataSource": "db",
"public": false
},
"RoleMapping": {
"dataSource": "db",
"public": false
},
"Role": {
"dataSource": "db",
"public": false
},
"EaApplication": {
"dataSource": "db",
"public": true
},
"EaAssetCapabilityRelation": {
"dataSource": "db",
"public": true
},
"EaAssetTyp": {
"dataSource": "db",
"public": true
},
"EaAssetStatus": {
"dataSource": "db",
"public": true
},
"EaAssetLocation": {
"dataSource": "db",
"public": true
},
"EaAssetRelation": {
"dataSource": "db",
"public": true
},
"EaAssets": {
"dataSource": null,
"public": true,
"$promise": {},
"$resolved": true
},
"EaCapability": {
"dataSource": "db",
"public": true
},
"EaRelationType": {
"dataSource": "db",
"public": true
},
"EaServers": {
"dataSource": "db",
"public": true
},
"EaServices": {
"dataSource": null,
"public": true,
"$promise": {},
"$resolved": true
},
"EaBuildTyp": {
"dataSource": "db",
"public": true
}
}
Your EaAssets model has a datasource of null so the built-in remote methods are not getting attached

Strongloop PostgreSQL connector embedded model error

Got a simple Loopback API to retrieve tickets and responses using the postgreSQL connector. Tickets and responses come back fine individually but when I try to embed the responses into the ticket model I get the error below. I have tried following the documentation and I'm sure it's something simple in one of my relations that I'm missing but whatever I try, I cannot get it to work.
Any help would be appreciated.
https://docs.strongloop.com/display/public/LB/Embedded+models+and+relations#Embeddedmodelsandrelations-EmbedsMany
Ticket Model:
{
"name": "Ticket",
"base": "PersistedModel",
"idInjection": true,
"options": {
"postgresql": {
"schema": "customer_service",
"table": "tbl_ticket"
}
},
"properties": {
"description": {
"type": "String",
"required": true,
"length": null,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "description",
"dataType": "text",
"dataLength": null,
"dataPrecision": null,
"dataScale": null,
"nullable": "NO"
}
},
"id": {
"type": "Number",
"id": 1,
"required": true,
"length": null,
"precision": 32,
"scale": 0,
"postgresql": {
"columnName": "id",
"dataType": "integer",
"dataLength": null,
"dataPrecision": 32,
"dataScale": 0,
"nullable": "NO"
}
}
},
"validations": [],
"relations": {
"responses": {
"type": "embedsMany",
"model": "Response",
"property": "embededResponses",
"options": {
"validate": true,
"forceId": false
}
}
},
"acls": [],
"methods": {}
}
Response Model:
{
"name": "Response",
"base": "PersistedModel",
"idInjection": true,
"options": {
"postgresql": {
"schema": "customer_service",
"table": "tbl_response"
}
},
"properties": {
"notes": {
"type": "String",
"required": false,
"length": null,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "notes",
"dataType": "text",
"dataLength": null,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"ticketId": {
"type": "Number",
"required": true,
"length": null,
"precision": 32,
"scale": 0,
"postgresql": {
"columnName": "ticket_id",
"dataType": "integer",
"dataLength": null,
"dataPrecision": 32,
"dataScale": 0,
"nullable": "NO"
}
},
"id": {
"type": "Number",
"id": 1,
"required": true,
"length": null,
"precision": 32,
"scale": 0,
"postgresql": {
"columnName": "id",
"dataType": "integer",
"dataLength": null,
"dataPrecision": 32,
"dataScale": 0,
"nullable": "NO"
}
}
},
"validations": [],
"relations": {
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketId"
}
},
"acls": [],
"methods": {}
}
Error:
{
"error": {
"name": "error",
"status": 500,
"message": "column \"embededresponses\" does not exist",
"length": 126,
"severity": "ERROR",
"code": "42703",
"position": "213",
"file": ".\\src\\backend\\parser\\parse_expr.c",
"line": "766",
"routine": "transformColumnRef",
"stack": "error: column \"embededresponses\" does not exist\n at Connection.parseE (C:\\WebApp\\node_modules\\loopback-connector-postgresql\\node_modules\\pg\\lib\\connection.js:539:11)\n at Connection.parseMessage (C:\\WebApp\\node_modules\\loopback-connector-postgresql\\node_modules\\pg\\lib\\connection.js:366:17)\n at Socket.<anonymous> (C:\\WebApp\\node_modules\\loopback-connector-postgresql\\node_modules\\pg\\lib\\connection.js:105:22)\n at Socket.emit (events.js:107:17)\n at readableAddChunk (_stream_readable.js:163:16)\n at Socket.Readable.push (_stream_readable.js:126:10)\n at TCP.onread (net.js:538:20)"
}
}
Your Ticket model should have the following relationship section:
"relations": {
"Responses": {
"type": "hasMany",
"model": "Response",
"foreignKey": "ticketId"
}
}
Your Response model relationship is correct.
It's not very clear from the docs that the embed relationships are for NoSQL databases. For traditional SQL databases, use the Has* relationship types.
To retrieve a Ticket with Responses from the REST API use the include filter: https://docs.strongloop.com/display/public/LB/Include+filter.
Example: localhost:3000/api/Tickets/{id}?filter[include]=responses
I am told that you can use embedded relations with SQL data sources, but the data is then stored in stringified-JSON format.
I've added a note to https://docs.strongloop.com/display/LB/Embedded+models+and+relations.
Rand