-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fuel Mint support Part 1 - Implement HyperFuel query selection for Mint receipts #214
Changes from all commits
5397095
04d74ef
0f5e7f9
e328ffe
bc5d0c9
6ec4a4b
9b94dec
22b74e6
042bcfd
ea9446a
e68e56d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,21 +219,98 @@ module Schema = { | |
let coerceToJsonPgType = schema => { | ||
schema->S.preprocess(s => { | ||
switch s.schema->S.classify { | ||
| Literal(Null(_)) => {serializer: _ => %raw(`"null"`)} | ||
| Null(_) | ||
| Bool => {serializer: unknown => { | ||
if unknown === %raw(`null`) { | ||
%raw(`"null"`) | ||
} else if unknown === %raw(`false`) { | ||
%raw(`"false"`) | ||
} else if unknown === %raw(`true`) { | ||
%raw(`"true"`) | ||
} else { | ||
unknown | ||
} | ||
}} | ||
| _ => {} | ||
| Literal(Null(_)) => {serializer: _ => %raw(`"null"`)} | ||
| Null(_) | ||
| Bool => { | ||
serializer: unknown => { | ||
if unknown === %raw(`null`) { | ||
%raw(`"null"`) | ||
} else if unknown === %raw(`false`) { | ||
%raw(`"false"`) | ||
} else if unknown === %raw(`true`) { | ||
%raw(`"true"`) | ||
} else { | ||
unknown | ||
} | ||
}, | ||
} | ||
| _ => {} | ||
} | ||
}) | ||
} | ||
} | ||
|
||
module Set = { | ||
type t<'value> | ||
|
||
/* | ||
* Constructor | ||
*/ | ||
@ocaml.doc("Creates a new `Set` object.") @new | ||
external make: unit => t<'value> = "Set" | ||
|
||
@ocaml.doc("Creates a new `Set` object.") @new | ||
external fromEntries: array<'value> => t<'value> = "Set" | ||
Comment on lines
+242
to
+253
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of interest why rebind this whole module? Just to be explicit about what the bindings are? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To prevent the case when you expect it to use the bindings, but then it unexpectedly used |
||
|
||
/* | ||
* Instance properties | ||
*/ | ||
@ocaml.doc("Returns the number of values in the `Set` object.") @get | ||
external size: t<'value> => int = "size" | ||
|
||
/* | ||
* Instance methods | ||
*/ | ||
@ocaml.doc("Appends `value` to the `Set` object. Returns the `Set` object with added value.") | ||
@send | ||
external add: (t<'value>, 'value) => t<'value> = "add" | ||
|
||
@ocaml.doc("Removes all elements from the `Set` object.") @send | ||
external clear: t<'value> => unit = "clear" | ||
|
||
@ocaml.doc( | ||
"Removes the element associated to the `value` and returns a boolean asserting whether an element was successfully removed or not. `Set.prototype.has(value)` will return `false` afterwards." | ||
) | ||
@send | ||
external delete: (t<'value>, 'value) => bool = "delete" | ||
|
||
@ocaml.doc( | ||
"Returns a boolean asserting whether an element is present with the given value in the `Set` object or not." | ||
) | ||
@send | ||
external has: (t<'value>, 'value) => bool = "has" | ||
|
||
external toArray: t<'a> => array<'a> = "Array.from" | ||
|
||
/* | ||
* Iteration methods | ||
*/ | ||
/* | ||
/// NOTE - if we need iteration we can add this back - currently it requires the `rescript-js-iterator` library. | ||
@ocaml.doc( | ||
"Returns a new iterator object that yields the **values** for each element in the `Set` object in insertion order." | ||
) | ||
@send | ||
external values: t<'value> => Js_iterator.t<'value> = "values" | ||
|
||
@ocaml.doc("An alias for `Set.prototype.values()`.") @send | ||
external keys: t<'value> => Js_iterator.t<'value> = "values" | ||
|
||
@ocaml.doc("Returns a new iterator object that contains **an array of [value, value]** for each element in the `Set` object, in insertion order. | ||
|
||
This is similar to the [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object, so that each entry's `key` is the same as its `value` for a `Set`.") | ||
@send | ||
external entries: t<'value> => Js_iterator.t<('value, 'value)> = "entries" | ||
*/ | ||
@ocaml.doc( | ||
"Calls `callbackFn` once for each value present in the `Set` object, in insertion order." | ||
) | ||
@send | ||
external forEach: (t<'value>, 'value => unit) => unit = "forEach" | ||
|
||
@ocaml.doc( | ||
"Calls `callbackFn` once for each value present in the `Set` object, in insertion order." | ||
) | ||
@send | ||
external forEachWithSet: (t<'value>, ('value, 'value, t<'value>) => unit) => unit = "forEach" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally to get rid of the old contract config