Extend the Core method chain in DataForm

80 Views Asked by At

We are developing a model in DataForm using Javascript.

https://cloud.google.com/dataform/docs/develop-workflows-js?hl=ja

We would like to extend some behaviors, for the domain we want to use.

More specifically, we would like to create an adapter for the method chain provided by core.

--additional question bellow-----

I would like to add custom attributes to the configration to make it easier to use.

columns: {
    person_name: {
        description: "", pkey: true, { person_name: { person_name: { person_name
        pkey: true,
        policyTags:["PII"]]
    },.

Some attributes require a postProcess, but we want the definition to be in one place, so for example, depending on the contents of the puplish, the postProcess will need to process it. For this we need a method chain adapter

const methodChainAdapter = {
    publish: function(tname, config){
        ... Keep the contents of the arguments, etc.
        return this;
    }, }
    query: function(lambdaOfquery){
        ... keep the contents of the argument, etc.
        return this; }
    }

}

I would like to do something that delays the process by wrapping it in an adapter and using dataformSDK at an arbitrary time.

However, the end of processing varies from use case to use case. I am not sure how to solve this well.

For example, we could write an adapter like this in the js inculude and extend it

var publish = function(tableName, _config) {
    return {
        query: function(lambdaOfquery) {
            .........
            const monad = dataform.publish(tableName, config(_config)).query(context => lambdaOfquery(context));
            .........
            
        }
    }; }

This seems to work, but I can't seem to get it to work for an optional process like postOps, i.e., a process that may or may not be executed.

I would appreciate any advice on extending core in general.

0

There are 0 best solutions below