profile
viewpoint
Roman moltar @ScaleLeap Canada https://www.ScaleLeap.com Have been poking around the web since 1998. #typescript #vue

berekuk/Ubic 90

Polymorphic service manager.

moltar/cpan-proxy 2

CPAN Proxy

moltar/Catalyst-Plugin-MessageStack 1

A plugin to handle messaging following the Post/Redirect/Get pattern.

moltar/CatalystX-I18N 1

I18N Toolkit for the Catalyst MVC

moltar/act-google-search 0

Apify actor for extracting google search data.

moltar/adonis-graphql 0

GraphQL Provider for AdonisJs Framework

moltar/apollo-link-token-refresh 0

Apollo Link that performs access tokens (JWT) renew

moltar/apollo-module 0

Nuxt.js module to use Vue-Apollo

Pull request review commentScaleLeap/amazon-mws-api-sdk

feat: merchant-fulfillment

+// Jest Snapshot v1, https://goo.gl/fbAQLP++exports[`merchant-fulfillment cancelShipment should return shipment info if succesful 1`] = `+Array [+  Object {+    "Shipment": Object {+      "AmazonOrderId": "903-1713775-3598252",+      "CreatedDate": 2015-09-23T20:11:12.908Z,+      "Insurance": Object {+        "Amount": 10,+        "CurrencyCode": "USD",+      },+      "ItemList": Array [+        Object {+          "OrderItemId": "40525960574974",+          "Quantity": 1,+        },+      ],+      "Label": Object {+        "Dimensions": Object {+          "Length": 11,+          "Unit": "inches",+          "Width": 8.5,+        },+        "FileContents": Object {+          "Checksum": "DmsWbJpdMPALN3jV4wHOrg==",+          "Contents": "H4sIAAAAAAAAAK16WbeqyrLmO2Pc/zBVRLG...+...kI0Ycv76w378UfL6O6ev7UsAwmkWBfL6nycD/Bd+Zx3S8LwAA",+          "FileType": "application/pdf",+        },+      },+      "PackageDimensions": Object {+        "Height": 5,+        "Length": 5,+        "Unit": "inches",+        "Width": 5,+      },+      "ShipFromAddress": Object {+        "AddressLine1": "1234 Westlake Ave",+        "City": "Seattle",+        "CountryCode": "US",+        "Email": "",+        "Name": "John Doe",+        "Phone": "2061234567",+        "PostalCode": "98121",+        "StateOrProvinceCode": "WA",+      },+      "ShipToAddress": Object {+        "AddressLine1": "321 Main St",+        "City": "Seattle",+        "CountryCode": "US",+        "Email": "",+        "Name": "Jane Smith",+        "Phone": "",+        "PostalCode": "98121-2778",+        "StateOrProvinceCode": "WA",+      },+      "ShipmentId": "6f77095e-9f75-47eb-aaab-a42d5428fa1a",+      "ShippingService": Object {+        "CarrierName": "FEDEX",+        "EarliestEstimatedDeliveryDate": 2015-09-24T10:30:00.000Z,+        "LatestEstimatedDeliveryDate": 2015-09-24T10:30:00.000Z,+        "Rate": Object {+          "Amount": 27.81,+          "CurrencyCode": "USD",+        },+        "ShipDate": 2015-09-23T20:10:56.829Z,+        "ShippingServiceId": "FEDEX_PTP_PRIORITY_OVERNIGHT",+        "ShippingServiceName": "FedEx Priority Overnight®",

I see. Ok, they probably messed up the encoding in the docs :/

justinemmanuelmercado

comment created time in 12 hours

Pull request review commentScaleLeap/amazon-mws-api-sdk

feat: merchant-fulfillment

+// Jest Snapshot v1, https://goo.gl/fbAQLP++exports[`merchant-fulfillment cancelShipment should return shipment info if succesful 1`] = `+Array [+  Object {+    "Shipment": Object {+      "AmazonOrderId": "903-1713775-3598252",+      "CreatedDate": 2015-09-23T20:11:12.908Z,+      "Insurance": Object {+        "Amount": 10,+        "CurrencyCode": "USD",+      },+      "ItemList": Array [+        Object {+          "OrderItemId": "40525960574974",+          "Quantity": 1,+        },+      ],+      "Label": Object {+        "Dimensions": Object {+          "Length": 11,+          "Unit": "inches",+          "Width": 8.5,+        },+        "FileContents": Object {+          "Checksum": "DmsWbJpdMPALN3jV4wHOrg==",+          "Contents": "H4sIAAAAAAAAAK16WbeqyrLmO2Pc/zBVRLG...+...kI0Ycv76w378UfL6O6ev7UsAwmkWBfL6nycD/Bd+Zx3S8LwAA",+          "FileType": "application/pdf",+        },+      },+      "PackageDimensions": Object {+        "Height": 5,+        "Length": 5,+        "Unit": "inches",+        "Width": 5,+      },+      "ShipFromAddress": Object {+        "AddressLine1": "1234 Westlake Ave",+        "City": "Seattle",+        "CountryCode": "US",+        "Email": "",+        "Name": "John Doe",+        "Phone": "2061234567",+        "PostalCode": "98121",+        "StateOrProvinceCode": "WA",+      },+      "ShipToAddress": Object {+        "AddressLine1": "321 Main St",+        "City": "Seattle",+        "CountryCode": "US",+        "Email": "",+        "Name": "Jane Smith",+        "Phone": "",+        "PostalCode": "98121-2778",+        "StateOrProvinceCode": "WA",+      },+      "ShipmentId": "6f77095e-9f75-47eb-aaab-a42d5428fa1a",+      "ShippingService": Object {+        "CarrierName": "FEDEX",+        "EarliestEstimatedDeliveryDate": 2015-09-24T10:30:00.000Z,+        "LatestEstimatedDeliveryDate": 2015-09-24T10:30:00.000Z,+        "Rate": Object {+          "Amount": 27.81,+          "CurrencyCode": "USD",+        },+        "ShipDate": 2015-09-23T20:10:56.829Z,+        "ShippingServiceId": "FEDEX_PTP_PRIORITY_OVERNIGHT",+        "ShippingServiceName": "FedEx Priority Overnight®",

Seems like an UTF issue here. I saw the same in the original XML file too. Was the original XML file corrupt?

justinemmanuelmercado

comment created time in 13 hours

Pull request review commentScaleLeap/amazon-mws-api-sdk

feat: merchant-fulfillment

 Array [               },             },           ],-          "AdjustmentType": "String",

Why did we lose these props in a file unrelated to this PR?

justinemmanuelmercado

comment created time in 13 hours

Pull request review commentScaleLeap/amazon-mws-api-sdk

