Skip to content

Commit 3c482d6

Browse files
committed
new components
1 parent 24202ef commit 3c482d6

File tree

9 files changed

+524
-1
lines changed

9 files changed

+524
-1
lines changed
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: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
if (this.expand && !Array.isArray(this.expand)) {
51+
throw new ConfigurationError("Expand must be an array");
52+
}
53+
54+
const params = {
55+
filter: this.filter?.join(","),
56+
sort: this.sort,
57+
};
58+
59+
const environments = this.app.paginate({
60+
fn: this.app.listEnvironments,
61+
args: {
62+
$,
63+
projectKey: this.projectKey,
64+
params,
65+
},
66+
max: this.maxResults,
67+
});
68+
69+
const results = [];
70+
for await (const environment of environments) {
71+
results.push(environment);
72+
}
73+
74+
$.export("$summary", `Found ${results.length} environment${results.length === 1
75+
? ""
76+
: "s"}`);
77+
return results;
78+
},
79+
};
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+
};
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import app from "../../launchdarkly.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "launchdarkly-list-members",
6+
name: "List Members",
7+
description: "List all members in an account. [See the documentation](https://launchdarkly.com/docs/api/account-members/get-members).",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
filter: {
13+
type: "string[]",
14+
label: "Filter",
15+
description: "A list of filters. Each filter is of the form `field:value`. Example: `query:abc`. [See the documentation](https://launchdarkly.com/docs/api/account-members/get-members#filtering-members) for supported fields.",
16+
optional: true,
17+
},
18+
expand: {
19+
type: "string[]",
20+
label: "Expand",
21+
description: "A list of properties that can reveal additional information in the response",
22+
options: [
23+
"customRoles",
24+
"roleAttributes",
25+
],
26+
optional: true,
27+
},
28+
sort: {
29+
type: "string",
30+
label: "Sort Field",
31+
description: "The field to sort by. Fields prefixed by a dash ( - ) sort in descending order.",
32+
options: [
33+
"displayName",
34+
"-displayName",
35+
"lastSeen",
36+
"-lastSeen",
37+
],
38+
optional: true,
39+
},
40+
maxResults: {
41+
propDefinition: [
42+
app,
43+
"maxResults",
44+
],
45+
},
46+
},
47+
async run({ $ }) {
48+
// validate array props
49+
if (this.filter && !Array.isArray(this.filter)) {
50+
throw new ConfigurationError("Filter must be an array");
51+
}
52+
if (this.expand && !Array.isArray(this.expand)) {
53+
throw new ConfigurationError("Expand must be an array");
54+
}
55+
56+
const params = {
57+
filter: this.filter?.join(","),
58+
expand: this.expand?.join(","),
59+
sort: this.sort,
60+
};
61+
62+
const members = this.app.paginate({
63+
fn: this.app.listAccountMembers,
64+
args: {
65+
$,
66+
params,
67+
},
68+
max: this.maxResults,
69+
});
70+
71+
const results = [];
72+
for await (const member of members) {
73+
results.push(member);
74+
}
75+
76+
$.export("$summary", `Found ${results.length} member${results.length === 1
77+
? ""
78+
: "s"}`);
79+
return results;
80+
},
81+
};

0 commit comments

Comments
 (0)