@rool-dev/extension 0.3.10 → 0.3.11-dev.22c312e

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.
@@ -5352,6 +5352,7 @@ var GraphQLClient = class {
5352
5352
  createdAt
5353
5353
  updatedAt
5354
5354
  linkAccess
5355
+ memberCount
5355
5356
  }
5356
5357
  }
5357
5358
  `)).listSpaces;
@@ -5363,6 +5364,7 @@ var GraphQLClient = class {
5363
5364
  name
5364
5365
  role
5365
5366
  linkAccess
5367
+ memberCount
5366
5368
  channels {
5367
5369
  id
5368
5370
  name
@@ -5697,10 +5699,10 @@ var GraphQLClient = class {
5697
5699
  parentInteractionId: options.parentInteractionId
5698
5700
  })).prompt;
5699
5701
  }
5700
- async getAccount() {
5702
+ async getCurrentUser() {
5701
5703
  return (await this.request(`
5702
- query GetAccount {
5703
- getAccount {
5704
+ query GetCurrentUser {
5705
+ getCurrentUser {
5704
5706
  id
5705
5707
  email
5706
5708
  name
@@ -5714,14 +5716,26 @@ var GraphQLClient = class {
5714
5716
  storage
5715
5717
  }
5716
5718
  }
5717
- `)).getAccount;
5719
+ `)).getCurrentUser;
5718
5720
  }
5719
- async setSlug(slug) {
5720
- await this.request(`
5721
- mutation SetSlug($slug: String!) {
5722
- setSlug(slug: $slug)
5721
+ async updateCurrentUser(input) {
5722
+ return (await this.request(`
5723
+ mutation UpdateCurrentUser($input: UpdateCurrentUserInput!) {
5724
+ updateCurrentUser(input: $input) {
5725
+ id
5726
+ email
5727
+ name
5728
+ slug
5729
+ plan
5730
+ creditsBalance
5731
+ totalCreditsUsed
5732
+ createdAt
5733
+ lastActivity
5734
+ processedAt
5735
+ storage
5736
+ }
5723
5737
  }
5724
- `, { slug });
5738
+ `, { input })).updateCurrentUser;
5725
5739
  }
