@rulebricks/sdk 1.3.0 → 1.4.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 (112) hide show
  1. package/README.md +3 -3
  2. package/api/errors/ForbiddenError.d.ts +1 -2
  3. package/api/resources/assets/resources/rules/client/Client.js +1 -6
  4. package/api/resources/index.d.ts +1 -2
  5. package/api/resources/index.js +2 -3
  6. package/api/resources/values/client/Client.d.ts +58 -4
  7. package/api/resources/values/client/Client.js +66 -5
  8. package/api/resources/values/client/requests/UpdateValuesRequest.d.ts +81 -4
  9. package/api/resources/values/client/requests/ValuesListRequest.d.ts +12 -1
  10. package/api/resources/values/index.d.ts +0 -1
  11. package/api/resources/values/index.js +0 -1
  12. package/api/types/DynamicValue.d.ts +12 -14
  13. package/api/types/index.d.ts +0 -6
  14. package/api/types/index.js +0 -6
  15. package/dist/api/errors/ForbiddenError.d.ts +1 -2
  16. package/dist/api/resources/assets/resources/rules/client/Client.js +1 -6
  17. package/dist/api/resources/index.d.ts +1 -2
  18. package/dist/api/resources/index.js +2 -3
  19. package/dist/api/resources/values/client/Client.d.ts +58 -4
  20. package/dist/api/resources/values/client/Client.js +66 -5
  21. package/dist/api/resources/values/client/requests/UpdateValuesRequest.d.ts +81 -4
  22. package/dist/api/resources/values/client/requests/ValuesListRequest.d.ts +12 -1
  23. package/dist/api/resources/values/index.d.ts +0 -1
  24. package/dist/api/resources/values/index.js +0 -1
  25. package/dist/api/types/DynamicValue.d.ts +12 -14
  26. package/dist/api/types/index.d.ts +0 -6
  27. package/dist/api/types/index.js +0 -6
  28. package/dist/serialization/resources/index.d.ts +1 -2
  29. package/dist/serialization/resources/index.js +2 -3
  30. package/dist/serialization/resources/values/client/requests/UpdateValuesRequest.d.ts +1 -2
  31. package/dist/serialization/resources/values/client/requests/UpdateValuesRequest.js +1 -2
  32. package/dist/serialization/resources/values/index.d.ts +0 -1
  33. package/dist/serialization/resources/values/index.js +0 -1
  34. package/dist/serialization/types/DynamicValue.d.ts +9 -17
  35. package/dist/serialization/types/DynamicValue.js +8 -14
  36. package/dist/serialization/types/index.d.ts +0 -6
  37. package/dist/serialization/types/index.js +0 -6
  38. package/package.json +1 -1
  39. package/serialization/resources/index.d.ts +1 -2
  40. package/serialization/resources/index.js +2 -3
  41. package/serialization/resources/values/client/requests/UpdateValuesRequest.d.ts +1 -2
  42. package/serialization/resources/values/client/requests/UpdateValuesRequest.js +1 -2
  43. package/serialization/resources/values/index.d.ts +0 -1
  44. package/serialization/resources/values/index.js +0 -1
  45. package/serialization/types/DynamicValue.d.ts +9 -17
  46. package/serialization/types/DynamicValue.js +8 -14
  47. package/serialization/types/index.d.ts +0 -6
  48. package/serialization/types/index.js +0 -6
  49. package/api/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -4
  50. package/api/resources/values/types/UpdateValuesRequestValuesValue.js +0 -5
  51. package/api/resources/values/types/index.d.ts +0 -1
  52. package/api/resources/values/types/index.js +0 -17
  53. package/api/types/BooleanValue.d.ts +0 -8
  54. package/api/types/BooleanValue.js +0 -5
  55. package/api/types/DynamicValueBase.d.ts +0 -14
  56. package/api/types/DynamicValueBase.js +0 -5
  57. package/api/types/ListValue.d.ts +0 -8
  58. package/api/types/ListValue.js +0 -5
  59. package/api/types/ListValueValueItem.d.ts +0 -4
  60. package/api/types/ListValueValueItem.js +0 -5
  61. package/api/types/NumberValue.d.ts +0 -8
  62. package/api/types/NumberValue.js +0 -5
  63. package/api/types/StringValue.d.ts +0 -8
  64. package/api/types/StringValue.js +0 -5
  65. package/dist/api/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -4
  66. package/dist/api/resources/values/types/UpdateValuesRequestValuesValue.js +0 -5
  67. package/dist/api/resources/values/types/index.d.ts +0 -1
  68. package/dist/api/resources/values/types/index.js +0 -17
  69. package/dist/api/types/BooleanValue.d.ts +0 -8
  70. package/dist/api/types/BooleanValue.js +0 -5
  71. package/dist/api/types/DynamicValueBase.d.ts +0 -14
  72. package/dist/api/types/DynamicValueBase.js +0 -5
  73. package/dist/api/types/ListValue.d.ts +0 -8
  74. package/dist/api/types/ListValue.js +0 -5
  75. package/dist/api/types/ListValueValueItem.d.ts +0 -4
  76. package/dist/api/types/ListValueValueItem.js +0 -5
  77. package/dist/api/types/NumberValue.d.ts +0 -8
  78. package/dist/api/types/NumberValue.js +0 -5
  79. package/dist/api/types/StringValue.d.ts +0 -8
  80. package/dist/api/types/StringValue.js +0 -5
  81. package/dist/serialization/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -10
  82. package/dist/serialization/resources/values/types/UpdateValuesRequestValuesValue.js +0 -36
  83. package/dist/serialization/resources/values/types/index.d.ts +0 -1
  84. package/dist/serialization/resources/values/types/index.js +0 -17
  85. package/dist/serialization/types/BooleanValue.d.ts +0 -13
  86. package/dist/serialization/types/BooleanValue.js +0 -36
  87. package/dist/serialization/types/DynamicValueBase.d.ts +0 -16
  88. package/dist/serialization/types/DynamicValueBase.js +0 -37
  89. package/dist/serialization/types/ListValue.d.ts +0 -14
  90. package/dist/serialization/types/ListValue.js +0 -37
  91. package/dist/serialization/types/ListValueValueItem.d.ts +0 -10
  92. package/dist/serialization/types/ListValueValueItem.js +0 -37
  93. package/dist/serialization/types/NumberValue.d.ts +0 -13
  94. package/dist/serialization/types/NumberValue.js +0 -36
  95. package/dist/serialization/types/StringValue.d.ts +0 -13
  96. package/dist/serialization/types/StringValue.js +0 -36
  97. package/serialization/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -10
  98. package/serialization/resources/values/types/UpdateValuesRequestValuesValue.js +0 -36
  99. package/serialization/resources/values/types/index.d.ts +0 -1
  100. package/serialization/resources/values/types/index.js +0 -17
  101. package/serialization/types/BooleanValue.d.ts +0 -13
  102. package/serialization/types/BooleanValue.js +0 -36
  103. package/serialization/types/DynamicValueBase.d.ts +0 -16
  104. package/serialization/types/DynamicValueBase.js +0 -37
  105. package/serialization/types/ListValue.d.ts +0 -14
  106. package/serialization/types/ListValue.js +0 -37
  107. package/serialization/types/ListValueValueItem.d.ts +0 -10
  108. package/serialization/types/ListValueValueItem.js +0 -37
  109. package/serialization/types/NumberValue.d.ts +0 -13
  110. package/serialization/types/NumberValue.js +0 -36
  111. package/serialization/types/StringValue.d.ts +0 -13
  112. package/serialization/types/StringValue.js +0 -36
