profile
viewpoint

pierreis/erlang-xxhash 23

Erlang wrapper for xxHash.

pierreis/webleak 1

🌊 Get notified when your e-mail or password leaks on the internet. Powered by Webtask.

pierreis/badger 0

Fast key-value DB in Go.

startedcomposewell/unicode-transforms

started time in 6 hours

startedcomposewell/streamly

started time in 6 hours

issue commentjeremydaly/dynamodb-toolbox

autoParse Not executing on query, am I misconfigured or misunderstood?

Thanks for the info @darbio. I don't think this is related to the autoParse composite key issue, but I'll investigate it as well.

GrahamEvans31

comment created time in a day

issue commentjeremydaly/dynamodb-toolbox

autoParse Not executing on query, am I misconfigured or misunderstood?

I fixed up my code to not enable autoParse (parse: false in the query method) and to manually parse the entities and this appears to be working for me with this workaround.

e.g.

const surveyEntity = results.Items.filter(item => item._et === SurveyEntityType).map(item => SurveyEntity.parse(item) as ISurveyEntity)[0];

I'll check once this is fixed.

GrahamEvans31

comment created time in a day

issue commentjeremydaly/dynamodb-toolbox

autoParse Not executing on query, am I misconfigured or misunderstood?

I had a further look into this and it appears that the issued is related (autoParse is not working) however the issue only appears when I update the entity.

When I update the entity and then query on the index, none of the entities are parsed.

GrahamEvans31

comment created time in a day

issue commentjeremydaly/dynamodb-toolbox

autoParse Not executing on query, am I misconfigured or misunderstood?

Just a 'me too' from me.

In the following screenshot you can see that some of the items are parsed, whilst others are not.

image

Unfortunately I can't do the save: false trick as I defined my entity as follows:

export const SurveySampleResultEntity = new Entity<
ISurveySampleResultEntity,
    'pk' | 'sk' | 'gsi1_pk' | 'gsi1_sk'
>({
    name: SurveySampleResultEntityType,
    timestamps: true,

    // Define attributes
    attributes: {
        // index
        pk: {
            partitionKey: true,
            hidden: true,
            default: (data: ISurveySampleResultEntity) => `SURVEY#${data.projectIdentifier}-${data.surveyIdentifier}`,
        },
        sk: {
            sortKey: true,
            hidden: true,
            default: (data: ISurveySampleResultEntity) => `SURVEY_SAMPLE_RESULT#${data.sampleIdentifier}#${data.identifier}`,
        },

        // gsi1
        gsi1_pk: {
            hidden: true,
            default: (data: ISurveySampleResultEntity) => `SURVEY#${data.surveyIdentifier}`,
        },
        gsi1_sk: {
            hidden: true,
            default: (data: ISurveySampleResultEntity) => `${data.surveyIdentifier}#${data.sampleIdentifier}#${data.identifier}`,
        },

        // attributes
        projectIdentifier: 'string',
        surveyIdentifier: 'number',
        sampleIdentifier: 'number',
        identifier: 'number',

        machineIdentifier: 'string',
        readings: 'map'
    },

    // Assign it to our table
    table: DataTable,
});
GrahamEvans31

comment created time in a day

push eventjeremydaly/dynamodb-toolbox

Jeremy Daly

commit sha ecdcecc756b9c0b7055fee9bfc9846a5073c44a3

add transactWrite WIP

view details

push time in 3 days

issue commentjeremydaly/dynamodb-toolbox

Partition key suffixes

Just to add an example of the transform feature, for anyone who is looking todo the same and stumbles upon this post.

