feat(aqua-compiler)!: JS-client aqua wrapper [fixes DXJ-461] (#347)

* Implement wrapper compiler

* Small formatting fixes

* Add simple test

* Package rename

* Add new package to release-please

* Misc fixes

* Fix object type

* Update package name

* Revert "Fix object type"

This reverts commit 572f1e10e2.

* Set string type

* Make generator func async

* Cleanup

* Code refactoring

* Fix PR comments

* Fix file path

* Refactor generate module

* Change header text

* Rename package

* Move some deps to devDeps

* Add a comment

* New index file

* Move aqua-api to devDeps

* Add desc

* Fix header

* Change return type

* Fix all tests

* Fix func

* Fix index file

* Add file entry

* Change package name (again)

* Snapshot testing

* Add func name

* Fix return type

* Fix nox images

* Update aurora image

* Conditional services

* Use function instead classes

* Refactor header

* Import same type

* Make named export

* Type generator array
This commit is contained in:
Akim
2023-09-21 15:32:27 +07:00
committed by GitHub
parent 580aff0042
commit 7fff3b1c03
22 changed files with 2600 additions and 38 deletions

View File

@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
type SomeNonArrowTypes = ScalarType | OptionType | ArrayType | StructType | TopType | BottomType;
type SimpleTypes = ScalarType | OptionType | ArrayType | StructType | TopType | BottomType | NilType;
export type NonArrowType = SomeNonArrowTypes | ProductType<SomeNonArrowTypes>;
export type NonArrowType = SimpleTypes | ProductType<SimpleTypes>;
export type TopType = {
/**
@ -108,35 +108,31 @@ export type StructType = {
fields: { [key: string]: NonArrowType };
};
export type LabeledProductType<T> =
| {
/**
* Type descriptor. Used for pattern-matching
*/
tag: 'labeledProduct';
export type LabeledProductType<T> = {
/**
* Type descriptor. Used for pattern-matching
*/
tag: 'labeledProduct';
/**
* Labelled product fields
*/
fields: { [key: string]: T };
}
| NilType;
/**
* Labelled product fields
*/
fields: { [key: string]: T };
};
export type UnlabeledProductType<T> =
| {
/**
* Type descriptor. Used for pattern-matching
*/
tag: 'unlabeledProduct';
export type UnlabeledProductType<T> = {
/**
* Type descriptor. Used for pattern-matching
*/
tag: 'unlabeledProduct';
/**
* Items in unlabelled product
*/
items: Array<T>;
}
| NilType;
/**
* Items in unlabelled product
*/
items: Array<T>;
};
export type ProductType<T> = UnlabeledProductType<T> | LabeledProductType<T>;
export type ProductType<T> = UnlabeledProductType<T> | LabeledProductType<T> | NilType;
/**
* ArrowType is a profunctor pointing its domain to codomain.
@ -238,7 +234,7 @@ export interface ServiceDef {
/**
* List of functions which the service consists of
*/
functions: LabeledProductType<ArrowWithoutCallbacks>;
functions: LabeledProductType<ArrowWithoutCallbacks> | NilType;
}
/**