@supernova-studio/client 1.23.1 → 1.23.2

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.
package/dist/index.mjs CHANGED
@@ -17170,6 +17170,180 @@ function roundDimension(dimension) {
17170
17170
  return Math.round(dimension * 100) / 100;
17171
17171
  }
17172
17172
 
17173
+ // src/yjs/feature-room/base.ts
17174
+ var FeatureRoomBaseYDoc = class {
17175
+ constructor(yDoc) {
17176
+ __publicField(this, "yDoc");
17177
+ this.yDoc = yDoc;
17178
+ }
17179
+ getState() {
17180
+ const iterations = this.getIterations();
17181
+ const artifacts = this.getArtifacts();
17182
+ const agentResponseTrackers = this.getAgentResponseTrackers();
17183
+ const executedTransactionIds = this.getExecutedTransactionIds();
17184
+ const isLoaded = true;
17185
+ return {
17186
+ isLoaded,
17187
+ iterations,
17188
+ artifacts,
17189
+ agentResponseTrackers,
17190
+ executedTransactionIds
17191
+ };
17192
+ }
17193
+ //
17194
+ // Feature Iterations
17195
+ //
17196
+ getIterations() {
17197
+ return this.getObjects(this.iterationsYMap, DTOFeatureIteration);
17198
+ }
17199
+ updateIterations(iterations) {
17200
+ this.setObjects(this.iterationsYMap, iterations);
17201
+ }
17202
+ deleteIterations(ids) {
17203
+ this.deleteObjects(this.iterationsYMap, ids);
17204
+ }
17205
+ get iterationsYMap() {
17206
+ return this.yDoc.getMap("forgeFeatureIterations");
17207
+ }
17208
+ //
17209
+ // Feature Artifacts
17210
+ //
17211
+ getArtifacts() {
17212
+ return this.getObjects(this.artifactsYMap, DTOFeatureArtifact);
17213
+ }
17214
+ updateArtifacts(artifacts) {
17215
+ this.setObjects(this.artifactsYMap, artifacts);
17216
+ }
17217
+ deleteArtifacts(ids) {
17218
+ this.deleteObjects(this.artifactsYMap, ids);
17219
+ }
17220
+ get artifactsYMap() {
17221
+ return this.yDoc.getMap("forgeFeatureArtifacts");
17222
+ }
17223
+ //
17224
+ // Agent Response Trackers
17225
+ //
17226
+ getAgentResponseTrackers() {
17227
+ return this.getObjects(this.agentResponseTrackersYMap, DTOFeatureAgentResponseTracker);
17228
+ }
17229
+ updateAgentResponseTrackers(trackers) {
17230
+ this.setObjects(this.agentResponseTrackersYMap, trackers);
17231
+ }
17232
+ deleteAgentResponseTrackers(ids) {
17233
+ this.deleteObjects(this.agentResponseTrackersYMap, ids);
17234
+ }
17235
+ get agentResponseTrackersYMap() {
17236
+ return this.yDoc.getMap("forgeFeatureAgentResponseTrackers");
17237
+ }
17238
+ //
17239
+ // Executed transactions
17240
+ //
17241
+ updateExecutedTransactionIds(transactionIds) {
17242
+ transactionIds = Array.from(new Set(transactionIds));
17243
+ if (!transactionIds.length) return;
17244
+ const array = this.executedTransactionIdsArray;
17245
+ array.push(transactionIds);
17246
+ if (array.length > 100) {
17247
+ array.delete(0, array.length - 100);
17248
+ }
17249
+ }
17250
+ getExecutedTransactionIds() {
17251
+ const array = this.executedTransactionIdsArray;
17252
+ const transactionIds = [];
17253
+ array.forEach((e) => typeof e === "string" && transactionIds.push(e));
17254
+ return transactionIds;
17255
+ }
17256
+ get executedTransactionIdsArray() {
17257
+ return this.yDoc.getArray("executedTransactionIds");
17258
+ }
17259
+ //
17260
+ // Utility methods
17261
+ //
17262
+ getObjects(map, schema) {
17263
+ const objects = [];
17264
+ map.forEach((value) => objects.push(schema.parse(value)));
17265
+ return objects;
17266
+ }
17267
+ setObjects(map, objects) {
17268
+ objects.forEach((o) => map.set(o.id, JSON.parse(JSON.stringify(o))));
17269
+ }
17270
+ deleteObjects(map, ids) {
17271
+ ids.forEach((id) => map.delete(id));
17272
+ }
17273
+ };
17274
+
17275
+ // src/yjs/feature-room/backend.ts
17276
+ var BackendFeatureRoomYDoc = class {
17277
+ constructor(yDoc) {
17278
+ __publicField(this, "yDoc");
17279
+ this.yDoc = yDoc;
17280
+ }
17281
+ updateFeatureRoom(transaction) {
17282
+ this.yDoc.transact((trx) => {
17283
+ const yDoc = new FeatureRoomBaseYDoc(trx.doc);
17284
+ transaction.iterationIdsToDelete && yDoc.deleteIterations(transaction.iterationIdsToDelete);
17285
+ transaction.iterations && yDoc.updateIterations(transaction.iterations);
17286
+ transaction.artifactIdsToDelete && yDoc.deleteArtifacts(transaction.artifactIdsToDelete);
17287
+ transaction.artifacts && yDoc.updateArtifacts(transaction.artifacts);
17288
+ transaction.agentResponseTrackerIdsToDelete && yDoc.deleteAgentResponseTrackers(transaction.agentResponseTrackerIdsToDelete);
17289
+ transaction.agentResponseTrackers && yDoc.updateAgentResponseTrackers(transaction.agentResponseTrackers);
17290
+ transaction.executedTransactionIds && yDoc.updateExecutedTransactionIds(transaction.executedTransactionIds);
17291
+ });
17292
+ }
17293
+ getState() {
17294
+ const featureRoomDoc = new FeatureRoomBaseYDoc(this.yDoc);
17295
+ return featureRoomDoc.getState();
17296
+ }
17297
+ };
17298
+
17299
+ // src/yjs/feature-room/frontend.ts
17300
+ var FrontendFeatureRoomYDoc = class {
17301
+ constructor(yDoc, debug = false) {
17302
+ this.debug = debug;
17303
+ __publicField(this, "yDoc");
17304
+ this.yDoc = yDoc;
17305
+ }
17306
+ //
17307
+ // State Access
17308
+ //
17309
+ getState() {
17310
+ const doc = new FeatureRoomBaseYDoc(this.yDoc);
17311
+ return doc.getState();
17312
+ }
17313
+ //
17314
+ // Feature Iterations
17315
+ //
17316
+ getIterations() {
17317
+ const doc = new FeatureRoomBaseYDoc(this.yDoc);
17318
+ return doc.getIterations();
17319
+ }
17320
+ //
17321
+ // Feature Artifacts
17322
+ //
17323
+ getArtifacts() {
17324
+ const doc = new FeatureRoomBaseYDoc(this.yDoc);
17325
+ return doc.getArtifacts();
17326
+ }
17327
+ //
17328
+ // Agent Response Trackers
17329
+ //
17330
+ getAgentResponseTrackers() {
17331
+ const doc = new FeatureRoomBaseYDoc(this.yDoc);
17332
+ return doc.getAgentResponseTrackers();
17333
+ }
17334
+ //
17335
+ // Utility Methods
17336
+ //
17337
+ isLoaded() {
17338
+ const doc = new FeatureRoomBaseYDoc(this.yDoc);
17339
+ return doc.getState().isLoaded;
17340
+ }
17341
+ getExecutedTransactionIds() {
17342
+ const doc = new FeatureRoomBaseYDoc(this.yDoc);
17343
+ return doc.getExecutedTransactionIds();
17344
+ }
17345
+ };
17346
+
17173
17347
  // src/yjs/forge-project-room/base.ts
