Fix complex Record IDs from being output incorrectly within JavaScript functions (#4661)
This commit is contained in:
parent
a0028e2c7a
commit
1153a2469b
2 changed files with 10 additions and 2 deletions
|
@ -21,6 +21,7 @@ impl Record {
|
|||
Value::Array(v) => v.into(),
|
||||
Value::Object(v) => v.into(),
|
||||
Value::Number(v) => v.into(),
|
||||
Value::Uuid(v) => v.into(),
|
||||
v => v.as_string().into(),
|
||||
},
|
||||
},
|
||||
|
@ -33,8 +34,8 @@ impl Record {
|
|||
}
|
||||
|
||||
#[qjs(get)]
|
||||
pub fn id(&self) -> String {
|
||||
self.value.id.to_raw()
|
||||
pub fn id(&self) -> Value {
|
||||
self.value.id.clone().into()
|
||||
}
|
||||
// Compare two Record instances
|
||||
pub fn is(a: &Record, b: &Record) -> bool {
|
||||
|
|
|
@ -150,6 +150,12 @@ async fn script_function_types() -> Result<(), Error> {
|
|||
manager = function() {
|
||||
return new Record('user', 'joanna');
|
||||
},
|
||||
organisation = function() {
|
||||
return new Record('organisation', {
|
||||
alias: 'acme',
|
||||
name: 'Acme Inc',
|
||||
});
|
||||
},
|
||||
identifier = function() {
|
||||
return new Uuid('03412258-988f-47cd-82db-549902cdaffe');
|
||||
}
|
||||
|
@ -168,6 +174,7 @@ async fn script_function_types() -> Result<(), Error> {
|
|||
created_at: d'1995-12-17T03:24:00Z',
|
||||
next_signin: 1w2d6h,
|
||||
manager: user:joanna,
|
||||
organisation: organisation:{ alias: 'acme', name: 'Acme Inc' },
|
||||
identifier: u'03412258-988f-47cd-82db-549902cdaffe',
|
||||
}
|
||||
]",
|
||||
|
|
Loading…
Reference in a new issue