#this my data (note date certain fields

1 messages · Page 1 of 1 (latest)

tall lava
#

Hi @rocky cape ,
Could you try creating the attribute like this:

import {Any} from "permify-node/grpc/generated/google/protobuf/any";

// Create a StringValue message
const stringValue = permify.grpc.base.StringValue.fromJSON({ data: "activated" });

// Create an Any message that wraps the StringValue
const message = Any.fromJSON({
    typeUrl: 'type.googleapis.com/base.v1.StringValue',
    value: permify.grpc.base.StringValue.encode(stringValue).finish()
});

Then use it like this when writing the data:

client.data.write({
    tenantId: "t1",
    metadata: {
        schemaVersion: schemaVersion
    },
    attributes: [
        {
            entity: {
                type: "tenants",
                id: "1"
            },
            attribute: "tenantStatus",
            value: message
        }
    ],
    // ...
});

Let me know if this works for you!