How to debounce rebuild triggers (e.g. Contentful and GitHub Actions) - github-actions

I have a static site (Gatsby) that builts with GitHub Actions and uses data that is organized in Contentful. The content changes frequently in a row (like 10 changes within 10 minutes) and this currently results in the page being recreated multiple times in a row for no reason.
Is there any simple mechanism (in GitHub or Contentful) that can be used handle this issue?
If not, what might be useful approaches to handle this problem?

Contentful DevRel here. 👋
Depending on the needs, I see people implementing static regeneration in different ways.
Rebuild after triggered web hooks
Define and send auto-save or publish webhooks from Contentful to your build server to trigger a regeneration. As you described this can lead to a lot of rebuilds depending on how busy the users in your Contentful space are.
Add a build trigger to the Contentful UI
Contentful's App framework lets you extend the contentful interface with custom UI. For e.g. you could set up this custom webhook app built by the community that allows you to trigger builds on a button click.
For Netlify, there's an integration available. Unfortunately, as of now for other build pipelines (Vercel, Travis, GitHub Action), it would need to be something custom.
For your case, I recommend having a look at a custom build trigger in the UI.

Related

using window.env variables to show/hide React component

Is it good idea to show/hide React component using window.env
for example we have feature which we are not ready to release yet,so we are thinking of hiding it using window.env.FEATURE_ENABLED=0 (these vars will be picked by api call to service that serves bundle to browser)
But,I am thinking its risky since user can look at windows.env and set window.env.FEATURE_ENABLED=1 and start seeing the workflow which we intend to hide.
Could anyone please provide their take on this.
Yes, it could potentially be risky for the reason you say.
A better approach would be to only include finished features in the production build - unfinished features that are still in testing should not be sent to the client. For such features, have a separate build. Host it:
On a local dev server (usually one running on the developer's personal machine) (great when one is making rapid changes), or
On a staging server - one that's accessible to all developers, and works similarly to the live site, but isn't the same as the production URL
A staging server is the professional approach when multiple devs need access to it at once. It can take some work at first to integrate it into your build process, but it's worth it for larger projects.

How do I know which NetSuite integration option to choose (suiteTalk, suitelet or restlet) for integrating NetSuite to our third party application?

I am trying to integrate our third party application with NetSuite. I want to be able to import sales invoice details generated from our third party system (which uses REST API) into the NetSuite invoice form.
The frequency of import is not too crucial- an immediate import will be ideal, but sending data once a day is fine as well.
I want to know what I have to use to do this API integration - SuiteTalk, RESTlet or Suitelet.
I am completely new to this topic and after a few days of research, I learned that there are 3 options for an API integration with netsuite (Suitelets, restlets and suitetalk which comprises REST and SOAP based web services). I also learned that there are scheduled scripts and user events, but I'm not too clear on the idea.
I need some help identifying which integration option I should choose.
Any and all information about netsuite API integration is appreciated!
I would avoid REST/SOAP. SOAP is outdated, and REST is incomplete and difficult to use.
Suitelet's are for when you want to present your own custom UI to frontend users, like a special new kind of custom form not relevant to any particular record. Probably not what you want.
What you probably want is to design a restlet. A restlet is a way for you to setup your own custom url inside NetSuite that your program can talk to from outside NetSuite. Like a webpage. You can pass in data to the restlet either inside the URL, or inside the body of an HTTP request (e.g. like a JSON object), and you can get data back out from the body of the HTTP response.
A restlet is a part of SuiteTalk. The method of authenticating a restlet is the same for the method of authenticating a request to the REST API. So, learning about SuiteTalk is helpful. The code you use to write the restlet, SuiteScript, is the same kind of code used to write suitelets and other kinds of scripts.
So you will want to learn about SuiteTalk, and then, in particular, SuiteTalk restlets.
this is a really subjective issue.
It used to be that SOAP/SuiteTalk was a little easier in terms of infrastructure and since Netsuite's offerings are ever changing the REST/SuiteTalk might fill this space in the future.
Since Netsuite deprecated the Full Access role setting up integrations almost always involves the integrator having to provide a permissions spec. The easiest way to do that is via a Bundle. For token based authentication (TBA) there also needs to be an integration record from which you need Consumer Id and Secret Tokens.
So as of this writing the set up for SOAP/SuiteTalk and RESTLets is roughly the same. The easiest way to communicate these is with a bundle so if you are a Netsuite dev with a dev account you can set these up in a bundle and have your customer import them.
So equal so far but differences:
SOAP/Suitetalk is slow. IMO not suiteable for an interactive interface
SOAP/Suitetalk the code is all in your external app so changes to the code don't require any changes in the target account.
RESTlets can be pretty speedy. I've used these for client interactions.
Updates require re-loading your bundle or overwriting your bundle files in the target account (with the resulting havoc if an admin refreshes the bundle)
RESTlets give you access to the features of the account on which you are running so that code can run appropriate chunks For instance features such as matrix items, multi-location inventory, one-world, pick/pack/ship, volume pricing, multi-currency will all change the data model of the account your code is running against. RESTlets can detect which features are enabled; SOAP/SuiteTalk cannot.
So really the only advantage at this point that I see for SOAP/Suitetalk is that code updates don't require access to the target account.
Who is making the changes? If it is your NetSuite developers, then your options are SUITELET or RESTLET.
If its your third-party application team, they own the code and the process and do all their work sitting outside of NetSuite - your option is SUITETALK/SOAP. Of course, they need to know something about NetSuite, but your business analyst would be sufficient to support them. As of 2020.1+, there is also support for native REST APIs in addition to SOAP in case you still want to use REST, but not write your own RESTLETS.
As the above comments mention, Suitetalk does perform a little slower than calling RESTLETS. So that maybe one of the deciding factors.
You may consider SUITELETs for integration only if you want to bypass all authentication schemes, by setting the suitelet as public. Highly inadvisable though.
If the third-party application supports REST APIs, you could call them directly from within NetSuite - either from user events or from scheduled scripts.
You can also consider iPAAS platforms like Dell Boomi, Celigo, Jitterbit, etc. These are general-purpose integration platforms, and make connecting one platform to another easy, with minimal coding. If your Company is already invested in these iPAAS platforms for other enterprise applications, then the choice is that much simpler.

Bim360 Forge get a list of changed items

Our organization is using Bim360 Docs. I'm writing a service that should stay constantly updated with any changes to documents/folders in the project. I'm using WebHook API to achieve this.
Everything works fine if service is always running, but if it would crash or there would be any maintenance then it would inevitably miss some webhook calls and would never know that some file/folder was updated, moved or deleted.
What I'm looking for is a way to get all changes in the project files/folders that happened while my service was offline. Something like GET projects/:project_id/changes?sinceTs=1588764730.
If there is no such method then during a "cold start" I would need to walk through project hierarchy comparing versions (or mtime) of the files/folders to find what has changed. This is doable but could take a lot of time, as our typical project contains ~6k folders.
If there is no such method then during a "cold start" I would need to walk through project hierarchy
Optimally it'd best to consider set up a cluster of redundant instances so you could update/maintain each one of them and still have the ability to receive callbacks available as a whole or at least have a stand-in service to receive and persist (temporarily) the callbacks for your app to come back online and consume
I'd suggest to have an always-on gateway (such as a FaaS on AWS/Azure etc) with the availability to either trap the callbacks when your app is down for maintenance or redirect them to your stand-in.

tvOS - Display web content

First off - our needs don't require any sort of interaction with the web view, we simply want to display content from the web.
Situation: we want to make a glorified slide show that pulls in web content. We were intending on having a list of templates shown to the user on the TV app, they can pick one, and then the appropriate URL is hit for that template (which would live on the web). The web portion would handle things from there, navigating to a new URL every X seconds (which just displays the next set of data in the same template)
In learning that web views are restricted, and you can't sneak an app submission by apple while utilizing a web view, we've hit a dead end. Having hundreds of templates that are all hard coded doesn't seem maintainable for us to do, plus we can't deliver a new template to users (er.. clients) without going through the potentially lengthy app approval process every time.
Does anyone have any other bright ideas for storing templates on the web, maybe even in a data format, that we can download and interpret/parse in-app to know where to position image views, labels, etc?
Thanks for any suggestions!
I know I'm a little late to the party, but I wanted to answer your secondary question. It is absolutely possible to load TVML files from the web without updating the tvOS submitted app. We have a published tvOS app that is currently doing this.
As I recall, the tvOS app we submitted is very basic, with the only real change being the TVBaseURL. We placed all of our TVJS files on Google App Engine and the TVML files are in the GAE Storage bucket, so the TVBaseURL points to the public URL for those files. I have a cron job that reads an API and dynamically builds the TVML files several times a day. When the TVOS app runs, it loads the files from the GAE Storage bucket. The real benefit is that I can update the TVML layout and add or delete screens as needed without ever needing to go through the app submission process.

http push django comet

I want to make a django server to refresh the content that you approach the database, if the idea is to first make the user see the current contents of the database and as the valley became the new content, this content comes and is placed above the previous content without reloading the page, in another part of the site is to make you change the current content with the new as it gets to the database?
evserver clearer is my choice, but really do not know how and what would be the most simple and efficient?
I think you should avoid HTTP Polling. Here's why:
if the frequency of the setInterval combined with the number of users on your web app is going to lead to a big resource drain. If you go through slides 9 to 19 in this presentation you'll see some quite dramatic figures for using Push (Note: this example uses a hosted service but hosting your own realtime server and using Push also has similar benefits)
between setInterval calls the data displayed in your app is potentially out of data. Using a Push technology means the instant that new data is available it can be push and displayed in your app. You don't want users looking at an app and thinking they are seeing correct information when they are not.
You should take a the following StackOverflow questions:
Django / Comet (Push): Least of all evils?
Need help understanding Comet in Python (with Django)
For Python/Comet see:
Python Comet Server
The latest recommendation for Comet in Python?
I'd recommend you also start considering "WebSockets" as well as "Comet". Most Comet servers now prefer to use a WebSocket connection when possible.
If you'd prefer to avoid installing and managing your own Comet/WebSocket solution then you could use a realtime hosted service which will allow you Push data through them using a REST API and your clients can receive events by embedding a JavaScript library and writing a small about of code to subscribe and receive the event.
The steps are quite straightforward:
Write a model to store data in DB
Write a view that will generate JSON-serialized data upon POST request.
Write a template that will contain JavaScript with setInterval() that will
proceed AJAX requests to the view and render recieved data. (I'd suggest using JQuery as it's well documented and widespread).