@gravity-rail/sdk 0.7.4 → 0.10.1

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 (43) hide show
  1. package/README.md +38 -0
  2. package/dist/{chunk-ANY7WLOD.js → chunk-2BJG4GYM.js} +778 -545
  3. package/dist/chunk-2BJG4GYM.js.map +1 -0
  4. package/dist/chunk-FSSXKQR5.js +471 -0
  5. package/dist/chunk-FSSXKQR5.js.map +1 -0
  6. package/dist/{chunk-QS6ZRQUZ.js → chunk-TJT7A4CO.js} +8 -1
  7. package/dist/{chunk-QS6ZRQUZ.js.map → chunk-TJT7A4CO.js.map} +1 -1
  8. package/dist/{client-B_cweJhP.d.cts → client-BffM3KcA.d.cts} +1367 -344
  9. package/dist/{client-C-on7whi.d.ts → client-DfjAYbt8.d.ts} +1367 -344
  10. package/dist/helpers.cjs +178 -2
  11. package/dist/helpers.cjs.map +1 -1
  12. package/dist/helpers.d.cts +82 -3
  13. package/dist/helpers.d.ts +82 -3
  14. package/dist/helpers.js +156 -1
  15. package/dist/helpers.js.map +1 -1
  16. package/dist/index.cjs +992 -174
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +14 -8
  19. package/dist/index.d.ts +14 -8
  20. package/dist/index.js +144 -20
  21. package/dist/index.js.map +1 -1
  22. package/dist/{inquiries-BX3PuU-7.d.cts → inquiries-UcWNYo-Q.d.cts} +567 -79
  23. package/dist/{inquiries-BX3PuU-7.d.ts → inquiries-UcWNYo-Q.d.ts} +567 -79
  24. package/dist/internal.cjs +925 -161
  25. package/dist/internal.cjs.map +1 -1
  26. package/dist/internal.d.cts +241 -5
  27. package/dist/internal.d.ts +241 -5
  28. package/dist/internal.js +71 -7
  29. package/dist/internal.js.map +1 -1
  30. package/dist/realtime.cjs +1 -0
  31. package/dist/realtime.cjs.map +1 -1
  32. package/dist/realtime.js +1 -0
  33. package/dist/realtime.js.map +1 -1
  34. package/dist/schemas.cjs +40 -7
  35. package/dist/schemas.cjs.map +1 -1
  36. package/dist/schemas.d.cts +134 -51
  37. package/dist/schemas.d.ts +134 -51
  38. package/dist/schemas.js +40 -8
  39. package/dist/schemas.js.map +1 -1
  40. package/dist/{scopes-ColqadkM.d.ts → scopes-CjSvITpL.d.cts} +53 -8
  41. package/dist/{scopes-CNbQi30F.d.cts → scopes-CmNKWrzb.d.ts} +53 -8
  42. package/package.json +6 -6
  43. package/dist/chunk-ANY7WLOD.js.map +0 -1