attributes: { pk: { partitionKey: true, transform: (pkk, item) => item.tenantId + "#" + pkk }, // flag as partitionKey sk: { hidden: true, sortKey: true }, // flag as sortKey and mark hidden status: ['sk', 0], // composite key mapping id: ['sk', 1], // composite key mapping name: { map: 'data' }, // map 'name' to table attribute 'data' co: { alias: 'company' }, // alias table attribute 'co' to 'company' age: { type: 'number' }, // set the attribute type tenantId: { type: 'string' } },

and the entity

let item = { id: 'a2e710f1-asffds', pk: 'BOOKING', name: 'Jane Smith', company: 'ACME', age: 35, status: 'ACTIVE', tenantId: 'tenant1' };

This will give you a partition key of tenant1#BOOKING

nkdevirl

comment created time in 6 days

push eventjeremydaly/dynamodb-toolbox

Jeremy Daly

commit sha bb905e52d167aa40f2e4ecc38ca32bd878b5feb5

transactions wip

view details

push time in 8 days

push eventjeremydaly/dynamodb-toolbox

Jeremy Daly

commit sha f0c8e3fe1e39ea6e06c7e4334350d19db03f5f16

initial transaction work

view details

Jeremy Daly

commit sha fd4318657ed205e421898dad4da71cde4c069c69

remove empty Tranasction class

view details

push time in 8 days

issue commentjeremydaly/dynamodb-toolbox

Create an example app

I like that you are always trying to keep things simple. Do you think lambda-api and this library is a good fit together? If so, would like to see how you would recommend using them together

Lambda API needs some more work (like v2 payload support for HTTP APIs), but libraries do work well together.

I always create a Data Access Layer (DAL) for my projects, which abstracts the data model into simple calls like getUser, getOrders, getOrderById, setUser, etc. I built this library to help me build my DALs faster.

StErMi

comment created time in 8 days

issue commentjeremydaly/dynamodb-toolbox

Create an example app

I like that you are always trying to keep things simple. Do you think lambda-api and this library is a good fit together? If so, would like to see how you would recommend using them together

StErMi

comment created time in 8 days

issue commentjeremydaly/dynamodb-toolbox

Update using dashes

Good catch. Looks like I'm just taking the attribute name and prefixing it with a #, but clearly that will cause issues. I should be able to switch it to an incrementing numerical index approach like I used for the projectionBuilder.

ThomasAribart

comment created time in 9 days

issue openedjeremydaly/dynamodb-toolbox

Update using dashes

FooEntity.update({
  dictionary: {
    $set: {
      'field-with-dash': 'bar',
    },
  },
})

This update will fail as the update method will generate an ExpressionAttributeName containing { '#field-with-dash': 'field-with-dash' } and the dynamoDb client will throw an error Invalid ExpressionAttributeName as it doesn't handle dashes... 😞

created time in 9 days

issue commentjeremydaly/dynamodb-toolbox

Update issue with default

0.2.0-beta.1 using version FYI

mfbx9da4

comment created time in 11 days

issue commentjeremydaly/dynamodb-toolbox

Update issue with default

Thanks for this. I'll take another look.

mfbx9da4

comment created time in 12 days

issue commentjeremydaly/dynamodb-toolbox

Update issue with default

Interestingly using enabled: () => false works instead of enabled: false

using the former:

{
  TableName: 'onin-dev-AccountSessions',
  Key: {
    email: 'hey@davidalbertoadler.com',
    deviceUDID: 'apps-web#fc2dae68-4194-4f04-abb5-cd389a2e66f5'
  },
  UpdateExpression: 'SET #createdAt = if_not_exists(#createdAt,:createdAt), #updatedAt = if_not_exists(#updatedAt,:updatedAt), #pushEnabled = if_not_exists(#pushEnabled,:pushEnabled), #foo = :foo',
  ExpressionAttributeNames: {
    '#createdAt': 'createdAt',
    '#updatedAt': 'updatedAt',
    '#pushEnabled': 'pushEnabled',
    '#foo': 'foo'
  },
  ExpressionAttributeValues: {
    ':createdAt': 1605889046135,
    ':updatedAt': 1605889046135,
    ':pushEnabled': false,
    ':foo': 'asdf'
  }
}
mfbx9da4

comment created time in 12 days

issue commentjeremydaly/dynamodb-toolbox

Update issue with default

await Group.put({ pk, enabled: true }) 
{
  TableName: 'Group',
  Key: {
    pk: 'asdf',
  },
  UpdateExpression: 'SET #createdAt = if_not_exists(#createdAt,:createdAt), #updatedAt = if_not_exists(#updatedAt,:updatedAt), #enabled = :enabled',
  ExpressionAttributeNames: {
    '#createdAt': 'createdAt',
    '#updatedAt': 'updatedAt',
    '#enabled': 'enabled'
  },
  ExpressionAttributeValues: {
    ':createdAt': 1605888916731,
    ':updatedAt': 1605888916731,
    ':enabled': true
  }
}
await Group.update({pk, foo: 'asdf'})
{
  TableName: 'Group',
  Key: {
    pk: 'asdf',
  },
  UpdateExpression: 'SET #createdAt = if_not_exists(#createdAt,:createdAt), #updatedAt = if_not_exists(#updatedAt,:updatedAt), #enabled = :enabled, #foo = :foo',
  ExpressionAttributeNames: {
    '#createdAt': 'createdAt',
    '#updatedAt': 'updatedAt',
    '#enabled': 'enabled',
    '#foo': 'foo'
  },
  ExpressionAttributeValues: {
    ':createdAt': 1605888916733,
    ':updatedAt': 1605888916733,
    ':enabled': false,
    ':foo': 'asdf'
  }
}
mfbx9da4

comment created time in 12 days

issue commentjeremydaly/dynamodb-toolbox

autoParse Not executing on query, am I misconfigured or misunderstood?

Awesome, I'm still using the toolbox now in 2 different projects so I'll look to make use of that config change and report back.

GrahamEvans31

comment created time in 12 days

created tagdavidmdm/myzod

tagv1.2.2

created time in 12 days

push eventdavidmdm/myzod

davidmdm

commit sha 8d0ec6d65cdf8bc248f565a2db18286fc710dbd9

make version 1.2.2

view details

push time in 12 days

created tagdavidmdm/myzod

tagv1.2.1

created time in 12 days

push eventdavidmdm/myzod

davidmdm

commit sha bb3b9f4b1898d3a3ddee175345c9fbf977599283

update typescript

view details

push time in 12 days

issue commentjeremydaly/dynamodb-toolbox

Updating an attribute to be undefined does not remove the attribute

I don't disagree with removing undefined, however I do note that $remove works just fine as well.

In the context of the DSL for this library, it's more explicit to use the DSL than it is to check for undefined attributes.

That doesn't mean that it's wrong to remove them, but it does introduce another vector for bugs and nuances in debugging that people who use the lib need to be aware of.

I suppose the broader question is to decide which method is the "way" to do it in this library - especially to get it to v1.0.0 rather than a WIP/beta.

mfbx9da4

comment created time in 12 days

issue commentjeremydaly/dynamodb-toolbox

autoParse Not executing on query, am I misconfigured or misunderstood?

This works correctly if you add { save: false } to the configuration. For example, bookingId : ['PK',1] would become bookingId : ['PK',1, { save: false}]. This should do it automatically.

GrahamEvans31

comment created time in 12 days

issue commentjeremydaly/dynamodb-toolbox

autoParse Not executing on query, am I misconfigured or misunderstood?

This is definitely not working correctly in v0.2. Will fix in v0.3.

GrahamEvans31

comment created time in 12 days

issue commentjeremydaly/dynamodb-toolbox

Entity pk mapping supported?

Hi @nwpointer. So sorry for the late, late, late reply. This might have been cleaned up in some of the updates over the last few months. If you can still replicate this, I'd love to see your code.

nwpointer

comment created time in 12 days

issue closedjeremydaly/dynamodb-toolbox

TypeScript support

Would love to see TypeScript types

Reopening this in reference to #14 since v0.2 is out.

closed time in 12 days

ryan-mars

issue commentjeremydaly/dynamodb-toolbox

TypeScript support

TypeScript branches have been consolidated into https://github.com/jeremydaly/dynamodb-toolbox/tree/v0.3. It's not complete yet and there is still some type work to be done, but future TS enhancements should go here. Thanks to @antoniopresto and @xavierlefevre for their work on this.

ryan-mars

comment created time in 12 days

issue closedjeremydaly/dynamodb-toolbox

Getting "'entity' value of 'xxx' must be a string and a valid table Entity name"

I am facing a problem with a condition expression on a put operation when using WebPack. The following piece of code:

const putOperationResponse = await Table.TagId2DsIdMapping.put(
    {
      sk: deviceId,
      tagId2DsId: map
    },
    {
      conditions: { size: "tagId2DsId", lte: validTagId2DsIds.length },
      metrics: "size"
    }
  );

results in an "...entity' value of 'TagId2DsIdMapping' must be a string and a valid table Entity name" error when running on AWS Lambda. The same code does not throw an error when used without WebPack or when deactivating the minimization with the WebPack config and when not using the "conditions" parameter. It is somehow related to the conditions parameter.

closed time in 12 days

TLaue
more