Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: DVC-9059 pull out EnvironmentConfigManager to its own library, change nodejs build to define external pacakges #564

Merged
merged 11 commits into from
Oct 24, 2023

Conversation

jonathannorris
Copy link
Member

@jonathannorris jonathannorris commented Sep 26, 2023

  • Update NodeJS build process to bundle libraries that are not defined in the package.json / external under the build step.
  • Pull out EnvironmentConfigManager into a generic lib to be used by the Edge Worker SDK
  • Other libs like the server request handling will be pulled into libs with further stacked PRs.

@vercel
Copy link

vercel bot commented Sep 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
js-sdks-next-js ❌ Failed (Inspect) Oct 24, 2023 7:29pm
js-sdks-web-elements ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2023 7:29pm
js-sdks-with-provider ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2023 7:29pm

@jonathannorris jonathannorris requested review from ajwootto and a team September 26, 2023 20:54
@jonathannorris jonathannorris marked this pull request as ready for review September 26, 2023 20:54
@jonathannorris jonathannorris force-pushed the DVC-9055-add-cf-example-app branch from f669994 to 5351674 Compare September 26, 2023 21:13
@jonathannorris jonathannorris force-pushed the DVC-9059-add-bundled-libraries branch from 4493435 to 51b013c Compare September 26, 2023 21:13
@jonathannorris jonathannorris changed the title feat: pull out EnvironmentConfigManager to its own library, change nodejs build to define external pacakges feat: DVC-9059 pull out EnvironmentConfigManager to its own library, change nodejs build to define external pacakges Sep 26, 2023
sdk/nodejs/project.json Outdated Show resolved Hide resolved
@@ -17,12 +21,18 @@ export class EnvironmentConfigManager {
private readonly requestTimeoutMS: number
private readonly cdnURI: string
fetchConfigPromise: Promise<void>
private intervalTimeout?: NodeJS.Timeout
private intervalTimeout?: any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this need to be any?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically because NodeJS.Timeout isn't supported in webworker / browser environments, they just return a number I believe. So the strategy here was to add a setInterval + clearInterval interface that would be passed in, so this needs to be an Any if we want it to compile when used in the non-NodeJS SDKs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you wanted to get fancy you could use a type generic for this. Type it so that the generic is what is returned by the SetIntervalInterface and then use the same generic here.


constructor(
logger: DVCLogger,
sdkKey: string,
setConfigBuffer: SetConfigBuffer,
setInterval: SetIntervalInterface,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this polling config fetcher seems very specific to the nodejs local bucketing SDK, what purpose would it serve in the worker SDK other than to fetch it once?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workers do last for a while (I think I've seen 10's of minutes if not longer), we'd still want polling for them.

@jonathannorris jonathannorris force-pushed the DVC-9055-add-cf-example-app branch from 5351674 to 6ae5b9f Compare September 29, 2023 15:41
@jonathannorris jonathannorris force-pushed the DVC-9059-add-bundled-libraries branch from ed1fb2d to d811b17 Compare September 29, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants