@productcraft/flags 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +25 -2
  2. package/dist/{chunk-ZL3B6RIH.cjs → browser/chunk-DIPMYL6H.cjs} +45 -52
  3. package/dist/browser/chunk-DIPMYL6H.cjs.map +1 -0
  4. package/dist/{chunk-UI25HRYK.js → browser/chunk-OI4KARX6.js} +46 -53
  5. package/dist/browser/chunk-OI4KARX6.js.map +1 -0
  6. package/dist/{chunk-SYCVHW7C.js → browser/chunk-UFZYZXX5.js} +4 -4
  7. package/dist/browser/chunk-UFZYZXX5.js.map +1 -0
  8. package/dist/{chunk-3KVHTUZO.cjs → browser/chunk-YAW7UFU3.cjs} +4 -4
  9. package/dist/browser/chunk-YAW7UFU3.cjs.map +1 -0
  10. package/dist/browser/index.cjs +105 -0
  11. package/dist/browser/index.cjs.map +1 -0
  12. package/dist/browser/index.js +9 -0
  13. package/dist/browser/index.js.map +1 -0
  14. package/dist/browser/management.cjs +12 -0
  15. package/dist/browser/management.cjs.map +1 -0
  16. package/dist/browser/management.js +3 -0
  17. package/dist/browser/management.js.map +1 -0
  18. package/dist/browser/testing.cjs +1315 -0
  19. package/dist/browser/testing.cjs.map +1 -0
  20. package/dist/browser/testing.js +1307 -0
  21. package/dist/browser/testing.js.map +1 -0
  22. package/dist/chunk-ERCRURB5.js +1584 -0
  23. package/dist/{chunk-SYCVHW7C.js.map → chunk-ERCRURB5.js.map} +1 -1
  24. package/dist/chunk-ERZAYN5A.js +626 -0
  25. package/dist/chunk-ERZAYN5A.js.map +1 -0
  26. package/dist/chunk-HOIKWDWQ.cjs +1584 -0
  27. package/dist/{chunk-3KVHTUZO.cjs.map → chunk-HOIKWDWQ.cjs.map} +1 -1
  28. package/dist/chunk-J62ZCSIV.cjs +631 -0
  29. package/dist/chunk-J62ZCSIV.cjs.map +1 -0
  30. package/dist/index.cjs +8 -8
  31. package/dist/index.js +2 -2
  32. package/dist/management.cjs +2 -2
  33. package/dist/management.js +1 -1
  34. package/dist/testing.cjs +3 -3
  35. package/dist/testing.js +1 -1
  36. package/package.json +47 -4
  37. package/dist/chunk-UI25HRYK.js.map +0 -1
  38. package/dist/chunk-ZL3B6RIH.cjs.map +0 -1
