@gravity-rail/sdk 0.18.0 → 0.18.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.
@@ -4535,9 +4535,9 @@ var OrgApi = class extends BaseApiClient {
4535
4535
  /**
4536
4536
  * Update the settings an org admin owns: name, slug and contact details.
4537
4537
  *
4538
- * Deliberately NOT the admin organization update — `primary` and
4539
- * `enforceCreditLimit` are superuser-only and are not fields on this
4540
- * endpoint's request model at all.
4538
+ * Deliberately NOT the admin organization update — `enforceCreditLimit`
4539
+ * is superuser-only and is not a field on this endpoint's request model
4540
+ * at all.
4541
4541
  */
4542
4542
  async updateOrganizationSettings(orgIdOrUuid, data) {
4543
4543
  return this.fetch(`o/${orgIdOrUuid}`, {
@@ -4573,6 +4573,21 @@ var OrgApi = class extends BaseApiClient {
4573
4573
  async getOrgBillingCustomer(orgIdOrUuid) {
4574
4574
  return this.fetch(`o/${orgIdOrUuid}/billing-customer`);
4575
4575
  }
4576
+ /**
4577
+ * Per-workspace usage for this organization's current credit window.
4578
+ *
4579
+ * Requires a billing role on the organization's billing customer — the
4580
+ * same gate `getOrgBillingCustomer().hasAccess` reports, and the one that
4581
+ * decides whether the billing tab is shown at all.
4582
+ *
4583
+ * `creditsUsed` is a real organization-wide total or it is null; it is
4584
+ * never a partial sum. There is deliberately no per-workspace "remaining"
4585
+ * figure — the caps belong to the organization, so `cap - oneWorkspace`
4586
+ * describes nothing.
4587
+ */
4588
+ async getOrgWorkspaceUsage(orgIdOrUuid) {
4589
+ return this.fetch(`o/${orgIdOrUuid}/usage/workspaces`);
4590
+ }
4576
4591
  /**
4577
4592
  * List members of an organization.
4578
4593
  */
@@ -6360,12 +6375,6 @@ var SitesApi = class extends BaseApiClient {
6360
6375
  }
6361
6376
  return verifyResponse;
6362
6377
  }
6363
- /** Trigger a crawl of the site's external content source. */
6364
- async crawlSite(wid, siteId) {
6365
- return this.fetch(`w/${wid}/sites/${siteId}/crawl`, {
6366
- method: "POST"
6367
- });
6368
- }
6369
6378
  /** Create a new site in the workspace. */
6370
6379
  async createSite(wid, site) {
6371
6380
  return this.fetch(`w/${wid}/sites`, {
@@ -6536,8 +6545,8 @@ var SubscriptionsApi = class extends BaseApiClient {
6536
6545
  });
6537
6546
  }
6538
6547
  /**
6539
- * List self-service, purchasable plans (org or workspace). Only plans with a
6540
- * paid Stripe price are returned. No auth required.
6548
+ * List self-service, purchasable organization plans or add-ons. Only products
6549
+ * with a Stripe Price are returned; zero-amount plans are allowed.
6541
6550
  */
6542
6551
  async listSelfServeProducts(productType) {
6543
6552
  const qs = productType ? `?product_type=${productType}` : "";
@@ -6572,7 +6581,13 @@ var SubscriptionsApi = class extends BaseApiClient {
6572
6581
  }
6573
6582
  });
6574
6583
  }
6575
- /** Add a workspace to an existing subscription. */
6584
+ /**
6585
+ * Provision a new workspace under an existing org subscription.
6586
+ *
6587
+ * No product or period: the organization already holds the plan and the new
6588
+ * workspace bills through it. Returns before the workspace exists —
6589
+ * `provisioning: true` means poll for it.
6590
+ */
6576
6591
  async addWorkspaceToSubscription(subscriptionId, data) {
6577
6592
  return this.fetch(`subscriptions/${subscriptionId}/add-workspace`, {
6578
6593
  method: "POST",
@@ -8029,7 +8044,6 @@ var Resource = /* @__PURE__ */ ((Resource2) => {
8029
8044
  return Resource2;
8030
8045
  })(Resource || {});
8031
8046
  var ProductType = /* @__PURE__ */ ((ProductType2) => {
8032
- ProductType2["WORKSPACE"] = "workspace";
8033
8047
  ProductType2["ORG"] = "org";
8034
8048
  ProductType2["ADDON"] = "addon";
8035
8049
  return ProductType2;
@@ -8039,15 +8053,6 @@ var ORG_ONLY_RESOURCES = /* @__PURE__ */ new Set([
8039
8053
  "org_admin" /* ORG_ADMIN */,
8040
8054
  "phone_number" /* PHONE_NUMBER */
8041
8055
  ]);
8042
- var LIMIT_ONLY_RESOURCES = /* @__PURE__ */ new Set([
8043
- "member" /* MEMBER */,
8044
- "inbox" /* INBOX */,
8045
- "site" /* SITE */,
8046
- "phone_number" /* PHONE_NUMBER */,
8047
- "storage_mb" /* STORAGE_MB */,
8048
- "workspace" /* WORKSPACE */,
8049
- "org_admin" /* ORG_ADMIN */
8050
- ]);
8051
8056
 
8052
8057
  // src/types/workspace-types.ts
8053
8058
  var WorkspaceProvisionStatus = /* @__PURE__ */ ((WorkspaceProvisionStatus2) => {
@@ -9157,6 +9162,29 @@ var MetricsApi = class extends BaseApiClient {
9157
9162
  }
9158
9163
  };
9159
9164
 
9165
+ // src/api/projects.ts
9166
+ var ProjectsApi = class extends BaseApiClient {
9167
+ /** List projects (README frontmatter summaries). */
9168
+ async getProjects(wid, options = {}) {
9169
+ const params = new URLSearchParams();
9170
+ if (options.page !== void 0) params.append("page", options.page.toString());
9171
+ if (options.pageSize !== void 0) params.append("pageSize", options.pageSize.toString());
9172
+ return this.fetch(
9173
+ `w/${wid}/projects${params.toString() ? `?${params.toString()}` : ""}`
9174
+ );
9175
+ }
9176
+ /** One project: summary + present docs + plan summaries. */
9177
+ async getProject(wid, slug) {
9178
+ return this.fetch(`w/${wid}/projects/${encodeURIComponent(slug)}`);
9179
+ }
9180
+ /** One plan: summary + resolved process + flows + run state. */
9181
+ async getPlan(wid, slug, plan) {
9182
+ return this.fetch(
9183
+ `w/${wid}/projects/${encodeURIComponent(slug)}/plans/${encodeURIComponent(plan)}`
9184
+ );
9185
+ }
9186
+ };
9187
+
9160
9188
  // src/api/tracked-links.ts
9161
9189
  function withFilters(params, options) {
9162
9190
  if (options.dateFrom) params.append("dateFrom", options.dateFrom);
@@ -9366,6 +9394,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
9366
9394
  hubspot: new HubspotApi(apiKey, baseUrl, customFetch),
9367
9395
  features: new FeaturesApi(apiKey, baseUrl, customFetch),
9368
9396
  files: new FilesApi(apiKey, baseUrl, customFetch),
9397
+ projects: new ProjectsApi(apiKey, baseUrl, customFetch),
9369
9398
  inboxes: new InboxesApi(apiKey, baseUrl, customFetch),
9370
9399
  inquiries: new InquiriesApi(apiKey, baseUrl, customFetch),
9371
9400
  journeys: new JourneysApi(apiKey, baseUrl, customFetch),
@@ -9460,7 +9489,6 @@ var WORKSPACE_METHOD_NAMES = [
9460
9489
  "configureSalesforce",
9461
9490
  "convertEmail",
9462
9491
  "convertFile",
9463
- "crawlSite",
9464
9492
  "createAbility",
9465
9493
  "createAccessGrant",
9466
9494
  "createAgent",
@@ -9885,8 +9913,11 @@ var WORKSPACE_METHOD_NAMES = [
9885
9913
  "getPhoneNumbers",
9886
9914
  "getPhoneUsageReport",
9887
9915
  "getPlatformApp",
9916
+ "getPlan",
9888
9917
  "getPresenceStatus",
9889
9918
  "getProducts",
9919
+ "getProject",
9920
+ "getProjects",
9890
9921
  "getPublicFile",
9891
9922
  "getPublicFolder",
9892
9923
  "getPublicFolderFiles",
@@ -10620,7 +10651,6 @@ function bindSitesMethods(target, sites) {
10620
10651
  target.siteSendEmailCode = sites.siteSendEmailCode.bind(sites);
10621
10652
  target.siteVerifyCode = sites.siteVerifyCode.bind(sites);
10622
10653
  target.siteGoogleOAuthInitiate = sites.siteGoogleOAuthInitiate.bind(sites);
10623
- target.crawlSite = sites.crawlSite.bind(sites);
10624
10654
  target.createSite = sites.createSite.bind(sites);
10625
10655
  target.updateSite = sites.updateSite.bind(sites);
10626
10656
  target.deleteSite = sites.deleteSite.bind(sites);
@@ -10683,6 +10713,13 @@ function bindFilesMethods(target, files) {
10683
10713
  target.getPublicFolderFiles = files.getPublicFolderFiles.bind(files);
10684
10714
  }
10685
10715
 
10716
+ // src/client/bindings/projects.ts
10717
+ function bindProjectsMethods(target, projects) {
10718
+ target.getProjects = projects.getProjects.bind(projects);
10719
+ target.getProject = projects.getProject.bind(projects);
10720
+ target.getPlan = projects.getPlan.bind(projects);
10721
+ }
10722
+
10686
10723
  // src/client/bindings/events.ts
10687
10724
  function bindEventsMethods(target, events) {
10688
10725
  target.getEventRules = events.getEventRules.bind(events);
@@ -11171,6 +11208,7 @@ function bindOrgMethods(target, org) {
11171
11208
  target.syncVoiceTrustProducts = org.syncVoiceTrustProducts.bind(org);
11172
11209
  target.createOrganizationWorkspace = org.createOrganizationWorkspace.bind(org);
11173
11210
  target.getOrgBillingCustomer = org.getOrgBillingCustomer.bind(org);
11211
+ target.getOrgWorkspaceUsage = org.getOrgWorkspaceUsage.bind(org);
11174
11212
  }
11175
11213
 
11176
11214
  // src/client/bindings/pronunciations.ts
@@ -11716,6 +11754,7 @@ var GravityRailClient = class {
11716
11754
  syncVoiceTrustProducts;
11717
11755
  createOrganizationWorkspace;
11718
11756
  getOrgBillingCustomer;
11757
+ getOrgWorkspaceUsage;
11719
11758
  getVapidPublicKey;
11720
11759
  registerPushSubscription;
11721
11760
  unregisterPushSubscription;
@@ -11815,7 +11854,6 @@ var GravityRailClient = class {
11815
11854
  siteSendEmailCode;
11816
11855
  siteVerifyCode;
11817
11856
  siteGoogleOAuthInitiate;
11818
- crawlSite;
11819
11857
  createSite;
11820
11858
  updateSite;
11821
11859
  deleteSite;
@@ -11836,6 +11874,9 @@ var GravityRailClient = class {
11836
11874
  // Files API
11837
11875
  getFiles;
11838
11876
  getFile;
11877
+ getProjects;
11878
+ getProject;
11879
+ getPlan;
11839
11880
  resolveFilePath;
11840
11881
  downloadFilesZip;
11841
11882
  createFile;
@@ -12371,6 +12412,7 @@ var GravityRailClient = class {
12371
12412
  bindAuthMethods(this, apis.auth, apis.assignments);
12372
12413
  bindSitesMethods(this, apis.sites);
12373
12414
  bindFilesMethods(this, apis.files);
12415
+ bindProjectsMethods(this, apis.projects);
12374
12416
  bindEventsMethods(this, apis.events);
12375
12417
  bindWorkflowsMethods(this, apis.workflows, apis.workflowNotes, apis.voice, apis.supervisors);
12376
12418
  bindCalendarsMethods(this, apis.calendars);
@@ -12890,105 +12932,79 @@ var RESOURCE_METADATA = {
12890
12932
  label: "Credits",
12891
12933
  unit: "credit",
12892
12934
  unitPlural: "credits",
12893
- description: "AI model usage billed as tokens with model-specific multipliers",
12894
- requiresFeature: null,
12895
- scope: "any"
12935
+ description: "AI model usage billed as tokens with model-specific multipliers"
12896
12936
  },
12897
12937
  ["stt" /* STT */]: {
12898
12938
  label: "Speech-to-Text",
12899
12939
  unit: "minute",
12900
12940
  unitPlural: "minutes",
12901
- description: "Audio transcription in minutes",
12902
- requiresFeature: null,
12903
- scope: "any"
12941
+ description: "Audio transcription in minutes"
12904
12942
  },
12905
12943
  ["tts" /* TTS */]: {
12906
12944
  label: "Text-to-Speech",
12907
12945
  unit: "1,000 characters",
12908
12946
  unitPlural: "1,000 characters",
12909
- description: "Text synthesized to audio, billed in lots of 1,000 characters",
12910
- requiresFeature: null,
12911
- scope: "any"
12947
+ description: "Text synthesized to audio, billed in lots of 1,000 characters"
12912
12948
  },
12913
12949
  ["sms" /* SMS */]: {
12914
12950
  label: "SMS Messages",
12915
12951
  unit: "message",
12916
12952
  unitPlural: "messages",
12917
- description: "Text messages sent via phone number",
12918
- requiresFeature: "phone" /* PHONE */,
12919
- scope: "any"
12953
+ description: "Text messages sent via phone number"
12920
12954
  },
12921
12955
  ["email" /* EMAIL */]: {
12922
12956
  label: "Emails",
12923
12957
  unit: "message",
12924
12958
  unitPlural: "messages",
12925
- description: "Email messages sent or received",
12926
- requiresFeature: "email" /* EMAIL */,
12927
- scope: "any"
12959
+ description: "Email messages sent or received"
12928
12960
  },
12929
12961
  ["phone_call" /* PHONE_CALL */]: {
12930
12962
  label: "Phone Calls",
12931
12963
  unit: "minute",
12932
12964
  unitPlural: "minutes",
12933
- description: "Phone call duration in minutes",
12934
- requiresFeature: "phone" /* PHONE */,
12935
- scope: "any"
12965
+ description: "Phone call duration in minutes"
12936
12966
  },
12937
12967
  ["phone_number" /* PHONE_NUMBER */]: {
12938
12968
  label: "Phone Numbers",
12939
12969
  unit: "number",
12940
12970
  unitPlural: "numbers",
12941
- description: "Active phone numbers for calling and SMS",
12942
- requiresFeature: "phone" /* PHONE */,
12943
- scope: "any"
12971
+ description: "Active phone numbers for calling and SMS"
12944
12972
  },
12945
12973
  ["inbox" /* INBOX */]: {
12946
12974
  label: "Email Inboxes",
12947
12975
  unit: "inbox",
12948
12976
  unitPlural: "inboxes",
12949
- description: "Email inboxes for receiving messages",
12950
- requiresFeature: "email" /* EMAIL */,
12951
- scope: "any"
12977
+ description: "Email inboxes for receiving messages"
12952
12978
  },
12953
12979
  ["site" /* SITE */]: {
12954
12980
  label: "Sites",
12955
12981
  unit: "site",
12956
12982
  unitPlural: "sites",
12957
- description: "Published websites",
12958
- requiresFeature: "sites" /* SITES */,
12959
- scope: "any"
12983
+ description: "Published websites"
12960
12984
  },
12961
12985
  ["member" /* MEMBER */]: {
12962
12986
  label: "Members",
12963
12987
  unit: "member",
12964
12988
  unitPlural: "members",
12965
- description: "Total workspace members",
12966
- requiresFeature: null,
12967
- scope: "workspace"
12989
+ description: "Members across the organization"
12968
12990
  },
12969
12991
  ["workspace" /* WORKSPACE */]: {
12970
12992
  label: "Workspaces",
12971
12993
  unit: "workspace",
12972
12994
  unitPlural: "workspaces",
12973
- description: "Workspaces in the organization",
12974
- requiresFeature: null,
12975
- scope: "org"
12995
+ description: "Workspaces in the organization"
12976
12996
  },
12977
12997
  ["org_admin" /* ORG_ADMIN */]: {
12978
12998
  label: "Organization Admins",
12979
12999
  unit: "admin",
12980
13000
  unitPlural: "admins",
12981
- description: "Organization administrators",
12982
- requiresFeature: null,
12983
- scope: "org"
13001
+ description: "Organization administrators"
12984
13002
  },
12985
13003
  ["storage_mb" /* STORAGE_MB */]: {
12986
13004
  label: "Storage",
12987
13005
  unit: "MB",
12988
13006
  unitPlural: "MB",
12989
- description: "File storage in megabytes",
12990
- requiresFeature: null,
12991
- scope: "any"
13007
+ description: "File storage in megabytes"
12992
13008
  }
12993
13009
  };
12994
13010
  function getResourceMetadata(resource) {
@@ -12997,35 +13013,6 @@ function getResourceMetadata(resource) {
12997
13013
  function getAllResourceSlugs() {
12998
13014
  return Object.keys(RESOURCE_METADATA);
12999
13015
  }
13000
- function getScopeFromProductType(productType) {
13001
- const isOrgProduct = productType === "org" /* ORG */;
13002
- return isOrgProduct ? "org" : "workspace";
13003
- }
13004
- function getApplicableResources(scope, enabledFeatures) {
13005
- const enabledSet = enabledFeatures ? new Set(enabledFeatures) : null;
13006
- return Object.entries(RESOURCE_METADATA).filter(([_slug, metadata]) => {
13007
- if (scope === "workspace" && metadata.scope === "org") {
13008
- return false;
13009
- }
13010
- if (scope === "org" && metadata.scope === "workspace") {
13011
- return false;
13012
- }
13013
- if (enabledSet !== null && metadata.requiresFeature !== null) {
13014
- if (!enabledSet.has(metadata.requiresFeature)) {
13015
- return false;
13016
- }
13017
- }
13018
- return true;
13019
- }).map(([slug]) => slug).sort((a, b) => {
13020
- const metaA = RESOURCE_METADATA[a];
13021
- const metaB = RESOURCE_METADATA[b];
13022
- return metaA.label.localeCompare(metaB.label);
13023
- });
13024
- }
13025
- function getApplicableResourceSlugs(productType) {
13026
- const scope = getScopeFromProductType(productType);
13027
- return getApplicableResources(scope);
13028
- }
13029
13016
 
13030
13017
  // src/scopes.ts
13031
13018
  var ScopeCategory = /* @__PURE__ */ ((ScopeCategory2) => {
@@ -13783,7 +13770,6 @@ export {
13783
13770
  Resource,
13784
13771
  ProductType,
13785
13772
  ORG_ONLY_RESOURCES,
13786
- LIMIT_ONLY_RESOURCES,
13787
13773
  WorkspaceProvisionStatus,
13788
13774
  InvitationStatus,
13789
13775
  ModelProvider,
@@ -13855,6 +13841,7 @@ export {
13855
13841
  bindAuthMethods,
13856
13842
  bindSitesMethods,
13857
13843
  bindFilesMethods,
13844
+ bindProjectsMethods,
13858
13845
  bindEventsMethods,
13859
13846
  bindExperimentsMethods,
13860
13847
  bindWorkflowsMethods,
@@ -13931,13 +13918,10 @@ export {
13931
13918
  DEFAULT_CUSTOM_VOICE_MODEL,
13932
13919
  getResourceMetadata,
13933
13920
  getAllResourceSlugs,
13934
- getScopeFromProductType,
13935
- getApplicableResources,
13936
- getApplicableResourceSlugs,
13937
13921
  ScopeCategory,
13938
13922
  SCOPES,
13939
13923
  ScopeManager,
13940
13924
  SCOPE_PRESETS,
13941
13925
  getRevisionState
13942
13926
  };
13943
- //# sourceMappingURL=chunk-MP5ENP4Q.js.map
13927
+ //# sourceMappingURL=chunk-PUIYXJSZ.js.map