forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetFeatureFlagById.ts
157 lines (157 loc) · 6.15 KB
/
getFeatureFlagById.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/** Data related to a single Feature Flag, across any Environment that the flag is present in.* */
export interface GetFeatureFlagById {
/**
* The FeatureFlagData schema version used for this flag data.
*
* Placeholder to support potential schema changes in the future.
*/
schemaVersion?: '1.0' | string;
/** The identifier for the Feature Flag. Must be unique for a given Provider. */
id: string;
/**
* The identifier that users would use to reference the Feature Flag in their source code etc.
*
* Will be made available via the UI for users to copy into their source code etc.
*/
key: string;
/**
* An ID used to apply an ordering to updates for this Feature Flag in the case of out-of-order receipt of update
* requests.
*
* This can be any monotonically increasing number. A suggested implementation is to use epoch millis from the
* Provider system, but other alternatives are valid (e.g. a Provider could store a counter against each Feature Flag
* and increment that on each update to Jira).
*
* Updates for a Feature Flag that are received with an updateSqeuenceId lower than what is currently stored will be
* ignored.
*/
updateSequenceId: number;
/**
* The human-readable name for the Feature Flag. Will be shown in the UI.
*
* If not provided, will use the ID for display.
*/
displayName?: string;
/** The Jira issue keys to associate the Feature Flag information with. */
issueKeys: string[];
/**
* Summary information for a single Feature Flag.
*
* Providers may elect to provide information from a specific environment, or they may choose to 'roll up' information
* from across multiple environments - whatever makes most sense in the Provider system.
*
* This is the summary information that will be presented to the user on e.g. the Jira issue screen.
*/
summary: {
/**
* A URL users can use to link to a summary view of this flag, if appropriate.
*
* This could be any location that makes sense in the Provider system (e.g. if the summary information comes from a
* specific environment, it might make sense to link the user to the flag in that environment).
*/
url?: string;
/** Status information about a single Feature Flag. */
status: {
/**
* Whether the Feature Flag is enabled in the given environment (or in summary).
*
* Enabled may imply a partial rollout, which can be described using the 'rollout' field.
*/
enabled: boolean;
/**
* The value served by this Feature Flag when it is disabled. This could be the actual value or an alias, as
* appropriate.
*
* This value may be presented to the user in the UI.
*/
defaultValue?: string;
/**
* Information about the rollout of a Feature Flag in an environment (or in summary).
*
* Only one of 'percentage', 'text', or 'rules' should be provided. They will be used in that order if multiple
* are present.
*
* This information may be presented to the user in the UI.
*/
rollout?: {
/** If the Feature Flag rollout is a simple percentage rollout */
percentage?: number;
/** A text status to display that represents the rollout. This could be e.g. a named cohort. */
text?: string;
/** A count of the number of rules active for this Feature Flag in an environment. */
rules?: number;
};
};
/**
* The last-updated timestamp to present to the user as a summary of the state of the Feature Flag.
*
* Providers may choose to supply the last-updated timestamp from a specific environment, or the 'most recent'
* last-updated timestamp across all environments - whatever makes sense in the Provider system.
*
* Expected format is an RFC3339 formatted string.
*/
lastUpdated: string;
};
/**
* Detail information for this Feature Flag.
*
* This may be information for each environment the Feature Flag is defined in or a selection of environments made by
* the user, as appropriate.
*/
details: {
/** A URL users can use to link to this Feature Flag, in this environment. */
url: string;
/**
* The last-updated timestamp for this Feature Flag, in this environment.
*
* Expected format is an RFC3339 formatted string.
*/
lastUpdated: string;
/**
* Details of a single environment.
*
* At the simplest this must be the name of the environment.
*
* Ideally there is also type information which may be used to group data from multiple Feature Flags and other
* entities for visualisation in the UI.
*/
environment: {
/** The name of the environment. */
name: string;
/** The 'type' or 'category' of environment this environment belongs to. */
type?: 'development' | 'testing' | 'staging' | 'production' | string;
};
/** Status information about a single Feature Flag. */
status: {
/**
* Whether the Feature Flag is enabled in the given environment (or in summary).
*
* Enabled may imply a partial rollout, which can be described using the 'rollout' field.
*/
enabled: boolean;
/**
* The value served by this Feature Flag when it is disabled. This could be the actual value or an alias, as
* appropriate.
*
* This value may be presented to the user in the UI.
*/
defaultValue?: string;
/**
* Information about the rollout of a Feature Flag in an environment (or in summary).
*
* Only one of 'percentage', 'text', or 'rules' should be provided. They will be used in that order if multiple
* are present.
*
* This information may be presented to the user in the UI.
*/
rollout?: {
/** If the Feature Flag rollout is a simple percentage rollout */
percentage?: number;
/** A text status to display that represents the rollout. This could be e.g. a named cohort. */
text?: string;
/** A count of the number of rules active for this Feature Flag in an environment. */
rules?: number;
};
};
}[];
}