tableau / wdc3

Web Data Connector (WDC), connecting to web application data from Tableau.
6 stars 0 forks source link

Build fails with taco-toolkit v2.1.0 #33

Open fcruzel opened 6 months ago

fcruzel commented 6 months ago

Build fails with taco-toolkit v2.1.0 if any of the imports contains ; at the end of the sentence or if they use doble quotes. E.g.:

import {
  type DataContainer,
  DataType,
  log,
  type ParseOptions,
  Parser,
} from '@tableau/taco-toolkit/handlers'

interface FeatureRow {
  id: string;
  properties: {
    mag: number; // notice ;
    title: string;
  };
  geometry: {
    type: string;
    coordinates: [number, number, number];
  };
}

will compile, but

import {
  type DataContainer,
  DataType,
  log,
  type ParseOptions,
  Parser,
} from '@tableau/taco-toolkit/handlers'; // notice ;

interface FeatureRow {
  id: string;
  properties: {
    mag: number;
    title: string;
  };
  geometry: {
    type: string;
    coordinates: [number, number, number];
  };
}

won't compile, giving this error:

"C:\Program Files\nodejs\npm.cmd" run dev

> dev
> npm run build && npm run start --debug --verbose

> build
> taco-scripts build

i Start building taco connector
× Failed to build connector/handlers

[Status Code] CANCELLED
[Error Source] client
[EPS Error Code] ZUWGQ7DL
[Error Message] Connector handlers failed to build: BuildError. Failed to resolve '@tableau/taco-toolkit/handlers' from './tmp/MyParser.ts'. Origin: @parcel/core. Code import {
  type DataContainer,
  DataType,
  log,
  type ParseOptions,
  Parser,
} from '@tableau/taco-toolkit/handlers';

interface FeatureRow {
  id: string;
  properties: {
    mag: number;
    title: string;
  };
  geometry: {                                                                                                                                                                   
    type: string;
    coordinates: [number, number, number];
  };
}

interface FetcherResult {
  features: FeatureRow[];
}

export default class MyParser extends Parser<FetcherResult> {
  parse(
    fetcherResult: FetcherResult,
    { dataContainer }: ParseOptions,
  ): DataContainer {
    const tableName = "My Sample Data";
    log(`parsing started for '${tableName}'`);

    const containerBuilder = Parser.createContainerBuilder(dataContainer);
    const { isNew, tableBuilder } = containerBuilder.getTable(tableName);

    if (isNew) {
      tableBuilder.setId("mySampleData");
      tableBuilder.addColumnHeaders([
        {
          id: "id",
          dataType: DataType.String,
        },
        {
          id: "mag",
          alias: "magnitude",
          dataType: DataType.Float,
        },
        {
          id: "title",
          alias: "title",
          dataType: DataType.String,
        },
        {
          id: "location",
          dataType: DataType.Geometry,
        },
      ]);
    }

    tableBuilder.addRows(
      fetcherResult.features.map((row) => {
        return {
          id: row.id,
          mag: row.properties.mag,
          title: row.properties.title,
          location: row.geometry,
        };
      }),
    );

    return containerBuilder.getDataContainer();
  }
}
globalRefs["MyParser"] = MyParser, At C:\Users\Fran\tableauwdc3\connector\tmp\MyParser.ts, [Ln 7, Col 8]. Cannot load file './handlers' from module '@tableau/taco-toolkit'. Hints: . Origin: @parcel/resolver-default.

Stacktrace: undefined

I'm using taco-scripts 2.1.0 with node 18.19.1

you should be able to replicate this issue creating a boilerplate project with taco and adding a ';' to any of the imports located in MyFetcher.ts or MyParser.ts.

anstosa commented 2 months ago

Removing the ; in my files don't help but I'm also getting node module resolution failures with v2.*