- LaunchDarklyApiClient
- LaunchDarklyLogger
- LaunchDarklyUtils
- LaunchDarklyUtilsFlags
- LaunchDarklyUtilsMembers
- LaunchDarklyUtilsProjects
- LaunchDarklyUtilsRoles
Used internally by LaunchDarklyUtils to create an instance of Swagger apiClient with interceptors configured
Kind: static method of LaunchDarklyApiClient
Fulfil: Swagger
apiClient generated by swagger-js
Reject: Error
object with message
Param | Type | Description |
---|---|---|
API_TOKEN | string |
from LaunchDarkly dashboard |
log | Object |
logger implementation |
openapiJsonString | string |
optional serialized json |
Get handle on Bunyan logger. This is the default logger if not supplied to utils.
Kind: static method of LaunchDarklyLogger
Create an instance of ldutils with api specific classes attached. This is the primary class used to access apis, as api grouping util classes are attached to this class.
Kind: instance method of LaunchDarklyUtils
Fulfil: LaunchDarklyUtils
Reject: Error
object with message
Param | Type | Description |
---|---|---|
API_TOKEN | string |
from LaunchDarkly dashboard |
customLogger | Object |
logger implementation, or 'console'. If not supplied, defaults to Bunyan logger |
swaggerYamlString | string |
optional serialized yaml |
Kind: global class
- LaunchDarklyUtilsFlags
- new LaunchDarklyUtilsFlags(apiClient, log, ldUtils)
- .API_GROUP ⇒
string
- .getFeatureFlags(projectKey) ⇒
Promise
- .getFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery) ⇒
Promise
- .getFeatureFlagState(projectKey, featureFlagKey, environmentKeyQuery) ⇒
Promise
- .updateFeatureFlag(projectKey, featureFlagKey, patch) ⇒
Promise
- .toggleFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery, value) ⇒
Promise
- .migrateFeatureFlag(projectKey, featureFlagKey, fromEnv, toEnv, includeState) ⇒
Promise
- .bulkMigrateFeatureFlags(projectKey, featureFlagKeys, fromEnv, toEnv, includeState) ⇒
Promise
- .restoreFeatureFlags(projectKey, featureFlagKeys, targetEnv, backupJsonFile, includeState) ⇒
Promise
Feature flag specific api functions attached as 'LaunchDarklyUtils.flags'
Returns: LaunchDarklyUtilsFlags
- feature flag api functions
Param | Type | Description |
---|---|---|
apiClient | Swagger |
generated launchdarkly apiClient |
log | Object |
logger implementation, or 'console' |
ldUtils | LaunchDarklyUtils |
primary utils class |
Api group object key in LD api
Kind: instance property of LaunchDarklyUtilsFlags
Get all feature flags in project
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: Object
feature flag list json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
Example
ldutils getFeatureFlags my-project
Get a single feature flag by key, and optional environment
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: Object
feature flag json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
featureFlagKey | string |
feature flag identifier |
environmentKeyQuery | string |
optional environment name |
Example
ldutils getFeatureFlag my-project my-flag dev
launchDarklyUtilsFlags.getFeatureFlagState(projectKey, featureFlagKey, environmentKeyQuery) ⇒ Promise
Get the boolean state of a single feature flag by key, and optional environment
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: boolean
true/false
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
featureFlagKey | string |
feature flag identifier |
environmentKeyQuery | string |
environment name |
Example
ldutils getFeatureFlagState my-project my-flag dev
patch a feature flag by key
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: Object
updated feature flag json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
featureFlagKey | string |
feature flag identifier |
patch | Array.<Object> |
array of valid json patch descriptors |
Example
ldutils updateFeatureFlag my-project my-flag {jsonPatch}
launchDarklyUtilsFlags.toggleFeatureFlag(projectKey, featureFlagKey, environmentKeyQuery, value) ⇒ Promise
Set the boolean state of a single feature flag by key, and environment name
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: Object
updated feature flag json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
featureFlagKey | string |
feature flag identifier |
environmentKeyQuery | string |
environment name |
value | boolean |
true or false |
Example
ldutils toggleFeatureFlag my-project my-flag dev true
launchDarklyUtilsFlags.migrateFeatureFlag(projectKey, featureFlagKey, fromEnv, toEnv, includeState) ⇒ Promise
Migrate feature flag properties between environments in a project. this includes: targets, rules, fallthrough, offVariation, prerequisites and optionally the flags on/off state.
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: Object
updated feature flag json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
featureFlagKey | string |
feature flag identifier |
fromEnv | string |
environment to copy flag attributes from |
toEnv | string |
environment to copy flag attributes to |
includeState | boolean |
optionally copy boolean state true/false |
Example
ldutils migrateFeatureFlag my-project my-flag dev test
launchDarklyUtilsFlags.bulkMigrateFeatureFlags(projectKey, featureFlagKeys, fromEnv, toEnv, includeState) ⇒ Promise
Migrate multiple feature flags properties between environments in a project. this includes: targets, rules, fallthrough, offVariation, prerequisites and optionally the flags on/off state.
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: Object
updated feature flag json array
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
featureFlagKeys | string |
comma-separated feature flag identifiers |
fromEnv | string |
environment to copy flag attributes from |
toEnv | string |
environment to copy flag attributes to |
includeState | boolean |
optionally copy boolean state true/false |
Example
ldutils bulkMigrateFeatureFlags my-project my-flag,my-flag-two dev test
launchDarklyUtilsFlags.restoreFeatureFlags(projectKey, featureFlagKeys, targetEnv, backupJsonFile, includeState) ⇒ Promise
Restore feature flags to state captured in a backup json file generated by getFeatureFlags(proj).
Kind: instance method of LaunchDarklyUtilsFlags
Fulfil: Object
updated feature flag json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | string |
project identifier |
featureFlagKeys | string |
feature flag identifiers comma separated |
targetEnv | string |
environment to restore flag attributes to |
backupJsonFile | string |
file to restore from from getFeatureFlags(proj) |
includeState | boolean |
optionally restore boolean state true/false |
Example
ldutils restoreFeatureFlags my-project my-flag,my-flag-two prod ./preReleaseBackup.json true
Kind: global class
- LaunchDarklyUtilsMembers
- new LaunchDarklyUtilsMembers(apiClient, log, ldUtils)
- .API_GROUP ⇒
string
- .getTeamMembers(limit, offset, filter) ⇒
Promise
- .getTeamMember(memberId) ⇒
Promise
- .getTeamMemberByEmail(emailAddress) ⇒
Promise
- .getTeamMemberCustomRoles(emailAddress) ⇒
Promise
- .inviteTeamMember(emailAddress, initialRoleKey) ⇒
Promise
Team member specific api functions attached as 'LaunchDarklyUtils.members'
Returns: LaunchDarklyUtilsMembers
- team member api functions
Param | Type | Description |
---|---|---|
apiClient | Swagger |
generated launchdarkly apiClient |
log | Object |
logger implementation, or 'console' |
ldUtils | LaunchDarklyUtils |
primary utils class |
Api group object key in LD api
Kind: instance property of LaunchDarklyUtilsMembers
Get all team members in account
Kind: instance method of LaunchDarklyUtilsMembers
Fulfil: Object
team member list json
Reject: Error
object with message
Param | Description |
---|---|
limit | max number of members to return (defaults to 20 per api) |
offset | starting offset to return |
filter | an optional filter https://apidocs.launchdarkly.com/reference#list-team-members |
Example
ldutils getTeamMembers
get a single team member by id
Kind: instance method of LaunchDarklyUtilsMembers
Fulfil: Object
team member object json
Reject: Error
object with message
Param | Description |
---|---|
memberId | _id field of team member |
Example
ldutils getTeamMember 5a3ad672761af020881a8814
Get a team member using a supplied email address
Kind: instance method of LaunchDarklyUtilsMembers
Fulfil: Object
team member json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
emailAddress | string |
email address of member to locate |
Example
ldutils getTeamMemberByEmail owner-sample-account@launchdarkly.com
Get a team member including customRoleKeys translated from customRoles array
Kind: instance method of LaunchDarklyUtilsMembers
Fulfil: Object
team member json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
emailAddress | string |
email address of member to locate |
Example
ldutils getTeamMemberCustomRoles owner-sample-account@launchdarkly.com
Invite a New Team Member by their Email Address
Kind: instance method of LaunchDarklyUtilsMembers
Fulfil: Object
Team Member JSON
Reject: Error
object with message
Param | Type | Default | Description |
---|---|---|---|
emailAddress | String |
Email Address of New Member | |
initialRoleKey | String |
reader |
Default Role for New Member |
Kind: global class
- LaunchDarklyUtilsProjects
- new LaunchDarklyUtilsProjects(apiClient, log, ldUtils)
- .API_GROUP ⇒
string
- .getProjects() ⇒
Promise
- .getProject(projectKey) ⇒
Promise
- .createProject(projectName, projectKey, includeInSnippetByDefault, tags, environments, defaultClientSideAvailability) ⇒
Promise
- .updateProject(projectKey, jsonPatch) ⇒
Promise
- .deleteProject(projectKey)
Projects specific api functions attached as 'LaunchDarklyUtils.projects'
Returns: LaunchDarklyUtilsMembers
- team member api functions
Param | Type | Description |
---|---|---|
apiClient | Swagger |
generated launchdarkly apiClient |
log | Object |
logger implementation, or 'console' |
ldUtils | LaunchDarklyUtils |
primary utils class |
Api group object key in LD api
Kind: instance property of LaunchDarklyUtilsProjects
Get all projects in account
Kind: instance method of LaunchDarklyUtilsProjects
Fulfil: Object
List of projects JSON
Reject: Error
object with message
Example
ldutils getProjects
get a single project by project key
Kind: instance method of LaunchDarklyUtilsProjects
Fulfil: Object
project object json
Reject: Error
object with message
Param | Description |
---|---|
projectKey | _id field of team member |
Example
ldutils getProject new-project
launchDarklyUtilsProjects.createProject(projectName, projectKey, includeInSnippetByDefault, tags, environments, defaultClientSideAvailability) ⇒ Promise
Create a project in the account
Kind: instance method of LaunchDarklyUtilsProjects
Fulfil: Object
project object json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectName | * |
the name of the project |
projectKey | * |
the key that identifies the project |
includeInSnippetByDefault | * |
boolean true / false of whether should include a snippet |
tags | * |
arrays of tags that can be associated with the project |
environments | * |
an array of environments that are associated with the account |
defaultClientSideAvailability | * |
An object that defines wether the SDK and / or mobile flags are available |
Example
ldutils createProject new-project 'New Project' 'false' dev,Development,#41705:test,Test,f5a623 'true' 'false' marketing,online
Patch a single project using jsonPatch notation
Kind: instance method of LaunchDarklyUtilsProjects
Fulfil: Object
an empty project
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | * |
projectKey a key that identifies the project |
jsonPatch | * |
an array of string using the JSON patch notation https://tools.ietf.org/html/rfc6902 |
Example
ldutils updateProject new-project [{ op: 'replace', path: '/name', value: 'New project name' }]
Delete a project
Kind: instance method of LaunchDarklyUtilsProjects
Fulfil: Object
an empty project
Reject: Error
object with message
Param | Type | Description |
---|---|---|
projectKey | * |
projectKey a key that identifies the project |
Example
ldutils deleteProject new-project
Kind: global class
- LaunchDarklyUtilsRoles
- new LaunchDarklyUtilsRoles(apiClient, log, ldUtils)
- .API_GROUP ⇒
string
- .getCustomRoles() ⇒
Promise
- .getCustomRole(customRoleKey) ⇒
Promise
- .getCustomRoleById(customRoleId) ⇒
Promise
- .createCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒
Promise
- .updateCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒
Promise
- .upsertCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒
Promise
- .bulkUpsertCustomRoles(roleBulkLoadFile) ⇒
Promise
- .bulkUpsertCustomRoleFolder(roleFolder) ⇒
Promise
Custom role specific api functions attached as 'LaunchDarklyUtils.roles'
Returns: LaunchDarklyUtilsRoles
- custom flag api functions
Param | Type | Description |
---|---|---|
apiClient | Swagger |
generated launchdarkly apiClient |
log | Object |
logger implementation, or 'console' |
ldUtils | LaunchDarklyUtils |
primary utils class |
Api group object key in LD api
Kind: instance property of LaunchDarklyUtilsRoles
Get all custom roles in account
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
custom role list json
Reject: Error
object with message
Example
ldutils getTeamMemberCustomRoles owner-sample-account@launchdarkly.com
Get a single custom role by key
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
custom role json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
customRoleKey | string |
custom role key |
Example
ldutils getCustomRole my-role
Get a single role by _id
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
custom role json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
customRoleId | string |
custom role _id |
Example
ldutils getCustomRoleById <id>
launchDarklyUtilsRoles.createCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒ Promise
Create a new custom role
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
custom role json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
customRoleKey | string |
custom role key |
customRoleName | string |
custom role name |
customRolePolicyArray | string |
array of policy objects per https://docs.launchdarkly.com/docs/custom-roles |
customRoleDescription | string |
user friendly description |
Example
ldutils createCustomRole my-role "My Role" [policyArrayJson] "some description"
launchDarklyUtilsRoles.updateCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒ Promise
Update an existing custom role
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
updated custom role json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
customRoleKey | string |
custom role key |
customRoleName | string |
custom role name |
customRolePolicyArray | string |
array of policy objects per https://docs.launchdarkly.com/docs/custom-roles |
customRoleDescription | string |
user friendly description |
Example
ldutils updateCustomRole my-role "My Role" [policyArrayJson] "some description"
launchDarklyUtilsRoles.upsertCustomRole(customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription) ⇒ Promise
Check for existence of role by key; update if exists, otherwise create new role
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
updated/created custom role json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
customRoleKey | string |
custom role key |
customRoleName | string |
custom role name |
customRolePolicyArray | string |
array of policy objects per https://docs.launchdarkly.com/docs/custom-roles |
customRoleDescription | string |
user friendly description |
Example
ldutils upsertCustomRole my-role "My Role" [policyArrayJson] "some description"
Load a file of custom role json, and update/create roles based on this
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
array of updated/created role json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
roleBulkLoadFile | string |
path to json file (eg. exampleRoleBulkLoad.json) |
Example
ldutils bulkUpsertCustomRoles ./my-roles.json
Create/update custom roles based on a folder of multiple json files
Kind: instance method of LaunchDarklyUtilsRoles
Fulfil: Object
array of updated/created role json
Reject: Error
object with message
Param | Type | Description |
---|---|---|
roleFolder | string |
path to folder containing json |
Example
ldutils bulkUpsertCustomRoleFolder ./my-roles-dir-containing json