@@ -0,0 +1,1584 @@
1
+ 'use strict';
2
+
3
+ var core = require('@productcraft/core');
4
+
5
+ // src/_generated/client.ts
6
+
7
+ // src/_generated/resources.ts
8
+ function fillActor(params, bound) {
9
+ if (bound.actor_id === void 0) return params;
10
+ const p = params ?? {};
11
+ return p.actor_id === void 0 ? { ...p, actor_id: bound.actor_id } : p;
12
+ }
13
+ var APIResource = class {
14
+ _client;
15
+ /** Path parameters (and `actor_id`) bound by the enclosing scope. */
16
+ _b;
17
+ constructor(client, bound = {}) {
18
+ this._client = client;
19
+ this._b = bound;
20
+ }
21
+ };
22
+ var ChangesResource = class extends APIResource {
23
+ /**
24
+ * Get a change
25
+ *
26
+ * One change with `before`, `after`, a JSON Patch `diff` (RFC 6902) and the summary. When `before` and `after` together exceed 64 KB, `diff_too_large` is true and the bodies are left out: compare the revisions in `revisions` (`url`, `previous_url`) instead.
27
+ *
28
+ * @param changeId - Id of the change.
29
+ * @param options - Per-request options.
30
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
31
+ * @throws {NotFoundError} 404 NOT_FOUND, CHANGE_NOT_FOUND: `CHANGE_NOT_FOUND`: no such change in this workspace (or it was pruned).
32
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
33
+ * @see GET /v1/workspaces/{workspace_id}/changes/{change_id}
34
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-changes-change-id
35
+ * @example
36
+ * ```ts
37
+ * const changeDetail = await flags.changes.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
38
+ * ```
39
+ */
40
+ retrieve(changeId, options) {
41
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/changes/{change_id}", pathParams: { change_id: changeId } }, options);
42
+ }
43
+ /**
44
+ * Restore a version
45
+ *
46
+ * Writes the change's `before` back as a new change (`reverts_change_id` points to this one), through the same checks as an edit: validation, the protected-environment and note rules, and publishing. Supported for `setting_value.updated`, `segment.updated` and `setting.updated`. Send the entity's current `version` (the value or segment); a setting is restored only while it is still as this change left it. Needs `flags.value.update` plus what the original edit needed (`flags.value.update` on the environment and setting, or `flags.update`; `flags.protected.update` in protected environments).
47
+ *
48
+ * @param changeId - Id of the change.
49
+ * @param params - `Flags.ChangeRevertParams`.
50
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
51
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: `version` is missing (value and segment restores) or invalid.
52
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`). A restore needs the actions of the original edit too.
53
+ * @throws {NotFoundError} 404 NOT_FOUND, CHANGE_NOT_FOUND, SETTING_NOT_FOUND, SEGMENT_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `CHANGE_NOT_FOUND`; `SETTING_NOT_FOUND`, `SEGMENT_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND` when the entity was deleted since.
54
+ * @throws {ConflictError} 409 CONFLICT, VERSION_CONFLICT, KEY_ALREADY_EXISTS, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `VERSION_CONFLICT`: the entity changed since you read it (`details.current_version`), or the setting no longer matches this change. `KEY_ALREADY_EXISTS`: the restored key is taken. Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
55
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, REVERT_NOT_SUPPORTED, NOTHING_TO_RESTORE, INVALID_VALUE, INVALID_TARGETING, SEGMENT_NOT_FOUND, PREREQUISITE_NOT_FOUND, PREREQUISITE_TYPE_MISMATCH, CIRCULAR_PREREQUISITE, CONFIDENTIAL_LIST_NOT_EDITABLE, LIMIT_EXCEEDED, NOTE_REQUIRED, CONFIG_TOO_LARGE, OWNER_NOT_A_MEMBER: `REVERT_NOT_SUPPORTED`: this kind of change cannot be restored. `NOTHING_TO_RESTORE`: it already matches the version before this change. The restored or copied targeting is refused by the normal write checks: `INVALID_VALUE`, `INVALID_TARGETING`, `SEGMENT_NOT_FOUND` (a segment it used was deleted), `PREREQUISITE_NOT_FOUND`, `PREREQUISITE_TYPE_MISMATCH`, `CIRCULAR_PREREQUISITE`, `CONFIDENTIAL_LIST_NOT_EDITABLE`, `LIMIT_EXCEEDED`, `NOTE_REQUIRED` (the environment requires a `note`), `CONFIG_TOO_LARGE`, or `OWNER_NOT_A_MEMBER` (a restored owner left the workspace).
56
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
57
+ * @see POST /v1/workspaces/{workspace_id}/changes/{change_id}/revert
58
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-changes-change-id-revert
59
+ * @example
60
+ * ```ts
61
+ * const changeDetail = await flags.changes.revert("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { note: "Roll back FLAG-142" });
62
+ * ```
63
+ */
64
+ revert(changeId, params, options) {
65
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/changes/{change_id}/revert", pathParams: { change_id: changeId }, body: params, idempotent: true }, options);
66
+ }
67
+ };
68
+ var ConfigsEnvironmentsRevisionsResource = class extends APIResource {
69
+ /**
70
+ * List config revisions
71
+ *
72
+ * Published revisions of the config in one environment, newest first. Every write that changes what SDKs download publishes a revision; edits that do not (a description, a name) do not. The last 100 revisions, or 20 MiB of compressed snapshots, are kept, and the current one always.
73
+ *
74
+ * @param configId - Id of the config.
75
+ * @param environmentId - Id of an environment of the same project.
76
+ * @param params - `Flags.ConfigEnvironmentRevisionListParams`.
77
+ * @param options - Per-request options.
78
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad cursor or `limit`.
79
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
80
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`: no such config in this workspace, or the environment is not one of its project.
81
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
82
+ * @see GET /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/revisions
83
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-revisions
84
+ * @example
85
+ * ```ts
86
+ * for await (const revision of flags.configs.environments.revisions.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
87
+ * console.log(revision);
88
+ * }
89
+ * const page = await flags.configs.environments.revisions.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
90
+ * ```
91
+ */
92
+ list(configId, environmentId, params, options) {
93
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/revisions", pathParams: { config_id: configId, environment_id: environmentId }, query: params }, options);
94
+ }
95
+ /**
96
+ * Get a config revision
97
+ *
98
+ * The config JSON (schema 1) of one revision, byte for byte what SDKs download: keys, types, values, rules, segments and hashes, but no names, descriptions or cleartext of confidential lists. The response body is the document itself (no envelope).
99
+ *
100
+ * @param configId - Id of the config.
101
+ * @param environmentId - Id of an environment of the same project.
102
+ * @param revision - The revision number.
103
+ * @param options - Per-request options.
104
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: `revision` is not a positive integer.
105
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
106
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND, REVISION_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`: no such config in this workspace, or the environment is not one of its project. `REVISION_NOT_FOUND`: no such revision (never published, or pruned).
107
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
108
+ * @see GET /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/revisions/{revision}
109
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-revisions-revision
110
+ * @example
111
+ * ```ts
112
+ * const result = await flags.configs.environments.revisions.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "1");
113
+ * ```
114
+ */
115
+ retrieve(configId, environmentId, revision, options) {
116
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/revisions/{revision}", pathParams: { config_id: configId, environment_id: environmentId, revision } }, options);
117
+ }
118
+ };
119
+ var ConfigsEnvironmentsSdkKeysResource = class extends APIResource {
120
+ /**
121
+ * End the grace period
122
+ *
123
+ * Revokes the secondary key now instead of at its `expires_at`. SDK servers still using it get 404 within about 5 seconds. Recorded in the history (`sdk_key.grace_ended`) and the workspace audit log.
124
+ *
125
+ * @param configId - Id of the config.
126
+ * @param environmentId - Id of an environment of the same project.
127
+ * @param options - Per-request options.
128
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
129
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND, SDK_KEY_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`: no such config in this workspace, or the environment is not one of its project. `SDK_KEY_NOT_FOUND`: there is no secondary key.
130
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
131
+ * @see DELETE /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/secondary
132
+ * @see https://productcraft.co/docs/flags/api-reference#delete-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-sdk-keys-secondary
133
+ * @example
134
+ * ```ts
135
+ * const sdkKeyList = await flags.configs.environments.sdkKeys.endGracePeriod("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
136
+ * ```
137
+ */
138
+ endGracePeriod(configId, environmentId, options) {
139
+ return this._client.request({ method: "DELETE", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/secondary", pathParams: { config_id: configId, environment_id: environmentId } }, options);
140
+ }
141
+ /**
142
+ * List SDK keys
143
+ *
144
+ * The SDK keys of this config in this environment, masked (prefix and last four characters): the primary key, and the secondary key while a rotation's grace period runs. The first call for a new environment mints its primary key.
145
+ *
146
+ * @param configId - Id of the config.
147
+ * @param environmentId - Id of an environment of the same project.
148
+ * @param options - Per-request options.
149
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
150
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`: no such config in this workspace, or the environment is not one of its project.
151
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
152
+ * @see GET /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys
153
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-sdk-keys
154
+ * @example
155
+ * ```ts
156
+ * const sdkKeyList = await flags.configs.environments.sdkKeys.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
157
+ * ```
158
+ */
159
+ list(configId, environmentId, options) {
160
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys", pathParams: { config_id: configId, environment_id: environmentId } }, options);
161
+ }
162
+ /**
163
+ * Reveal SDK keys
164
+ *
165
+ * The full primary key, and the secondary key while a grace period runs. Needs `flags.sdk_key.reveal`; every call is recorded in the history (`sdk_key.revealed`) and the workspace audit log. Never cached. Whoever holds a key can download the whole config of this environment: keep server keys server-side.
166
+ *
167
+ * @param configId - Id of the config.
168
+ * @param environmentId - Id of an environment of the same project.
169
+ * @param options - Per-request options.
170
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
171
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`: no such config in this workspace, or the environment is not one of its project.
172
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
173
+ * @see POST /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/reveal
174
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-sdk-keys-reveal
175
+ * @example
176
+ * ```ts
177
+ * const revealedSdkKeyList = await flags.configs.environments.sdkKeys.reveal("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
178
+ * ```
179
+ */
180
+ reveal(configId, environmentId, options) {
181
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/reveal", pathParams: { config_id: configId, environment_id: environmentId } }, options);
182
+ }
183
+ /**
184
+ * Rotate the SDK key
185
+ *
186
+ * Mints a new primary key. The current primary becomes the secondary key and keeps working for `grace_hours` (default 24, at most 168; `0` revokes it at once); a previous secondary key is revoked. SDK servers pick up the change within about 5 seconds. The response is masked: reveal the new key separately.
187
+ *
188
+ * @param configId - Id of the config.
189
+ * @param environmentId - Id of an environment of the same project.
190
+ * @param params - `Flags.ConfigEnvironmentSdkKeyRotateParams`.
191
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
192
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: `grace_hours` is not an integer from 0 to 168, or `note` is too long.
193
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
194
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`: no such config in this workspace, or the environment is not one of its project.
195
+ * @throws {ConflictError} 409 CONFLICT, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
196
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
197
+ * @see POST /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/rotate
198
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-sdk-keys-rotate
199
+ * @example
200
+ * ```ts
201
+ * const sdkKeyList = await flags.configs.environments.sdkKeys.rotate("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { grace_hours: 24 });
202
+ * ```
203
+ */
204
+ rotate(configId, environmentId, params, options) {
205
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/sdk-keys/rotate", pathParams: { config_id: configId, environment_id: environmentId }, body: params, idempotent: true }, options);
206
+ }
207
+ };
208
+ var ConfigsEnvironmentsValuesResource = class extends APIResource {
209
+ /**
210
+ * List values in an environment
211
+ *
212
+ * Every setting of the config with its value and targeting in one environment (the flag list), in `ordinal` order. `include=states` adds each setting's compact state in every environment.
213
+ *
214
+ * @param configId - Id of the config.
215
+ * @param environmentId - Id of an environment of the same project.
216
+ * @param params - `Flags.ConfigEnvironmentValueListParams`.
217
+ * @param options - Per-request options.
218
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad cursor, `limit` or `include`.
219
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
220
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND` (not an environment of the config's project).
221
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
222
+ * @see GET /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/values
223
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-values
224
+ * @example
225
+ * ```ts
226
+ * for await (const value of flags.configs.environments.values.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
227
+ * console.log(value);
228
+ * }
229
+ * const page = await flags.configs.environments.values.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
230
+ * ```
231
+ */
232
+ list(configId, environmentId, params, options) {
233
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/values", pathParams: { config_id: configId, environment_id: environmentId }, query: params }, options);
234
+ }
235
+ };
236
+ var ConfigsEnvironmentsResource = class extends APIResource {
237
+ #revisions;
238
+ #sdkKeys;
239
+ #values;
240
+ get revisions() {
241
+ return this.#revisions ??= new ConfigsEnvironmentsRevisionsResource(this._client, this._b);
242
+ }
243
+ get sdkKeys() {
244
+ return this.#sdkKeys ??= new ConfigsEnvironmentsSdkKeysResource(this._client, this._b);
245
+ }
246
+ get values() {
247
+ return this.#values ??= new ConfigsEnvironmentsValuesResource(this._client, this._b);
248
+ }
249
+ /**
250
+ * Copy targeting between environments
251
+ *
252
+ * Copies value and targeting (rules, splits, split attribute) of `setting_ids`, or of every setting that differs (`all_differing: true`), from `source_environment_id` into this environment. All or nothing: send the target `version` of every setting that will be copied in `versions`; if any moved, nothing is written and 409 lists them. Publishes one config revision, with one history entry per setting. Needs `flags.value.update` on this environment and each setting, plus `flags.protected.update` when it is protected.
253
+ *
254
+ * @param configId - Id of the config.
255
+ * @param environmentId - Id of the target environment (same project as the config).
256
+ * @param params - `Flags.ConfigEnvironmentCopyParams`.
257
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
258
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: neither or both of `setting_ids` / `all_differing`, the source is the target, or a bad `versions` entry.
259
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`). Copies need `flags.value.update` on the environment and every setting, and `flags.protected.update` into a protected environment.
260
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND, SETTING_NOT_FOUND: `CONFIG_NOT_FOUND`, `ENVIRONMENT_NOT_FOUND` (target or source is not of this project) or `SETTING_NOT_FOUND`.
261
+ * @throws {ConflictError} 409 CONFLICT, VERSION_CONFLICT, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `VERSION_CONFLICT`: a setting changed in the target since you read it, or has no entry in `versions` (`details.conflicts[]`: `setting_id`, `key`, `current_version`, `sent_version`); nothing was copied. Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
262
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, INVALID_VALUE, INVALID_TARGETING, SEGMENT_NOT_FOUND, PREREQUISITE_NOT_FOUND, PREREQUISITE_TYPE_MISMATCH, CIRCULAR_PREREQUISITE, CONFIDENTIAL_LIST_NOT_EDITABLE, LIMIT_EXCEEDED, NOTE_REQUIRED, CONFIG_TOO_LARGE, OWNER_NOT_A_MEMBER: The restored or copied targeting is refused by the normal write checks: `INVALID_VALUE`, `INVALID_TARGETING`, `SEGMENT_NOT_FOUND` (a segment it used was deleted), `PREREQUISITE_NOT_FOUND`, `PREREQUISITE_TYPE_MISMATCH`, `CIRCULAR_PREREQUISITE`, `CONFIDENTIAL_LIST_NOT_EDITABLE`, `LIMIT_EXCEEDED`, `NOTE_REQUIRED` (the environment requires a `note`), `CONFIG_TOO_LARGE`, or `OWNER_NOT_A_MEMBER` (a restored owner left the workspace).
263
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
264
+ * @see POST /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/copy
265
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-copy
266
+ * @example
267
+ * ```ts
268
+ * const copyEnvironment = await flags.configs.environments.copy("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {
269
+ * source_environment_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
270
+ * versions: { "0b8f8a2c-4d3e-4f5a-8b6c-7d8e9f0a1b2c": 3 },
271
+ * });
272
+ * ```
273
+ */
274
+ copy(configId, environmentId, params, options) {
275
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/copy", pathParams: { config_id: configId, environment_id: environmentId }, body: params, idempotent: true }, options);
276
+ }
277
+ /**
278
+ * Test an evaluation
279
+ *
280
+ * Evaluates a sample user against the published config of this environment (the current revision, or `revision`) with the same engine the SDKs run, and returns the evaluation details per key: value, reason, the rule and percentage option that decided, and soft-miss warnings. Each setting's own value is the default. Nothing is stored and the user is never logged. Limited to 30 calls a minute per credential; the evaluation has a 250 ms budget (422 `EVALUATION_BUDGET_EXCEEDED`, ask for fewer keys).
281
+ *
282
+ * @param configId - Id of the config.
283
+ * @param environmentId - Id of an environment of the same project.
284
+ * @param params - `Flags.ConfigEnvironmentEvaluateParams`.
285
+ * @param options - Per-request options.
286
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: `user` is not an object or null, it has more than 200 attributes, more than 200 `keys`, or a bad `revision`.
287
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
288
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND, REVISION_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`: no such config in this workspace, or the environment is not one of its project. `REVISION_NOT_FOUND`: the requested revision was pruned or never published.
289
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, EVALUATION_BUDGET_EXCEEDED, INVALID_TARGETING: `EVALUATION_BUDGET_EXCEEDED`: the evaluation ran over 250 ms; ask for fewer keys. `INVALID_TARGETING`: the stored revision is not a config the engine accepts.
290
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
291
+ * @see POST /v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/evaluate
292
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-configs-config-id-environments-environment-id-evaluate
293
+ * @example
294
+ * ```ts
295
+ * const testEvaluation = await flags.configs.environments.evaluate("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { keys: ["new_checkout", "banner_text"] });
296
+ * ```
297
+ */
298
+ evaluate(configId, environmentId, params, options) {
299
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/evaluate", pathParams: { config_id: configId, environment_id: environmentId }, body: params }, options);
300
+ }
301
+ };
302
+ var ConfigsSettingsResource = class extends APIResource {
303
+ /**
304
+ * Create a setting
305
+ *
306
+ * Adds a feature flag (`boolean`) or a typed setting to the config, with a value in every environment (`initial_value`, else the type's zero). Needs `flags.create`; a non-zero `initial_value` is also a value write in every environment (protected ones need `flags.protected.update`).
307
+ *
308
+ * @param configId - Id of the config.
309
+ * @param params - `Flags.ConfigSettingsCreateParams`.
310
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
311
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is missing or invalid.
312
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
313
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND: `CONFIG_NOT_FOUND`: no such config in this workspace.
314
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `KEY_ALREADY_EXISTS`: the config already has a setting with this key. Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
315
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, INVALID_VALUE, LIMIT_EXCEEDED, OWNER_NOT_A_MEMBER, NOTE_REQUIRED, CONFIG_TOO_LARGE: `INVALID_VALUE`: `initial_value` does not match the type; `LIMIT_EXCEEDED`: the config has the maximum number of settings; `OWNER_NOT_A_MEMBER`: `owner_id` is not a workspace member; `NOTE_REQUIRED`. Publishing: `CONFIG_TOO_LARGE` (the rendered config would exceed 1 MiB; `details.size_bytes`, `max_bytes`) or `LIMIT_EXCEEDED` with `details.limit: comparison_values_per_config` (over 20,000 comparison values in the config); the write is not applied.
316
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
317
+ * @throws {InternalServerError} 503 SERVICE_UNAVAILABLE: `SERVICE_UNAVAILABLE`: the member lookup for `owner_id` is unavailable; retry.
318
+ * @see POST /v1/workspaces/{workspace_id}/configs/{config_id}/settings
319
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-configs-config-id-settings
320
+ * @example
321
+ * ```ts
322
+ * const settingDetail = await flags.configs.settings.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { key: "new_checkout", type: "boolean" });
323
+ * ```
324
+ */
325
+ create(configId, params, options) {
326
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/settings", pathParams: { config_id: configId }, body: params, idempotent: true }, options);
327
+ }
328
+ /**
329
+ * List settings
330
+ *
331
+ * The config's feature flags and settings, in `ordinal` order, with filters.
332
+ *
333
+ * @param configId - Id of the config.
334
+ * @param params - `Flags.ConfigSettingsListParams`.
335
+ * @param options - Per-request options.
336
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad filter, cursor or `limit`.
337
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
338
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND: `CONFIG_NOT_FOUND`: no such config in this workspace.
339
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
340
+ * @see GET /v1/workspaces/{workspace_id}/configs/{config_id}/settings
341
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-configs-config-id-settings
342
+ * @example
343
+ * ```ts
344
+ * for await (const settings of flags.configs.settings.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
345
+ * console.log(settings);
346
+ * }
347
+ * const page = await flags.configs.settings.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
348
+ * ```
349
+ */
350
+ list(configId, params, options) {
351
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/settings", pathParams: { config_id: configId }, query: params }, options);
352
+ }
353
+ };
354
+ var ConfigsResource = class extends APIResource {
355
+ #environments;
356
+ #settings;
357
+ get environments() {
358
+ return this.#environments ??= new ConfigsEnvironmentsResource(this._client, this._b);
359
+ }
360
+ get settings() {
361
+ return this.#settings ??= new ConfigsSettingsResource(this._client, this._b);
362
+ }
363
+ /**
364
+ * Compare environments
365
+ *
366
+ * Each setting's value and targeting side by side in 2-5 environments, with `differs` per setting.
367
+ *
368
+ * @param configId - Id of the config.
369
+ * @param params - `Flags.ConfigCompareParams`.
370
+ * @param options - Per-request options.
371
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: `environment_ids` is not 2-5 environment ids.
372
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
373
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `CONFIG_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`.
374
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
375
+ * @see GET /v1/workspaces/{workspace_id}/configs/{config_id}/compare
376
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-configs-config-id-compare
377
+ * @example
378
+ * ```ts
379
+ * for await (const config of flags.configs.compare("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {
380
+ * environment_ids: "0b8c7a52-5a8e-4b8f-9d0a-6b1f0e0c1a11,7c1d9e44-2f3a-4c55-8e6b-1a2b3c4d5e6f",
381
+ * })) {
382
+ * console.log(config);
383
+ * }
384
+ * ```
385
+ */
386
+ compare(configId, params, options) {
387
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/configs/{config_id}/compare", pathParams: { config_id: configId }, query: params }, options);
388
+ }
389
+ /**
390
+ * Delete a config
391
+ *
392
+ * Deletes the config with its flags, values and SDK keys in every environment. Needs `flags.project.manage`.
393
+ *
394
+ * @param configId - Id of the config.
395
+ * @param params - `Flags.ConfigDeleteParams`.
396
+ * @param options - Per-request options.
397
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
398
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND: `CONFIG_NOT_FOUND`: no such config in this workspace.
399
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
400
+ * @see DELETE /v1/workspaces/{workspace_id}/configs/{config_id}
401
+ * @see https://productcraft.co/docs/flags/api-reference#delete-v1-workspaces-workspace-id-configs-config-id
402
+ * @example
403
+ * ```ts
404
+ * await flags.configs.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
405
+ * ```
406
+ */
407
+ delete(configId, params, options) {
408
+ return this._client.request({ method: "DELETE", path: "/v1/workspaces/{workspace_id}/configs/{config_id}", pathParams: { config_id: configId }, query: params }, options);
409
+ }
410
+ /**
411
+ * Get a config
412
+ *
413
+ * @param configId - Id of the config.
414
+ * @param options - Per-request options.
415
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
416
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND: `CONFIG_NOT_FOUND`: no such config in this workspace.
417
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
418
+ * @see GET /v1/workspaces/{workspace_id}/configs/{config_id}
419
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-configs-config-id
420
+ * @example
421
+ * ```ts
422
+ * const config = await flags.configs.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
423
+ * ```
424
+ */
425
+ retrieve(configId, options) {
426
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/configs/{config_id}", pathParams: { config_id: configId } }, options);
427
+ }
428
+ /**
429
+ * Update a config
430
+ *
431
+ * Key, name, description or order. Only the fields you send change. Needs `flags.project.manage`.
432
+ *
433
+ * @param configId - Id of the config.
434
+ * @param params - `Flags.ConfigUpdateParams`.
435
+ * @param options - Per-request options.
436
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is invalid.
437
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
438
+ * @throws {NotFoundError} 404 NOT_FOUND, CONFIG_NOT_FOUND: `CONFIG_NOT_FOUND`: no such config in this workspace.
439
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS: `KEY_ALREADY_EXISTS`: the project already has a config with this key.
440
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
441
+ * @see PATCH /v1/workspaces/{workspace_id}/configs/{config_id}
442
+ * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-configs-config-id
443
+ * @example
444
+ * ```ts
445
+ * const config = await flags.configs.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { description: "string" });
446
+ * ```
447
+ */
448
+ update(configId, params, options) {
449
+ return this._client.request({ method: "PATCH", path: "/v1/workspaces/{workspace_id}/configs/{config_id}", pathParams: { config_id: configId }, body: params }, options);
450
+ }
451
+ };
452
+ var ImportsResource = class extends APIResource {
453
+ /**
454
+ * Import from ConfigCat
455
+ *
456
+ * Reads a ConfigCat product through ConfigCat's Public Management API with credentials you send for this one request (never stored, logged or cached), and maps it to a new Flags project: environments, configs, feature flags and settings (seed = the ConfigCat key, so every user stays in the same percentage bucket), segments, targeting rules, percentage options and prerequisite flags; sensitive comparators become confidential comparators re-hashed under the project salt. Send `dry_run: true` first: it reads and reports (`counts`, `mapped`, `unsupported`, `warnings`) and writes nothing. A real run (`dry_run: false`) creates the project and answers 201; while the report lists `unsupported` items it answers 422 `IMPORT_UNSUPPORTED` unless `skip_unsupported: true`. One synchronous call with a 120 s budget for the ConfigCat reads (paced to ConfigCat's rate limits). Needs `flags.project.manage` and `flags.create`. No Idempotency-Key: the body carries credentials, and a retry of a finished import answers 409 `KEY_ALREADY_EXISTS` (the project name is taken).
457
+ *
458
+ * @param params - `Flags.ImportCreateParams`.
459
+ * @param options - Per-request options.
460
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is missing or invalid (`source` must be `configcat`, `configcat_product_id` a uuid).
461
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
462
+ * @throws {NotFoundError} 404 NOT_FOUND, IMPORT_SOURCE_NOT_FOUND: `IMPORT_SOURCE_NOT_FOUND`: the ConfigCat product does not exist, or the credentials cannot see it.
463
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS: `KEY_ALREADY_EXISTS`: a project with the target name already exists (pass `target_project_name`).
464
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, IMPORT_CREDENTIALS_INVALID, IMPORT_UNSUPPORTED, IMPORT_EXCEEDS_LIMITS: `IMPORT_CREDENTIALS_INVALID`: ConfigCat rejected the credentials. `IMPORT_UNSUPPORTED`: a real run while the report lists unsupported items (`details.items`); send `skip_unsupported: true` to import without them. `IMPORT_EXCEEDS_LIMITS`: the product is larger than the Flags limits, or reading it ran over the 120 s budget (`details`: `limit`, `max`, `current`). Nothing was imported.
465
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
466
+ * @throws {InternalServerError} 502 BAD_GATEWAY, IMPORT_SOURCE_UNAVAILABLE: `IMPORT_SOURCE_UNAVAILABLE`: ConfigCat answered 5xx, timed out or could not be reached.
467
+ * @see POST /v1/workspaces/{workspace_id}/imports
468
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-imports
469
+ * @example
470
+ * ```ts
471
+ * const importResult = await flags.imports.create({
472
+ * configcat_product_id: "08d8a0b0-0000-4c1f-8a1c-1a2b3c4d5e6f",
473
+ * credentials: { password: "cc-basic-auth-password", username: "cc-basic-auth-username" },
474
+ * dry_run: true,
475
+ * source: "configcat",
476
+ * });
477
+ * ```
478
+ */
479
+ create(params, options) {
480
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/imports", body: params }, options);
481
+ }
482
+ };
483
+ var LimitsResource = class extends APIResource {
484
+ /**
485
+ * Get Flags limits and usage
486
+ *
487
+ * The preview limits that apply to this workspace and how much of the counted ones it uses.
488
+ *
489
+ * @param options - Per-request options.
490
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
491
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
492
+ * @see GET /v1/workspaces/{workspace_id}/limits
493
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-limits
494
+ * @example
495
+ * ```ts
496
+ * const flagsLimits = await flags.limits.retrieve();
497
+ * ```
498
+ */
499
+ retrieve(options) {
500
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/limits" }, options);
501
+ }
502
+ };
503
+ var ProjectsChangesResource = class extends APIResource {
504
+ /**
505
+ * Export changes
506
+ *
507
+ * The filtered history as a file, newest first, at most 50,000 rows, streamed. `csv`: one row per change with the summary (no bodies). `json`: JSON Lines (`application/x-ndjson`), one change object per line with `before` and `after` (confidential lists as counts). Cells a spreadsheet would run as a formula start with `'`.
508
+ *
509
+ * @param projectId - Id of the project.
510
+ * @param params - `Flags.ProjectChangeExportParams`.
511
+ * @param options - Per-request options.
512
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad filter or `format`, or `since` is not before `until`.
513
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
514
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
515
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
516
+ * @see GET /v1/workspaces/{workspace_id}/projects/{project_id}/changes/export
517
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects-project-id-changes-export
518
+ * @example
519
+ * ```ts
520
+ * const response = await flags.projects.changes.export("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
521
+ * const text = await response.text();
522
+ * ```
523
+ */
524
+ export(projectId, params, options) {
525
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/changes/export", pathParams: { project_id: projectId }, query: fillActor(params, this._b), raw: true }, options);
526
+ }
527
+ /**
528
+ * List changes
529
+ *
530
+ * The history of a project, newest first: every write with who made it (user, API key, or a client acting for a user), its note, the config revisions it published and a human summary ("Production: value false → true"). Filter by config, environment, setting, segment, actor or time. Confidential lists show as counts, never values.
531
+ *
532
+ * @param projectId - Id of the project.
533
+ * @param params - `Flags.ProjectChangeListParams`.
534
+ * @param options - Per-request options.
535
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad filter, cursor or `limit`, or `since` is not before `until`.
536
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
537
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
538
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
539
+ * @see GET /v1/workspaces/{workspace_id}/projects/{project_id}/changes
540
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects-project-id-changes
541
+ * @example
542
+ * ```ts
543
+ * for await (const change of flags.projects.changes.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
544
+ * console.log(change);
545
+ * }
546
+ * const page = await flags.projects.changes.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
547
+ * ```
548
+ */
549
+ list(projectId, params, options) {
550
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/changes", pathParams: { project_id: projectId }, query: fillActor(params, this._b) }, options);
551
+ }
552
+ };
553
+ var ProjectsConfigsResource = class extends APIResource {
554
+ /**
555
+ * Create a config
556
+ *
557
+ * Adds a config to the project, with a published state in every environment. Each (config, environment) pair has its own SDK key. Needs `flags.project.manage`.
558
+ *
559
+ * @param projectId - Id of the project.
560
+ * @param params - `Flags.ProjectConfigCreateParams`.
561
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
562
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is missing or invalid.
563
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
564
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
565
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `KEY_ALREADY_EXISTS`: the project already has a config with this key. Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
566
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, LIMIT_EXCEEDED: `LIMIT_EXCEEDED`: the project already has the maximum number of configs (`details`: `limit`, `max`, `current`).
567
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
568
+ * @see POST /v1/workspaces/{workspace_id}/projects/{project_id}/configs
569
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-projects-project-id-configs
570
+ * @example
571
+ * ```ts
572
+ * const config = await flags.projects.configs.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { key: "checkout", name: "Checkout" });
573
+ * ```
574
+ */
575
+ create(projectId, params, options) {
576
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/configs", pathParams: { project_id: projectId }, body: params, idempotent: true }, options);
577
+ }
578
+ /**
579
+ * List configs
580
+ *
581
+ * The project's configs, in `ordinal` order.
582
+ *
583
+ * @param projectId - Id of the project.
584
+ * @param params - `Flags.ProjectConfigListParams`.
585
+ * @param options - Per-request options.
586
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad cursor or a `limit` outside 1-100.
587
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
588
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
589
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
590
+ * @see GET /v1/workspaces/{workspace_id}/projects/{project_id}/configs
591
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects-project-id-configs
592
+ * @example
593
+ * ```ts
594
+ * for await (const config of flags.projects.configs.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
595
+ * console.log(config);
596
+ * }
597
+ * const page = await flags.projects.configs.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
598
+ * ```
599
+ */
600
+ list(projectId, params, options) {
601
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/configs", pathParams: { project_id: projectId }, query: params }, options);
602
+ }
603
+ };
604
+ var ProjectsEnvironmentsResource = class extends APIResource {
605
+ /**
606
+ * Create an environment
607
+ *
608
+ * Adds an environment to every config of the project. The key `production` starts protected unless you say otherwise. Needs `flags.project.manage`.
609
+ *
610
+ * @param projectId - Id of the project.
611
+ * @param params - `Flags.ProjectEnvironmentCreateParams`.
612
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
613
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is missing or invalid.
614
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
615
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
616
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `KEY_ALREADY_EXISTS`: the project already has an environment with this key. Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
617
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, LIMIT_EXCEEDED: `LIMIT_EXCEEDED`: the project already has the maximum number of environments (`details`: `limit`, `max`, `current`).
618
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
619
+ * @see POST /v1/workspaces/{workspace_id}/projects/{project_id}/environments
620
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-projects-project-id-environments
621
+ * @example
622
+ * ```ts
623
+ * const environment = await flags.projects.environments.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { key: "staging", name: "Staging" });
624
+ * ```
625
+ */
626
+ create(projectId, params, options) {
627
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/environments", pathParams: { project_id: projectId }, body: params, idempotent: true }, options);
628
+ }
629
+ /**
630
+ * Delete an environment
631
+ *
632
+ * Deletes the environment with its values in every config, and its SDK keys. A project keeps at least one environment. Needs `flags.project.manage`.
633
+ *
634
+ * @param projectId - Id of the project.
635
+ * @param environmentId - Id of the environment.
636
+ * @param params - `Flags.ProjectEnvironmentDeleteParams`.
637
+ * @param options - Per-request options.
638
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
639
+ * @throws {NotFoundError} 404 NOT_FOUND, ENVIRONMENT_NOT_FOUND: `ENVIRONMENT_NOT_FOUND`: no such environment in this project.
640
+ * @throws {ConflictError} 409 CONFLICT, LAST_ENVIRONMENT: `LAST_ENVIRONMENT`: this is the project's only environment.
641
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
642
+ * @see DELETE /v1/workspaces/{workspace_id}/projects/{project_id}/environments/{environment_id}
643
+ * @see https://productcraft.co/docs/flags/api-reference#delete-v1-workspaces-workspace-id-projects-project-id-environments-environment-id
644
+ * @example
645
+ * ```ts
646
+ * await flags.projects.environments.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
647
+ * ```
648
+ */
649
+ delete(projectId, environmentId, params, options) {
650
+ return this._client.request({ method: "DELETE", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/environments/{environment_id}", pathParams: { project_id: projectId, environment_id: environmentId }, query: params }, options);
651
+ }
652
+ /**
653
+ * List environments
654
+ *
655
+ * Every environment of the project, in `ordinal` order.
656
+ *
657
+ * @param projectId - Id of the project.
658
+ * @param options - Per-request options.
659
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
660
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
661
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
662
+ * @see GET /v1/workspaces/{workspace_id}/projects/{project_id}/environments
663
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects-project-id-environments
664
+ * @example
665
+ * ```ts
666
+ * const environmentList = await flags.projects.environments.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
667
+ * ```
668
+ */
669
+ list(projectId, options) {
670
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/environments", pathParams: { project_id: projectId } }, options);
671
+ }
672
+ /**
673
+ * Get an environment
674
+ *
675
+ * @param projectId - Id of the project.
676
+ * @param environmentId - Id of the environment.
677
+ * @param options - Per-request options.
678
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
679
+ * @throws {NotFoundError} 404 NOT_FOUND, ENVIRONMENT_NOT_FOUND: `ENVIRONMENT_NOT_FOUND`: no such environment in this project.
680
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
681
+ * @see GET /v1/workspaces/{workspace_id}/projects/{project_id}/environments/{environment_id}
682
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects-project-id-environments-environment-id
683
+ * @example
684
+ * ```ts
685
+ * const environment = await flags.projects.environments.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
686
+ * ```
687
+ */
688
+ retrieve(projectId, environmentId, options) {
689
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/environments/{environment_id}", pathParams: { project_id: projectId, environment_id: environmentId } }, options);
690
+ }
691
+ /**
692
+ * Update an environment
693
+ *
694
+ * Name, color, order, `protected` and `require_note`; the key never changes. Changing `protected` or `require_note` is recorded in the workspace audit log. Needs `flags.project.manage`.
695
+ *
696
+ * @param projectId - Id of the project.
697
+ * @param environmentId - Id of the environment.
698
+ * @param params - `Flags.ProjectEnvironmentUpdateParams`.
699
+ * @param options - Per-request options.
700
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is invalid.
701
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
702
+ * @throws {NotFoundError} 404 NOT_FOUND, ENVIRONMENT_NOT_FOUND: `ENVIRONMENT_NOT_FOUND`: no such environment in this project.
703
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
704
+ * @see PATCH /v1/workspaces/{workspace_id}/projects/{project_id}/environments/{environment_id}
705
+ * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-projects-project-id-environments-environment-id
706
+ * @example
707
+ * ```ts
708
+ * const environment = await flags.projects.environments.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { color: "#e67700" });
709
+ * ```
710
+ */
711
+ update(projectId, environmentId, params, options) {
712
+ return this._client.request({ method: "PATCH", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/environments/{environment_id}", pathParams: { project_id: projectId, environment_id: environmentId }, body: params }, options);
713
+ }
714
+ };
715
+ var ProjectsSegmentsResource = class extends APIResource {
716
+ /**
717
+ * Create a segment
718
+ *
719
+ * A reusable set of ANDed user conditions that any config of the project can target with `{segment: {segment_id, comparator: in | not_in}}`. Confidential lists are stored as hashes plus encrypted cleartext; the response shows only their count.
720
+ *
721
+ * @param projectId - Id of the project.
722
+ * @param params - `Flags.ProjectSegmentCreateParams`.
723
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
724
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is missing or invalid.
725
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
726
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
727
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `KEY_ALREADY_EXISTS`: the project already has a segment with this key. Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
728
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, INVALID_TARGETING, LIMIT_EXCEEDED, CONFIDENTIAL_LIST_NOT_EDITABLE, NOTE_REQUIRED: The conditions are invalid; `details.errors` lists every problem (`param`, `code`, `message`) and `code` is the first one: `INVALID_TARGETING` (shape, comparator or value), `LIMIT_EXCEEDED` (conditions, values or segments per project), `CONFIDENTIAL_LIST_NOT_EDITABLE` (`values_add` / `values_remove` on a list sent pre-hashed), or `NOTE_REQUIRED` (the segment is used in an environment that requires a `note`).
729
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
730
+ * @see POST /v1/workspaces/{workspace_id}/projects/{project_id}/segments
731
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-projects-project-id-segments
732
+ * @example
733
+ * ```ts
734
+ * const segmentDetail = await flags.projects.segments.create("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {
735
+ * conditions: [
736
+ * {
737
+ * user: { attribute: "email", comparator: "ends_with_any_hashed", values: ["@acme.test"] },
738
+ * },
739
+ * ],
740
+ * key: "qa_staff",
741
+ * });
742
+ * ```
743
+ */
744
+ create(projectId, params, options) {
745
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/segments", pathParams: { project_id: projectId }, body: params, idempotent: true }, options);
746
+ }
747
+ /**
748
+ * List segments
749
+ *
750
+ * The project's segments, oldest first, with `usage_count`.
751
+ *
752
+ * @param projectId - Id of the project.
753
+ * @param params - `Flags.ProjectSegmentListParams`.
754
+ * @param options - Per-request options.
755
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad cursor or `limit`.
756
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
757
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
758
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
759
+ * @see GET /v1/workspaces/{workspace_id}/projects/{project_id}/segments
760
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects-project-id-segments
761
+ * @example
762
+ * ```ts
763
+ * for await (const segment of flags.projects.segments.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f")) {
764
+ * console.log(segment);
765
+ * }
766
+ * const page = await flags.projects.segments.list("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {}, { timeout: 5_000 });
767
+ * ```
768
+ */
769
+ list(projectId, params, options) {
770
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects/{project_id}/segments", pathParams: { project_id: projectId }, query: params }, options);
771
+ }
772
+ };
773
+ var ProjectsResource = class extends APIResource {
774
+ #changes;
775
+ #configs;
776
+ #environments;
777
+ #segments;
778
+ get changes() {
779
+ return this.#changes ??= new ProjectsChangesResource(this._client, this._b);
780
+ }
781
+ get configs() {
782
+ return this.#configs ??= new ProjectsConfigsResource(this._client, this._b);
783
+ }
784
+ get environments() {
785
+ return this.#environments ??= new ProjectsEnvironmentsResource(this._client, this._b);
786
+ }
787
+ get segments() {
788
+ return this.#segments ??= new ProjectsSegmentsResource(this._client, this._b);
789
+ }
790
+ /**
791
+ * Create a project
792
+ *
793
+ * Creates the project with the environments of `environment_preset` (default `dev_prod`: Development and a protected Production) and one config, `main`, unless you pass `environments` / `configs`. Every config gets a published state in every environment. Needs `flags.project.manage`.
794
+ *
795
+ * @param params - `Flags.ProjectCreateParams`.
796
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
797
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is missing or invalid.
798
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
799
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `KEY_ALREADY_EXISTS`: another project has this name, or a key repeats in `environments` / `configs`. Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
800
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, LIMIT_EXCEEDED: `LIMIT_EXCEEDED`: the workspace already has the maximum number of projects (`details`: `limit`, `max`, `current`).
801
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
802
+ * @see POST /v1/workspaces/{workspace_id}/projects
803
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-projects
804
+ * @example
805
+ * ```ts
806
+ * const project = await flags.projects.create({ name: "Storefront" });
807
+ * ```
808
+ */
809
+ create(params, options) {
810
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/projects", body: params, idempotent: true }, options);
811
+ }
812
+ /**
813
+ * Delete a project
814
+ *
815
+ * Deletes the project with all of its environments, configs, flags, segments, SDK keys and history. Pass `confirm` with the exact project name. SDKs using its keys stop receiving updates. Needs `flags.project.manage`; recorded in the workspace audit log.
816
+ *
817
+ * @param projectId - Id of the project.
818
+ * @param params - `Flags.ProjectDeleteParams`.
819
+ * @param options - Per-request options.
820
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
821
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
822
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, CONFIRMATION_REQUIRED: `CONFIRMATION_REQUIRED`: `confirm` is missing or is not the exact project name.
823
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
824
+ * @see DELETE /v1/workspaces/{workspace_id}/projects/{project_id}
825
+ * @see https://productcraft.co/docs/flags/api-reference#delete-v1-workspaces-workspace-id-projects-project-id
826
+ * @example
827
+ * ```ts
828
+ * await flags.projects.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { confirm: "Storefront" });
829
+ * ```
830
+ */
831
+ delete(projectId, params, options) {
832
+ return this._client.request({ method: "DELETE", path: "/v1/workspaces/{workspace_id}/projects/{project_id}", pathParams: { project_id: projectId }, query: params }, options);
833
+ }
834
+ /**
835
+ * List projects
836
+ *
837
+ * The workspace's projects, oldest first, each with its environments and configs.
838
+ *
839
+ * @param params - `Flags.ProjectListParams`.
840
+ * @param options - Per-request options.
841
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a bad cursor or a `limit` outside 1-100.
842
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
843
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
844
+ * @see GET /v1/workspaces/{workspace_id}/projects
845
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects
846
+ * @example
847
+ * ```ts
848
+ * for await (const project of flags.projects.list()) {
849
+ * console.log(project);
850
+ * }
851
+ * const page = await flags.projects.list({}, { timeout: 5_000 });
852
+ * ```
853
+ */
854
+ list(params, options) {
855
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects", query: params }, options);
856
+ }
857
+ /**
858
+ * Get a project
859
+ *
860
+ * The project with its environments and configs.
861
+ *
862
+ * @param projectId - Id of the project.
863
+ * @param options - Per-request options.
864
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
865
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
866
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
867
+ * @see GET /v1/workspaces/{workspace_id}/projects/{project_id}
868
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-projects-project-id
869
+ * @example
870
+ * ```ts
871
+ * const project = await flags.projects.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
872
+ * ```
873
+ */
874
+ retrieve(projectId, options) {
875
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/projects/{project_id}", pathParams: { project_id: projectId } }, options);
876
+ }
877
+ /**
878
+ * Update a project
879
+ *
880
+ * Rename, describe or reorder the project. Only the fields you send change. Needs `flags.project.manage`.
881
+ *
882
+ * @param projectId - Id of the project.
883
+ * @param params - `Flags.ProjectUpdateParams`.
884
+ * @param options - Per-request options.
885
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is invalid.
886
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
887
+ * @throws {NotFoundError} 404 NOT_FOUND, PROJECT_NOT_FOUND: `PROJECT_NOT_FOUND`: no such project in this workspace.
888
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS: `KEY_ALREADY_EXISTS`: another project has this name.
889
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
890
+ * @see PATCH /v1/workspaces/{workspace_id}/projects/{project_id}
891
+ * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-projects-project-id
892
+ * @example
893
+ * ```ts
894
+ * const project = await flags.projects.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { description: "string" });
895
+ * ```
896
+ */
897
+ update(projectId, params, options) {
898
+ return this._client.request({ method: "PATCH", path: "/v1/workspaces/{workspace_id}/projects/{project_id}", pathParams: { project_id: projectId }, body: params }, options);
899
+ }
900
+ };
901
+ var SegmentsResource = class extends APIResource {
902
+ /**
903
+ * Delete a segment
904
+ *
905
+ * Deletes an unused segment. Needs `flags.delete`.
906
+ *
907
+ * @param segmentId - Id of the segment.
908
+ * @param params - `Flags.SegmentDeleteParams`.
909
+ * @param options - Per-request options.
910
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
911
+ * @throws {NotFoundError} 404 NOT_FOUND, SEGMENT_NOT_FOUND: `SEGMENT_NOT_FOUND`: no such segment in this workspace.
912
+ * @throws {ConflictError} 409 CONFLICT, SEGMENT_IN_USE: `SEGMENT_IN_USE`: a rule uses it (`details.used_by` lists where).
913
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
914
+ * @see DELETE /v1/workspaces/{workspace_id}/segments/{segment_id}
915
+ * @see https://productcraft.co/docs/flags/api-reference#delete-v1-workspaces-workspace-id-segments-segment-id
916
+ * @example
917
+ * ```ts
918
+ * await flags.segments.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
919
+ * ```
920
+ */
921
+ delete(segmentId, params, options) {
922
+ return this._client.request({ method: "DELETE", path: "/v1/workspaces/{workspace_id}/segments/{segment_id}", pathParams: { segment_id: segmentId }, query: params }, options);
923
+ }
924
+ /**
925
+ * Get a segment
926
+ *
927
+ * The segment with its conditions and every (setting, environment) that uses it (`used_by`).
928
+ *
929
+ * @param segmentId - Id of the segment.
930
+ * @param options - Per-request options.
931
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
932
+ * @throws {NotFoundError} 404 NOT_FOUND, SEGMENT_NOT_FOUND: `SEGMENT_NOT_FOUND`: no such segment in this workspace.
933
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
934
+ * @see GET /v1/workspaces/{workspace_id}/segments/{segment_id}
935
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-segments-segment-id
936
+ * @example
937
+ * ```ts
938
+ * const segmentDetail = await flags.segments.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
939
+ * ```
940
+ */
941
+ retrieve(segmentId, options) {
942
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/segments/{segment_id}", pathParams: { segment_id: segmentId } }, options);
943
+ }
944
+ /**
945
+ * Reveal confidential values of a segment
946
+ *
947
+ * The cleartext of the segment's confidential lists, decrypted. Needs `flags.confidential.read`; every call is recorded in the history (`confidential.revealed`). Never cached.
948
+ *
949
+ * @param segmentId - Id of the segment.
950
+ * @param options - Per-request options.
951
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
952
+ * @throws {NotFoundError} 404 NOT_FOUND, SEGMENT_NOT_FOUND: `SEGMENT_NOT_FOUND`: no such segment in this workspace.
953
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, CONFIDENTIAL_LIST_NOT_EDITABLE: `CONFIDENTIAL_LIST_NOT_EDITABLE`: every confidential list was sent pre-hashed, so there is no cleartext.
954
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
955
+ * @see GET /v1/workspaces/{workspace_id}/segments/{segment_id}/confidential
956
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-segments-segment-id-confidential
957
+ * @example
958
+ * ```ts
959
+ * const confidentialReveal = await flags.segments.revealConfidential("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
960
+ * ```
961
+ */
962
+ revealConfidential(segmentId, options) {
963
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/segments/{segment_id}/confidential", pathParams: { segment_id: segmentId } }, options);
964
+ }
965
+ /**
966
+ * Update a segment
967
+ *
968
+ * Key, name, description or conditions; only the fields you send change. Edit a confidential list with `list_id` plus `values_add` / `values_remove`. A segment used in a protected environment also needs `flags.protected.update` there.
969
+ *
970
+ * @param segmentId - Id of the segment.
971
+ * @param params - `Flags.SegmentUpdateParams`.
972
+ * @param options - Per-request options.
973
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is invalid.
974
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`). A segment used in a protected environment also needs `flags.protected.update` on it.
975
+ * @throws {NotFoundError} 404 NOT_FOUND, SEGMENT_NOT_FOUND: `SEGMENT_NOT_FOUND`: no such segment in this workspace.
976
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS, VERSION_CONFLICT: `KEY_ALREADY_EXISTS`: the project already has a segment with this key; `VERSION_CONFLICT`: `version` is stale (`details.current_version`).
977
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, INVALID_TARGETING, LIMIT_EXCEEDED, CONFIDENTIAL_LIST_NOT_EDITABLE, NOTE_REQUIRED, CONFIG_TOO_LARGE: The conditions are invalid; `details.errors` lists every problem (`param`, `code`, `message`) and `code` is the first one: `INVALID_TARGETING` (shape, comparator or value), `LIMIT_EXCEEDED` (conditions, values or segments per project), `CONFIDENTIAL_LIST_NOT_EDITABLE` (`values_add` / `values_remove` on a list sent pre-hashed), or `NOTE_REQUIRED` (the segment is used in an environment that requires a `note`). Publishing (every config that uses the segment): `CONFIG_TOO_LARGE` (a rendered config would exceed 1 MiB) or `LIMIT_EXCEEDED` with `details.limit: comparison_values_per_config`; the edit is not applied.
978
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
979
+ * @see PATCH /v1/workspaces/{workspace_id}/segments/{segment_id}
980
+ * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-segments-segment-id
981
+ * @example
982
+ * ```ts
983
+ * const segmentDetail = await flags.segments.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {
984
+ * conditions: [
985
+ * {
986
+ * user: {
987
+ * attribute: "email",
988
+ * comparator: "ends_with_any_hashed",
989
+ * list_id: "3f0c6a3e-0f5e-4b8e-9d1a-2c7b9f1e8a10",
990
+ * values_add: ["@beta.test"],
991
+ * },
992
+ * },
993
+ * ],
994
+ * });
995
+ * ```
996
+ */
997
+ update(segmentId, params, options) {
998
+ return this._client.request({ method: "PATCH", path: "/v1/workspaces/{workspace_id}/segments/{segment_id}", pathParams: { segment_id: segmentId }, body: params }, options);
999
+ }
1000
+ };
1001
+ var SettingsValuesResource = class extends APIResource {
1002
+ /**
1003
+ * Replace a value
1004
+ *
1005
+ * Replaces the value and the whole targeting (rules, flag-level split, split attribute) in one environment. Send the `version` you read.
1006
+ *
1007
+ * @param settingId - Id of the setting.
1008
+ * @param environmentId - Id of an environment of the same project.
1009
+ * @param params - `Flags.SettingsValueReplaceParams`.
1010
+ * @param options - Per-request options.
1011
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: `version` or `note` is missing or invalid.
1012
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`). Value writes need `flags.value.update` on the environment and the setting, plus `flags.protected.update` in a protected environment.
1013
+ * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `SETTING_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`.
1014
+ * @throws {ConflictError} 409 CONFLICT, VERSION_CONFLICT: `VERSION_CONFLICT`: the value changed since you read it (`details.current_version`, `updated_at`, `updated_by`).
1015
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, INVALID_VALUE, INVALID_TARGETING, SEGMENT_NOT_FOUND, CONFIDENTIAL_LIST_NOT_EDITABLE, PERCENTAGES_MUST_SUM_TO_100, PREREQUISITE_NOT_FOUND, PREREQUISITE_TYPE_MISMATCH, CIRCULAR_PREREQUISITE, LIMIT_EXCEEDED, NOTE_REQUIRED, CONFIG_TOO_LARGE: The value or targeting is invalid; `details.errors` lists every problem (`param`, `code`, `message`) and `code` is the first one: `INVALID_VALUE` (type mismatch, over 100 KB, json that does not parse), `INVALID_TARGETING` (shape, comparator or comparison value), `SEGMENT_NOT_FOUND` (a segment condition names no segment of this project), `CONFIDENTIAL_LIST_NOT_EDITABLE` (`values_add` / `values_remove` on a list sent pre-hashed), `PERCENTAGES_MUST_SUM_TO_100`, `PREREQUISITE_NOT_FOUND`, `PREREQUISITE_TYPE_MISMATCH`, `CIRCULAR_PREREQUISITE` (`details.cycle` lists the keys), `LIMIT_EXCEEDED` (rules, conditions, values or prerequisite depth), or `NOTE_REQUIRED` (the environment requires a `note`). Publishing: `CONFIG_TOO_LARGE` (the rendered config would exceed 1 MiB; `details.size_bytes`, `max_bytes`) or `LIMIT_EXCEEDED` with `details.limit: comparison_values_per_config` (over 20,000 comparison values in the config); the write is not applied.
1016
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1017
+ * @see PUT /v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}
1018
+ * @see https://productcraft.co/docs/flags/api-reference#put-v1-workspaces-workspace-id-settings-setting-id-values-environment-id
1019
+ * @example
1020
+ * ```ts
1021
+ * const settingValue = await flags.settings.values.replace("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { value: false, version: 3 });
1022
+ * ```
1023
+ */
1024
+ replace(settingId, environmentId, params, options) {
1025
+ return this._client.request({ method: "PUT", path: "/v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}", pathParams: { setting_id: settingId, environment_id: environmentId }, body: params }, options);
1026
+ }
1027
+ /**
1028
+ * Get a value
1029
+ *
1030
+ * The setting's value and targeting in one environment, with its `version`.
1031
+ *
1032
+ * @param settingId - Id of the setting.
1033
+ * @param environmentId - Id of an environment of the same project.
1034
+ * @param options - Per-request options.
1035
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
1036
+ * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `SETTING_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`.
1037
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1038
+ * @see GET /v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}
1039
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-settings-setting-id-values-environment-id
1040
+ * @example
1041
+ * ```ts
1042
+ * const settingValue = await flags.settings.values.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
1043
+ * ```
1044
+ */
1045
+ retrieve(settingId, environmentId, options) {
1046
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}", pathParams: { setting_id: settingId, environment_id: environmentId } }, options);
1047
+ }
1048
+ /**
1049
+ * Reveal confidential values
1050
+ *
1051
+ * The cleartext of this value's confidential lists, decrypted. Needs `flags.confidential.read` on the environment and the setting; every call is recorded in the history (`confidential.revealed`). Never cached.
1052
+ *
1053
+ * @param settingId - Id of the setting.
1054
+ * @param environmentId - Id of an environment of the same project.
1055
+ * @param options - Per-request options.
1056
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
1057
+ * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `SETTING_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`.
1058
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, CONFIDENTIAL_LIST_NOT_EDITABLE: `CONFIDENTIAL_LIST_NOT_EDITABLE`: every confidential list was sent pre-hashed, so there is no cleartext.
1059
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1060
+ * @see GET /v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}/confidential
1061
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-settings-setting-id-values-environment-id-confidential
1062
+ * @example
1063
+ * ```ts
1064
+ * const confidentialReveal = await flags.settings.values.revealConfidential("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
1065
+ * ```
1066
+ */
1067
+ revealConfidential(settingId, environmentId, options) {
1068
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}/confidential", pathParams: { setting_id: settingId, environment_id: environmentId } }, options);
1069
+ }
1070
+ /**
1071
+ * Update a value
1072
+ *
1073
+ * The quick edits: `value` (the toggle), `percentage_attribute`, and `clear_rules: true` to drop every rule and split so `value` is served to everyone (the kill switch). Send the `version` you read.
1074
+ *
1075
+ * @param settingId - Id of the setting.
1076
+ * @param environmentId - Id of an environment of the same project.
1077
+ * @param params - `Flags.SettingsValueUpdateParams`.
1078
+ * @param options - Per-request options.
1079
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: nothing to change, or `version` is missing.
1080
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`). Value writes need `flags.value.update` on the environment and the setting, plus `flags.protected.update` in a protected environment.
1081
+ * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `SETTING_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`.
1082
+ * @throws {ConflictError} 409 CONFLICT, VERSION_CONFLICT: `VERSION_CONFLICT`: the value changed since you read it (`details.current_version`, `updated_at`, `updated_by`).
1083
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, INVALID_VALUE, INVALID_TARGETING, NOTE_REQUIRED, CONFIG_TOO_LARGE, LIMIT_EXCEEDED: `INVALID_VALUE`, `INVALID_TARGETING` or `NOTE_REQUIRED`; `details.errors` lists each problem. Publishing: `CONFIG_TOO_LARGE` (the rendered config would exceed 1 MiB; `details.size_bytes`, `max_bytes`) or `LIMIT_EXCEEDED` with `details.limit: comparison_values_per_config` (over 20,000 comparison values in the config); the write is not applied.
1084
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1085
+ * @see PATCH /v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}
1086
+ * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-settings-setting-id-values-environment-id
1087
+ * @example
1088
+ * ```ts
1089
+ * const settingValue = await flags.settings.values.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { version: 3 });
1090
+ * ```
1091
+ */
1092
+ update(settingId, environmentId, params, options) {
1093
+ return this._client.request({ method: "PATCH", path: "/v1/workspaces/{workspace_id}/settings/{setting_id}/values/{environment_id}", pathParams: { setting_id: settingId, environment_id: environmentId }, body: params }, options);
1094
+ }
1095
+ };
1096
+ var SettingsResource = class extends APIResource {
1097
+ #values;
1098
+ get values() {
1099
+ return this.#values ??= new SettingsValuesResource(this._client, this._b);
1100
+ }
1101
+ /**
1102
+ * Delete a setting
1103
+ *
1104
+ * Deletes the setting and its values in every environment. Needs `flags.delete`.
1105
+ *
1106
+ * @param settingId - Id of the setting.
1107
+ * @param params - `Flags.SettingsDeleteParams`.
1108
+ * @param options - Per-request options.
1109
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
1110
+ * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND: `SETTING_NOT_FOUND`: no such setting in this workspace.
1111
+ * @throws {ConflictError} 409 CONFLICT, SETTING_IN_USE: `SETTING_IN_USE`: another setting uses it as a prerequisite (`details.used_by`).
1112
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1113
+ * @see DELETE /v1/workspaces/{workspace_id}/settings/{setting_id}
1114
+ * @see https://productcraft.co/docs/flags/api-reference#delete-v1-workspaces-workspace-id-settings-setting-id
1115
+ * @example
1116
+ * ```ts
1117
+ * await flags.settings.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
1118
+ * ```
1119
+ */
1120
+ delete(settingId, params, options) {
1121
+ return this._client.request({ method: "DELETE", path: "/v1/workspaces/{workspace_id}/settings/{setting_id}", pathParams: { setting_id: settingId }, query: params }, options);
1122
+ }
1123
+ /**
1124
+ * Get a setting
1125
+ *
1126
+ * The setting with its value and targeting in every environment, and what depends on it (`dependents`).
1127
+ *
1128
+ * @param settingId - Id of the setting.
1129
+ * @param options - Per-request options.
1130
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
1131
+ * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND: `SETTING_NOT_FOUND`: no such setting in this workspace.
1132
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1133
+ * @see GET /v1/workspaces/{workspace_id}/settings/{setting_id}
1134
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-settings-setting-id
1135
+ * @example
1136
+ * ```ts
1137
+ * const settingDetail = await flags.settings.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
1138
+ * ```
1139
+ */
1140
+ retrieve(settingId, options) {
1141
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/settings/{setting_id}", pathParams: { setting_id: settingId } }, options);
1142
+ }
1143
+ /**
1144
+ * Update a setting
1145
+ *
1146
+ * Key, name, description, hint, tags, lifecycle, owner or order; only the fields you send change. The type cannot change. Renaming the key keeps the seed (users stay in their split buckets) and needs `flags.protected.update` when the project has a protected environment.
1147
+ *
1148
+ * @param settingId - Id of the setting.
1149
+ * @param params - `Flags.SettingsUpdateParams`.
1150
+ * @param options - Per-request options.
1151
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is invalid.
1152
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
1153
+ * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND: `SETTING_NOT_FOUND`: no such setting in this workspace.
1154
+ * @throws {ConflictError} 409 CONFLICT, KEY_ALREADY_EXISTS: `KEY_ALREADY_EXISTS`: the config already has a setting with this key.
1155
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY, SETTING_TYPE_IMMUTABLE, OWNER_NOT_A_MEMBER, CONFIG_TOO_LARGE, LIMIT_EXCEEDED: `SETTING_TYPE_IMMUTABLE`: `type` differs from the current one; `OWNER_NOT_A_MEMBER`: `owner_id` is not a workspace member. Publishing: `CONFIG_TOO_LARGE` (the rendered config would exceed 1 MiB; `details.size_bytes`, `max_bytes`) or `LIMIT_EXCEEDED` with `details.limit: comparison_values_per_config` (over 20,000 comparison values in the config); the write is not applied.
1156
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1157
+ * @throws {InternalServerError} 503 SERVICE_UNAVAILABLE: `SERVICE_UNAVAILABLE`: the member lookup for `owner_id` is unavailable; retry.
1158
+ * @see PATCH /v1/workspaces/{workspace_id}/settings/{setting_id}
1159
+ * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-settings-setting-id
1160
+ * @example
1161
+ * ```ts
1162
+ * const settingDetail = await flags.settings.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { description: "string" });
1163
+ * ```
1164
+ */
1165
+ update(settingId, params, options) {
1166
+ return this._client.request({ method: "PATCH", path: "/v1/workspaces/{workspace_id}/settings/{setting_id}", pathParams: { setting_id: settingId }, body: params }, options);
1167
+ }
1168
+ };
1169
+ var StatsResource = class extends APIResource {
1170
+ /**
1171
+ * Get Flags stats
1172
+ *
1173
+ * Counts for the workspace: projects, configs, flags and settings, segments, changes in the last 7 days and when the latest change was made, plus each project’s history usage against the retention caps (50,000 rows or 200 MiB per project; `warning` from 80%). Counts only: no keys, values or rules.
1174
+ *
1175
+ * @param options - Per-request options.
1176
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: The caller lacks the action this route needs (`message` names it), or the workspace has not enabled Flags (`SERVICE_NOT_ENABLED`).
1177
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1178
+ * @see GET /v1/workspaces/{workspace_id}/stats
1179
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-stats
1180
+ * @example
1181
+ * ```ts
1182
+ * const flagsStats = await flags.stats.retrieve();
1183
+ * ```
1184
+ */
1185
+ retrieve(options) {
1186
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/stats" }, options);
1187
+ }
1188
+ };
1189
+ var WebhooksEndpointsResource = class extends APIResource {
1190
+ /**
1191
+ * Add a webhook endpoint. Returns its signing secret once.
1192
+ *
1193
+ * Deliveries are signed with the Standard Webhooks headers `webhook-id`, `webhook-timestamp` and `webhook-signature` (`v1,<base64 HMAC-SHA256 of "<id>.<timestamp>.<body>">`); the returned `whsec_…` secret works unchanged with any Standard Webhooks library. Failed deliveries are retried after 1 min, 5 min, 30 min, 2 h, 6 h and 24 h.
1194
+ *
1195
+ * @param params - `Flags.WebhookEndpointCreateParams`.
1196
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
1197
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR, WEBHOOK_EVENT_TYPE_UNKNOWN: Validation failure: URL not https with a public host, or an unknown event type (`WEBHOOK_EVENT_TYPE_UNKNOWN`).
1198
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1199
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1200
+ * @throws {ConflictError} 409 CONFLICT, WEBHOOK_ENDPOINT_LIMIT, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: Already 10 endpoints (`WEBHOOK_ENDPOINT_LIMIT`), or Idempotency-Key reused with a different body (`IDEMPOTENCY_KEY_REUSE`). Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
1201
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY: The URL points at a private, loopback or internal address.
1202
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1203
+ * @see POST /v1/workspaces/{workspace_id}/webhooks/endpoints
1204
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-webhooks-endpoints
1205
+ * @example
1206
+ * ```ts
1207
+ * const webhookEndpoint = await flags.webhooks.endpoints.create({ url: "https://api.acme.com/webhooks" });
1208
+ * ```
1209
+ */
1210
+ create(params, options) {
1211
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/webhooks/endpoints", body: params, idempotent: true }, options);
1212
+ }
1213
+ /**
1214
+ * Delete a webhook endpoint.
1215
+ *
1216
+ * Queued retries are dropped. Its past attempts stay in the event log until the events expire.
1217
+ *
1218
+ * @param endpointId - Id of the endpoint.
1219
+ * @param options - Per-request options.
1220
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `endpoint_id` is not a UUID.
1221
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1222
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1223
+ * @throws {NotFoundError} 404 NOT_FOUND, WEBHOOK_ENDPOINT_NOT_FOUND: No such endpoint here (`WEBHOOK_ENDPOINT_NOT_FOUND`).
1224
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1225
+ * @see DELETE /v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}
1226
+ * @see https://productcraft.co/docs/flags/api-reference#delete-v1-workspaces-workspace-id-webhooks-endpoints-endpoint-id
1227
+ * @example
1228
+ * ```ts
1229
+ * await flags.webhooks.endpoints.delete("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
1230
+ * ```
1231
+ */
1232
+ delete(endpointId, options) {
1233
+ return this._client.request({ method: "DELETE", path: "/v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}", pathParams: { endpoint_id: endpointId } }, options);
1234
+ }
1235
+ /**
1236
+ * List webhook endpoints, oldest first.
1237
+ *
1238
+ * At most 10, so this is always one page. Signing secrets are never returned here, only their last 4 characters.
1239
+ *
1240
+ * @param options - Per-request options.
1241
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: The scope id in the path is malformed.
1242
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1243
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1244
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1245
+ * @see GET /v1/workspaces/{workspace_id}/webhooks/endpoints
1246
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-webhooks-endpoints
1247
+ * @example
1248
+ * ```ts
1249
+ * for await (const endpoint of flags.webhooks.endpoints.list()) {
1250
+ * console.log(endpoint);
1251
+ * }
1252
+ * ```
1253
+ */
1254
+ list(options) {
1255
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/webhooks/endpoints" }, options);
1256
+ }
1257
+ /**
1258
+ * Get one webhook endpoint (without its secret).
1259
+ *
1260
+ * The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
1261
+ *
1262
+ * @param endpointId - Id of the endpoint.
1263
+ * @param options - Per-request options.
1264
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `endpoint_id` is not a UUID.
1265
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1266
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1267
+ * @throws {NotFoundError} 404 NOT_FOUND, WEBHOOK_ENDPOINT_NOT_FOUND: No such endpoint here (`WEBHOOK_ENDPOINT_NOT_FOUND`).
1268
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1269
+ * @see GET /v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}
1270
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-webhooks-endpoints-endpoint-id
1271
+ * @example
1272
+ * ```ts
1273
+ * const webhookEndpoint = await flags.webhooks.endpoints.retrieve("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");
1274
+ * ```
1275
+ */
1276
+ retrieve(endpointId, options) {
1277
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}", pathParams: { endpoint_id: endpointId } }, options);
1278
+ }
1279
+ /**
1280
+ * Rotate the signing secret. The new one is returned once.
1281
+ *
1282
+ * For `grace_hours` (default 24) the previous secret keeps signing too: `webhook-signature` then lists one `v1,` signature per secret, so receivers can switch over without dropping a delivery.
1283
+ *
1284
+ * @param endpointId - Id of the endpoint.
1285
+ * @param params - `Flags.WebhookEndpointRotateSecretParams`.
1286
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
1287
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `grace_hours` out of range, or `endpoint_id` is not a UUID.
1288
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1289
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1290
+ * @throws {NotFoundError} 404 NOT_FOUND, WEBHOOK_ENDPOINT_NOT_FOUND: No such endpoint here (`WEBHOOK_ENDPOINT_NOT_FOUND`).
1291
+ * @throws {ConflictError} 409 CONFLICT, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: Idempotency-Key reused with a different body (`IDEMPOTENCY_KEY_REUSE`). Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
1292
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1293
+ * @see POST /v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}/rotate-secret
1294
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-webhooks-endpoints-endpoint-id-rotate-secret
1295
+ * @example
1296
+ * ```ts
1297
+ * const webhookEndpoint = await flags.webhooks.endpoints.rotateSecret("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { grace_hours: 24 });
1298
+ * ```
1299
+ */
1300
+ rotateSecret(endpointId, params, options) {
1301
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}/rotate-secret", pathParams: { endpoint_id: endpointId }, body: params, idempotent: true }, options);
1302
+ }
1303
+ /**
1304
+ * Send a test event to this endpoint now and return the result.
1305
+ *
1306
+ * Delivers the catalogue example of `event_type`, signed like any delivery, with `"test": true` in the body. Works while the endpoint is switched off or not subscribed to that type, is logged in the event log, and is never retried or counted toward an automatic disable. Waits up to 15 s for your receiver.
1307
+ *
1308
+ * @param endpointId - Id of the endpoint.
1309
+ * @param params - `Flags.WebhookEndpointTestParams`.
1310
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
1311
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Unknown `event_type`, or `endpoint_id` is not a UUID.
1312
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1313
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1314
+ * @throws {NotFoundError} 404 NOT_FOUND, WEBHOOK_ENDPOINT_NOT_FOUND: No such endpoint here (`WEBHOOK_ENDPOINT_NOT_FOUND`).
1315
+ * @throws {ConflictError} 409 CONFLICT, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: Idempotency-Key reused with a different body (`IDEMPOTENCY_KEY_REUSE`). Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
1316
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1317
+ * @see POST /v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}/test
1318
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-webhooks-endpoints-endpoint-id-test
1319
+ * @example
1320
+ * ```ts
1321
+ * const webhookDeliveryAttempt = await flags.webhooks.endpoints.test("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { event_type: "config.published" });
1322
+ * ```
1323
+ */
1324
+ test(endpointId, params, options) {
1325
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}/test", pathParams: { endpoint_id: endpointId }, body: params, idempotent: true }, options);
1326
+ }
1327
+ /**
1328
+ * Change a webhook endpoint: URL, description, events, on/off.
1329
+ *
1330
+ * Only the fields sent change. `enabled: true` (or a new URL) also clears an automatic disable. Switching off cancels queued retries. The secret is unchanged; rotate it with `POST …/rotate-secret`.
1331
+ *
1332
+ * @param endpointId - Id of the endpoint.
1333
+ * @param params - `Flags.WebhookEndpointUpdateParams`.
1334
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
1335
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Validation failure, or `endpoint_id` is not a UUID.
1336
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1337
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1338
+ * @throws {NotFoundError} 404 NOT_FOUND, WEBHOOK_ENDPOINT_NOT_FOUND: No such endpoint here (`WEBHOOK_ENDPOINT_NOT_FOUND`).
1339
+ * @throws {ConflictError} 409 CONFLICT, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: Idempotency-Key reused with a different body (`IDEMPOTENCY_KEY_REUSE`). Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
1340
+ * @throws {UnprocessableEntityError} 422 UNPROCESSABLE_ENTITY: The new URL points at a private, loopback or internal address.
1341
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1342
+ * @see PATCH /v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}
1343
+ * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-webhooks-endpoints-endpoint-id
1344
+ * @example
1345
+ * ```ts
1346
+ * const webhookEndpoint = await flags.webhooks.endpoints.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { config_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b" });
1347
+ * ```
1348
+ */
1349
+ update(endpointId, params, options) {
1350
+ return this._client.request({ method: "PATCH", path: "/v1/workspaces/{workspace_id}/webhooks/endpoints/{endpoint_id}", pathParams: { endpoint_id: endpointId }, body: params, idempotent: true }, options);
1351
+ }
1352
+ };
1353
+ var WebhooksEventTypesResource = class extends APIResource {
1354
+ /**
1355
+ * List the events an endpoint can subscribe to.
1356
+ *
1357
+ * Each type with a plain description, its group and an example `data` object (what "Send test" delivers).
1358
+ *
1359
+ * @param options - Per-request options.
1360
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1361
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1362
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1363
+ * @see GET /v1/workspaces/{workspace_id}/webhooks/event-types
1364
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-webhooks-event-types
1365
+ * @example
1366
+ * ```ts
1367
+ * const webhookEventTypeList = await flags.webhooks.eventTypes.list();
1368
+ * ```
1369
+ */
1370
+ list(options) {
1371
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/webhooks/event-types" }, options);
1372
+ }
1373
+ };
1374
+ var WebhooksEventsResource = class extends APIResource {
1375
+ /**
1376
+ * List webhook events, newest first (kept for 30 days).
1377
+ *
1378
+ * Every event logged while at least one endpoint existed, with the latest state per endpoint and when the next retry is due.
1379
+ *
1380
+ * @param params - `Flags.WebhookEventListParams`.
1381
+ * @param options - Per-request options.
1382
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: Invalid filter value or cursor.
1383
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1384
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1385
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1386
+ * @see GET /v1/workspaces/{workspace_id}/webhooks/events
1387
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-webhooks-events
1388
+ * @example
1389
+ * ```ts
1390
+ * for await (const event of flags.webhooks.events.list()) {
1391
+ * console.log(event);
1392
+ * }
1393
+ * const page = await flags.webhooks.events.list({}, { timeout: 5_000 });
1394
+ * ```
1395
+ */
1396
+ list(params, options) {
1397
+ return this._client.list({ method: "GET", path: "/v1/workspaces/{workspace_id}/webhooks/events", query: params }, options);
1398
+ }
1399
+ /**
1400
+ * Send a logged event again, to its endpoints or to one endpoint.
1401
+ *
1402
+ * Same body and `webhook-id`, freshly signed, to every switched-on endpoint that receives this event type now, or only to `endpoint_id`. Waits for the receivers (up to 15 s each) and returns the attempts. A success cancels a retry still queued for that endpoint.
1403
+ *
1404
+ * @param eventId - The event id, `evt_<uuid>`.
1405
+ * @param params - `Flags.WebhookEventReplayParams`.
1406
+ * @param options - Per-request options (an Idempotency-Key is sent automatically; override with `idempotencyKey`).
1407
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `event_id` is not `evt_<uuid>`, or `endpoint_id` is not a UUID.
1408
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1409
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1410
+ * @throws {NotFoundError} 404 NOT_FOUND, WEBHOOK_EVENT_NOT_FOUND, WEBHOOK_ENDPOINT_NOT_FOUND: No such event here (`WEBHOOK_EVENT_NOT_FOUND`); events are kept for 30 days. Or No such endpoint here (`WEBHOOK_ENDPOINT_NOT_FOUND`).
1411
+ * @throws {ConflictError} 409 CONFLICT, WEBHOOK_ENDPOINT_NOT_SUBSCRIBED, IDEMPOTENCY_KEY_REUSE, IDEMPOTENCY_IN_PROGRESS: `endpoint_id` is switched off or does not receive this event type (`WEBHOOK_ENDPOINT_NOT_SUBSCRIBED`), or Idempotency-Key reused with a different body (`IDEMPOTENCY_KEY_REUSE`). Idempotency: `IDEMPOTENCY_KEY_REUSE` when this `Idempotency-Key` was already used with a different body or route; `IDEMPOTENCY_IN_PROGRESS` while another request with the same key is still running (retry after `Retry-After` seconds, with the same key).
1412
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1413
+ * @see POST /v1/workspaces/{workspace_id}/webhooks/events/{event_id}/replay
1414
+ * @see https://productcraft.co/docs/flags/api-reference#post-v1-workspaces-workspace-id-webhooks-events-event-id-replay
1415
+ * @example
1416
+ * ```ts
1417
+ * const webhookEventReplay = await flags.webhooks.events.replay("3f0c1a2b-4c5d-4e6f-8a9b-0c1d2e3f4a5b");
1418
+ * ```
1419
+ */
1420
+ replay(eventId, params, options) {
1421
+ return this._client.request({ method: "POST", path: "/v1/workspaces/{workspace_id}/webhooks/events/{event_id}/replay", pathParams: { event_id: eventId }, query: params, idempotent: true }, options);
1422
+ }
1423
+ /**
1424
+ * Get one webhook event with every delivery attempt.
1425
+ *
1426
+ * The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
1427
+ *
1428
+ * @param eventId - The event id, `evt_<uuid>`.
1429
+ * @param options - Per-request options.
1430
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `event_id` is not `evt_<uuid>`.
1431
+ * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing or invalid bearer token.
1432
+ * @throws {PermissionDeniedError} 403 FORBIDDEN, SERVICE_NOT_ENABLED: Caller lacks `flags.webhook.read` (reads) or `flags.webhook.manage` (changes, Send test, replay), or Flags is not enabled for the workspace (`SERVICE_NOT_ENABLED`).
1433
+ * @throws {NotFoundError} 404 NOT_FOUND, WEBHOOK_EVENT_NOT_FOUND: No such event here (`WEBHOOK_EVENT_NOT_FOUND`); events are kept for 30 days.
1434
+ * @throws {RateLimitError} 429 RATE_LIMITED: More than 20 requests per second or 600 per minute from this client IP (`RATE_LIMITED`); wait `Retry-After` seconds.
1435
+ * @see GET /v1/workspaces/{workspace_id}/webhooks/events/{event_id}
1436
+ * @see https://productcraft.co/docs/flags/api-reference#get-v1-workspaces-workspace-id-webhooks-events-event-id
1437
+ * @example
1438
+ * ```ts
1439
+ * const webhookEventDetail = await flags.webhooks.events.retrieve("3f0c1a2b-4c5d-4e6f-8a9b-0c1d2e3f4a5b");
1440
+ * ```
1441
+ */
1442
+ retrieve(eventId, options) {
1443
+ return this._client.request({ method: "GET", path: "/v1/workspaces/{workspace_id}/webhooks/events/{event_id}", pathParams: { event_id: eventId } }, options);
1444
+ }
1445
+ };
1446
+ var WebhooksResource = class extends APIResource {
1447
+ #endpoints;
1448
+ #eventTypes;
1449
+ #events;
1450
+ get endpoints() {
1451
+ return this.#endpoints ??= new WebhooksEndpointsResource(this._client, this._b);
1452
+ }
1453
+ get eventTypes() {
1454
+ return this.#eventTypes ??= new WebhooksEventTypesResource(this._client, this._b);
1455
+ }
1456
+ get events() {
1457
+ return this.#events ??= new WebhooksEventsResource(this._client, this._b);
1458
+ }
1459
+ /**
1460
+ * Verify a webhook's signature and parse it (Standard Webhooks, and the legacy `t=…,v1=…` scheme).
1461
+ *
1462
+ * @param params - The raw body, the request headers and optionally the secret.
1463
+ * @throws {WebhookVerificationError} The signature, timestamp or payload is invalid.
1464
+ * @throws {ConfigurationError} No secret was passed or configured.
1465
+ */
1466
+ unwrap(params) {
1467
+ return this._client.unwrapWebhook(params, "PRODUCTCRAFT_FLAGS_WEBHOOK_SECRET");
1468
+ }
1469
+ /**
1470
+ * Sign a test event the way ProductCraft signs deliveries (Standard Webhooks), so a handler
1471
+ * test can call `unwrap` without a live delivery. Returns the exact body and the headers.
1472
+ *
1473
+ * @param params - The event (an object is JSON-encoded), and optionally the secret, `id` and `timestamp`.
1474
+ * @throws {ConfigurationError} No secret was passed or configured.
1475
+ */
1476
+ sign(params) {
1477
+ return this._client.signWebhook(params, "PRODUCTCRAFT_FLAGS_WEBHOOK_SECRET");
1478
+ }
1479
+ };
1480
+ var FlagsResources = class extends APIResource {
1481
+ #changes;
1482
+ #configs;
1483
+ #imports;
1484
+ #limits;
1485
+ #projects;
1486
+ #segments;
1487
+ #settings;
1488
+ #stats;
1489
+ #webhooks;
1490
+ get changes() {
1491
+ return this.#changes ??= new ChangesResource(this._client, this._b);
1492
+ }
1493
+ get configs() {
1494
+ return this.#configs ??= new ConfigsResource(this._client, this._b);
1495
+ }
1496
+ get imports() {
1497
+ return this.#imports ??= new ImportsResource(this._client, this._b);
1498
+ }
1499
+ get limits() {
1500
+ return this.#limits ??= new LimitsResource(this._client, this._b);
1501
+ }
1502
+ get projects() {
1503
+ return this.#projects ??= new ProjectsResource(this._client, this._b);
1504
+ }
1505
+ get segments() {
1506
+ return this.#segments ??= new SegmentsResource(this._client, this._b);
1507
+ }
1508
+ get settings() {
1509
+ return this.#settings ??= new SettingsResource(this._client, this._b);
1510
+ }
1511
+ get stats() {
1512
+ return this.#stats ??= new StatsResource(this._client, this._b);
1513
+ }
1514
+ get webhooks() {
1515
+ return this.#webhooks ??= new WebhooksResource(this._client, this._b);
1516
+ }
1517
+ };
1518
+
1519
+ // src/_generated/types.ts
1520
+ var FlagsActorType = { values: ["user", "api_key", "system"] };
1521
+ var FlagsChangeActorType = { values: ["user", "api_key", "system"] };
1522
+ var FlagsEnvironmentPreset = { values: ["dev_prod", "dev_staging_prod"] };
1523
+ var FlagsEvaluationErrorCode = { values: ["FLAG_NOT_FOUND", "TYPE_MISMATCH", "PREREQUISITE_CYCLE", "PREREQUISITE_NOT_FOUND", "PREREQUISITE_DEPTH", "GENERAL"] };
1524
+ var FlagsEvaluationReason = { values: ["STATIC", "TARGETING_MATCH", "SPLIT", "DEFAULT", "ERROR"] };
1525
+ var FlagsEvaluationWarningCode = { values: ["missing_user", "missing_attribute", "invalid_attribute", "unknown_comparator", "missing_percentage_attribute"] };
1526
+ var FlagsHistoryExportFormat = { values: ["csv", "json"] };
1527
+ var FlagsImportMappedType = { values: ["environment", "config", "segment", "setting"] };
1528
+ var FlagsImportSource = { values: ["configcat"] };
1529
+ var FlagsJsonPatchOp = { values: ["add", "remove", "replace"] };
1530
+ var FlagsPrerequisiteComparator = { values: ["eq", "neq"] };
1531
+ var FlagsSdkKeyRotationReason = { values: ["rotated", "grace_ended"] };
1532
+ var FlagsSdkKeySlot = { values: ["primary", "secondary"] };
1533
+ var FlagsSegmentComparator = { values: ["in", "not_in"] };
1534
+ var FlagsSettingLifecycle = { values: ["temporary", "permanent"] };
1535
+ var FlagsSettingType = { values: ["boolean", "string", "integer", "number", "json"] };
1536
+ var FlagsUserComparator = { values: ["eq", "neq", "one_of", "not_one_of", "contains_any", "not_contains_any", "starts_with_any", "not_starts_with_any", "ends_with_any", "not_ends_with_any", "semver_one_of", "semver_not_one_of", "semver_lt", "semver_lte", "semver_gt", "semver_gte", "num_eq", "num_neq", "num_lt", "num_lte", "num_gt", "num_gte", "before", "after", "array_contains_any", "array_not_contains_any", "eq_hashed", "neq_hashed", "one_of_hashed", "not_one_of_hashed", "starts_with_any_hashed", "not_starts_with_any_hashed", "ends_with_any_hashed", "not_ends_with_any_hashed", "array_contains_any_hashed", "array_not_contains_any_hashed"] };
1537
+ var FlagsWebhookActorType = { values: ["user", "api_key", "system"] };
1538
+ var SdkKeySlot = { values: ["primary", "secondary"] };
1539
+ var WebhookAttemptTrigger = { values: ["automatic", "replay", "test"] };
1540
+ var WebhookEndpointDisabledReason = { values: ["manual", "failing"] };
1541
+ var WebhookEndpointStatus = { values: ["enabled", "disabled", "auto_disabled"] };
1542
+ var WebhookEventStatus = { values: ["pending", "delivered", "failed", "not_sent"] };
1543
+ var WebhookEventType = { values: ["config.published", "sdk_key.rotated"] };
1544
+
1545
+ // src/_generated/client.ts
1546
+ var VERSION = "0.2.0" ;
1547
+ exports.Flags = class Flags extends FlagsResources {
1548
+ constructor(options = {}) {
1549
+ super(new core.APIClient(options, core.PC_BASE_URL.flags, { name: "flags", version: VERSION }));
1550
+ }
1551
+ #openapi;
1552
+ /** The typed `openapi-fetch` escape hatch over the same credential and base URL. It does not retry. */
1553
+ get client() {
1554
+ return this.#openapi ??= core.createOpenAPIClient(this._client);
1555
+ }
1556
+ };
1557
+ ((Flags2) => {
1558
+ Flags2.FlagsActorType = FlagsActorType;
1559
+ Flags2.FlagsChangeActorType = FlagsChangeActorType;
1560
+ Flags2.FlagsEnvironmentPreset = FlagsEnvironmentPreset;
1561
+ Flags2.FlagsEvaluationErrorCode = FlagsEvaluationErrorCode;
1562
+ Flags2.FlagsEvaluationReason = FlagsEvaluationReason;
1563
+ Flags2.FlagsEvaluationWarningCode = FlagsEvaluationWarningCode;
1564
+ Flags2.FlagsHistoryExportFormat = FlagsHistoryExportFormat;
1565
+ Flags2.FlagsImportMappedType = FlagsImportMappedType;
1566
+ Flags2.FlagsImportSource = FlagsImportSource;
1567
+ Flags2.FlagsJsonPatchOp = FlagsJsonPatchOp;
1568
+ Flags2.FlagsPrerequisiteComparator = FlagsPrerequisiteComparator;
1569
+ Flags2.FlagsSdkKeyRotationReason = FlagsSdkKeyRotationReason;
1570
+ Flags2.FlagsSdkKeySlot = FlagsSdkKeySlot;
1571
+ Flags2.FlagsSegmentComparator = FlagsSegmentComparator;
1572
+ Flags2.FlagsSettingLifecycle = FlagsSettingLifecycle;
1573
+ Flags2.FlagsSettingType = FlagsSettingType;
1574
+ Flags2.FlagsUserComparator = FlagsUserComparator;
1575
+ Flags2.FlagsWebhookActorType = FlagsWebhookActorType;
1576
+ Flags2.SdkKeySlot = SdkKeySlot;
1577
+ Flags2.WebhookAttemptTrigger = WebhookAttemptTrigger;
1578
+ Flags2.WebhookEndpointDisabledReason = WebhookEndpointDisabledReason;
1579
+ Flags2.WebhookEndpointStatus = WebhookEndpointStatus;
1580
+ Flags2.WebhookEventStatus = WebhookEventStatus;
1581
+ Flags2.WebhookEventType = WebhookEventType;
1582
+ })(exports.Flags || (exports.Flags = {}));
1583
+ //# sourceMappingURL=chunk-HOIKWDWQ.cjs.map
1584
+ //# sourceMappingURL=chunk-HOIKWDWQ.cjs.map