5726
5740
  async findExtensions(options) {
5727
5741
  return (await this.request(`
@@ -6493,7 +6507,7 @@ function toAsyncIterable(val) {
6493
6507
  var INITIAL_RECONNECT_DELAY = 1e3;
6494
6508
  var MAX_RECONNECT_DELAY = 3e4;
6495
6509
  var RECONNECT_MULTIPLIER = 2;
6496
- var HEARTBEAT_TIMEOUT = 35e3;
6510
+ var HEARTBEAT_TIMEOUT = 15e3;
6497
6511
  var ClientSubscriptionManager = class {
6498
6512
  config;
6499
6513
  client = null;
@@ -6667,7 +6681,8 @@ var ClientSubscriptionManager = class {
6667
6681
  createdAt: raw.createdAt,
6668
6682
  updatedAt: raw.updatedAt,
6669
6683
  role: raw.role,
6670
- linkAccess: raw.linkAccess
6684
+ linkAccess: raw.linkAccess,
6685
+ memberCount: raw.memberCount
6671
6686
  };
6672
6687
  case "user_storage_changed": return {
6673
6688
  type,
@@ -8327,6 +8342,7 @@ var RoolSpace = class {
8327
8342
  _name;
8328
8343
  _role;
8329
8344
  _linkAccess;
8345
+ _memberCount;
8330
8346
  _channels;
8331
8347
  graphqlClient;
8332
8348
  mediaClient;
@@ -8336,6 +8352,7 @@ var RoolSpace = class {
8336
8352
  this._name = config.name;
8337
8353
  this._role = config.role;
8338
8354
  this._linkAccess = config.linkAccess;
8355
+ this._memberCount = config.memberCount;
8339
8356
  this._channels = config.channels;
8340
8357
  this.graphqlClient = config.graphqlClient;
8341
8358
  this.mediaClient = config.mediaClient;
@@ -8353,6 +8370,12 @@ var RoolSpace = class {
8353
8370
  get linkAccess() {
8354
8371
  return this._linkAccess;
8355
8372
  }
8373
+ get memberCount() {
8374
+ return this._memberCount;
8375
+ }
8376
+ get isPrivate() {
8377
+ return this._linkAccess === "none" && this._memberCount === 1;
8378
+ }
8356
8379
  /**
8357
8380
  * Open a channel on this space.
8358
8381
  * If the channel doesn't exist, the server creates it.
@@ -8431,10 +8454,11 @@ var RoolSpace = class {
8431
8454
  * Updates name, role, linkAccess, and channel list.
8432
8455
  */
8433
8456
  async refresh() {
8434
- const { name, role, linkAccess, channels } = await this.graphqlClient.openSpace(this._id);
8457
+ const { name, role, linkAccess, memberCount, channels } = await this.graphqlClient.openSpace(this._id);
8435
8458
  this._name = name;
8436
8459
  this._role = role;
8437
8460
  this._linkAccess = linkAccess;
8461
+ this._memberCount = memberCount;
8438
8462
  this._channels = channels;
8439
8463
  }
8440
8464
  };
@@ -8637,12 +8661,13 @@ var RoolClient = class extends EventEmitter {
8637
8661
  * To work with objects and AI, call space.openChannel(channelId).
8638
8662
  */
8639
8663
  async openSpace(spaceId) {
8640
- const { name, role, linkAccess, channels } = await this.graphqlClient.openSpace(spaceId);
8664
+ const { name, role, linkAccess, memberCount, channels } = await this.graphqlClient.openSpace(spaceId);
8641
8665
  return new RoolSpace({
8642
8666
  id: spaceId,
8643
8667
  name,
8644
8668
  role,
8645
8669
  linkAccess,
8670
+ memberCount,
8646
8671
  channels,
8647
8672
  graphqlClient: this.graphqlClient,
8648
8673
  mediaClient: this.mediaClient,
@@ -8662,6 +8687,7 @@ var RoolClient = class extends EventEmitter {
8662
8687
  name,
8663
8688
  role: "owner",
8664
8689
  linkAccess: "none",
8690
+ memberCount: 1,
8665
8691
  channels: [],
8666
8692
  graphqlClient: this.graphqlClient,
8667
8693
  mediaClient: this.mediaClient,
@@ -8704,7 +8730,7 @@ var RoolClient = class extends EventEmitter {
8704
8730
  * Returns the user's server-assigned id, email, plan, and credits.
8705
8731
  */
8706
8732
  async getCurrentUser() {
8707
- const user = await this.graphqlClient.getAccount();
8733
+ const user = await this.graphqlClient.getCurrentUser();
8708
8734
  this._currentUser = user;
8709
8735
  return user;
8710
8736
  }
@@ -8715,13 +8741,14 @@ var RoolClient = class extends EventEmitter {
8715
8741
  return this.graphqlClient.searchUser(email);
8716
8742
  }
8717
8743
  /**
8718
- * Set the current user's slug (used in app publishing URLs).
8719
- * Slug must be 3-32 characters, start with a letter, and contain only
8720
- * lowercase letters, numbers, hyphens, and underscores.
8721
- * Cannot be changed if the user has published apps.
8744
+ * Update the current user's profile.
8745
+ * - name: display name
8746
+ * - slug: used in app publishing URLs (3-32 chars, start with letter, lowercase alphanumeric/hyphens/underscores)
8722
8747
  */
8723
- async setSlug(slug) {
8724
- return this.graphqlClient.setSlug(slug);
8748
+ async updateCurrentUser(input) {
8749
+ const user = await this.graphqlClient.updateCurrentUser(input);
8750
+ this._currentUser = user;
8751
+ return user;
8725
8752
  }
8726
8753
  /**
8727
8754
  * Publish an extension. The extension will be accessible at:
@@ -8892,7 +8919,8 @@ var RoolClient = class extends EventEmitter {
8892
8919
  size: event.size ?? 0,
8893
8920
  createdAt: event.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
8894
8921
  updatedAt: event.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
8895
- linkAccess: "none"
8922
+ linkAccess: "none",
8923
+ memberCount: 1
8896
8924
  });
8897
8925
  break;
8898
8926
  case "space_deleted":
@@ -8911,7 +8939,8 @@ var RoolClient = class extends EventEmitter {
8911
8939
  size: event.size,
8912
8940
  createdAt: event.createdAt,
8913
8941
  updatedAt: event.updatedAt,
8914
- linkAccess: event.linkAccess
8942
+ linkAccess: event.linkAccess,
8943
+ memberCount: event.memberCount
8915
8944
  });
8916
8945
  break;
8917
8946
  case "user_storage_changed":