17174
17348
  var ForgeProjectRoomBaseYDoc = class {
17175
17349
  constructor(yDoc) {
@@ -17962,6 +18136,7 @@ var TransactionQueue2 = class {
17962
18136
  }
17963
18137
  };
17964
18138
  export {
18139
+ BackendFeatureRoomYDoc,
17965
18140
  BackendForgeProjectRoomYDoc,
17966
18141
  BackendVersionRoomYDoc,
17967
18142
  BlockDefinitionUtils,
@@ -18588,6 +18763,7 @@ export {
18588
18763
  ElementsEndpoint,
18589
18764
  ExporterJobsEndpoint,
18590
18765
  ExportersEndpoint,
18766
+ FeatureRoomBaseYDoc,
18591
18767
  FigmaComponentGroupsEndpoint,
18592
18768
  FigmaComponentsEndpoint,
18593
18769
  FigmaFrameStructuresEndpoint,
@@ -18611,6 +18787,7 @@ export {
18611
18787
  ForgeProjectsEndpoint,
18612
18788
  ForgesEndpoint,
18613
18789
  FormattedCollections,
18790
+ FrontendFeatureRoomYDoc,
18614
18791
  FrontendVersionRoomYDoc,
18615
18792
  GitDestinationOptions,
18616
18793
  ImportJobsEndpoint,