@gravity-rail/sdk 0.16.0 → 0.18.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 (36) hide show
  1. package/dist/{chunk-4B7T6MBH.js → chunk-MP5ENP4Q.js} +493 -77
  2. package/dist/chunk-MP5ENP4Q.js.map +1 -0
  3. package/dist/{chunk-GP6ICMWF.js → chunk-PJFEGUHM.js} +8 -1
  4. package/dist/chunk-PJFEGUHM.js.map +1 -0
  5. package/dist/{client-3xYGmF3t.d.ts → client-B51HZ6zY.d.cts} +2229 -217
  6. package/dist/{client-BhO_UFFz.d.cts → client-G5i59XtT.d.ts} +2229 -217
  7. package/dist/helpers.cjs +7 -0
  8. package/dist/helpers.cjs.map +1 -1
  9. package/dist/helpers.d.cts +2 -2
  10. package/dist/helpers.d.ts +2 -2
  11. package/dist/helpers.js +1 -1
  12. package/dist/index.cjs +449 -70
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +23 -5
  15. package/dist/index.d.ts +23 -5
  16. package/dist/index.js +77 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/internal.cjs +564 -72
  19. package/dist/internal.cjs.map +1 -1
  20. package/dist/internal.d.cts +95 -7
  21. package/dist/internal.d.ts +95 -7
  22. package/dist/internal.js +93 -6
  23. package/dist/internal.js.map +1 -1
  24. package/dist/{revision-state-Dma10N9s.d.ts → revision-state-Cc7RAf8A.d.ts} +30 -5
  25. package/dist/{revision-state-Dx8gCQIj.d.cts → revision-state-DudSCwea.d.cts} +30 -5
  26. package/dist/schemas.cjs +170 -216
  27. package/dist/schemas.cjs.map +1 -1
  28. package/dist/schemas.d.cts +11 -11
  29. package/dist/schemas.d.ts +11 -11
  30. package/dist/schemas.js +170 -209
  31. package/dist/schemas.js.map +1 -1
  32. package/dist/{tasks-vupYoJgG.d.cts → tasks-1JXJJuG8.d.cts} +256 -73
  33. package/dist/{tasks-vupYoJgG.d.ts → tasks-1JXJJuG8.d.ts} +256 -73
  34. package/package.json +3 -3
  35. package/dist/chunk-4B7T6MBH.js.map +0 -1
  36. package/dist/chunk-GP6ICMWF.js.map +0 -1
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ import {
44
44
  MemberImportValidationError,
45
45
  MemberType,
46
46
  MenuItemResponseItemType,
47
+ MergeMemberRolesRequestAccessStrategy,
47
48
  ModelProvider,
48
49
  ModelType,
49
50
  NO_ASSISTANT_PARTICIPANT_CHAT_TYPES,
@@ -83,7 +84,8 @@ import {
83
84
  SMS_DELIVERY_FAILURE_STATUSES,
84
85
  STT_MODEL_DEEPGRAM_FLUX,
85
86
  STT_MODEL_DEEPGRAM_FLUX_MULTI,
86
- STT_MODEL_ELEVENLABS_SCRIBE,
87
+ STT_MODEL_DEEPGRAM_FLUX_MULTI_SELFHOST,
88
+ STT_MODEL_DEEPGRAM_FLUX_SELFHOST,
87
89
  Scope,
88
90
  ScopeCategory,
89
91
  ScopeManager,
@@ -101,9 +103,12 @@ import {
101
103
  WIDGET_SLUGS,
102
104
  WORKFLOW_IMPLICIT_USE_SCOPE,
103
105
  WorkflowAccessWarningResourceType,
106
+ WorkflowRoutingMode,
104
107
  WorkspaceFeature,
105
108
  WorkspaceProvisionStatus,
109
+ archivedMemberConflictId,
106
110
  areDependenciesSatisfied,
111
+ asIdentifiedMemberContactConflict,
107
112
  canPreviewVoice,
108
113
  clearRegistry,
109
114
  createWorkspaceClient,
@@ -126,9 +131,12 @@ import {
126
131
  getTTSProvider,
127
132
  getVoiceModelId,
128
133
  initializeFeatures,
134
+ isAccountContactConflict,
129
135
  isAgentNoteOrigin,
130
136
  isChatType,
131
137
  isFeatureAvailable,
138
+ isIdentifiedMemberContactConflict,
139
+ isMemberContactConflict,
132
140
  isPositiveRating,
133
141
  isRegistryInitialized,
134
142
  isSMSDeliveryFailureStatus,
@@ -138,7 +146,7 @@ import {
138
146
  roleWorkflowAccess,
139
147
  usesBuiltinAssistant,
140
148
  validateFeatureDependencies
141
- } from "./chunk-4B7T6MBH.js";
149
+ } from "./chunk-MP5ENP4Q.js";
142
150
  import {
143
151
  AttendeeResponseStatus,
144
152
  AttendeeStatus,
@@ -159,7 +167,7 @@ import {
159
167
  BaseApiClient,
160
168
  getCookieValue,
161
169
  parseOrgAuthChallenge
162
- } from "./chunk-GP6ICMWF.js";
170
+ } from "./chunk-PJFEGUHM.js";
163
171
 
164
172
  // src/workspace-builder/resource.ts
165
173
  function isRecord(value) {
@@ -971,6 +979,16 @@ var TaskBuilder = class extends WorkspaceBuilderResource {
971
979
  description;
972
980
  transitions = [];
973
981
  eventRules = [];
982
+ /** Child task ids the server already has, recorded when this task is adopted. */
983
+ existingChildIds = /* @__PURE__ */ new Set();
984
+ /** Record the edges an adopted task already carries, so a re-run adds only what is missing. */
985
+ adopt(existing) {
986
+ super.adopt(existing);
987
+ for (const child of existing.childTasks ?? []) {
988
+ const id = child.taskId ?? child.id;
989
+ if (typeof id === "number") this.existingChildIds.add(id);
990
+ }
991
+ }
974
992
  transitionsTo(child, when, autoNext = false, required = false, celCondition) {
975
993
  if (child === this) {
976
994
  throw new Error(`Task '${this.name}' cannot transition to itself`);
@@ -1281,7 +1299,53 @@ ${"=".repeat(50)}`);
1281
1299
  writeLine("\n Journey warnings:");
1282
1300
  for (const problem of problems) writeLine(` ! ${problem}`);
1283
1301
  }
1302
+ /**
1303
+ * Problems that make the plan unwritable, found before the first write.
1304
+ *
1305
+ * The API validates each CEL when you save it, and its diagnosis is right —
1306
+ * but it fires per-write, so a plan whose edges reference a non-collection
1307
+ * form gets four labels, two forms, a workflow and six tasks created before
1308
+ * the seventh call rejects it. The operator is left with a half-built
1309
+ * program to hand-repair. Checking here costs nothing and writes nothing.
1310
+ *
1311
+ * Deliberately narrow: only cross-resource facts the builder can see with
1312
+ * certainty. Per-field CEL schema checking stays server-side, where the
1313
+ * real validator lives — duplicating it here would drift.
1314
+ */
1315
+ preflight() {
1316
+ const problems = [];
1317
+ const forms = this.resources.filter(
1318
+ (resource) => resource instanceof FormBuilder
1319
+ );
1320
+ const collectionBySlug = new Map(forms.map((form) => [form.slug, form.collection]));
1321
+ const reference = /assignment\.collections\.([A-Za-z0-9_]+)/g;
1322
+ for (const resource of this.sortedResources()) {
1323
+ if (!(resource instanceof TaskBuilder)) continue;
1324
+ for (const transition of resource.transitions) {
1325
+ const cel = transition.celCondition;
1326
+ if (!cel) continue;
1327
+ for (const [, slug] of cel.matchAll(reference)) {
1328
+ if (!collectionBySlug.has(slug)) continue;
1329
+ if (!collectionBySlug.get(slug)) {
1330
+ problems.push(
1331
+ `task '${transition.parent.name}' \u2192 '${transition.child.name}': CEL reads assignment.collections.${slug}, but this plan creates '${slug}' as a non-collection form. Declare it with { collection: true }.`
1332
+ );
1333
+ }
1334
+ }
1335
+ }
1336
+ }
1337
+ return [...new Set(problems)];
1338
+ }
1284
1339
  async apply() {
1340
+ const problems = this.preflight();
1341
+ if (problems.length) {
1342
+ writeLine("\nPlan rejected \u2014 nothing was created:");
1343
+ for (const problem of problems) writeLine(` ! ${problem}`);
1344
+ throw new Error(
1345
+ `Plan has ${problems.length} problem(s) and was not applied:
1346
+ ` + problems.map((problem) => ` - ${problem}`).join("\n")
1347
+ );
1348
+ }
1285
1349
  const resources = this.sortedResources();
1286
1350
  await this.resolveExisting(resources);
1287
1351
  const summary = {};
@@ -1468,6 +1532,7 @@ Done! Created ${count} resources.`);
1468
1532
  const childTasks = transitions.flatMap((transition) => {
1469
1533
  const taskId = transition.child._id;
1470
1534
  if (taskId === void 0 || taskId === parent._id) return [];
1535
+ if (parent.existingChildIds.has(taskId)) return [];
1471
1536
  return [
1472
1537
  {
1473
1538
  taskId,
@@ -1858,6 +1923,7 @@ export {
1858
1923
  MemberType,
1859
1924
  MenuItemResponseItemType,
1860
1925
  MenuItemResponseItemType as MenuItemType,
1926
+ MergeMemberRolesRequestAccessStrategy,
1861
1927
  ModelProvider,
1862
1928
  ModelType,
1863
1929
  NO_ASSISTANT_PARTICIPANT_CHAT_TYPES,
@@ -1900,7 +1966,8 @@ export {
1900
1966
  SMS_DELIVERY_FAILURE_STATUSES,
1901
1967
  STT_MODEL_DEEPGRAM_FLUX,
1902
1968
  STT_MODEL_DEEPGRAM_FLUX_MULTI,
1903
- STT_MODEL_ELEVENLABS_SCRIBE,
1969
+ STT_MODEL_DEEPGRAM_FLUX_MULTI_SELFHOST,
1970
+ STT_MODEL_DEEPGRAM_FLUX_SELFHOST,
1904
1971
  Scope,
1905
1972
  ScopeCategory,
1906
1973
  ScopeManager,
@@ -1921,11 +1988,14 @@ export {
1921
1988
  WorkflowAccessWarningResourceType,
1922
1989
  WorkflowBuilder,
1923
1990
  WorkflowAccessWarningResourceType as WorkflowResourceType,
1991
+ WorkflowRoutingMode,
1924
1992
  WorkspaceBuilder,
1925
1993
  WorkspaceBuilderResource,
1926
1994
  WorkspaceFeature,
1927
1995
  WorkspaceProvisionStatus,
1996
+ archivedMemberConflictId,
1928
1997
  areDependenciesSatisfied,
1998
+ asIdentifiedMemberContactConflict,
1929
1999
  canPreviewVoice,
1930
2000
  clearRegistry,
1931
2001
  createWorkspaceClient,
@@ -1949,9 +2019,12 @@ export {
1949
2019
  getTTSProvider,
1950
2020
  getVoiceModelId,
1951
2021
  initializeFeatures,
2022
+ isAccountContactConflict,
1952
2023
  isAgentNoteOrigin,
1953
2024
  isChatType,
1954
2025
  isFeatureAvailable,
2026
+ isIdentifiedMemberContactConflict,
2027
+ isMemberContactConflict,
1955
2028
  isPositiveRating,
1956
2029
  isRegistryInitialized,
1957
2030
  isSMSDeliveryFailureStatus,