Skip to content

Commit eb8d58e

Browse files
authored
Merging pull request #17973
* new components * pnpm-lock.yaml * pnpm-lock.yaml * versions * update
1 parent eca7334 commit eb8d58e

File tree

15 files changed

+527
-7
lines changed

15 files changed

+527
-7
lines changed

components/launchdarkly/actions/evaluate-feature-flag/evaluate-feature-flag.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "launchdarkly-evaluate-feature-flag",
55
name: "Evaluate Feature Flag",
66
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).",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
app,
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import app from "../../launchdarkly.app.mjs";
2+
3+
export default {
4+
key: "launchdarkly-get-feature-flag-status",
5+
name: "Get Feature Flag Status",
6+
description: "Get the status of a feature flag. [See the documentation](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag-status).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
projectKey: {
12+
propDefinition: [
13+
app,
14+
"project",
15+
],
16+
},
17+
environmentKey: {
18+
propDefinition: [
19+
app,
20+
"environment",
21+
({ projectKey }) => ({
22+
projectKey,
23+
}),
24+
],
25+
},
26+
featureFlagKey: {
27+
propDefinition: [
28+
app,
29+
"flag",
30+
({
31+
projectKey, environmentKey,
32+
}) => ({
33+
projectKey,
34+
environmentKey,
35+
}),
36+
],
37+
description: "The key of the feature flag to retrieve the status of",
38+
},
39+
},
40+
async run({ $ }) {
41+
const status = await this.app.getFeatureFlagStatus({
42+
$,
43+
projectKey: this.projectKey,
44+
environmentKey: this.environmentKey,
45+
featureFlagKey: this.featureFlagKey,
46+
});
47+
$.export("$summary", `Found feature flag status: ${status.name}`);
48+
return status;
49+
},
50+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import app from "../../launchdarkly.app.mjs";
2+
3+
export default {
4+
key: "launchdarkly-get-feature-flag",
5+
name: "Get Feature Flag",
6+
description: "Get a feature flag by key. [See the documentation](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
projectKey: {
12+
propDefinition: [
13+
app,
14+
"project",
15+
],
16+
},
17+
environmentKey: {
18+
propDefinition: [
19+
app,
20+
"environment",
21+
({ projectKey }) => ({
22+
projectKey,
23+
}),
24+
],
25+
},
26+
featureFlagKey: {
27+
propDefinition: [
28+
app,
29+
"flag",
30+
({
31+
projectKey, environmentKey,
32+
}) => ({
33+
projectKey,
34+
environmentKey,
35+
}),
36+
],
37+
description: "The key of the feature flag to retrieve",
38+
},
39+
},
40+
async run({ $ }) {
41+
const flag = await this.app.getFeatureFlag({
42+
$,
43+
projectKey: this.projectKey,
44+
featureFlagKey: this.featureFlagKey,
45+
});
46+
$.export("$summary", `Found feature flag ${flag.key}`);
47+
return flag;
48+
},
49+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import app from "../../launchdarkly.app.mjs";
2+
3+
export default {
4+
key: "launchdarkly-get-project",
5+
name: "Get Project",
6+
description: "Get a project by key. [See the documentation](https://launchdarkly.com/docs/api/projects/get-project).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
projectKey: {
12+
propDefinition: [
13+
app,
14+
"project",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const project = await this.app.getProject({
20+
projectKey: this.projectKey,
21+
});
22+
$.export("$summary", `Found project: ${project.name}`);
23+
return project;
24+
},
25+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import app from "../../launchdarkly.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "launchdarkly-list-environments",
6+
name: "List Environments",
7+
description: "List all environments. [See the documentation](https://launchdarkly.com/docs/api/environments/get-environments-by-project).",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
projectKey: {
13+
propDefinition: [
14+
app,
15+
"project",
16+
],
17+
},
18+
filter: {
19+
type: "string[]",
20+
label: "Filter",
21+
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.",
22+
optional: true,
23+
},
24+
sort: {
25+
type: "string",
26+
label: "Sort Field",
27+
description: "The field to sort by. Fields prefixed by a dash ( - ) sort in descending order.",
28+
options: [
29+
"createdOn",
30+
"-createdOn",
31+
"critical",
32+
"-critical",
33+
"name",
34+
"-name",
35+
],
36+
optional: true,
37+
},
38+
maxResults: {
39+
propDefinition: [
40+
app,
41+
"maxResults",
42+
],
43+
},
44+
},
45+
async run({ $ }) {
46+
// validate array props
47+
if (this.filter && !Array.isArray(this.filter)) {
48+
throw new ConfigurationError("Filter must be an array");
49+
}
50+
51+
const params = {
52+
filter: this.filter?.join(","),
53+
sort: this.sort,
54+
};
55+
56+
const environments = this.app.paginate({
57+
fn: this.app.listEnvironments,
58+
args: {
59+
$,
60+
projectKey: this.projectKey,
61+
params,
62+
},
63+
max: this.maxResults,
64+
});
65+
66+
const results = [];
67+
for await (const environment of environments) {
68+
results.push(environment);
69+
}
70+
71+
$.export("$summary", `Found ${results.length} environment${results.length === 1
72+
? ""
73+
: "s"}`);
74+
return results;
75+
},
76+
};
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import app from "../../launchdarkly.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "launchdarkly-list-feature-flags",
6+
name: "List Feature Flags",
7+
description: "List all feature flags. [See the documentation](https://launchdarkly.com/docs/api/feature-flags/get-feature-flags).",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
projectKey: {
13+
propDefinition: [
14+
app,
15+
"project",
16+
],
17+
},
18+
environmentKey: {
19+
propDefinition: [
20+
app,
21+
"environment",
22+
({ projectKey }) => ({
23+
projectKey,
24+
}),
25+
],
26+
},
27+
filter: {
28+
type: "string[]",
29+
label: "Filter",
30+
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.",
31+
optional: true,
32+
},
33+
expand: {
34+
type: "string[]",
35+
label: "Expand",
36+
description: "A list of properties that can reveal additional information in the response",
37+
options: [
38+
"codeReferences",
39+
"evaluation",
40+
"migrationSettings",
41+
],
42+
optional: true,
43+
},
44+
sort: {
45+
type: "string",
46+
label: "Sort Field",
47+
description: "The field to sort by. Fields prefixed by a dash ( - ) sort in descending order.",
48+
options: [
49+
"creationDate",
50+
"-creationDate",
51+
"key",
52+
"-key",
53+
"maintainerId",
54+
"-maintainerId",
55+
"name",
56+
"-name",
57+
"tags",
58+
"-tags",
59+
"targetingModifiedDate",
60+
"-targetingModifiedDate",
61+
"type",
62+
"-type",
63+
],
64+
optional: true,
65+
},
66+
maxResults: {
67+
propDefinition: [
68+
app,
69+
"maxResults",
70+
],
71+
},
72+
},
73+
async run({ $ }) {
74+
// validate array props
75+
if (this.filter && !Array.isArray(this.filter)) {
76+
throw new ConfigurationError("Filter must be an array");
77+
}
78+
if (this.expand && !Array.isArray(this.expand)) {
79+
throw new ConfigurationError("Expand must be an array");
80+
}
81+
82+
const params = {
83+
filter: this.filter?.join(","),
84+
expand: this.expand?.join(","),
85+
sort: this.sort,
86+
env: this.environmentKey,
87+
};
88+
89+
const flags = this.app.paginate({
90+
fn: this.app.listFeatureFlags,
91+
args: {
92+
$,
93+
projectKey: this.projectKey,
94+
params,
95+
},
96+
max: this.maxResults,
97+
});
98+
99+
const results = [];
100+
for await (const flag of flags) {
101+
results.push(flag);
102+
}
103+
104+
$.export("$summary", `Found ${results.length} feature flag${results.length === 1
105+
? ""
106+
: "s"}`);
107+
return results;
108+
},
109+
};

0 commit comments

Comments
 (0)