package/dist/index.js CHANGED
@@ -6,10 +6,8 @@ import {
6
6
  AccessGrantStatus,
7
7
  AccessGrantTrigger,
8
8
  AccessLevel,
9
- ApiError,
10
9
  AppsApi,
11
10
  BUILTIN_ASSISTANT_CHAT_TYPES,
12
- BaseApiClient,
13
11
  BuildersApi,
14
12
  BulkMemberResultStatus,
15
13
  BusinessIndustry,
@@ -38,6 +36,9 @@ import {
38
36
  MASKED_SECRET_SENTINEL,
39
37
  McpServerState,
40
38
  MemberFeature,
39
+ MemberImportMatchInfoMatchType,
40
+ MemberImportPreviewRowAction,
41
+ MemberImportValidationError,
41
42
  MemberType,
42
43
  MenuItemResponseItemType,
43
44
  ModelProvider,
@@ -57,7 +58,11 @@ import {
57
58
  PERMISSION_NONE,
58
59
  PERMISSION_USE,
59
60
  PERMISSION_VERIFY,
61
+ PIDS_DISPOSITIONS,
62
+ PIDS_SOURCES,
60
63
  ProductType,
64
+ QUERY_VALUELESS_OPS,
65
+ QueriesApi,
61
66
  REALTIME_MODEL_CUSTOM,
62
67
  REALTIME_MODEL_GEMINI,
63
68
  REALTIME_MODEL_GEMINI_VERTEX,
@@ -85,7 +90,6 @@ import {
85
90
  TTS_MODEL_ELEVENLABS_FLASH,
86
91
  TTS_MODEL_ELEVENLABS_MULTILINGUAL,
87
92
  TTS_MODEL_ELEVENLABS_TURBO,
88
- TTS_MODEL_POCKET,
89
93
  TTS_PREVIEW_PROVIDERS,
90
94
  TemplatesApi,
91
95
  ToolkitState,
@@ -105,7 +109,6 @@ import {
105
109
  getApplicableResourceSlugs,
106
110
  getApplicableResources,
107
111
  getAvailableFeaturesForUpgrade,
108
- getCookieValue,
109
112
  getFeature,
110
113
  getFeaturesByCategory,
111
114
  getFeaturesByVisibility,
@@ -122,7 +125,7 @@ import {
122
125
  requiresAssistantParticipant,
123
126
  usesBuiltinAssistant,
124
127
  validateFeatureDependencies
125
- } from "./chunk-ANY7WLOD.js";
128
+ } from "./chunk-2BJG4GYM.js";
126
129
  import {
127
130
  AttendeeResponseStatus,
128
131
  AttendeeStatus,
@@ -133,10 +136,16 @@ import {
133
136
  CalendarSource,
134
137
  DataCategory,
135
138
  DataFieldType,
139
+ DataRecordRetirementResponseReason,
136
140
  DataSensitivity,
137
141
  DataTypeRecordScope,
138
142
  IndexStatus
139
- } from "./chunk-QS6ZRQUZ.js";
143
+ } from "./chunk-TJT7A4CO.js";
144
+ import {
145
+ ApiError,
146
+ BaseApiClient,
147
+ getCookieValue
148
+ } from "./chunk-FSSXKQR5.js";
140
149
 
141
150
  // src/workspace-builder/resource.ts
142
151
  function isRecord(value) {
@@ -155,6 +164,24 @@ var WorkspaceBuilderResource = class {
155
164
  _uuid;
156
165
  _created = false;
157
166
  _existed = false;
167
+ /** Server-assigned numeric id — available after apply() or adopt(). */
168
+ get id() {
169
+ if (this._id === void 0) {
170
+ throw new Error(
171
+ `${this.constructor.name} has no id yet \u2014 ids are assigned during apply(). Pass the builder object itself where a reference is needed; refs resolve at apply time.`
172
+ );
173
+ }
174
+ return this._id;
175
+ }
176
+ /** Server-assigned uuid — available after apply() or adopt(). */
177
+ get uuid() {
178
+ if (this._uuid === void 0) {
179
+ throw new Error(
180
+ `${this.constructor.name} has no uuid yet \u2014 uuids are assigned during apply(). Pass the builder object itself where a reference is needed; refs resolve at apply time.`
181
+ );
182
+ }
183
+ return this._uuid;
184
+ }
158
185
  matchKey() {
159
186
  return void 0;
160
187
  }
@@ -185,6 +212,7 @@ var MemberFilterBuilder = class extends WorkspaceBuilderResource {
185
212
  this.name = name;
186
213
  this.description = options.description ?? "";
187
214
  }
215
+ name;
188
216
  description;
189
217
  rules = [];
190
218
  addRule(objectType, filterType, options = {}) {
@@ -219,6 +247,8 @@ var RoutineBuilder = class extends WorkspaceBuilderResource {
219
247
  this.active = options.active ?? false;
220
248
  this.description = options.description ?? "";
221
249
  }
250
+ name;
251
+ cronSchedule;
222
252
  active;
223
253
  description;
224
254
  rules = [];
@@ -280,6 +310,7 @@ var NotificationRuleBuilder = class extends WorkspaceBuilderResource {
280
310
  this.notifyEmail = Boolean(options.notifyEmail ?? options.notify_email);
281
311
  this.notifyVoice = Boolean(options.notifyVoice ?? options.notify_voice);
282
312
  }
313
+ name;
283
314
  noticeType;
284
315
  memberId;
285
316
  workflow;
@@ -504,6 +535,11 @@ var JourneyStepBuilder = class extends WorkspaceBuilderResource {
504
535
  this.workflow = workflow;
505
536
  this.description = description;
506
537
  }
538
+ name;
539
+ journey;
540
+ order;
541
+ workflow;
542
+ description;
507
543
  connections = [];
508
544
  connectsTo(child, condition, required = false, timeoutSeconds) {
509
545
  this.connections.push({ parent: this, child, condition, required, timeoutSeconds });
@@ -532,6 +568,7 @@ var JourneyBuilder = class extends WorkspaceBuilderResource {
532
568
  this.name = name;
533
569
  this.description = options.description ?? "";
534
570
  }
571
+ name;
535
572
  description;
536
573
  steps = [];
537
574
  goals = [];
@@ -602,6 +639,9 @@ var RoleUpdate = class extends WorkspaceBuilderResource {
602
639
  this.workflowIds = workflowIds;
603
640
  this.dataTypeIds = dataTypeIds;
604
641
  }
642
+ roleId;
643
+ workflowIds;
644
+ dataTypeIds;
605
645
  planLine() {
606
646
  const parts = [];
607
647
  if (this.workflowIds) parts.push(`workflows=${JSON.stringify(this.workflowIds)}`);
@@ -643,6 +683,7 @@ var AbilityDef = class {
643
683
  if (inputKey in options) this.perms[outputKey] = options[inputKey];
644
684
  }
645
685
  }
686
+ abilityType;
646
687
  uuid = crypto.randomUUID();
647
688
  config;
648
689
  enabled;
@@ -673,13 +714,25 @@ var TaskBuilder = class extends WorkspaceBuilderResource {
673
714
  this.start = start;
674
715
  this.description = description;
675
716
  }
717
+ name;
718
+ workflow;
719
+ prompt;
720
+ start;
721
+ description;
676
722
  transitions = [];
677
723
  eventRules = [];
678
- transitionsTo(child, when, autoNext = false, required = false) {
724
+ transitionsTo(child, when, autoNext = false, required = false, celCondition) {
679
725
  if (child === this) {
680
726
  throw new Error(`Task '${this.name}' cannot transition to itself`);
681
727
  }
682
- this.transitions.push({ parent: this, child, when, autoNext, required });
728
+ this.transitions.push({
729
+ parent: this,
730
+ child,
731
+ when,
732
+ autoNext,
733
+ required,
734
+ celCondition
735
+ });
683
736
  return this;
684
737
  }
685
738
  onEnter(action, params = {}, name) {
@@ -721,6 +774,7 @@ var WorkflowBuilder = class extends WorkspaceBuilderResource {
721
774
  this.prompt = options.prompt;
722
775
  this.agentId = options.agentId ?? options.agent_id;
723
776
  }
777
+ name;
724
778
  description;
725
779
  prompt;
726
780
  agentId;
@@ -841,6 +895,7 @@ var AgentBuilder = class extends WorkspaceBuilderResource {
841
895
  this.tools = options.tools ?? [];
842
896
  this.codeInterpreterEnabled = options.codeInterpreterEnabled ?? options.code_interpreter_enabled ?? false;
843
897
  }
898
+ name;
844
899
  chatModelId;
845
900
  systemPrompt;
846
901
  memberRoleId;
@@ -892,6 +947,7 @@ var WorkspaceBuilder = class {
892
947
  constructor(client) {
893
948
  this.client = client;
894
949
  }
950
+ client;
895
951
  resources = [];
896
952
  form(name, options = {}) {
897
953
  const form = new FormBuilder(name, options.slug, options);
@@ -1016,7 +1072,7 @@ ${"=".repeat(50)}`);
1016
1072
  writeLine(` Skipped: ${resource.planLine()}`);
1017
1073
  }
1018
1074
  } catch (err) {
1019
- writeLine(` FAILED: ${resource.planLine()}: ${summarizeError(err)}`);
1075
+ writeLine(formatApplyFailureLine(resource, err));
1020
1076
  throw new ApplyError(resource, err, summary);
1021
1077
  }
1022
1078
  }
@@ -1167,7 +1223,7 @@ Done! Created ${count} resources.`);
1167
1223
  {
1168
1224
  taskId,
1169
1225
  choicePrompt: transition.when,
1170
- celCondition: null,
1226
+ celCondition: transition.celCondition ?? null,
1171
1227
  autoNext: transition.autoNext,
1172
1228
  required: transition.required
1173
1229
  }
@@ -1273,16 +1329,21 @@ Done! Created ${count} resources.`);
1273
1329
  }
1274
1330
  };
1275
1331
  var ApplyError = class extends Error {
1332
+ createdSoFar;
1333
+ #resource;
1334
+ #cause;
1276
1335
  constructor(resource, cause, createdSoFar) {
1277
- super(
1278
- `Failed creating ${resource.planLine()}: ${summarizeError(cause)}
1279
- Already created: ${JSON.stringify(
1280
- createdSoFar
1281
- )}`
1282
- );
1283
- this.resource = resource;
1284
- this.cause = cause;
1336
+ super(formatApplyErrorMessage(resource, cause, createdSoFar));
1337
+ this.name = "ApplyError";
1285
1338
  this.createdSoFar = createdSoFar;
1339
+ this.#resource = resource;
1340
+ this.#cause = cause;
1341
+ }
1342
+ get resource() {
1343
+ return this.#resource;
1344
+ }
1345
+ get cause() {
1346
+ return this.#cause;
1286
1347
  }
1287
1348
  };
1288
1349
  function resourceKey(resource) {
@@ -1393,8 +1454,64 @@ function handleEventRuleApplyFailure(resourceName, err) {
1393
1454
  writeLine(` FAILED: Event rule on '${resourceName}': ${summary}`);
1394
1455
  throw new Error(`Failed wiring event rule on '${resourceName}': ${summary}`);
1395
1456
  }
1457
+ function writeScopeForResource(resource) {
1458
+ if (resource instanceof FormBuilder) return "datatypes:write";
1459
+ if (resource instanceof WorkflowBuilder || resource instanceof TaskBuilder) {
1460
+ return "workflows:write";
1461
+ }
1462
+ if (resource instanceof AgentBuilder) return "agents:write";
1463
+ if (resource instanceof MemberLabelBuilder || resource instanceof MemberFilterBuilder) {
1464
+ return "members:write";
1465
+ }
1466
+ if (resource instanceof RoutineBuilder || resource instanceof NotificationRuleBuilder) {
1467
+ return "automations:admin";
1468
+ }
1469
+ if (resource instanceof JourneyBuilder || resource instanceof JourneyStepBuilder) {
1470
+ return "journeys:write";
1471
+ }
1472
+ if (resource instanceof RoleUpdate) return "member_roles:write";
1473
+ return null;
1474
+ }
1475
+ function scopeRetryHint(resource) {
1476
+ const scope = writeScopeForResource(resource);
1477
+ return scope ? ` (retry exec with scopes=['${scope}'])` : "";
1478
+ }
1479
+ function formatApplyFailureLine(resource, err) {
1480
+ const line = ` FAILED: ${resource.planLine()}: ${summarizeError(err)}`;
1481
+ return hasStatus(err, 403) ? `${line}${scopeRetryHint(resource)}` : line;
1482
+ }
1483
+ function formatApplyErrorMessage(resource, cause, createdSoFar) {
1484
+ let message = `Failed creating ${resource.planLine()}: ${summarizeError(cause)}`;
1485
+ if (hasStatus(cause, 403)) {
1486
+ const scope = writeScopeForResource(resource);
1487
+ if (scope) {
1488
+ message += `
1489
+ Retry exec with scopes=['${scope}']`;
1490
+ }
1491
+ }
1492
+ const createdKeys = Object.keys(createdSoFar);
1493
+ if (createdKeys.length > 0) {
1494
+ message += `
1495
+ Already created: ${JSON.stringify(createdSoFar)}`;
1496
+ }
1497
+ return message;
1498
+ }
1396
1499
  function summarizeError(err) {
1397
- if (err instanceof Error) return err.name || "Error";
1500
+ if (hasStatus(err, 403)) {
1501
+ return "Insufficient permissions for this operation";
1502
+ }
1503
+ if (err instanceof ApiError) {
1504
+ const msg = err.message.trim();
1505
+ const availableTypesIdx = msg.indexOf("Available types:");
1506
+ if (availableTypesIdx !== -1) {
1507
+ const head = msg.slice(0, availableTypesIdx).trim().replace(/\.$/, "");
1508
+ return head ? `${head}.` : "Request failed";
1509
+ }
1510
+ return msg.length > 240 ? `${msg.slice(0, 237)}...` : msg;
1511
+ }
1512
+ if (err instanceof Error) {
1513
+ return err.name || "Error";
1514
+ }
1398
1515
  return typeof err;
1399
1516
  }
1400
1517
  function hasStatus(err, status) {
@@ -1448,6 +1565,7 @@ export {
1448
1565
  DEFAULT_VOICE_INFERENCE_MODEL,
1449
1566
  DataCategory,
1450
1567
  DataFieldType,
1568
+ DataRecordRetirementResponseReason,
1451
1569
  DataSensitivity,
1452
1570
  DataTypeRecordScope,
1453
1571
  DriverMode,
@@ -1471,6 +1589,9 @@ export {
1471
1589
  McpServerState,
1472
1590
  MemberFeature,
1473
1591
  MemberFilterBuilder,
1592
+ MemberImportMatchInfoMatchType,
1593
+ MemberImportPreviewRowAction,
1594
+ MemberImportValidationError,
1474
1595
  MemberLabelBuilder,
1475
1596
  MemberType,
1476
1597
  MenuItemResponseItemType,
@@ -1493,7 +1614,11 @@ export {
1493
1614
  PERMISSION_NONE,
1494
1615
  PERMISSION_USE,
1495
1616
  PERMISSION_VERIFY,
1617
+ PIDS_DISPOSITIONS,
1618
+ PIDS_SOURCES,
1496
1619
  ProductType,
1620
+ QUERY_VALUELESS_OPS,
1621
+ QueriesApi,
1497
1622
  REALTIME_MODEL_CUSTOM,
1498
1623
  REALTIME_MODEL_GEMINI,
1499
1624
  REALTIME_MODEL_GEMINI_VERTEX,
@@ -1523,7 +1648,6 @@ export {
1523
1648
  TTS_MODEL_ELEVENLABS_FLASH,
1524
1649
  TTS_MODEL_ELEVENLABS_MULTILINGUAL,
1525
1650
  TTS_MODEL_ELEVENLABS_TURBO,
1526
- TTS_MODEL_POCKET,
1527
1651
  TTS_PREVIEW_PROVIDERS,
1528
1652
  TaskBuilder,
1529
1653
  TemplatesApi,