headintheclouddev / typings-suitescript-2.0

TypeScript typings for SuiteScript version 2.0
MIT License
142 stars 89 forks source link

File.Type Enum #288

Open iaars opened 2 weeks ago

iaars commented 2 weeks ago

While looking into the MediaType over the Schema Browser over here and the NetSuite file.Type over here, I noticed that not all the possible values are mapped in the file.Type enum for the package, is there a reason for that?

ahowley commented 2 weeks ago

My best guess is that values in the namespace that aren't in the enum are either not officially supported, no longer officially supported, or are intentionally not able to be manipulated via SuiteScript. Would be an interesting experiment to try using them though, I wouldn't be shocked if some of them actually do exist in the enum and are just not documented.

iaars commented 2 weeks ago

If you log the file.Type it gives all the mentioned values as follows:

{
    "APPCACHE": "APPCACHE",
    "AUTOCAD": "AUTOCAD",
    "BMPIMAGE": "BMPIMAGE",
    "CERTIFICATE": "CERTIFICATE",
    "CONFIG": "CONFIG",
    "CSV": "CSV",
    "EXCEL": "EXCEL",
    "FLASH": "FLASH",
    "FREEMARKER": "FREEMARKER",
    "GIFIMAGE": "GIFIMAGE",
    "GZIP": "GZIP",
    "HTMLDOC": "HTMLDOC",
    "ICON": "ICON",
    "JAVASCRIPT": "JAVASCRIPT",
    "JPGIMAGE": "JPGIMAGE",
    "JSON": "JSON",
    "MESSAGERFC": "MESSAGERFC",
    "MP3": "MP3",
    "MPEGMOVIE": "MPEGMOVIE",
    "MSPROJECT": "MSPROJECT",
    "PDF": "PDF",
    "PJPGIMAGE": "PJPGIMAGE",
    "PLAINTEXT": "PLAINTEXT",
    "PNGIMAGE": "PNGIMAGE",
    "POSTSCRIPT": "POSTSCRIPT",
    "POWERPOINT": "POWERPOINT",
    "QUICKTIME": "QUICKTIME",
    "RTF": "RTF",
    "SCSS": "SCSS",
    "SMS": "SMS",
    "STYLESHEET": "STYLESHEET",
    "SVG": "SVG",
    "TAR": "TAR",
    "TIFFIMAGE": "TIFFIMAGE",
    "VISIO": "VISIO",
    "WEBAPPPAGE": "WEBAPPPAGE",
    "WEBAPPSCRIPT": "WEBAPPSCRIPT",
    "WORD": "WORD",
    "XMLDOC": "XMLDOC",
    "XSD": "XSD",
    "ZIP": "ZIP"
}

They are there, I don't know if there is a specific reason for them not being in the package

MrRob commented 2 weeks ago

I think I'd be fine with including those if someone wants to create a PR. We recently merged in a PR for a similar thing for record.Type

ShawnTalbert commented 2 weeks ago

My only caution is the same one around all enums we've defined in this lib. In SS1.0 we had no enums - we had raw strings. If the spirit of the enum-like objects provided by NetSuite in SS 2.x is to abstract the values, we should be careful about assigning values to the enum object.

If the [NetSuite designers] spirit was to just make the values more conveniently packaged, then having values defined as well as the keys should be fine.

In either case, certainly having ALL the keys represented makes sense for this lib?

ahowley commented 2 weeks ago

Worth mentioning that WOFF and WOFF2 are present in the schema browser, but not in the logged enum/docs - this was all I meant, I misunderstood that there are documented keys missing from the enum in this package

MrRob commented 2 weeks ago

@iaars Were you wanting to have the string values in the enum? Or were you more concerned about the file types that we didn't have listed at all?

iaars commented 2 weeks ago

The one I tested was with the string values, but I think that a stringless one should work too