@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.
@@ -1,5 +1,5 @@
1
- import { eb as GravityRailClient } from './client-B51HZ6zY.cjs';
2
- import { bW as WorkspaceMemberResponse, aM as DataRecordResponse } from './tasks-1JXJJuG8.cjs';
1
+ import { eb as GravityRailClient } from './client-B-jmQ4UA.cjs';
2
+ import { bW as WorkspaceMemberResponse, aM as DataRecordResponse } from './tasks-GVbVa_Lj.cjs';
3
3
  import 'zod';
4
4
 
5
5
  interface OutboundPhoneNumberOption {
package/dist/helpers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { eb as GravityRailClient } from './client-G5i59XtT.js';
2
- import { bW as WorkspaceMemberResponse, aM as DataRecordResponse } from './tasks-1JXJJuG8.js';
1
+ import { eb as GravityRailClient } from './client-CatNn6FD.js';
2
+ import { bW as WorkspaceMemberResponse, aM as DataRecordResponse } from './tasks-GVbVa_Lj.js';
3
3
  import 'zod';
4
4
 
5
5
  interface OutboundPhoneNumberOption {
package/dist/index.cjs CHANGED
@@ -170,8 +170,6 @@ __export(src_exports, {
170
170
  formatAppContextAsMarkdown: () => formatAppContextAsMarkdown,
171
171
  getAllFeatures: () => getAllFeatures,
172
172
  getAllResourceSlugs: () => getAllResourceSlugs,
173
- getApplicableResourceSlugs: () => getApplicableResourceSlugs,
174
- getApplicableResources: () => getApplicableResources,
175
173
  getAvailableFeaturesForUpgrade: () => getAvailableFeaturesForUpgrade,
176
174
  getCookieValue: () => getCookieValue,
177
175
  getFeature: () => getFeature,
@@ -180,7 +178,6 @@ __export(src_exports, {
180
178
  getMissingDependencies: () => getMissingDependencies,
181
179
  getResourceMetadata: () => getResourceMetadata,
182
180
  getRevisionState: () => getRevisionState,
183
- getScopeFromProductType: () => getScopeFromProductType,
184
181
  getTTSProvider: () => getTTSProvider,
185
182
  getVoiceModelId: () => getVoiceModelId,
186
183
  initializeFeatures: () => initializeFeatures,
@@ -5500,9 +5497,9 @@ var OrgApi = class extends BaseApiClient {
5500
5497
  /**
5501
5498
  * Update the settings an org admin owns: name, slug and contact details.
5502
5499
  *
5503
- * Deliberately NOT the admin organization update — `primary` and
5504
- * `enforceCreditLimit` are superuser-only and are not fields on this
5505
- * endpoint's request model at all.
5500
+ * Deliberately NOT the admin organization update — `enforceCreditLimit`
5501
+ * is superuser-only and is not a field on this endpoint's request model
5502
+ * at all.
5506
5503
  */
5507
5504
  async updateOrganizationSettings(orgIdOrUuid, data) {
5508
5505
  return this.fetch(`o/${orgIdOrUuid}`, {
@@ -5538,6 +5535,21 @@ var OrgApi = class extends BaseApiClient {
5538
5535
  async getOrgBillingCustomer(orgIdOrUuid) {
5539
5536
  return this.fetch(`o/${orgIdOrUuid}/billing-customer`);
5540
5537
  }
5538
+ /**
5539
+ * Per-workspace usage for this organization's current credit window.
5540
+ *
5541
+ * Requires a billing role on the organization's billing customer — the
5542
+ * same gate `getOrgBillingCustomer().hasAccess` reports, and the one that
5543
+ * decides whether the billing tab is shown at all.
5544
+ *
5545
+ * `creditsUsed` is a real organization-wide total or it is null; it is
5546
+ * never a partial sum. There is deliberately no per-workspace "remaining"
5547
+ * figure — the caps belong to the organization, so `cap - oneWorkspace`
5548
+ * describes nothing.
5549
+ */
5550
+ async getOrgWorkspaceUsage(orgIdOrUuid) {
5551
+ return this.fetch(`o/${orgIdOrUuid}/usage/workspaces`);
5552
+ }
5541
5553
  /**
5542
5554
  * List members of an organization.
5543
5555
  */
@@ -6691,6 +6703,29 @@ var QueriesApi = class extends BaseApiClient {
6691
6703
  }
6692
6704
  };
6693
6705
 
6706
+ // src/api/projects.ts
6707
+ var ProjectsApi = class extends BaseApiClient {
6708
+ /** List projects (README frontmatter summaries). */
6709
+ async getProjects(wid, options = {}) {
6710
+ const params = new URLSearchParams();
6711
+ if (options.page !== void 0) params.append("page", options.page.toString());
6712
+ if (options.pageSize !== void 0) params.append("pageSize", options.pageSize.toString());
6713
+ return this.fetch(
6714
+ `w/${wid}/projects${params.toString() ? `?${params.toString()}` : ""}`
6715
+ );
6716
+ }
6717
+ /** One project: summary + present docs + plan summaries. */
6718
+ async getProject(wid, slug) {
6719
+ return this.fetch(`w/${wid}/projects/${encodeURIComponent(slug)}`);
6720
+ }
6721
+ /** One plan: summary + resolved process + flows + run state. */
6722
+ async getPlan(wid, slug, plan) {
6723
+ return this.fetch(
6724
+ `w/${wid}/projects/${encodeURIComponent(slug)}/plans/${encodeURIComponent(plan)}`
6725
+ );
6726
+ }
6727
+ };
6728
+
6694
6729
  // src/api/qualifications.ts
6695
6730
  var QualificationsApi = class extends BaseApiClient {
6696
6731
  /** List qualifications in a workspace, paginated. */
@@ -7386,12 +7421,6 @@ var SitesApi = class extends BaseApiClient {
7386
7421
  }
7387
7422
  return verifyResponse;
7388
7423
  }
7389
- /** Trigger a crawl of the site's external content source. */
7390
- async crawlSite(wid, siteId) {
7391
- return this.fetch(`w/${wid}/sites/${siteId}/crawl`, {
7392
- method: "POST"
7393
- });
7394
- }
7395
7424
  /** Create a new site in the workspace. */
7396
7425
  async createSite(wid, site) {
7397
7426
  return this.fetch(`w/${wid}/sites`, {
@@ -7535,8 +7564,8 @@ var SubscriptionsApi = class extends BaseApiClient {
7535
7564
  });
7536
7565
  }
7537
7566
  /**
7538
- * List self-service, purchasable plans (org or workspace). Only plans with a
7539
- * paid Stripe price are returned. No auth required.
7567
+ * List self-service, purchasable organization plans or add-ons. Only products
7568
+ * with a Stripe Price are returned; zero-amount plans are allowed.
7540
7569
  */
7541
7570
  async listSelfServeProducts(productType) {
7542
7571
  const qs = productType ? `?product_type=${productType}` : "";
@@ -7571,7 +7600,13 @@ var SubscriptionsApi = class extends BaseApiClient {
7571
7600
  }
7572
7601
  });
7573
7602
  }
7574
- /** Add a workspace to an existing subscription. */
7603
+ /**
7604
+ * Provision a new workspace under an existing org subscription.
7605
+ *
7606
+ * No product or period: the organization already holds the plan and the new
7607
+ * workspace bills through it. Returns before the workspace exists —
7608
+ * `provisioning: true` means poll for it.
7609
+ */
7575
7610
  async addWorkspaceToSubscription(subscriptionId, data) {
7576
7611
  return this.fetch(`subscriptions/${subscriptionId}/add-workspace`, {
7577
7612
  method: "POST",
@@ -9140,7 +9175,6 @@ var Resource = /* @__PURE__ */ ((Resource2) => {
9140
9175
  return Resource2;
9141
9176
  })(Resource || {});
9142
9177
  var ProductType = /* @__PURE__ */ ((ProductType2) => {
9143
- ProductType2["WORKSPACE"] = "workspace";
9144
9178
  ProductType2["ORG"] = "org";
9145
9179
  ProductType2["ADDON"] = "addon";
9146
9180
  return ProductType2;
@@ -10004,6 +10038,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
10004
10038
  hubspot: new HubspotApi(apiKey, baseUrl, customFetch),
10005
10039
  features: new FeaturesApi(apiKey, baseUrl, customFetch),
10006
10040
  files: new FilesApi(apiKey, baseUrl, customFetch),
10041
+ projects: new ProjectsApi(apiKey, baseUrl, customFetch),
10007
10042
  inboxes: new InboxesApi(apiKey, baseUrl, customFetch),
10008
10043
  inquiries: new InquiriesApi(apiKey, baseUrl, customFetch),
10009
10044
  journeys: new JourneysApi(apiKey, baseUrl, customFetch),
@@ -10098,7 +10133,6 @@ var WORKSPACE_METHOD_NAMES = [
10098
10133
  "configureSalesforce",
10099
10134
  "convertEmail",
10100
10135
  "convertFile",
10101
- "crawlSite",
10102
10136
  "createAbility",
10103
10137
  "createAccessGrant",
10104
10138
  "createAgent",
@@ -10523,8 +10557,11 @@ var WORKSPACE_METHOD_NAMES = [
10523
10557
  "getPhoneNumbers",
10524
10558
  "getPhoneUsageReport",
10525
10559
  "getPlatformApp",
10560
+ "getPlan",
10526
10561
  "getPresenceStatus",
10527
10562
  "getProducts",
10563
+ "getProject",
10564
+ "getProjects",
10528
10565
  "getPublicFile",
10529
10566
  "getPublicFolder",
10530
10567
  "getPublicFolderFiles",
@@ -11258,7 +11295,6 @@ function bindSitesMethods(target, sites) {
11258
11295
  target.siteSendEmailCode = sites.siteSendEmailCode.bind(sites);
11259
11296
  target.siteVerifyCode = sites.siteVerifyCode.bind(sites);
11260
11297
  target.siteGoogleOAuthInitiate = sites.siteGoogleOAuthInitiate.bind(sites);
11261
- target.crawlSite = sites.crawlSite.bind(sites);
11262
11298
  target.createSite = sites.createSite.bind(sites);
11263
11299
  target.updateSite = sites.updateSite.bind(sites);
11264
11300
  target.deleteSite = sites.deleteSite.bind(sites);
@@ -11321,6 +11357,13 @@ function bindFilesMethods(target, files) {
11321
11357
  target.getPublicFolderFiles = files.getPublicFolderFiles.bind(files);
11322
11358
  }
11323
11359
 
11360
+ // src/client/bindings/projects.ts
11361
+ function bindProjectsMethods(target, projects) {
11362
+ target.getProjects = projects.getProjects.bind(projects);
11363
+ target.getProject = projects.getProject.bind(projects);
11364
+ target.getPlan = projects.getPlan.bind(projects);
11365
+ }
11366
+
11324
11367
  // src/client/bindings/events.ts
11325
11368
  function bindEventsMethods(target, events) {
11326
11369
  target.getEventRules = events.getEventRules.bind(events);
@@ -11809,6 +11852,7 @@ function bindOrgMethods(target, org) {
11809
11852
  target.syncVoiceTrustProducts = org.syncVoiceTrustProducts.bind(org);
11810
11853
  target.createOrganizationWorkspace = org.createOrganizationWorkspace.bind(org);
11811
11854
  target.getOrgBillingCustomer = org.getOrgBillingCustomer.bind(org);
11855
+ target.getOrgWorkspaceUsage = org.getOrgWorkspaceUsage.bind(org);
11812
11856
  }
11813
11857
 
11814
11858
  // src/client/bindings/pronunciations.ts
@@ -12354,6 +12398,7 @@ var GravityRailClient = class {
12354
12398
  syncVoiceTrustProducts;
12355
12399
  createOrganizationWorkspace;
12356
12400
  getOrgBillingCustomer;
12401
+ getOrgWorkspaceUsage;
12357
12402
  getVapidPublicKey;
12358
12403
  registerPushSubscription;
12359
12404
  unregisterPushSubscription;
@@ -12453,7 +12498,6 @@ var GravityRailClient = class {
12453
12498
  siteSendEmailCode;
12454
12499
  siteVerifyCode;
12455
12500
  siteGoogleOAuthInitiate;
12456
- crawlSite;
12457
12501
  createSite;
12458
12502
  updateSite;
12459
12503
  deleteSite;
@@ -12474,6 +12518,9 @@ var GravityRailClient = class {
12474
12518
  // Files API
12475
12519
  getFiles;
12476
12520
  getFile;
12521
+ getProjects;
12522
+ getProject;
12523
+ getPlan;
12477
12524
  resolveFilePath;
12478
12525
  downloadFilesZip;
12479
12526
  createFile;
@@ -13009,6 +13056,7 @@ var GravityRailClient = class {
13009
13056
  bindAuthMethods(this, apis.auth, apis.assignments);
13010
13057
  bindSitesMethods(this, apis.sites);
13011
13058
  bindFilesMethods(this, apis.files);
13059
+ bindProjectsMethods(this, apis.projects);
13012
13060
  bindEventsMethods(this, apis.events);
13013
13061
  bindWorkflowsMethods(this, apis.workflows, apis.workflowNotes, apis.voice, apis.supervisors);
13014
13062
  bindCalendarsMethods(this, apis.calendars);
@@ -15209,105 +15257,79 @@ var RESOURCE_METADATA = {
15209
15257
  label: "Credits",
15210
15258
  unit: "credit",
15211
15259
  unitPlural: "credits",
15212
- description: "AI model usage billed as tokens with model-specific multipliers",
15213
- requiresFeature: null,
15214
- scope: "any"
15260
+ description: "AI model usage billed as tokens with model-specific multipliers"
15215
15261
  },
15216
15262
  ["stt" /* STT */]: {
15217
15263
  label: "Speech-to-Text",
15218
15264
  unit: "minute",
15219
15265
  unitPlural: "minutes",
15220
- description: "Audio transcription in minutes",
15221
- requiresFeature: null,
15222
- scope: "any"
15266
+ description: "Audio transcription in minutes"
15223
15267
  },
15224
15268
  ["tts" /* TTS */]: {
15225
15269
  label: "Text-to-Speech",
15226
15270
  unit: "1,000 characters",
15227
15271
  unitPlural: "1,000 characters",
15228
- description: "Text synthesized to audio, billed in lots of 1,000 characters",
15229
- requiresFeature: null,
15230
- scope: "any"
15272
+ description: "Text synthesized to audio, billed in lots of 1,000 characters"
15231
15273
  },
15232
15274
  ["sms" /* SMS */]: {
15233
15275
  label: "SMS Messages",
15234
15276
  unit: "message",
15235
15277
  unitPlural: "messages",
15236
- description: "Text messages sent via phone number",
15237
- requiresFeature: "phone" /* PHONE */,
15238
- scope: "any"
15278
+ description: "Text messages sent via phone number"
15239
15279
  },
15240
15280
  ["email" /* EMAIL */]: {
15241
15281
  label: "Emails",
15242
15282
  unit: "message",
15243
15283
  unitPlural: "messages",
15244
- description: "Email messages sent or received",
15245
- requiresFeature: "email" /* EMAIL */,
15246
- scope: "any"
15284
+ description: "Email messages sent or received"
15247
15285
  },
15248
15286
  ["phone_call" /* PHONE_CALL */]: {
15249
15287
  label: "Phone Calls",
15250
15288
  unit: "minute",
15251
15289
  unitPlural: "minutes",
15252
- description: "Phone call duration in minutes",
15253
- requiresFeature: "phone" /* PHONE */,
15254
- scope: "any"
15290
+ description: "Phone call duration in minutes"
15255
15291
  },
15256
15292
  ["phone_number" /* PHONE_NUMBER */]: {
15257
15293
  label: "Phone Numbers",
15258
15294
  unit: "number",
15259
15295
  unitPlural: "numbers",
15260
- description: "Active phone numbers for calling and SMS",
15261
- requiresFeature: "phone" /* PHONE */,
15262
- scope: "any"
15296
+ description: "Active phone numbers for calling and SMS"
15263
15297
  },
15264
15298
  ["inbox" /* INBOX */]: {
15265
15299
  label: "Email Inboxes",
15266
15300
  unit: "inbox",
15267
15301
  unitPlural: "inboxes",
15268
- description: "Email inboxes for receiving messages",
15269
- requiresFeature: "email" /* EMAIL */,
15270
- scope: "any"
15302
+ description: "Email inboxes for receiving messages"
15271
15303
  },
15272
15304
  ["site" /* SITE */]: {
15273
15305
  label: "Sites",
15274
15306
  unit: "site",
15275
15307
  unitPlural: "sites",
15276
- description: "Published websites",
15277
- requiresFeature: "sites" /* SITES */,
15278
- scope: "any"
15308
+ description: "Published websites"
15279
15309
  },
15280
15310
  ["member" /* MEMBER */]: {
15281
15311
  label: "Members",
15282
15312
  unit: "member",
15283
15313
  unitPlural: "members",
15284
- description: "Total workspace members",
15285
- requiresFeature: null,
15286
- scope: "workspace"
15314
+ description: "Members across the organization"
15287
15315
  },
15288
15316
  ["workspace" /* WORKSPACE */]: {
15289
15317
  label: "Workspaces",
15290
15318
  unit: "workspace",
15291
15319
  unitPlural: "workspaces",
15292
- description: "Workspaces in the organization",
15293
- requiresFeature: null,
15294
- scope: "org"
15320
+ description: "Workspaces in the organization"
15295
15321
  },
15296
15322
  ["org_admin" /* ORG_ADMIN */]: {
15297
15323
  label: "Organization Admins",
15298
15324
  unit: "admin",
15299
15325
  unitPlural: "admins",
15300
- description: "Organization administrators",
15301
- requiresFeature: null,
15302
- scope: "org"
15326
+ description: "Organization administrators"
15303
15327
  },
15304
15328
  ["storage_mb" /* STORAGE_MB */]: {
15305
15329
  label: "Storage",
15306
15330
  unit: "MB",
15307
15331
  unitPlural: "MB",
15308
- description: "File storage in megabytes",
15309
- requiresFeature: null,
15310
- scope: "any"
15332
+ description: "File storage in megabytes"
15311
15333
  }
15312
15334
  };
15313
15335
  function getResourceMetadata(resource) {
@@ -15316,35 +15338,6 @@ function getResourceMetadata(resource) {
15316
15338
  function getAllResourceSlugs() {
15317
15339
  return Object.keys(RESOURCE_METADATA);
15318
15340
  }
15319
- function getScopeFromProductType(productType) {
15320
- const isOrgProduct = productType === "org" /* ORG */;
15321
- return isOrgProduct ? "org" : "workspace";
15322
- }
15323
- function getApplicableResources(scope, enabledFeatures) {
15324
- const enabledSet = enabledFeatures ? new Set(enabledFeatures) : null;
15325
- return Object.entries(RESOURCE_METADATA).filter(([_slug, metadata]) => {
15326
- if (scope === "workspace" && metadata.scope === "org") {
15327
- return false;
15328
- }
15329
- if (scope === "org" && metadata.scope === "workspace") {
15330
- return false;
15331
- }
15332
- if (enabledSet !== null && metadata.requiresFeature !== null) {
15333
- if (!enabledSet.has(metadata.requiresFeature)) {
15334
- return false;
15335
- }
15336
- }
15337
- return true;
15338
- }).map(([slug]) => slug).sort((a, b) => {
15339
- const metaA = RESOURCE_METADATA[a];
15340
- const metaB = RESOURCE_METADATA[b];
15341
- return metaA.label.localeCompare(metaB.label);
15342
- });
15343
- }
15344
- function getApplicableResourceSlugs(productType) {
15345
- const scope = getScopeFromProductType(productType);
15346
- return getApplicableResources(scope);
15347
- }
15348
15341
 
15349
15342
  // src/scopes.ts
15350
15343
  var ScopeCategory = /* @__PURE__ */ ((ScopeCategory2) => {
@@ -16150,8 +16143,6 @@ function getRevisionState(workflow, revision) {
16150
16143
  formatAppContextAsMarkdown,
16151
16144
  getAllFeatures,
16152
16145
  getAllResourceSlugs,
16153
- getApplicableResourceSlugs,
16154
- getApplicableResources,
16155
16146
  getAvailableFeaturesForUpgrade,
16156
16147
  getCookieValue,
16157
16148
  getFeature,
@@ -16160,7 +16151,6 @@ function getRevisionState(workflow, revision) {
16160
16151
  getMissingDependencies,
16161
16152
  getResourceMetadata,
16162
16153
  getRevisionState,
16163
- getScopeFromProductType,
16164
16154
  getTTSProvider,
16165
16155
  getVoiceModelId,
16166
16156
  initializeFeatures,