@@ -53,24 +53,30 @@ class Values {
53
53
  this._options = _options;
54
54
  }
55
55
  /**
56
- * Retrieve all dynamic values for the authenticated user.
56
+ * Retrieve all dynamic values for the authenticated user. Use the 'include' parameter to control whether usage information is returned.
57
57
  *
58
58
  * @param {Rulebricks.ValuesListRequest} request
59
59
  * @param {Values.RequestOptions} requestOptions - Request-specific configuration.
60
60
  *
61
+ * @throws {@link Rulebricks.NotFoundError}
61
62
  * @throws {@link Rulebricks.InternalServerError}
62
63
  *
63
64
  * @example
64
- * await client.values.list()
65
+ * await client.values.list({
66
+ * include: "usage"
67
+ * })
65
68
  */
66
69
  list(request = {}, requestOptions) {
67
70
  var _a, _b;
68
71
  return __awaiter(this, void 0, void 0, function* () {
69
- const { name } = request;
72
+ const { name, include } = request;
70
73
  const _queryParams = {};
71
74
  if (name != null) {
72
75
  _queryParams["name"] = name;
73
76
  }
77
+ if (include != null) {
78
+ _queryParams["include"] = include;
79
+ }
74
80
  const _response = yield core.fetcher({
75
81
  url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.RulebricksEnvironment.Default, "values"),
76
82
  method: "GET",
@@ -92,6 +98,8 @@ class Values {
92
98
  }
93
99
  if (_response.error.reason === "status-code") {
94
100
  switch (_response.error.statusCode) {
101
+ case 404:
102
+ throw new Rulebricks.NotFoundError(_response.error.body);
95
103
  case 500:
96
104
  throw new Rulebricks.InternalServerError(_response.error.body);
97
105
  default:
@@ -117,12 +125,13 @@ class Values {
117
125
  });
118
126
  }
119
127
  /**
120
- * Update existing dynamic values or add new ones for the authenticated user.
128
+ * Update existing dynamic values or add new ones for the authenticated user. Supports both flat and nested object structures. Nested objects are automatically flattened using dot notation and keys are converted to readable format (e.g., 'user_name' becomes 'User Name', nested 'user.contact_info.email' becomes 'User.Contact Info.Email').
121
129
  *
122
130
  * @param {Rulebricks.UpdateValuesRequest} request
123
131
  * @param {Values.RequestOptions} requestOptions - Request-specific configuration.
124
132
  *
125
133
  * @throws {@link Rulebricks.BadRequestError}
134
+ * @throws {@link Rulebricks.ForbiddenError}
126
135
  * @throws {@link Rulebricks.InternalServerError}
127
136
  *
128
137
  * @example
@@ -131,10 +140,60 @@ class Values {
131
140
  * "Favorite Color": "blue",
132
141
  * "Age": 30,
133
142
  * "Is Student": false,
134
- * "Hobbies": ["reading", "cycling"]
143
+ * "Hobbies": [
144
+ * "reading",
145
+ * "cycling"
146
+ * ]
147
+ * },
148
+ * accessGroups: ["marketing", "developers"]
149
+ * })
150
+ *
151
+ * @example
152
+ * await client.values.update({
153
+ * values: {
154
+ * "user_profile": {
155
+ * "first_name": "Alice",
156
+ * "last_name": "Johnson",
157
+ * "contact_info": {
158
+ * "email_address": "alice@example.com",
159
+ * "phone_number": "555-0123"
160
+ * }
161
+ * },
162
+ * "account_settings": {
163
+ * "is_premium_user": true,
164
+ * "subscription_tier": "gold",
165
+ * "preferences": [
166
+ * "email_notifications",
167
+ * "sms_alerts"
168
+ * ]
169
+ * },
170
+ * "account_balance": 1250.75
135
171
  * },
136
172
  * accessGroups: ["marketing", "developers"]
137
173
  * })
174
+ *
175
+ * @example
176
+ * await client.values.update({
177
+ * values: {
178
+ * "Company Name": "Acme Corp",
179
+ * "company_details": {
180
+ * "founded_year": 2020,
181
+ * "employee_count": 150,
182
+ * "headquarters": {
183
+ * "city": "San Francisco",
184
+ * "state": "CA",
185
+ * "country": "USA"
186
+ * }
187
+ * },
188
+ * "Is Public": false,
189
+ * "tags": [
190
+ * "tech",
191
+ * "startup",
192
+ * "saas"
193
+ * ]
194
+ * },
195
+ * accessGroups: ["marketing"]
196
+ * })
138
197
  */
139
198
  update(request, requestOptions) {
140
199
  var _a, _b;
@@ -162,6 +221,8 @@ class Values {
162
221
  switch (_response.error.statusCode) {
163
222
  case 400:
164
223
  throw new Rulebricks.BadRequestError(_response.error.body);
224
+ case 403:
225
+ throw new Rulebricks.ForbiddenError(_response.error.body);
165
226
  case 500:
166
227
  throw new Rulebricks.InternalServerError(_response.error.body);
167
228
  default:
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Rulebricks from "../../../../index";
5
4
  /**
6
5
  * @example
7
6
  * {
@@ -9,14 +8,92 @@ import * as Rulebricks from "../../../../index";
9
8
  * "Favorite Color": "blue",
10
9
  * "Age": 30,
11
10
  * "Is Student": false,
12
- * "Hobbies": ["reading", "cycling"]
11
+ * "Hobbies": [
12
+ * "reading",
13
+ * "cycling"
14
+ * ]
15
+ * },
16
+ * accessGroups: ["marketing", "developers"]
17
+ * }
18
+ *
19
+ * @example
20
+ * {
21
+ * values: {
22
+ * "user_profile": {
23
+ * "first_name": "Alice",
24
+ * "last_name": "Johnson",
25
+ * "contact_info": {
26
+ * "email_address": "alice@example.com",
27
+ * "phone_number": "555-0123"
28
+ * }
29
+ * },
30
+ * "account_settings": {
31
+ * "is_premium_user": true,
32
+ * "subscription_tier": "gold",
33
+ * "preferences": [
34
+ * "email_notifications",
35
+ * "sms_alerts"
36
+ * ]
37
+ * },
38
+ * "account_balance": 1250.75
39
+ * },
40
+ * accessGroups: ["marketing", "developers"]
41
+ * }
42
+ *
43
+ * @example
44
+ * {
45
+ * values: {
46
+ * "Company Name": "Acme Corp",
47
+ * "company_details": {
48
+ * "founded_year": 2020,
49
+ * "employee_count": 150,
50
+ * "headquarters": {
51
+ * "city": "San Francisco",
52
+ * "state": "CA",
53
+ * "country": "USA"
54
+ * }
55
+ * },
56
+ * "Is Public": false,
57
+ * "tags": [
58
+ * "tech",
59
+ * "startup",
60
+ * "saas"
61
+ * ]
62
+ * },
63
+ * accessGroups: ["marketing"]
64
+ * }
65
+ *
66
+ * @example
67
+ * {
68
+ * values: {
69
+ * "Favorite Color": "blue",
70
+ * "Age": 30,
71
+ * "Is Student": false,
72
+ * "Hobbies": [
73
+ * "reading",
74
+ * "cycling"
75
+ * ]
76
+ * },
77
+ * accessGroups: ["marketing", "developers"]
78
+ * }
79
+ *
80
+ * @example
81
+ * {
82
+ * values: {
83
+ * "Favorite Color": "blue",
84
+ * "Age": 30,
85
+ * "Is Student": false,
86
+ * "Hobbies": [
87
+ * "reading",
88
+ * "cycling"
89
+ * ]
13
90
  * },
14
91
  * accessGroups: ["marketing", "developers"]
15
92
  * }
16
93
  */
17
94
  export interface UpdateValuesRequest {
18
- /** A flat dictionary of keys and values to update or add. */
19
- values: Record<string, Rulebricks.UpdateValuesRequestValuesValue>;
95
+ /** A dictionary of keys and values to update or add. Supports both flat key-value pairs and nested objects. Nested objects will be automatically flattened using dot notation with readable key names (e.g., 'user.contact_info.email' becomes 'User.Contact Info.Email'). */
96
+ values: Record<string, unknown>;
20
97
  /** Optional array of access group names or IDs. If omitted and user belongs to access groups, values will be assigned to all user's access groups. Required if values should be restricted to specific access groups. */
21
98
  accessGroups?: string[];
22
99
  }
@@ -3,11 +3,22 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {}
6
+ * {
7
+ * include: "usage"
8
+ * }
9
+ *
10
+ * @example
11
+ * {
12
+ * include: "usage"
13
+ * }
7
14
  */
8
15
  export interface ValuesListRequest {
9
16
  /**
10
17
  * Query all dynamic values containing a specific name
11
18
  */
12
19
  name?: string;
20
+ /**
21
+ * Comma-separated list of additional data to include. Use 'usage' to include which rules reference each value.
22
+ */
23
+ include?: string;
13
24
  }
@@ -1,2 +1 @@
1
- export * from "./types";
2
1
  export * from "./client";
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
17
  __exportStar(require("./client"), exports);
@@ -2,18 +2,16 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as Rulebricks from "../index";
5
- export declare type DynamicValue = Rulebricks.DynamicValue.String | Rulebricks.DynamicValue.Number | Rulebricks.DynamicValue.Boolean | Rulebricks.DynamicValue.List;
6
- export declare namespace DynamicValue {
7
- interface String extends Rulebricks.StringValue {
8
- type: "string";
9
- }
10
- interface Number extends Rulebricks.NumberValue {
11
- type: "number";
12
- }
13
- interface Boolean extends Rulebricks.BooleanValue {
14
- type: "boolean";
15
- }
16
- interface List extends Rulebricks.ListValue {
17
- type: "list";
18
- }
5
+ export interface DynamicValue {
6
+ /** Unique identifier for the dynamic value. */
7
+ id: string;
8
+ /** Name of the dynamic value (may include dot notation for nested properties). */
9
+ name: string;
10
+ /** Type identifier for the value (e.g., 'string', 'number', 'boolean', 'list', 'function', etc.) */
11
+ type: string;
12
+ value?: unknown;
13
+ /** Rules that use this dynamic value (only included when 'include=usage' parameter is used). */
14
+ usages?: Rulebricks.RuleUsage[];
15
+ /** Access groups assigned to this value. */
16
+ accessGroups?: string[];
19
17
  }
@@ -29,12 +29,6 @@ export * from "./DecisionLogDecisionConditionsItemValue";
29
29
  export * from "./DecisionLogDecision";
30
30
  export * from "./DecisionLog";
31
31
  export * from "./UsageStatistics";
32
- export * from "./DynamicValueBase";
33
- export * from "./StringValue";
34
- export * from "./NumberValue";
35
- export * from "./BooleanValue";
36
- export * from "./ListValueValueItem";
37
- export * from "./ListValue";
38
32
  export * from "./DynamicValue";
39
33
  export * from "./DynamicValueListResponse";
40
34
  export * from "./RuleUsage";
@@ -45,12 +45,6 @@ __exportStar(require("./DecisionLogDecisionConditionsItemValue"), exports);
45
45
  __exportStar(require("./DecisionLogDecision"), exports);
46
46
  __exportStar(require("./DecisionLog"), exports);
47
47
  __exportStar(require("./UsageStatistics"), exports);
48
- __exportStar(require("./DynamicValueBase"), exports);
49
- __exportStar(require("./StringValue"), exports);
50
- __exportStar(require("./NumberValue"), exports);
51
- __exportStar(require("./BooleanValue"), exports);
52
- __exportStar(require("./ListValueValueItem"), exports);
53
- __exportStar(require("./ListValue"), exports);
54
48
  __exportStar(require("./DynamicValue"), exports);
55
49
  __exportStar(require("./DynamicValueListResponse"), exports);
56
50
  __exportStar(require("./RuleUsage"), exports);
@@ -1,8 +1,7 @@
1
1
  export * as users from "./users";
2
2
  export * from "./users/types";
3
- export * as values from "./values";
4
- export * from "./values/types";
5
3
  export * as rules from "./rules";
6
4
  export * from "./users/client/requests";
5
+ export * as values from "./values";
7
6
  export * from "./values/client/requests";
8
7
  export * as assets from "./assets";
@@ -26,12 +26,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.assets = exports.rules = exports.values = exports.users = void 0;
29
+ exports.assets = exports.values = exports.rules = exports.users = void 0;
30
30
  exports.users = __importStar(require("./users"));
31
31
  __exportStar(require("./users/types"), exports);
32
- exports.values = __importStar(require("./values"));
33
- __exportStar(require("./values/types"), exports);
34
32
  exports.rules = __importStar(require("./rules"));
35
33
  __exportStar(require("./users/client/requests"), exports);
34
+ exports.values = __importStar(require("./values"));
36
35
  __exportStar(require("./values/client/requests"), exports);
37
36
  exports.assets = __importStar(require("./assets"));
@@ -4,11 +4,10 @@
4
4
  import * as serializers from "../../../../index";
5
5
  import * as Rulebricks from "../../../../../api/index";
6
6
  import * as core from "../../../../../core";
7
- import { UpdateValuesRequestValuesValue } from "../../types/UpdateValuesRequestValuesValue";
8
7
  export declare const UpdateValuesRequest: core.serialization.Schema<serializers.UpdateValuesRequest.Raw, Rulebricks.UpdateValuesRequest>;
9
8
  export declare namespace UpdateValuesRequest {
10
9
  interface Raw {
11
- values: Record<string, UpdateValuesRequestValuesValue.Raw>;
10
+ values: Record<string, unknown>;
12
11
  accessGroups?: string[] | null;
13
12
  }
14
13
  }
@@ -28,8 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.UpdateValuesRequest = void 0;
30
30
  const core = __importStar(require("../../../../../core"));
31
- const UpdateValuesRequestValuesValue_1 = require("../../types/UpdateValuesRequestValuesValue");
32
31
  exports.UpdateValuesRequest = core.serialization.object({
33
- values: core.serialization.record(core.serialization.string(), UpdateValuesRequestValuesValue_1.UpdateValuesRequestValuesValue),
32
+ values: core.serialization.record(core.serialization.string(), core.serialization.unknown()),
34
33
  accessGroups: core.serialization.list(core.serialization.string()).optional(),
35
34
  });
@@ -1,2 +1 @@
1
- export * from "./types";
2
1
  export * from "./client";
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
17
  __exportStar(require("./client"), exports);
@@ -4,23 +4,15 @@
4
4
  import * as serializers from "../index";
5
5
  import * as Rulebricks from "../../api/index";
6
6
  import * as core from "../../core";
7
- import { StringValue } from "./StringValue";
8
- import { NumberValue } from "./NumberValue";
9
- import { BooleanValue } from "./BooleanValue";
10
- import { ListValue } from "./ListValue";
11
- export declare const DynamicValue: core.serialization.Schema<serializers.DynamicValue.Raw, Rulebricks.DynamicValue>;
7
+ import { RuleUsage } from "./RuleUsage";
8
+ export declare const DynamicValue: core.serialization.ObjectSchema<serializers.DynamicValue.Raw, Rulebricks.DynamicValue>;
12
9
  export declare namespace DynamicValue {
13
- type Raw = DynamicValue.String | DynamicValue.Number | DynamicValue.Boolean | DynamicValue.List;
14
- interface String extends StringValue.Raw {
15
- type: "string";
16
- }
17
- interface Number extends NumberValue.Raw {
18
- type: "number";
19
- }
20
- interface Boolean extends BooleanValue.Raw {
21
- type: "boolean";
22
- }
23
- interface List extends ListValue.Raw {
24
- type: "list";
10
+ interface Raw {
11
+ id: string;
12
+ name: string;
13
+ type: string;
14
+ value?: unknown | null;
15
+ usages?: RuleUsage.Raw[] | null;
16
+ accessGroups?: string[] | null;
25
17
  }
26
18
  }
@@ -28,18 +28,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.DynamicValue = void 0;
30
30
  const core = __importStar(require("../../core"));
31
- const StringValue_1 = require("./StringValue");
32
- const NumberValue_1 = require("./NumberValue");
33
- const BooleanValue_1 = require("./BooleanValue");
34
- const ListValue_1 = require("./ListValue");
35
- exports.DynamicValue = core.serialization
36
- .union("type", {
37
- string: StringValue_1.StringValue,
38
- number: NumberValue_1.NumberValue,
39
- boolean: BooleanValue_1.BooleanValue,
40
- list: ListValue_1.ListValue,
41
- })
42
- .transform({
43
- transform: (value) => value,
44
- untransform: (value) => value,
31
+ const RuleUsage_1 = require("./RuleUsage");
32
+ exports.DynamicValue = core.serialization.object({
33
+ id: core.serialization.string(),
34
+ name: core.serialization.string(),
35
+ type: core.serialization.string(),
36
+ value: core.serialization.unknown().optional(),
37
+ usages: core.serialization.list(RuleUsage_1.RuleUsage).optional(),
38
+ accessGroups: core.serialization.list(core.serialization.string()).optional(),
45
39
  });
@@ -29,12 +29,6 @@ export * from "./DecisionLogDecisionConditionsItemValue";
29
29
  export * from "./DecisionLogDecision";
30
30
  export * from "./DecisionLog";
31
31
  export * from "./UsageStatistics";
32
- export * from "./DynamicValueBase";
33
- export * from "./StringValue";
34
- export * from "./NumberValue";
35
- export * from "./BooleanValue";
36
- export * from "./ListValueValueItem";
37
- export * from "./ListValue";
38
32
  export * from "./DynamicValue";
39
33
  export * from "./DynamicValueListResponse";
40
34
  export * from "./RuleUsage";
@@ -45,12 +45,6 @@ __exportStar(require("./DecisionLogDecisionConditionsItemValue"), exports);
45
45
  __exportStar(require("./DecisionLogDecision"), exports);
46
46
  __exportStar(require("./DecisionLog"), exports);
47
47
  __exportStar(require("./UsageStatistics"), exports);
48
- __exportStar(require("./DynamicValueBase"), exports);
49
- __exportStar(require("./StringValue"), exports);
50
- __exportStar(require("./NumberValue"), exports);
51
- __exportStar(require("./BooleanValue"), exports);
52
- __exportStar(require("./ListValueValueItem"), exports);
53
- __exportStar(require("./ListValue"), exports);
54
48
  __exportStar(require("./DynamicValue"), exports);
55
49
  __exportStar(require("./DynamicValueListResponse"), exports);
56
50
  __exportStar(require("./RuleUsage"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulebricks/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "private": false,
5
5
  "repository": "https://github.com/rulebricks/node-sdk",
6
6
  "main": "./index.js",
@@ -1,8 +1,7 @@
1
1
  export * as users from "./users";
2
2
  export * from "./users/types";
3
- export * as values from "./values";
4
- export * from "./values/types";
5
3
  export * as rules from "./rules";
6
4
  export * from "./users/client/requests";
5
+ export * as values from "./values";
7
6
  export * from "./values/client/requests";
8
7
  export * as assets from "./assets";
@@ -26,12 +26,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.assets = exports.rules = exports.values = exports.users = void 0;
29
+ exports.assets = exports.values = exports.rules = exports.users = void 0;
30
30
  exports.users = __importStar(require("./users"));
31
31
  __exportStar(require("./users/types"), exports);
32
- exports.values = __importStar(require("./values"));
33
- __exportStar(require("./values/types"), exports);
34
32
  exports.rules = __importStar(require("./rules"));
35
33
  __exportStar(require("./users/client/requests"), exports);
34
+ exports.values = __importStar(require("./values"));
36
35
  __exportStar(require("./values/client/requests"), exports);
37
36
  exports.assets = __importStar(require("./assets"));
@@ -4,11 +4,10 @@
4
4
  import * as serializers from "../../../../index";
5
5
  import * as Rulebricks from "../../../../../api/index";
6
6
  import * as core from "../../../../../core";
7
- import { UpdateValuesRequestValuesValue } from "../../types/UpdateValuesRequestValuesValue";
8
7
  export declare const UpdateValuesRequest: core.serialization.Schema<serializers.UpdateValuesRequest.Raw, Rulebricks.UpdateValuesRequest>;
9
8
  export declare namespace UpdateValuesRequest {
10
9
  interface Raw {
11
- values: Record<string, UpdateValuesRequestValuesValue.Raw>;
10
+ values: Record<string, unknown>;
12
11
  accessGroups?: string[] | null;
13
12
  }
14
13
  }
@@ -28,8 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.UpdateValuesRequest = void 0;
30
30
  const core = __importStar(require("../../../../../core"));
31
- const UpdateValuesRequestValuesValue_1 = require("../../types/UpdateValuesRequestValuesValue");
32
31
  exports.UpdateValuesRequest = core.serialization.object({
33
- values: core.serialization.record(core.serialization.string(), UpdateValuesRequestValuesValue_1.UpdateValuesRequestValuesValue),
32
+ values: core.serialization.record(core.serialization.string(), core.serialization.unknown()),
34
33
  accessGroups: core.serialization.list(core.serialization.string()).optional(),
35
34
  });
@@ -1,2 +1 @@
1
- export * from "./types";
2
1
  export * from "./client";
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
17
  __exportStar(require("./client"), exports);
@@ -4,23 +4,15 @@
4
4
  import * as serializers from "../index";
5
5
  import * as Rulebricks from "../../api/index";
6
6
  import * as core from "../../core";
7
- import { StringValue } from "./StringValue";
8
- import { NumberValue } from "./NumberValue";
9
- import { BooleanValue } from "./BooleanValue";
10
- import { ListValue } from "./ListValue";
11
- export declare const DynamicValue: core.serialization.Schema<serializers.DynamicValue.Raw, Rulebricks.DynamicValue>;
7
+ import { RuleUsage } from "./RuleUsage";
8
+ export declare const DynamicValue: core.serialization.ObjectSchema<serializers.DynamicValue.Raw, Rulebricks.DynamicValue>;
12
9
  export declare namespace DynamicValue {
13
- type Raw = DynamicValue.String | DynamicValue.Number | DynamicValue.Boolean | DynamicValue.List;
14
- interface String extends StringValue.Raw {
15
- type: "string";
16
- }
17
- interface Number extends NumberValue.Raw {
18
- type: "number";
19
- }
20
- interface Boolean extends BooleanValue.Raw {
21
- type: "boolean";
22
- }
23
- interface List extends ListValue.Raw {
24
- type: "list";
10
+ interface Raw {
11
+ id: string;
12
+ name: string;
13
+ type: string;
14
+ value?: unknown | null;
15
+ usages?: RuleUsage.Raw[] | null;
16
+ accessGroups?: string[] | null;
25
17
  }
26
18
  }
@@ -28,18 +28,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.DynamicValue = void 0;
30
30
  const core = __importStar(require("../../core"));
31
- const StringValue_1 = require("./StringValue");
32
- const NumberValue_1 = require("./NumberValue");
33
- const BooleanValue_1 = require("./BooleanValue");
34
- const ListValue_1 = require("./ListValue");
35
- exports.DynamicValue = core.serialization
36
- .union("type", {
37
- string: StringValue_1.StringValue,
38
- number: NumberValue_1.NumberValue,
39
- boolean: BooleanValue_1.BooleanValue,
40
- list: ListValue_1.ListValue,
41
- })
42
- .transform({
43
- transform: (value) => value,
44
- untransform: (value) => value,
31
+ const RuleUsage_1 = require("./RuleUsage");
32
+ exports.DynamicValue = core.serialization.object({
33
+ id: core.serialization.string(),
34
+ name: core.serialization.string(),
35
+ type: core.serialization.string(),
36
+ value: core.serialization.unknown().optional(),
37
+ usages: core.serialization.list(RuleUsage_1.RuleUsage).optional(),
38
+ accessGroups: core.serialization.list(core.serialization.string()).optional(),
45
39
  });
@@ -29,12 +29,6 @@ export * from "./DecisionLogDecisionConditionsItemValue";
29
29
  export * from "./DecisionLogDecision";
30
30
  export * from "./DecisionLog";
31
31
  export * from "./UsageStatistics";
32
- export * from "./DynamicValueBase";
33
- export * from "./StringValue";
34
- export * from "./NumberValue";
35
- export * from "./BooleanValue";
36
- export * from "./ListValueValueItem";
37
- export * from "./ListValue";
38
32
  export * from "./DynamicValue";
39
33
  export * from "./DynamicValueListResponse";
40
34
  export * from "./RuleUsage";