@productcraft/flags 0.4.0 → 0.5.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 (52) hide show
  1. package/README.md +35 -0
  2. package/api.md +5 -16
  3. package/dist/{chunk-7237IZU3.js → browser/chunk-OOX7EUCT.js} +8 -19
  4. package/dist/browser/chunk-OOX7EUCT.js.map +1 -0
  5. package/dist/browser/{chunk-72WU42RU.js → chunk-WUZAG2E3.js} +11 -4
  6. package/dist/browser/chunk-WUZAG2E3.js.map +1 -0
  7. package/dist/browser/{chunk-CXYODDHM.cjs → chunk-XZK57G7L.cjs} +8 -19
  8. package/dist/browser/chunk-XZK57G7L.cjs.map +1 -0
  9. package/dist/browser/{chunk-4XCQBTYE.cjs → chunk-YM5K4NHA.cjs} +11 -4
  10. package/dist/browser/chunk-YM5K4NHA.cjs.map +1 -0
  11. package/dist/browser/index.cjs +8 -8
  12. package/dist/browser/index.js +2 -2
  13. package/dist/browser/management.cjs +2 -2
  14. package/dist/browser/management.js +1 -1
  15. package/dist/browser/testing.cjs +3 -3
  16. package/dist/browser/testing.cjs.map +1 -1
  17. package/dist/browser/testing.js +1 -1
  18. package/dist/browser/testing.js.map +1 -1
  19. package/dist/{chunk-NB7OGN6R.js → chunk-CGVDMKEE.js} +12 -5
  20. package/dist/chunk-CGVDMKEE.js.map +1 -0
  21. package/dist/{chunk-Q3P66XRI.cjs → chunk-L3AOANTB.cjs} +12 -5
  22. package/dist/chunk-L3AOANTB.cjs.map +1 -0
  23. package/dist/{chunk-NSAKFGTJ.cjs → chunk-RJIVAOBG.cjs} +8 -19
  24. package/dist/{browser/chunk-CXYODDHM.cjs.map → chunk-RJIVAOBG.cjs.map} +1 -1
  25. package/dist/{browser/chunk-TCVKCN3S.js → chunk-XNJ5OX4X.js} +8 -19
  26. package/dist/{browser/chunk-TCVKCN3S.js.map → chunk-XNJ5OX4X.js.map} +1 -1
  27. package/dist/{client-K2zALPGD.d.cts → client-BBiIKiGW.d.cts} +18 -14
  28. package/dist/{client-K2zALPGD.d.ts → client-BBiIKiGW.d.ts} +18 -14
  29. package/dist/{client-BwoMpm8_.d.cts → client-BWi7PASW.d.cts} +94 -33
  30. package/dist/{client-BwoMpm8_.d.ts → client-BWi7PASW.d.ts} +94 -33
  31. package/dist/index.cjs +8 -8
  32. package/dist/index.d.cts +3 -3
  33. package/dist/index.d.ts +3 -3
  34. package/dist/index.js +2 -2
  35. package/dist/management.cjs +2 -2
  36. package/dist/management.d.cts +1 -1
  37. package/dist/management.d.ts +1 -1
  38. package/dist/management.js +1 -1
  39. package/dist/testing.cjs +3 -3
  40. package/dist/testing.cjs.map +1 -1
  41. package/dist/testing.d.cts +3 -3
  42. package/dist/testing.d.ts +3 -3
  43. package/dist/testing.js +1 -1
  44. package/dist/testing.js.map +1 -1
  45. package/manifest.json +1 -1
  46. package/package.json +2 -2
  47. package/dist/browser/chunk-4XCQBTYE.cjs.map +0 -1
  48. package/dist/browser/chunk-72WU42RU.js.map +0 -1
  49. package/dist/chunk-7237IZU3.js.map +0 -1
  50. package/dist/chunk-NB7OGN6R.js.map +0 -1
  51. package/dist/chunk-NSAKFGTJ.cjs.map +0 -1
  52. package/dist/chunk-Q3P66XRI.cjs.map +0 -1
