deep-foundation / deeplinks

https://discord.gg/deep-foundation
The Unlicense
14 stars 9 forks source link

deep.insert does not support _id syntax #260

Open Konard opened 1 year ago

Konard commented 1 year ago

image

This code

const spaceId = 2355;
await deep.insert({
  type_id: { _id: ["@deep-foundation/rss-to-deep", "Address"] },
  in: { data: { 
    type_id: { _id: [ "@deep-foundation/core", "Contain" ] },
    from_id: spaceId
  }}
});

fails with error:

client.js:397 Uncaught Error: DeepClient Insert Error: parsing Integer expected for input type: PGBigInt failed, expected Number, but encountered Object
    at DeepClient.eval (client.js:396:1)
    at Generator.throw (<anonymous>)
    at rejected (client.js:5:42)

Workaround

Use await deep.id(...)

const spaceId = 2355;
await deep.insert({
  type_id: await deep.id("@deep-foundation/rss-to-deep", "Address"),
  in: { data: { 
    type_id: await deep.id("@deep-foundation/core", "Contain"),
    from_id: spaceId
  }}
});
FreePhoenix888 commented 1 year ago

Duplicate of https://github.com/deep-foundation/deeplinks/issues/253 ?