feat: merchant-fulfillment

+<CreateShipmentResponse xmlns="https://mws.amazonservices.com/MerchantFulfillment/2015-06-01">+  <CreateShipmentResult>+    <Shipment>+      <Insurance>+        <CurrencyCode>USD</CurrencyCode>+        <Amount>10.00</Amount>+      </Insurance>+      <ShipToAddress>+        <City>Seattle</City>+        <Phone/>+        <CountryCode>US</CountryCode>+        <PostalCode>98121-2778</PostalCode>+        <Name>Jane Smith</Name>+        <AddressLine1>321 Main St</AddressLine1>+        <StateOrProvinceCode>WA</StateOrProvinceCode>+        <Email/>+      </ShipToAddress>+      <AmazonOrderId>903-1713775-3598252</AmazonOrderId>+      <Weight>+        <Value>10</Value>+        <Unit>oz</Unit>+      </Weight>+      <Label>+        <CustomTextForLabel>ABC123</CustomTextForLabel>+        <LabelFormat>ZPL203</LabelFormat>+        <FileContents>+          <Checksum>DmsWbJpdMPALN3jV4wHOrg==</Checksum>+          <Contents>H4sIAAAAAAAAAK16WbeqyrLmO2Pc/zBVRLG...+                        ...kI0Ycv76w378UfL6O6ev7UsAwmkWBfL6nycD/Bd+Zx3S8LwAA</Contents>+          <FileType>application/zpl</FileType>+          <LabelFormat>ZPL203</LabelFormat>+        </FileContents>+        <Dimensions>+          <Width>8.50000</Width>+          <Length>11.00000</Length>+          <Unit>inches</Unit>+        </Dimensions>+        <StandardIdForLabel>AmazonOrderId</StandardIdForLabel>+      </Label>+      <ShippingService>+        <CarrierName>FEDEX</CarrierName>+        <ShippingServiceOptions>+          <CarrierWillPickUp>false</CarrierWillPickUp>+          <DeclaredValue>+            <CurrencyCode>USD</CurrencyCode>+            <Amount>10.00</Amount>+          </DeclaredValue>+          <DeliveryExperience>DeliveryConfirmationWithAdultSignature</DeliveryExperience>+        </ShippingServiceOptions>+        <ShippingServiceId>FEDEX_PTP_PRIORITY_OVERNIGHT </ShippingServiceId>+        <Rate>+          <CurrencyCode>USD</CurrencyCode>+          <Amount>27.81</Amount>+        </Rate>+        <LatestEstimatedDeliveryDate>2015-09-24T10:30:00Z </LatestEstimatedDeliveryDate>

Seem to be spaces here too.

justinemmanuelmercado

comment created time in 13 hours

Pull request review commentScaleLeap/amazon-mws-api-sdk