@@ -1038,12 +1038,12 @@ var SegmentsResource = class extends APIResource {
1038
1038
  /**
1039
1039
  * Update a segment
1040
1040
  *
1041
- * 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.
1041
+ * Key, name, description or conditions; only the fields you send change. To add or remove values in one list condition without re-sending the others, send `condition_edits` (with the `version` you read). Edit a confidential list with `list_id` plus `values_add` / `values_remove`, or with `condition_edits`. A segment used in a protected environment also needs `flags.protected.update` there.
1042
1042
  *
1043
1043
  * @param segmentId - Id of the segment.
1044
1044
  * @param params - `Flags.SegmentUpdateParams`.
1045
1045
  * @param options - Per-request options.
1046
- * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is invalid.
1046
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: a field is invalid, an edit has no values, or both `conditions` and `condition_edits` were sent.
1047
1047
  * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, expired or invalid bearer token (`UNAUTHORIZED`). Send a workspace API key or a platform session token as `Authorization: Bearer <token>`.
1048
1048
  * @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.
1049
1049
  * @throws {NotFoundError} 404 NOT_FOUND, SEGMENT_NOT_FOUND: `SEGMENT_NOT_FOUND`: no such segment in this workspace.
@@ -1055,18 +1055,7 @@ var SegmentsResource = class extends APIResource {
1055
1055
  * @see https://productcraft.co/docs/flags/api-reference#patch-v1-workspaces-workspace-id-segments-segment-id
1056
1056
  * @example
1057
1057
  * ```ts
1058
- * const segmentDetail = await flags.segments.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", {
1059
- * conditions: [
1060
- * {
1061
- * user: {
1062
- * attribute: "email",
1063
- * comparator: "ends_with_any_hashed",
1064
- * list_id: "3f0c6a3e-0f5e-4b8e-9d1a-2c7b9f1e8a10",
1065
- * values_add: ["@beta.test"],
1066
- * },
1067
- * },
1068
- * ],
1069
- * });
1058
+ * const segmentDetail = await flags.segments.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { condition_edits: [{ condition_index: 0, values_add: ["qa-bot@example.com"] }] });
1070
1059
  * ```
1071
1060
  */
1072
1061
  update(segmentId, params, options) {
@@ -1151,13 +1140,13 @@ var SettingsValuesResource = class extends APIResource {
1151
1140
  /**
1152
1141
  * Update a value
1153
1142
  *
1154
- * 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.
1143
+ * The quick edits: `value` (the toggle), `percentage_attribute`, `rule_edits` to add or remove values in a list condition of an existing rule (a tester, a QA account) without re-sending the other rules, and `clear_rules: true` to drop every rule and split so `value` is served to everyone (the kill switch). Send the `version` you read. A protected environment needs `flags.protected.update`; one change and one revision per request, none when nothing changed.
1155
1144
  *
1156
1145
  * @param settingId - Id of the setting.
1157
1146
  * @param environmentId - Id of an environment of the same project.
1158
1147
  * @param params - `Flags.SettingsValueUpdateParams`.
1159
1148
  * @param options - Per-request options.
1160
- * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: nothing to change, or `version` is missing.
1149
+ * @throws {BadRequestError} 400 BAD_REQUEST, VALIDATION_ERROR: `VALIDATION_ERROR`: nothing to change, `version` is missing, an edit has no values, or `rule_edits` sent with `clear_rules`.
1161
1150
  * @throws {AuthenticationError} 401 UNAUTHORIZED: Missing, expired or invalid bearer token (`UNAUTHORIZED`). Send a workspace API key or a platform session token as `Authorization: Bearer <token>`.
1162
1151
  * @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.
1163
1152
  * @throws {NotFoundError} 404 NOT_FOUND, SETTING_NOT_FOUND, ENVIRONMENT_NOT_FOUND: `SETTING_NOT_FOUND` or `ENVIRONMENT_NOT_FOUND`.
@@ -1644,7 +1633,7 @@ var WebhookEventStatus = { values: ["pending", "delivered", "failed", "not_sent"
1644
1633
  var WebhookEventType = { values: ["config.published", "sdk_key.rotated"] };
1645
1634
 
1646
1635
  // src/_generated/client.ts
1647
- var VERSION = "0.4.0" ;
1636
+ var VERSION = "0.5.0" ;
1648
1637
  var Flags = class extends FlagsResources {
1649
1638
  constructor(options = {}) {
1650
1639
  super(new APIClient(options, PC_BASE_URL.flags, { name: "flags", version: VERSION }));
@@ -1683,5 +1672,5 @@ var Flags = class extends FlagsResources {
1683
1672
  })(Flags || (Flags = {}));
1684
1673
 
1685
1674
  export { Flags };
1686
- //# sourceMappingURL=chunk-TCVKCN3S.js.map
1687
- //# sourceMappingURL=chunk-TCVKCN3S.js.map
1675
+ //# sourceMappingURL=chunk-XNJ5OX4X.js.map
1676
+ //# sourceMappingURL=chunk-XNJ5OX4X.js.map