launchdarkly-node-client-sdk
Advanced tools
| name: Publish Documentation | ||
| description: 'Publish documentation to github pages.' | ||
| inputs: | ||
| github_token: | ||
| description: 'The github token to use for committing' | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.2 | ||
| name: 'Publish to Github pages' | ||
| with: | ||
| docs_path: docs | ||
| github_token: ${{ inputs.github_token }} |
| name: Publish to NPM | ||
| description: Publish an npm package. | ||
| inputs: | ||
| prerelease: | ||
| description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.' | ||
| required: false | ||
| dry-run: | ||
| description: 'Is this a dry run. If so no package will be published.' | ||
| required: false | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Publish | ||
| shell: bash | ||
| run: | | ||
| ./scripts/publish-npm.sh | ||
| env: | ||
| LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }} | ||
| LD_RELEASE_IS_DRYRUN: ${{ inputs.dry-run }} |
| name: Build and Test | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths-ignore: | ||
| - '**.md' #Do not need to run CI for markdown changes. | ||
| pull_request: | ||
| branches: [main] | ||
| paths-ignore: | ||
| - '**.md' | ||
| jobs: | ||
| build-test: | ||
| strategy: | ||
| matrix: | ||
| variations: [ | ||
| {os: ubuntu-latest, node: latest}, | ||
| {os: ubuntu-latest, node: 18} | ||
| ] | ||
| runs-on: ${{ matrix.variations.os }} | ||
| env: | ||
| TEST_SERVICE_PORT: 8000 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.variations.node }} | ||
| registry-url: 'https://registry.npmjs.org' | ||
| - name: Install | ||
| run: npm install | ||
| - name: Test | ||
| run: npm test | ||
| - name: Lint | ||
| run: npm run lint:all | ||
| - name: Check typescript | ||
| run: npm run check-typescript | ||
| - name: Run contract test service | ||
| run: npm run contract-test-service 2>&1 & | ||
| - uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.0.0 | ||
| with: | ||
| test_service_port: ${{ env.TEST_SERVICE_PORT }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Build Docs | ||
| run: npm run doc |
| name: Lint PR title | ||
| on: | ||
| pull_request_target: | ||
| types: | ||
| - opened | ||
| - edited | ||
| - synchronize | ||
| jobs: | ||
| lint-pr-title: | ||
| uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main |
| name: Release Please | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| release-please: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| release_created: ${{ steps.release.outputs.release_created }} | ||
| steps: | ||
| - uses: googleapis/release-please-action@v4 | ||
| id: release | ||
| with: | ||
| token: ${{secrets.GITHUB_TOKEN}} | ||
| publish-package: | ||
| runs-on: ubuntu-latest | ||
| needs: ['release-please'] | ||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
| registry-url: 'https://registry.npmjs.org' | ||
| - uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0 | ||
| name: 'Get NPM token' | ||
| with: | ||
| aws_assume_role: ${{ vars.AWS_ROLE_ARN }} | ||
| ssm_parameter_pairs: '/production/common/releasing/npm/token = NODE_AUTH_TOKEN' | ||
| - name: Install Dependencies | ||
| run: npm install | ||
| - id: publish-npm | ||
| name: Publish NPM Package | ||
| uses: ./.github/actions/publish-npm | ||
| with: | ||
| dry-run: 'false' | ||
| prerelease: 'false' | ||
| - name: Build Documentation | ||
| run: npm run doc | ||
| - id: publish-docs | ||
| name: Publish Documentation | ||
| uses: ./.github/actions/publish-docs | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} |
| { | ||
| ".": "3.3.0" | ||
| } |
| { | ||
| "bootstrap-sha": "aef46172aa8ae518d18e456f573e35bec8f542b0", | ||
| "packages": { | ||
| ".": { | ||
| "release-type": "node", | ||
| "include-v-in-tag": false, | ||
| "include-component-in-tag": false | ||
| } | ||
| } | ||
| } |
| #!/usr/bin/env bash | ||
| if $LD_RELEASE_IS_DRYRUN ; then | ||
| echo "Doing a dry run of publishing." | ||
| else | ||
| if $LD_RELEASE_IS_PRERELEASE ; then | ||
| echo "Publishing with prerelease tag." | ||
| npm publish --tag prerelease --provenance --access public || { echo "npm publish failed" >&2; exit 1; } | ||
| else | ||
| npm publish --provenance --access public || { echo "npm publish failed" >&2; exit 1; } | ||
| fi | ||
| fi |
+17
| { | ||
| "$schema": "https://typedoc.org/schema.json", | ||
| "name": "launchdarkly-node-client-sdk", | ||
| "includeVersion": true, | ||
| "entryPoints": [ | ||
| "typings.d.ts", | ||
| ], | ||
| "readme": "none", | ||
| "visibilityFilters": { | ||
| "protected": false, | ||
| "private": false, | ||
| "inherited": true, | ||
| "external": true, | ||
| "@alpha": false, | ||
| "@beta": false | ||
| } | ||
| } |
+11
-0
@@ -5,2 +5,13 @@ # Change log | ||
| ## [3.3.0](https://github.com/launchdarkly/node-client-sdk/compare/3.2.1...3.3.0) (2024-10-18) | ||
| ### Features | ||
| * Add support for client-side prerequisite events. ([#49](https://github.com/launchdarkly/node-client-sdk/issues/49)) ([7495877](https://github.com/launchdarkly/node-client-sdk/commit/7495877e9bcff857b3ba6cef36e0de8a9120c57e)) | ||
| ## [3.2.1] - 2024-05-23 | ||
| ### Fixed: | ||
| - Updated `launchdarkly-evensource` to version `2.0.3` which includes improvements to error handling and shutdown of SSE streams. | ||
| ## [3.2.0] - 2024-05-01 | ||
@@ -7,0 +18,0 @@ ### Added: |
@@ -29,2 +29,3 @@ const express = require('express'); | ||
| 'anonymous-redaction', | ||
| 'client-prereq-events', | ||
| ], | ||
@@ -31,0 +32,0 @@ }); |
+6
-5
| { | ||
| "name": "launchdarkly-node-client-sdk", | ||
| "version": "3.2.1", | ||
| "version": "3.3.0", | ||
| "description": "LaunchDarkly Client-Side SDK for Node.js", | ||
@@ -21,3 +21,4 @@ "author": "LaunchDarkly <team@launchdarkly.com>", | ||
| "contract-test-harness": "curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/main/downloader/run.sh \\ | VERSION=v2 PARAMS=\"-url http://localhost:8000 -debug -stop-service-at-end $TEST_HARNESS_PARAMS\" sh", | ||
| "contract-tests": "npm run contract-test-service & npm run contract-test-harness" | ||
| "contract-tests": "npm run contract-test-service & npm run contract-test-harness", | ||
| "doc": "typedoc" | ||
| }, | ||
@@ -44,4 +45,4 @@ "engines": { | ||
| "prettier": "2.7.1", | ||
| "typescript": "^4.8.4", | ||
| "typedoc": "^0.23.24" | ||
| "typescript": "~5.4.5", | ||
| "typedoc": "^0.25.13" | ||
| }, | ||
@@ -70,3 +71,3 @@ "jest": { | ||
| "launchdarkly-eventsource": "2.0.3", | ||
| "launchdarkly-js-sdk-common": "5.2.0", | ||
| "launchdarkly-js-sdk-common": "5.4.0", | ||
| "node-localstorage": "^1.3.1" | ||
@@ -73,0 +74,0 @@ }, |
+24
-15
@@ -0,4 +1,14 @@ | ||
| /** | ||
| * This is the API reference for the LaunchDarkly Client-Side Node SDK. | ||
| * | ||
| * | ||
| * In typical usage, you will call {@link initialize} once at startup time to obtain an instance of | ||
| * {@link LDClient}, which provides access to all of the SDK's functionality. | ||
| * | ||
| * For more information, see the [SDK reference guide](https://docs.launchdarkly.com/sdk/client-side/node-js). | ||
| * | ||
| * @packageDocumentation | ||
| */ | ||
| declare module 'launchdarkly-node-client-sdk' { | ||
| //// DOCBUILD-START-REPLACE (see docs/Makefile) | ||
| export * from 'launchdarkly-js-sdk-common'; | ||
@@ -17,3 +27,2 @@ | ||
| } from 'launchdarkly-js-sdk-common'; | ||
| //// DOCBUILD-END-REPLACE | ||
@@ -30,4 +39,4 @@ /** | ||
| * The client will begin attempting to connect to LaunchDarkly as soon as it is created. To | ||
| * determine when it is ready to use, call [[LDClient.waitForInitialization]], or register an | ||
| * event listener for the `"ready"` event using [[LDClient.on]]. | ||
| * determine when it is ready to use, call {@link LDClient.waitForInitialization}, or register an | ||
| * event listener for the `"ready"` event using {@link LDClient.on}. | ||
| * | ||
@@ -37,3 +46,3 @@ * @param envKey | ||
| * @param context | ||
| * The initial context properties. These can be changed later with [[LDClient.identify]]. | ||
| * The initial context properties. These can be changed later with {@link LDClient.identify}. | ||
| * The context must have a `key` property, except that if you omit `context.key` and set `context.anonymous` to | ||
@@ -67,4 +76,4 @@ * true, the SDK will create a randomized unique key (which will be cached in local storage for the | ||
| * of the TLS-related parameters supported by `https.request()`, such as `ca`, `cert`, and `key`. | ||
| * This object should be stored in the `tlsParams` property of [[LDOptions]]. | ||
| * | ||
| * This object should be stored in the `tlsParams` property of {@link LDOptions}. | ||
| * | ||
| * For more information, see the Node documentation for `https.request()` and `tls.connect()`. | ||
@@ -88,3 +97,3 @@ */ | ||
| * | ||
| * Applications should configure the client at startup time with [[initialize]], and reuse the same instance. | ||
| * Applications should configure the client at startup time with {@link initialize}, and reuse the same instance. | ||
| * | ||
@@ -97,10 +106,10 @@ * For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/client-side/node-js). | ||
| /** | ||
| * Provides a simple [[LDLogger]] implementation. | ||
| * Provides a simple {@link LDLogger} implementation. | ||
| * | ||
| * This logging implementation uses a simple format that includes only the log level | ||
| * and the message text. Output is written to the standard error stream (`console.error`). | ||
| * You can filter by log level as described in [[BasicLoggerOptions.level]]. | ||
| * You can filter by log level as described in {@link BasicLoggerOptions.level}. | ||
| * | ||
| * To use the logger created by this function, put it into [[LDOptions.logger]]. If | ||
| * you do not set [[LDOptions.logger]] to anything, the SDK uses a default logger | ||
| * To use the logger created by this function, put it into {@link LDOptions.logger}. If | ||
| * you do not set {@link LDOptions.logger} to anything, the SDK uses a default logger | ||
| * that is equivalent to `ld.basicLogger({ level: 'info' })`. | ||
@@ -110,3 +119,3 @@ * | ||
| * logger uses `{ level: 'info' }`. | ||
| * | ||
| * | ||
| * @example | ||
@@ -130,5 +139,5 @@ * This example shows how to use `basicLogger` in your SDK options to enable console | ||
| */ | ||
| export function basicLogger( | ||
| export function basicLogger( | ||
| options?: BasicLoggerOptions | ||
| ): LDLogger; | ||
| } |
| This is the API reference for the LaunchDarkly Client-Side Node SDK. | ||
| In typical usage, you will call [[initialize]] in the main process at startup time to obtain an | ||
| an instance of [[LDClient]]. | ||
| For more information, see the [SDK reference guide](https://docs.launchdarkly.com/sdk/client-side/node-js). | ||
| # The TypeDoc build for this module is more complicated than for ldclient-node because it takes some of | ||
| # its types from launchdarkly-js-sdk-common. TypeDoc unfortunately does not understand the directive | ||
| # "export * from 'launchdarkly-js-sdk-common'" - so, by default, even though it does see the common types (like | ||
| # LDUser), it will not include them in the output. | ||
| # | ||
| # The current solution is to run TypeDoc on a hacked-together file that puts all of the types directly | ||
| # into one package. The sed commands below create this temporary declaration file by taking our types file | ||
| # and replacing the launchdarkly-js-sdk-common imports with the actual contents of the launchdarkly-js-sdk-common module. | ||
| # We then run TypeDoc from the docs directory, which contains its own tsconfig.json that points to the | ||
| # temporarily file instead of the original files. | ||
| # | ||
| .PHONY: html prepare | ||
| html: prepare | ||
| ../node_modules/.bin/typedoc --options typedoc.js | ||
| prepare: | ||
| rm -rf build | ||
| mkdir build | ||
| @# Extract the whole module declaration from launchdarkly-js-sdk-common, then remove the first and last lines | ||
| sed -n '/^declare module/,/^}/p' ../node_modules/launchdarkly-js-sdk-common/typings.d.ts | \ | ||
| sed '1d;$$d' \ | ||
| >build/common-excerpt | ||
| @# Replace the block from DOCBUILD-START-REPLACE to DOCBUILD-END-REPLACE with that excerpt | ||
| sed -e '/DOCBUILD-END-REPLACE/r build/common-excerpt' ../typings.d.ts | \ | ||
| sed -e '/DOCBUILD-START-REPLACE/,/DOCBUILD-END-REPLACE/d' >build/typings.d.ts |
| { | ||
| "compilerOptions": { | ||
| "module": "commonjs", | ||
| "strict": true, | ||
| "lib": [ | ||
| "es6" | ||
| ] | ||
| }, | ||
| "files": [ | ||
| "build/typings.d.ts" | ||
| ] | ||
| } |
| // Note that the format of this file is barely documented on the TypeDoc site. In general, | ||
| // the properties are equivalent to the command-line options described here: | ||
| // https://typedoc.org/api/ | ||
| let version = process.env.VERSION; | ||
| if (!version) { | ||
| const package = require('../package.json'); | ||
| version = package.version; | ||
| } | ||
| module.exports = { | ||
| out: './build/html', | ||
| name: 'LaunchDarkly Client-Side Node SDK (' + version + ')', | ||
| readme: 'doc.md', | ||
| entryPointStrategy: 'resolve', // Allows us to specify the specific entrypoints. | ||
| entryPoints: ["./build/typings.d.ts"] // This is the updated version created by the makefile. | ||
| }; |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
88024
3.69%49
11.36%1072
1.23%+ Added
- Removed