feat: merchant-fulfillment

 export const mwsBoolean = Codec.custom<boolean>({ })  export const mwsDate = Codec.custom<Date>({-  decode: (x) => string.decode(x).chain((aString) => date.decode(decodeURIComponent(aString))),+  decode: (x) =>+    string.decode(x).chain((aString) => {+      let toDecode = aString+      // Temp fix. Add UTC if no letter is found in string passed

Please prefix any fixes like this with TODO:. This way we can scan for them later and fix.

justinemmanuelmercado

comment created time in 13 hours

Pull request review commentScaleLeap/amazon-mws-api-sdk

feat: merchant-fulfillment

+<CreateShipmentResponse xmlns="https://mws.amazonservices.com/MerchantFulfillment/2015-06-01">+  <CreateShipmentResult>+    <Shipment>+      <Insurance>+        <CurrencyCode>USD</CurrencyCode>+        <Amount>10.00</Amount>+      </Insurance>+      <ShipToAddress>+        <City>Seattle</City>+        <Phone/>+        <CountryCode>US</CountryCode>+        <PostalCode>98121-2778</PostalCode>+        <Name>Jane Smith</Name>+        <AddressLine1>321 Main St</AddressLine1>+        <StateOrProvinceCode>WA</StateOrProvinceCode>+        <Email/>+      </ShipToAddress>+      <AmazonOrderId>903-1713775-3598252</AmazonOrderId>+      <Weight>+        <Value>10</Value>+        <Unit>oz</Unit>+      </Weight>+      <Label>+        <CustomTextForLabel>ABC123</CustomTextForLabel>+        <LabelFormat>ZPL203</LabelFormat>+        <FileContents>+          <Checksum>DmsWbJpdMPALN3jV4wHOrg==</Checksum>+          <Contents>H4sIAAAAAAAAAK16WbeqyrLmO2Pc/zBVRLG...+                        ...kI0Ycv76w378UfL6O6ev7UsAwmkWBfL6nycD/Bd+Zx3S8LwAA</Contents>+          <FileType>application/zpl</FileType>+          <LabelFormat>ZPL203</LabelFormat>+        </FileContents>+        <Dimensions>+          <Width>8.50000</Width>+          <Length>11.00000</Length>+          <Unit>inches</Unit>+        </Dimensions>+        <StandardIdForLabel>AmazonOrderId</StandardIdForLabel>+      </Label>+      <ShippingService>+        <CarrierName>FEDEX</CarrierName>+        <ShippingServiceOptions>+          <CarrierWillPickUp>false</CarrierWillPickUp>+          <DeclaredValue>+            <CurrencyCode>USD</CurrencyCode>+            <Amount>10.00</Amount>+          </DeclaredValue>+          <DeliveryExperience>DeliveryConfirmationWithAdultSignature</DeliveryExperience>+        </ShippingServiceOptions>+        <ShippingServiceId>FEDEX_PTP_PRIORITY_OVERNIGHT </ShippingServiceId>

Why is there a space at the end of the value? Does Amazon actually return it like that?

justinemmanuelmercado

comment created time in 13 hours

push eventScaleLeap/amazon-mws-api-sdk

Roman Filippov

commit sha 3917fcf379464cf13799f0b777762f2eb2d5f9bc

ci: adds GitHub CodeQL workflow action

view details

push time in 13 hours

push eventScaleLeap/amazon-advertising-api-sdk

Roman Filippov

commit sha 8520c0b474d93e7705a05e9d40c3ff2026ee79d3

test: fixes code quality scan warnings

view details

push time in 13 hours

push eventScaleLeap/amazon-advertising-api-sdk

Roman

commit sha d5841d005e1e2ab82a3132c04a34b48dcb885334

Create codeql-analysis.yml

view details

push time in 13 hours

issue commentberstend/puppeteer-extra

Looking for co-maintainers / State of the project

I’m interested as well. Can help with the CI setup also. Have a lot of experience with GH Actions. We can setup Semantic Release to auto publish to NPM.

berstend

comment created time in 15 hours

push eventScaleLeap/renovate-config

Roman Filippov

commit sha c74aaed652af5988b0ba7242f4acc805324eb382

feat: adds aws-sdk and aws-cdk to monthly list

view details

push time in a day

push eventScaleLeap/amazon-advertising-api-sdk

Renovate Bot

commit sha 205910f1452cd21a03aa056afe833b180e201a85

chore(deps): update dependency typescript to v3.9.6

view details

push time in a day

PR merged ScaleLeap/amazon-advertising-api-sdk

chore(deps): update dependency typescript to v3.9.6 renovatebot

This PR contains the following updates:

Package Type Update Change
typescript (source) devDependencies patch 3.9.3 -> 3.9.6

Release Notes

<details> <summary>Microsoft/TypeScript</summary>

v3.9.5

This release contains bug fixes in type-checking, emit, and editor scenarios.

For release notes, check out the release announcement.

For the complete list of fixed issues, check out the

(note, 3.9.4 was intentionally skipped due to minor complications in publishing)

Downloads are available on:

</details>


Renovate configuration

:date: Schedule: "every weekday" in timezone Etc/UTC.

:vertical_traffic_light: Automerge: Disabled due to failing status checks.

:recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+4 -4

1 comment

2 changed files

renovate[bot]

pr closed time in a day

delete branch ScaleLeap/amazon-advertising-api-sdk

delete branch : renovate/scaleleap-amazon-marketplaces-5.x

delete time in a day

push eventScaleLeap/amazon-advertising-api-sdk

Renovate Bot

commit sha fafefc3de181686d524eb7f70d93aacc836e4e25

fix(deps): update dependency @scaleleap/amazon-marketplaces to v5

view details

push time in a day

push eventScaleLeap/amazon-marketplaces

Roman Filippov

commit sha 47b1dbe8ce32e52a298ca51c4a68227636280f51

chore: adds renovate config

view details

push time in a day

issue openedreporanger/feedback

RR not picking up a repo

For some odd reason RR is not seeing one of the repos (private), however it is granted all repo access.

By not seeing, I mean not reacting to label merge when passing.

Any idea?

Thanks!

created time in a day

delete branch ScaleLeap/amazon-marketplaces

delete branch : chore/utils

delete time in a day

create barnchScaleLeap/amazon-marketplaces

branch : chore/utils

created branch time in a day

issue closedm3dev/typesafe-di

Cannot override binded value

I am not sure if this is intentional or a bug. But it doesn't seem to be possible to override a set value.

I think if this is intentional, then maybe it should throw an error, if an attempt is made to overwrite the value?

import { Design, Injector } from 'typesafe-di'

type HasName = { name: string }
type HasAge = { age: number }

class User {
  constructor(private name: string, private age: number) {}

  get bio() {
    return `My name is ${this.name}. I am ${this.age} old.`
  }
}

const design = Design
  // age
  .bind('age', () => 30)
  // user
  .bind(
    'user',
    async (injector: Injector<HasName & HasAge>) =>
      new User(await injector.name, await injector.age),
  )

async function main() {
  const { container: c1 } = await design.resolve({
    name: 'Bob',
  })

  // --> OVERWRITING THE VALUE
  design.bind('age', () => 45)

  const { container: c2 } = await design.resolve({
    name: 'John',
  })

  console.log(c1.user.bio)
  console.log(c2.user.bio)
}

main()

Output is:

My name is Bob. I am 30 old.
My name is John. I am 30 old.

closed time in a day

moltar

issue commentm3dev/typesafe-di

Cannot override binded value

Ah ok, thank you for the explanation. So it does sound like a scoped container would be useful here.

I'll close this issue then.

moltar

comment created time in a day

issue openedScaleLeap/amazon-mws-api-sdk

Remove ajv dep

We don't seem to be actually using it, I think.

If not, let's get rid of it then.

Thanks.

created time in 2 days

startedfabiospampinato/atomically

started time in 3 days

startedandrew-templeton/cfn-lambda

started time in 3 days

issue commentsalsita/node-pg-migrate

Support explicitly listing migrations, instead of using a filesystem loading function

Would you accept a PR for this?

moltar

comment created time in 4 days

create barnchScaleLeap/logger

branch : feature/heroku-env-camelcase

created branch time in 4 days

issue commentreporanger/feedback

Repo ranger merged immediately without waiting for passing events

Seems to work fine now! :)

Evidence: https://github.com/ScaleLeap/logger/pull/75

moltar

comment created time in 4 days

delete branch ScaleLeap/logger

delete branch : feature/heroku-env

delete time in 4 days

PR opened ScaleLeap/logger

feat: adds Heroku environment variables
+13 -1

0 comment

1 changed file

pr created time in 4 days

create barnchScaleLeap/logger

branch : feature/heroku-env

created branch time in 4 days

issue commentm3dev/typesafe-di

Cannot override binded value

@jooohn awesome! So I guess that also answers the #9 question? That's how you create scopes? Just bind a new value which then returns the scope?

moltar

comment created time in 4 days

issue commentmicrosoft/vscode-eslint

Code Helper (Renderer) hangs with 100% CPU usage

Mine is on type.

moltar

comment created time in 4 days

issue commentm3dev/typesafe-di

Bindings lost during merge

Btw, merging d2 into d1, did not change the value of age.

moltar

comment created time in 4 days

issue closedm3dev/typesafe-di

Bindings lost during merge

import { Design, Injector } from 'typesafe-di'

type HasName = { name: string }
type HasAge = { age: number }

class User {
  constructor(private name: string, private age: number) {}

  get bio() {
    return `My name is ${this.name}. I am ${this.age} old.`
  }
}

const d1 = Design
  // age
  .bind('age', () => 30)
  // user
  .bind(
    'user',
    async (injector: Injector<HasName & HasAge>) =>
      new User(await injector.name, await injector.age),
  )

const d2 = Design
  // age
  .bind('age', () => 45)

async function main() {
  const { container: c1 } = await d1.resolve({
    name: 'Bob',
  })

  d1.merge(d2)

  const { container: c2 } = await d2.resolve({
    name: 'John',
  })

  console.log(c1.user.bio)
  console.log(c2.user.bio)
  //             ~~~~
  // Property 'user' does not exist on type 'Container<{ age: { dependencies: {}; value: number; }; }>'
}

main()

Now c2 does not have a user binding anymore.

The same happens in reverse when merging d1 into d2, which I can understand.

But why does it happen when d2 is merged into d1? The word merge to me implies that they will be combined.

Thanks.

closed time in 4 days

moltar

issue commentm3dev/typesafe-di

Bindings lost during merge

Never mind on this one. My mistake! I was resolving the d2 here: await d2.resolve({

moltar

comment created time in 4 days

issue openedm3dev/typesafe-di

Bindings lost during merge

import { Design, Injector } from 'typesafe-di'

type HasName = { name: string }
type HasAge = { age: number }

class User {
  constructor(private name: string, private age: number) {}

  get bio() {
    return `My name is ${this.name}. I am ${this.age} old.`
  }
}

const d1 = Design
  // age
  .bind('age', () => 30)
  // user
  .bind(
    'user',
    async (injector: Injector<HasName & HasAge>) =>
      new User(await injector.name, await injector.age),
  )

const d2 = Design
  // age
  .bind('age', () => 45)

async function main() {
  const { container: c1 } = await d1.resolve({
    name: 'Bob',
  })

  d1.merge(d2)

  const { container: c2 } = await d2.resolve({
    name: 'John',
  })

  console.log(c1.user.bio)
  console.log(c2.user.bio)
  //             ~~~~
  // Property 'user' does not exist on type 'Container<{ age: { dependencies: {}; value: number; }; }>'
}

main()

Now c2 does not have a user binding anymore.

The same happens in reverse when merging d1 into d2, which I can understand.

But why does it happen when d2 is merged into d1? The word merge to me implies that they will be combined.

Thanks.

created time in 4 days

issue openedm3dev/typesafe-di

Cannot override binded value

I am not sure if this is intentional or a bug. But it doesn't seem to be possible to override a set value.

I think if this is intentional, then maybe it should throw an error, if an attempt is made to overwrite the value?

import { Design, Injector } from 'typesafe-di'

type HasName = { name: string }
type HasAge = { age: number }

class User {
  constructor(private name: string, private age: number) {}

  get bio() {
    return `My name is ${this.name}. I am ${this.age} old.`
  }
}

const design = Design
  // age
  .bind('age', () => 30)
  // user
  .bind(
    'user',
    async (injector: Injector<HasName & HasAge>) =>
      new User(await injector.name, await injector.age),
  )

async function main() {
  const { container: c1 } = await design.resolve({
    name: 'Bob',
  })

  // --> OVERWRITING THE VALUE
  design.bind('age', () => 45)

  const { container: c2 } = await design.resolve({
    name: 'John',
  })

  console.log(c1.user.bio)
  console.log(c2.user.bio)
}

main()

Output is:

My name is Bob. I am 30 old.
My name is John. I am 30 old.

created time in 4 days

issue openedm3dev/typesafe-di

Scoped containers?

Hi Jun,

The module looks great!

I have a question:

Is there scoped container functionality? If so, does it work?

Example of other libraries:

created time in 4 days

issue openedinversify/InversifyJS

Firefox is producing Potential Security Risk Ahead warning on the website https://inversify.io/

https://inversify.io/

image

Probably SSL cert expired.

created time in 4 days

issue commentmicrosoft/vscode-eslint

Code Helper (Renderer) hangs with 100% CPU usage

I also noticed a pattern when that happens more often. It happens on a large file, that is codegen'ed and when I open it, there are a ton of lint failures. So I think it tries to process that and somehow gets stuck, or it just takes a very long time maybe.

moltar

comment created time in 5 days

issue openedNetflix/pollyjs

beforePersist event payload (recording) is missing queryString values.

Description

beforePersist event payload (recording) is missing queryString values.

This is potentially a security issue.

I am relying on the recording payload to sanitize it from secrets, before storing the recordings. But a secret (API key) had leaked out in the query string in the CI environment.

Shareable Source

// Avoid posting hundreds of lines of source code.
// Edit to just the relevant portions.

Error Message & Stack Trace

N/A

Config

Polly.register(NodeHttpAdapter)
Polly.register(FSPersister)

Dump recording payload values:

  polly.server
    .any()
    .on('beforePersist', (request, recording) => {
      console.log(JSON.stringify(recording, undefined, 2))
    })

I am seeing:

"queryString": [],

Inspect the recording stored on disk:

I'm seeing:

          "queryString": [
            {
              "name": "foo",
              "value": "foobarbaz"
            }
          ],

Dependencies

Copy the @pollyjs dependencies from package.json:

{
    "@pollyjs/adapter-node-http": "5.0.0",
    "@pollyjs/core": "5.0.0",
    "@pollyjs/persister-fs": "5.0.0",
}

Relevant Links

N/A

Environment

Node.js v12.16.0
darwin 19.4.0
npm: 6.14.5

created time in 6 days

startedScrapingAnt/amazon_scraper

started time in 6 days

startedkyle-n/unofficial-amazon-search

started time in 6 days

push eventScaleLeap/amazon-mws-api-sdk

Roman Filippov

commit sha a19ac2f70a4b74d03fcd352a6efb6ae33563ba49

ci: enables releases from master

view details

push time in 7 days

startedVivify-Ideas/vue-draggable

started time in 7 days

startedaigoncharov/cls-proxify

started time in 8 days

pull request commentScaleLeap/amazon-mws-api-sdk

feature: documentation

I think any code should have code formatting. The only annoying part is that inside markdown tables don’t think it’s possible to have multi line code blocks. So we cab only use single ticks.

justinemmanuelmercado

comment created time in 8 days

pull request commentScaleLeap/amazon-mws-api-sdk

feature: documentation

There are still cases of italic. E.g. see getFeedSubmissionList section.

Also, I meant to code format ALL of the example values. I think it'll look nicer and more readable. What do you think?

justinemmanuelmercado

comment created time in 8 days

startedm3dev/typesafe-di

started time in 8 days

issue commentmiddyjs/middy

Cannot extend Context type

I see maybe #275 is relevant here.

Making the prop optional actually makes it work.

moltar

comment created time in 9 days

issue openedmiddyjs/middy

Cannot extend Context type

(Thanks for reporting an issue! Please make sure you click the link above to view the issue guidelines, then fill out the blanks below.)

What are the steps to reproduce this issue?

  1. Create an interface that extends Context type
  2. Create a middleware with the extended Context
  3. Supply the middleware to use method

What happens?

use method throws an TypeScript error.

What were you expecting to happen?

Extended type to be accepted.

Any logs, error output, etc?

Argument of type 'MiddlewareObject<SQSEvent, unknown, Ctx>' is not assignable to parameter of type 'MiddlewareObject<SQSEvent, unknown, Context> | MiddlewareObject<SQSEvent, unknown, Context>[]'.
  Type 'MiddlewareObject<SQSEvent, unknown, Ctx>' is not assignable to type 'MiddlewareObject<SQSEvent, unknown, Context>'.
    Types of property 'before' are incompatible.
      Type 'MiddlewareFunction<SQSEvent, unknown, Ctx> | undefined' is not assignable to type 'MiddlewareFunction<SQSEvent, unknown, Context> | undefined'.
        Type 'MiddlewareFunction<SQSEvent, unknown, Ctx>' is not assignable to type 'MiddlewareFunction<SQSEvent, unknown, Context>'.
          Types of parameters 'handler' and 'handler' are incompatible.
            Type 'HandlerLambda<SQSEvent, unknown, Context>' is not assignable to type 'HandlerLambda<SQSEvent, unknown, Ctx>'.
              Types of property 'context' are incompatible.
                Type 'Context' is not assignable to type 'Ctx'.ts(2345)

Any other comments?

import { Context, SQSEvent } from 'aws-lambda'

interface Ctx extends Context {
  foo: string
}

const mw: middy.MiddlewareObject<Event, Res, Ctx> = {
  before: ({ context }) => {
    return Promise.resolve()
  },
}

// ...

// errors here
handler.use(mw)

What versions of software are you using?

Node.js Version: v12.16.0

Middy Version: 1.0.0

AWS SDK Version: 2.697.0

created time in 9 days

issue commentsindresorhus/eslint-plugin-unicorn

no-fn-reference-in-iterator is not compatible with TypeScript type guards

@oss6 thanks for finding the proper references!

moltar

comment created time in 9 days

push eventScaleLeap/amazon-mws-api-sdk

EJ Mercado

commit sha fc877dd59009df3ae640486a3097c96d3ee173da

fix: expose params for subscriptions

view details

EJ Mercado

commit sha ef1f80581041b0e75f001da6e7e4502712169422

fix: expose parameters for orders

view details

EJ Mercado

commit sha ffb51834d6ac5282dca9c4a612a6576daeda0059

fix: expose parameters fulfillment inventory

view details

EJ Mercado

commit sha 617e5e14569759ca278260e20d07fe3d0a205e7e

fix: import correct parameters

view details

EJ Mercado

commit sha 6000f7f747a1b26deef42b6f7c2a7fa2140496bc

fix: expose parameters reports

view details

EJ Mercado

commit sha 5f4d59f50be3aeae8e4ad822b7b4f3cd42652f32

fix: expose products parameters

view details

EJ Mercado

commit sha 138b5c041ee4f0bda8173b845c50e66dbf537a7b

fix: expose finances parameter types

view details

EJ Mercado

commit sha 70ab09605dd27afd42ba65c4dff28650ddfb4b25

fix: lint error in reports

view details

EJ Mercado

commit sha 9869be134b0cdb1d923e419dd1afdf5973c92b53

fix: missed some parameters

view details

EJ Mercado

commit sha f08cb36598cfc9f28800875b8163b3164a158674

fix: revert accidental parameter change

view details

EJ Mercado

commit sha d1b37a700ceb5a430c803ae4605ef408e6cc5e30

fix: unit test utils, finances and fulfillment inv unit tests

view details

EJ Mercado

commit sha 09be2dadda5e3836906977ed34203d61e0f3ee47

fix: tests for products, reports, sellers, subscriptions

view details

Roman Filippov

commit sha d452af6bc6d7dfdabc2725789b7be44da65944b3

ci: runs polly workflow to the end, even if test fail

view details

Renovate Bot

commit sha 105277b272e277851dae7b7c5580e2d63103e550

chore(deps): update dependency @scaleleap/utils to v1.7.3

view details

EJ Mercado

commit sha ec9dc3b5e60c49bf22e0d22360b05f592bb5253e

feat: add get-service-status example

view details

Roman Filippov

commit sha 59f0aae3aa9f332c833672fdcd71652ee29d6b66

build: fixes API extractor

view details

EJ Mercado

commit sha f28e97a6ee4362962666288e8f41d9c409b8284d

feat: add list orders example

view details

EJ Mercado

commit sha 9e72fb7e2f587d42af2e83612ff38d5866a385ef

test: add integration tests for fulfillment inventory

view details

Scale Bot

commit sha 171b4c69b72aacada71b520252b9baedf60332fc

test: adds Polly recordings

view details

EJ Mercado

commit sha 426695d14e809750aa0aeb8468c007f5b579d277

feat: example for list inventory supply

view details

push time in 9 days

push eventScaleLeap/amazon-mws-api-sdk

Roman Filippov

commit sha 6901b92c4c4616959576abf8a0d8ef229dce1f91

docs: fixes GitHub Workflow badge

view details

Roman Filippov

commit sha 0d1ac9c59a4e879d3946ceb8304f76cacf5c59bc

docs: adds Codecov and Snyk badges

view details

Roman Filippov

commit sha b234ec73f1853999f82f9d2f568f7fdedb67a91c

docs: moves badges to the top

view details

Roman Filippov

commit sha d93bf0d3db1b12e001c5d042eba7481e16370cef

docs: test fix report name with code ticks

view details

push time in 10 days

issue closedawslabs/aws-solutions-constructs

aws-sqs-lambda & KMS

<!-- description of the bug: -->

Docs state:

Enable server-side encryption for source SQS Queue using AWS managed KMS Key

But when I am looking at the code I don't see any KMS constructs.

I am somewhat new to this, and maybe missing something.

This is :bug: Bug Report

closed time in 11 days

moltar

issue commentawslabs/aws-solutions-constructs

aws-sqs-lambda & KMS

Ah, thanks, awesome! Learned something new about Customer Master Key. Had no idea it was available :)

moltar

comment created time in 11 days

issue commentreporanger/feedback

Repo ranger merged immediately without waiting for passing events

Thank you 🙏

Will try again soon!

moltar

comment created time in 11 days

issue openedawslabs/aws-solutions-constructs

Misformatted markdown in README

https://github.com/awslabs/aws-solutions-constructs/blame/master/source/patterns/%40aws-solutions-constructs/aws-lambda-s3/README.md#L68-L71

created time in 12 days

issue openedawslabs/aws-solutions-constructs

aws-sqs-lambda & KMS

<!-- description of the bug: -->

Docs state:

Enable server-side encryption for source SQS Queue using AWS managed KMS Key

But when I am looking at the code I don't see any KMS constructs.

I am somewhat new to this, and maybe missing something.

This is :bug: Bug Report

created time in 12 days

startedawslabs/aws-solutions-constructs

started time in 12 days

pull request commentScaleLeap/amazon-mws-api-sdk

refactor: submit feed integration test

Works great on my machine. Re-recording is not triggered.

Please document at the top of the file, near the config, why we are doing this for future selfs :)

Other than that it's good to merge.

justinemmanuelmercado

comment created time in 12 days

issue closedadonisjs/adonis-vow

Using DatabaseTransactions does not play well with app transactions

Test:

trait('DatabaseTransactions')

test('...', async ({ assert }) => {
  // this is created inside a trx1 via DatabaseTransactions
  const user = await Factory
    .model('App/Models/User')
    .create()

  const res = await userFacade.doStuff(user, 'foo')
})

App code (App/Facades/userFacade.js):

  async doStuff (user, foo) {
    // will start a new trx2, which then does not see the user previously created outside of this txn
    const trx = await use('Database').beginTransaction()

    await user.stuff().create({}, trx)
  }

closed time in 12 days

moltar

issue commentjawj/zapatos

Test contribution, initial questions

Not sure how common, but I’m just pointing out the constraint. I guess it’s a trade off. 🤷‍♂️

eyelidlessness

comment created time in 12 days

delete branch ScaleLeap/amazon-mws-api-sdk

delete branch : renovate/scaleleap-amazon-marketplaces-5.x

delete time in 12 days

push eventScaleLeap/amazon-mws-api-sdk

Renovate Bot

commit sha 22be939003249a016290a45cfbbaab040653e122

fix(deps): update dependency @scaleleap/amazon-marketplaces to v5

view details

push time in 12 days

PR merged ScaleLeap/amazon-mws-api-sdk

fix(deps): update dependency @scaleleap/amazon-marketplaces to v5 renovatebot

This PR contains the following updates:

Package Type Update Change
@scaleleap/amazon-marketplaces dependencies major 4.1.0 -> 5.0.0

Release Notes

<details> <summary>ScaleLeap/amazon-marketplaces</summary>

v5.0.0

Compare Source

Features
  • adds Saudi Arabia marketplace (dae8348)
BREAKING CHANGES
  • adds Saudi Arabia marketplace

</details>


Renovate configuration

:date: Schedule: "every weekday" in timezone Etc/UTC.

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+4 -4

1 comment

2 changed files

renovate[bot]

pr closed time in 12 days

Pull request review commentScaleLeap/amazon-mws-api-sdk

feature: feeds-api

+{+  "log": {+    "_recordingName": "Feeds/should be able to get count of feeds",+    "creator": {+      "comment": "persister:fs",+      "name": "Polly.JS",+      "version": "4.3.0"+    },+    "entries": [+      {+        "_id": "5a6ba40da21717e76b8a9ccec14e29cf",+        "_order": 0,+        "cache": {},+        "request": {+          "bodySize": 318,+          "cookies": [],+          "headers": [+            {+              "name": "accept",+              "value": "application/json, text/plain, */*"+            },+            {+              "name": "content-type",+              "value": "application/x-www-form-urlencoded"+            },+            {+              "name": "user-agent",+              "value": "@scaleleap/amazon-mws-api-sdk/1.0.0 (Language=JavaScript)"+            },+            {+              "name": "content-length",+              "value": 318+            },+            {+              "name": "host",+              "value": "mws.amazonservices.ca"+            }+          ],+          "headersSize": 277,+          "httpVersion": "HTTP/1.1",+          "method": "POST",+          "postData": {+            "mimeType": "application/x-www-form-urlencoded",+            "params": [],+            "text": "AWSAccessKeyId=x&Action=GetFeedSubmissionListByNextToken&MWSAuthToken=x&SellerId=x&Signature=2Ea0QAEifRC4pWKlcMh40ikYZFHqkucUrO0PdSi8geo%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-06-25T04%3A05%3A28.661Z&Version=2009-01-01"+          },+          "queryString": [],+          "url": "https://mws.amazonservices.ca/Feeds/2009-01-01"+        },+        "response": {+          "bodySize": 376,+          "content": {+            "mimeType": "text/xml",+            "size": 376,+            "text": "<?xml version=\"1.0\"?>\n<ErrorResponse xmlns=\"http://mws.amazonaws.com/doc/2009-01-01/\">\n  <Error>\n    <Type>Sender</Type>\n    <Code>ValidationError</Code>\n    <Message>1 validation error detected: Value null at 'nextToken' failed to satisfy constraint: Member must not be null</Message>\n  </Error>\n  <RequestId>598a82be-d4ed-4bb6-802d-8e9150036d43</RequestId>\n</ErrorResponse>\n"

Test filename doesn't seem to match what is in the output.

Feeds/should be able to get count of feeds

1 validation error detected: Value null at 'nextToken' failed to satisfy constraint: Member must not be null

justinemmanuelmercado

comment created time in 12 days

Pull request review commentScaleLeap/amazon-mws-api-sdk

feature: feeds-api

+<?xml version="1.0" encoding="iso-8859-1"?>+<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">+  <Header>+    <DocumentVersion>1.01</DocumentVersion>+    <MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>+  </Header>+  <MessageType>Product</MessageType>+  <PurgeAndReplace>false</PurgeAndReplace>+  <Message>+    <MessageID>1</MessageID>+    <OperationType>Update</OperationType>+    <Product>+      <SKU>56789</SKU>+      <StandardProductID>+        <Type>ASIN</Type>+        <Value>B0EXAMPLEG</Value>+      </StandardProductID>+      <ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>+      <DescriptionData>+        <Title>Example Product Title</Title>+        <Brand>Example Product Brand</Brand>+        <Description>This is an example product description.</Description>+        <BulletPoint>Example Bullet Point 1</BulletPoint>+        <BulletPoint>Example Bullet Point 2</BulletPoint>+        <MSRP currency="USD">25.19</MSRP>+        <Manufacturer>Example Product Manufacturer</Manufacturer>+        <ItemType>example-item-type</ItemType>+      </DescriptionData>+      <ProductData>+        <Health>+          <ProductType>+            <HealthMisc>+              <Ingredients>Example Ingredients</Ingredients>+              <Directions>Example Directions</Directions>+            </HealthMisc>+          </ProductType>+        </Health>+      </ProductData>+    </Product>+  </Message>+</AmazonEnvelope>++<!-- <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">

Do we still need this?

justinemmanuelmercado

comment created time in 12 days

Pull request review commentScaleLeap/amazon-mws-api-sdk

feature: feeds-api

+import { ParsingError, SubmitFeedParameters } from '../../src'+import { NextToken } from '../../src/parsing'+import { createMockHttpClient, mockMwsFail, parsingError } from '../utils'++describe('feeds', () => {+  describe('submitFeed', () => {+    const parameters: SubmitFeedParameters = {+      FeedContent: '',+      FeedType: '_POST_PRODUCT_DATA_',+    }++    it('returns feed info of submitted feeds if succesful', async () => {+      expect.assertions(1)++      const mockSubmitFeed = createMockHttpClient('feeds_submit_feed')++      expect(await mockSubmitFeed.feeds.submitFeed(parameters)).toMatchSnapshot()+    })++    it('throws a parsing error when the response isnt valid', async () => {+      expect.assertions(1)++      await expect(() => mockMwsFail.feeds.submitFeed(parameters)).rejects.toStrictEqual(+        new ParsingError(parsingError),+      )+    })+  })++  describe('getFeedSubmissionResult', () => {+    const parameters = { FeedSubmissionId: '' }++    it('returns an XML file when succesful', async () => {

Why are we returning the XML file?

justinemmanuelmercado

comment created time in 12 days

Pull request review commentScaleLeap/amazon-mws-api-sdk

feature: feeds-api

+import crypto from 'crypto'+import {+  array,+  boolean,+  Codec,+  exactly,+  GetInterface,+  Left,+  number,+  oneOf,+  optional,+  string,+} from 'purify-ts'++import { ParsingError } from '../error'+import { HttpClient, RequestMeta, Resource } from '../http'+import { ensureString, mwsDate, NextToken, nextToken as nextTokenCodec } from '../parsing'++const FEEDS_API_VERSION = '2009-01-01'+interface GetFeedSubmissionListParameters {+  FeedSubmissionIdList?: string[]+  MaxCount?: number+  FeedTypeList?: string[]+  FeedProcessingStatusList?: string[]+  SubmittedFromDate?: Date+  SubmittedToDate?: Date+}++const FeedSubmissionInfo = Codec.interface({+  FeedSubmissionId: ensureString,+  FeedType: string,+  SubmittedDate: mwsDate,+  FeedProcessingStatus: string,+  StartedProcessingDate: optional(mwsDate),+  CompletedProcessingDate: optional(mwsDate),+})++const GetFeedSubmissionList = Codec.interface({+  HasToken: optional(boolean),+  NextToken: optional(nextTokenCodec('GetFeedSubmissionList')),+  FeedSubmissionInfo: optional(oneOf([FeedSubmissionInfo, array(FeedSubmissionInfo), exactly('')])),+})++type GetFeedSubmissionList = GetInterface<typeof GetFeedSubmissionList>++const GetFeedSubmissionListResponse = Codec.interface({+  GetFeedSubmissionListResponse: Codec.interface({+    GetFeedSubmissionListResult: GetFeedSubmissionList,+  }),+})++const GetFeedSubmissionListByNextTokenResponse = Codec.interface({+  GetFeedSubmissionListByNextTokenResponse: Codec.interface({+    GetFeedSubmissionListByNextTokenResult: GetFeedSubmissionList,+  }),+})++export type FeedType =+  | '_POST_PRODUCT_DATA_'+  | '_POST_INVENTORY_AVAILABILITY_DATA_'+  | '_POST_PRODUCT_OVERRIDES_DATA_'+  | '_POST_PRODUCT_PRICING_DATA_'+  | '_POST_PRODUCT_IMAGE_DATA_'+  | '_POST_PRODUCT_RELATIONSHIP_DATA_'+  | '_POST_FLAT_FILE_INVLOADER_DATA_'+  | '_POST_FLAT_FILE_LISTINGS_DATA_'+  | '_POST_FLAT_FILE_BOOKLOADER_DATA_'+  | '_POST_FLAT_FILE_CONVERGENCE_LISTINGS_DATA_'+  | '_POST_FLAT_FILE_LISTINGS_DATA_'+  | '_POST_FLAT_FILE_PRICEANDQUANTITYONLY_UPDATE_DATA_'+  | '_POST_UIEE_BOOKLOADER_DATA_'+  | '_POST_STD_ACES_DATA_'+  | '_POST_ORDER_ACKNOWLEDGEMENT_DATA_'+  | '_POST_PAYMENT_ADJUSTMENT_DATA_'+  | '_POST_ORDER_FULFILLMENT_DATA_'+  | '_POST_INVOICE_CONFIRMATION_DATA_'+  | '_POST_EXPECTED_SHIP_DATE_SOD_'+  | '_POST_FLAT_FILE_ORDER_ACKNOWLEDGEMENT_DATA_'+  | '_POST_FLAT_FILE_PAYMENT_ADJUSTMENT_DATA_'+  | '_POST_FLAT_FILE_FULFILLMENT_DATA_'+  | '_POST_EXPECTED_SHIP_DATE_SOD_FLAT_FILE_'+  | '_POST_FULFILLMENT_ORDER_REQUEST_DATA_'+  | '_POST_FULFILLMENT_ORDER_CANCELLATION_REQUEST_DATA_'+  | '_POST_FBA_INBOUND_CARTON_CONTENTS_'+  | '_POST_FLAT_FILE_FULFILLMENT_ORDER_REQUEST_DATA_'+  | '_POST_FLAT_FILE_FULFILLMENT_ORDER_CANCELLATION_REQUEST_DATA_'+  | '_POST_FLAT_FILE_FBA_CREATE_INBOUND_PLAN_'+  | '_POST_FLAT_FILE_FBA_UPDATE_INBOUND_PLAN_'+  | '_POST_FLAT_FILE_FBA_CREATE_REMOVAL_'+  | '_RFQ_UPLOAD_FEED_'+  | '	_POST_EASYSHIP_DOCUMENTS_'

There's a leading space here.

justinemmanuelmercado

comment created time in 12 days

PR opened laconiajs/laconia

Adds receiptHandle to SqsRecord type

Closes #597

+1 -0

0 comment

1 changed file

pr created time in 13 days

push eventmoltar/laconia

Roman

commit sha 6bddd3c0e934d43e09741ca05f639ff1cc7a8a83

adds receiptHandle to SqsRecord type Closes #597

view details

push time in 13 days

fork moltar/laconia

Create well-crafted serverless applications, effortlessly

http://laconiajs.io

fork in 13 days

issue commentjawj/zapatos

Test contribution, initial questions

Wouldn't using a global, project-level schema.d.ts limit the project to one database then?

eyelidlessness

comment created time in 13 days

issue commentlaconiajs/laconia

@laconia/event SqsEvent type is missing receiptHandle prop

yes, will do tomorrow

moltar

comment created time in 13 days

issue openedlaconiajs/laconia

@laconia/event SqsEvent type is missing receiptHandle prop

Describe the bug

SqsEvent TypeScript type is missing receiptHandle prop

To Reproduce

const app = async (event: SQSEvent, { logger }: Container) => {
  const event_ = sqs(event)
  logger.info(event_, 'inside lambda event handler')
  return event
}

Logs:

{
    "level": 30,
    "time": 1592996542272,
    "pid": 8,
    "hostname": "169.254.43.61",
    "name": "foo",
    "records": [
        {
            "body": "testfoo1",
            "receiptHandle": "AQEBOgwdOjoyLPvU4..."
        }
    ],
    "msg": "inside lambda event handler"
}
```

**Expected behavior**

`SqsEvent` type to have `receiptHandle` prop

**Actual behavior**

`SqsEvent` TypeScript type is missing `receiptHandle` prop

**Additional context**

N/a

created time in 13 days

delete branch ScaleLeap/logger

delete branch : feature/lambda

delete time in 13 days

issue openedreporanger/feedback

Repo ranger merged immediately without waiting for passing events

I created a PR using a CLI:

 hub pull-request -p -l "merge when passing"

image

The bot merged my PR immediately, 2 seconds after the PR was created.

I think this might be a race condition, as GitHub Actions did not start yet, and bot thought that everything was done.

Maybe the bot needs to detect checks that haven't started yet, or allow for some grace period before merging?

created time in 13 days

PR opened ScaleLeap/logger

feat: adds AWS Lambda environment variables to log base

Closes #25

+26 -0

0 comment

2 changed files

pr created time in 13 days

create barnchScaleLeap/logger

branch : feature/lambda

created branch time in 13 days

issue openedlaconiajs/website

Example overrides constants

Example overrides constants:

https://github.com/laconiajs/website/blame/master/docs/introduction/core-concepts.md#L57-L60

created time in 13 days

pull request commentScaleLeap/amazon-mws-api-sdk

feature: next tokens example

I think the idea was that tokens should be encapsulated, and also be unique for each end point. So that you cannot accidentally use one token for another endpoint.

But these tokens should definitely be able to be instantiated by the end user. Because they may come from a queue, rather than directly from the method.

E.g. think of a distributed system that is fetching 1000s of orders. We'd get a response with a next token, then add the token to the queue. Then a worker picks up the token and passes it to a method, and so forth in a loop, until no more data left. But when the token is picked up from the queue, it needs to be converted back into whatever shape the method excepts.

justinemmanuelmercado

comment created time in 14 days

push eventScaleLeap/jest-polly

Roman Filippov

commit sha 7baadc2ca40dd8490d56c7a2523b1d78fe309635

fix: upgrades @pollyjs/*

view details

push time in 14 days

pull request commentmoltar/typescript-runtime-type-benchmarks

feat: adds rulr

I’m in Vietnam 🇻🇳 now 😅

ryansmith94

comment created time in 14 days

pull request commentmoltar/typescript-runtime-type-benchmarks

feat: adds rulr

Oh yeah, crap, that does happen when I merge multiple things too quickly. Then the GitHub Actions step on themselves.

I deployed a fix, hopefully will self-resolve in a few minutes.

Thanks for the heads up! Probably need another GitHub Actions workflow to monitor for this :D

ryansmith94

comment created time in 14 days

push eventmoltar/typescript-runtime-type-benchmarks

Roman Filippov

commit sha 9a3bd143c1419c03525e438df064a66ab9457449

fix: brings back SVGO Closes #306

view details

push time in 14 days

issue commentsindresorhus/eslint-plugin-unicorn

no-fn-reference-in-iterator is not compatible with TypeScript type guards

I am not sure what is going on there. I am getting confused.

Both of the code snippets I posted are valid.

My only concern is that the rule is being triggered in a case where there is no other option. The only option is to do filter(isDefined), as that is how TypeScript works/infers.

moltar

comment created time in 14 days

issue commentsindresorhus/eslint-plugin-unicorn

no-fn-reference-in-iterator is not compatible with TypeScript type guards

But the code being validated is the TypeScript one. So I’m not sure how the result is relevant?

moltar

comment created time in 14 days

issue commentsindresorhus/eslint-plugin-unicorn

no-fn-reference-in-iterator is not compatible with TypeScript type guards

That's not true:


number is not undefined:

Screenshot:

image


number is: number | undefined type.

Screenshot:

image


I think my example was poor, here is a better one:

https://www.typescriptlang.org/play/index.html?target=99#code/GYVwdgxgLglg9mABDAzgEQKbBmDATAHgBUA+ACgEMAnAcxAFsMwoAuRIxAH0XDyx3wBKNtTqNmyFO0QBvAFCJEVDFBBUkUAJ4AHDHGCJRDJlEQBCALwXEAcl79ceG3IC+cuRAQpTMKBnpS1gDaAIwANIgATBH22I4Auu6+-igAdNgANn5UZKiYcUKp9BTaZGRgDABGGFSCiBYksgqIAPQtiBX01VSSHXAA7ohauoh01Hx4hmCTsQKTqIgYGTD0OBR+eM3KquodVTWugkl+AekwWTVlnXUNkvlz5QyCgkUlV-u19Y3yim2IABYDDAANxqESg-wW-QommQpjwcAwUjAcFM-TgVAA1hEKNNEAAiTrdfGICC4xDec4ZRDVHjTBz4LYqNRIIk1RAAakQIUOQA

moltar

comment created time in 14 days

issue openedsindresorhus/eslint-plugin-unicorn

no-fn-reference-in-iterator is not compatible with TypeScript type guards

function isDefined<T>(argument: T | undefined): argument is T {
  return typeof argument !== 'undefined'
}

const items = [1, 2, undefined]

items.filter(isDefined).map((number) => {
  // number is now type guarded and undefined is eliminated
  console.log(number)
})

items.filter((num) => isDefined(num)).map((number) => {
  // however, this way it does not work, and "number" can still be undefined
  console.log(number)
})

I am not sure why TypeScript is not inferring the results in the second way.

created time in 14 days

issue commentmiyajan/npm-audit-pr

On branch npm-audit-fix\nnothing to commit

I don't think this is a good behavior. Every time this fails, I get a failed alert from GitHub Actions. I think failures should be something very serious.

I think maybe instead of failing it can create an issue stating that it could not upgrade something.

moltar

comment created time in 15 days

issue openedScaleLeap/amazon-mws-api-sdk

Fix API Extractor warnings

API Extractor has many warnings about types not being exported. I think we want them all to be exported.

To get the list of warnings:

npm run build
npm run api-extractor

created time in 15 days

push eventScaleLeap/amazon-mws-api-sdk

Roman Filippov

commit sha 1beb5b07b0ed8ee3e7a92f86aa449233bba48798

build: fixes API extractor

view details

push time in 15 days

pull request commentmoltar/typescript-runtime-type-benchmarks

feat: includes marshal in outliers

Thanks for doing this. I meant to do this a long time ago, but never found the time. Really appreciate your help with house keeping! :)

ryansmith94

comment created time in 15 days

push eventmoltar/typescript-runtime-type-benchmarks

Ryan Smith

commit sha 120ff8609e07ce36027ebb781dbdcc8b095c0cb6

feat: Includes marshal in outliers

view details

push time in 15 days

more