Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "launchdarkly-evaluate-feature-flag",
name: "Evaluate Feature Flag",
description: "Evaluates an existing feature flag for a specific user or in a general context. [See the documentation](https://apidocs.launchdarkly.com/tag/Contexts#operation/evaluateContextInstance).",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
app,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import app from "../../launchdarkly.app.mjs";

export default {
key: "launchdarkly-get-feature-flag-status",
name: "Get Feature Flag Status",
description: "Get the status of a feature flag. [See the documentation](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag-status).",
version: "0.0.1",
type: "action",
props: {
app,
projectKey: {
propDefinition: [
app,
"project",
],
},
environmentKey: {
propDefinition: [
app,
"environment",
({ projectKey }) => ({
projectKey,
}),
],
},
featureFlagKey: {
propDefinition: [
app,
"flag",
({
projectKey, environmentKey,
}) => ({
projectKey,
environmentKey,
}),
],
description: "The key of the feature flag to retrieve the status of",
},
},
async run({ $ }) {
const status = await this.app.getFeatureFlagStatus({
$,
projectKey: this.projectKey,
environmentKey: this.environmentKey,
featureFlagKey: this.featureFlagKey,
});
$.export("$summary", `Found feature flag status: ${status.name}`);
return status;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import app from "../../launchdarkly.app.mjs";

export default {
key: "launchdarkly-get-feature-flag",
name: "Get Feature Flag",
description: "Get a feature flag by key. [See the documentation](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag).",
version: "0.0.1",
type: "action",
props: {
app,
projectKey: {
propDefinition: [
app,
"project",
],
},
environmentKey: {
propDefinition: [
app,
"environment",
({ projectKey }) => ({
projectKey,
}),
],
},
featureFlagKey: {
propDefinition: [
app,
"flag",
({
projectKey, environmentKey,
}) => ({
projectKey,
environmentKey,
}),
],
description: "The key of the feature flag to retrieve",
},
},
async run({ $ }) {
const flag = await this.app.getFeatureFlag({
$,
projectKey: this.projectKey,
featureFlagKey: this.featureFlagKey,
});
$.export("$summary", `Found feature flag ${flag.key}`);
return flag;
},
};
25 changes: 25 additions & 0 deletions components/launchdarkly/actions/get-project/get-project.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import app from "../../launchdarkly.app.mjs";

export default {
key: "launchdarkly-get-project",
name: "Get Project",
description: "Get a project by key. [See the documentation](https://launchdarkly.com/docs/api/projects/get-project).",
version: "0.0.1",
type: "action",
props: {
app,
projectKey: {
propDefinition: [
app,
"project",
],
},
},
async run({ $ }) {
const project = await this.app.getProject({
projectKey: this.projectKey,
});
$.export("$summary", `Found project: ${project.name}`);
return project;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import app from "../../launchdarkly.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "launchdarkly-list-environments",
name: "List Environments",
description: "List all environments. [See the documentation](https://launchdarkly.com/docs/api/environments/get-environments-by-project).",
version: "0.0.1",
type: "action",
props: {
app,
projectKey: {
propDefinition: [
app,
"project",
],
},
filter: {
type: "string[]",
label: "Filter",
description: "A list of filters. Each filter is of the form `field:value`. Example: `query:abc`. [See the documentation](https://launchdarkly.com/docs/api/environments/get-environments-by-project#filtering-environments) for supported fields.",
optional: true,
},
sort: {
type: "string",
label: "Sort Field",
description: "The field to sort by. Fields prefixed by a dash ( - ) sort in descending order.",
options: [
"createdOn",
"-createdOn",
"critical",
"-critical",
"name",
"-name",
],
optional: true,
},
maxResults: {
propDefinition: [
app,
"maxResults",
],
},
},
async run({ $ }) {
// validate array props
if (this.filter && !Array.isArray(this.filter)) {
throw new ConfigurationError("Filter must be an array");
}
if (this.expand && !Array.isArray(this.expand)) {
throw new ConfigurationError("Expand must be an array");
}

const params = {
filter: this.filter?.join(","),
sort: this.sort,
};

const environments = this.app.paginate({
fn: this.app.listEnvironments,
args: {
$,
projectKey: this.projectKey,
params,
},
max: this.maxResults,
});

const results = [];
for await (const environment of environments) {
results.push(environment);
}

$.export("$summary", `Found ${results.length} environment${results.length === 1
? ""
: "s"}`);
return results;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import app from "../../launchdarkly.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "launchdarkly-list-feature-flags",
name: "List Feature Flags",
description: "List all feature flags. [See the documentation](https://launchdarkly.com/docs/api/feature-flags/get-feature-flags).",
version: "0.0.1",
type: "action",
props: {
app,
projectKey: {
propDefinition: [
app,
"project",
],
},
environmentKey: {
propDefinition: [
app,
"environment",
({ projectKey }) => ({
projectKey,
}),
],
},
filter: {
type: "string[]",
label: "Filter",
description: "A list of filters. Each filter is of the form `field:value`. Example: `query:dark-mode`. [See the documentation](https://launchdarkly.com/docs/api/feature-flags/get-feature-flags#filtering-flags) for supported fields.",
optional: true,
},
expand: {
type: "string[]",
label: "Expand",
description: "A list of properties that can reveal additional information in the response",
options: [
"codeReferences",
"evaluation",
"migrationSettings",
],
optional: true,
},
sort: {
type: "string",
label: "Sort Field",
description: "The field to sort by. Fields prefixed by a dash ( - ) sort in descending order.",
options: [
"creationDate",
"-creationDate",
"key",
"-key",
"maintainerId",
"-maintainerId",
"name",
"-name",
"tags",
"-tags",
"targetingModifiedDate",
"-targetingModifiedDate",
"type",
"-type",
],
optional: true,
},
maxResults: {
propDefinition: [
app,
"maxResults",
],
},
},
async run({ $ }) {
// validate array props
if (this.filter && !Array.isArray(this.filter)) {
throw new ConfigurationError("Filter must be an array");
}
if (this.expand && !Array.isArray(this.expand)) {
throw new ConfigurationError("Expand must be an array");
}

const params = {
filter: this.filter?.join(","),
expand: this.expand?.join(","),
sort: this.sort,
env: this.environmentKey,
};

const flags = this.app.paginate({
fn: this.app.listFeatureFlags,
args: {
$,
projectKey: this.projectKey,
params,
},
max: this.maxResults,
});

const results = [];
for await (const flag of flags) {
results.push(flag);
}

$.export("$summary", `Found ${results.length} feature flag${results.length === 1
? ""
: "s"}`);
return results;
},
};
Loading
Loading