@supernova-studio/client 1.17.1 → 1.17.3

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
@@ -187,9 +187,9 @@ import { z as z175 } from "zod";
187
187
  import { z as z177 } from "zod";
188
188
  import { z as z178 } from "zod";
189
189
  import { z as z179 } from "zod";
190
+ import { z as z181 } from "zod";
190
191
  import { z as z180 } from "zod";
191
192
  import { z as z182 } from "zod";
192
- import { z as z181 } from "zod";
193
193
  import { z as z183 } from "zod";
194
194
  import { z as z185 } from "zod";
195
195
  import { z as z186 } from "zod";
@@ -5143,22 +5143,14 @@ var ForgeMeta = z173.object({
5143
5143
  name: z173.string(),
5144
5144
  description: z173.string().optional()
5145
5145
  });
5146
- var ForgeProjectTag = z174.array(z174.string()).default([]);
5147
- var ForgeProjectAccessMode = z174.enum(["InviteOnly", "Open"]);
5148
- var ForgeProject = z174.object({
5149
- createdAt: z174.coerce.date(),
5150
- createdByUserId: z174.string().optional(),
5151
- fpContextId: z174.string(),
5146
+ var ForgeProjectArtifactContentData = DocumentationPageContentData;
5147
+ var ForgeProjectArtifactContent = z174.object({
5152
5148
  id: z174.string(),
5153
- instruction: z174.string().nullable(),
5154
- meta: ForgeMeta,
5155
- name: z174.string(),
5156
- tags: ForgeProjectTag,
5157
- updatedAt: z174.coerce.date().optional(),
5158
- workspaceId: z174.string(),
5159
- accessMode: ForgeProjectAccessMode,
5160
- isArchived: z174.boolean().optional(),
5161
- emoji: z174.string().optional()
5149
+ artifactId: z174.string(),
5150
+ projectId: z174.string(),
5151
+ createdAt: z174.coerce.date(),
5152
+ updatedAt: z174.coerce.date(),
5153
+ data: ForgeProjectArtifactContentData
5162
5154
  });
5163
5155
  var ForgeProjectSectionChildType = z175.enum(["Artifact", "Feature"]);
5164
5156
  var SortOrder = z175.number().int().min(0);
@@ -5183,95 +5175,105 @@ var ForgeProjectArtifact = z176.object({
5183
5175
  createdByUserId: z176.string(),
5184
5176
  sectionId: Id.optional()
5185
5177
  });
5186
- var ForgeProjectArtifactContentData = DocumentationPageContentData;
5187
- var ForgeProjectArtifactContent = z177.object({
5188
- id: z177.string(),
5189
- artifactId: z177.string(),
5190
- projectId: z177.string(),
5191
- createdAt: z177.coerce.date(),
5192
- updatedAt: z177.coerce.date(),
5193
- data: ForgeProjectArtifactContentData
5194
- });
5195
- var ForgeProjectContextDependency = z178.object({
5196
- packageName: z178.string(),
5197
- type: z178.literal("npm"),
5198
- version: z178.string().default("latest")
5178
+ var ForgeProjectContextDependency = z177.object({
5179
+ packageName: z177.string(),
5180
+ type: z177.literal("npm"),
5181
+ version: z177.string().default("latest")
5199
5182
  });
5200
- var ForgeProjectContextTailwindConfig = z178.object({
5201
- content: z178.string(),
5202
- version: z178.string()
5183
+ var ForgeProjectContextTailwindConfig = z177.object({
5184
+ content: z177.string(),
5185
+ version: z177.string()
5203
5186
  });
5204
- var ForgeProjectContext = z178.object({
5205
- createdAt: z178.coerce.date(),
5206
- definition: z178.string(),
5207
- dependencies: z178.array(ForgeProjectContextDependency),
5208
- designSystemId: z178.string(),
5209
- id: z178.string(),
5187
+ var ForgeProjectContext = z177.object({
5188
+ createdAt: z177.coerce.date(),
5189
+ definition: z177.string(),
5190
+ dependencies: z177.array(ForgeProjectContextDependency),
5191
+ designSystemId: z177.string(),
5192
+ id: z177.string(),
5210
5193
  meta: ForgeMeta,
5211
- name: z178.string(),
5194
+ name: z177.string(),
5212
5195
  npmProxySettings: NpmRegistryConfig,
5213
- platform: z178.enum(["React", "Vue", "Angular"]),
5214
- styling: z178.enum(["CSS", "Tailwind"]),
5196
+ platform: z177.enum(["React", "Vue", "Angular"]),
5197
+ styling: z177.enum(["CSS", "Tailwind"]),
5215
5198
  tailwindConfig: ForgeProjectContextTailwindConfig.optional(),
5216
- updatedAt: z178.coerce.date(),
5217
- workspaceId: z178.string()
5199
+ updatedAt: z177.coerce.date(),
5200
+ workspaceId: z177.string()
5218
5201
  });
5219
- var ProjectFeature = z179.object({
5220
- createdAt: z179.coerce.date(),
5221
- createdByUserId: z179.string(),
5222
- description: z179.string(),
5202
+ var ProjectFeatureStatus = z178.enum(["Draft", "ReadyForDevelopment"]);
5203
+ var ProjectFeature = z178.object({
5204
+ createdAt: z178.coerce.date(),
5205
+ createdByUserId: z178.string(),
5206
+ description: z178.string(),
5223
5207
  id: Id,
5224
- isArchived: z179.boolean().optional(),
5225
- name: z179.string(),
5226
- projectId: z179.string(),
5208
+ isArchived: z178.boolean().optional(),
5209
+ name: z178.string(),
5210
+ projectId: z178.string(),
5227
5211
  sectionId: Id.optional(),
5228
5212
  sortOrder: SortOrder.default(0),
5229
- updatedAt: z179.coerce.date().optional()
5213
+ status: ProjectFeatureStatus.default("Draft"),
5214
+ updatedAt: z178.coerce.date().optional()
5230
5215
  });
5231
- var ForgeProjectFigmaNode = z180.object({
5232
- id: z180.string().uuid(),
5233
- projectId: z180.string(),
5234
- sceneNodeId: z180.string(),
5216
+ var ForgeProjectFigmaNode = z179.object({
5217
+ id: z179.string().uuid(),
5218
+ projectId: z179.string(),
5219
+ sceneNodeId: z179.string(),
5235
5220
  format: FigmaNodeRenderFormat,
5236
- scale: z180.number().optional(),
5221
+ scale: z179.number().optional(),
5237
5222
  renderState: FigmaNodeRenderState,
5238
5223
  renderedImage: FigmaNodeRenderedImage.optional(),
5239
5224
  renderError: FigmaNodeRenderError.optional()
5240
5225
  });
5241
- var ForgeProjectFigmaNodeRenderInput = z180.object({
5242
- url: z180.string(),
5226
+ var ForgeProjectFigmaNodeRenderInput = z179.object({
5227
+ url: z179.string(),
5243
5228
  format: FigmaNodeRenderFormat,
5244
- scale: z180.number()
5229
+ scale: z179.number()
5245
5230
  });
5246
- var ForgeProjectRole = z181.enum(["Viewer", "Editor", "Admin"]);
5247
- var ForgeProjectMembership = z181.object({
5248
- userId: z181.string(),
5249
- forgeProjectId: z181.string(),
5250
- workspaceMembershipId: z181.string(),
5231
+ var ForgeProjectRole = z180.enum(["Viewer", "Editor", "Admin"]);
5232
+ var ForgeProjectMembership = z180.object({
5233
+ userId: z180.string(),
5234
+ forgeProjectId: z180.string(),
5235
+ workspaceMembershipId: z180.string(),
5251
5236
  workspaceRole: WorkspaceRoleSchema,
5252
5237
  role: ForgeProjectRole
5253
5238
  });
5254
- var ForgeProjectInvitation = z182.object({
5255
- email: z182.string().email(),
5256
- forgeProjectId: z182.string(),
5257
- workspaceInvitationId: z182.string(),
5239
+ var ForgeProjectInvitation = z181.object({
5240
+ email: z181.string().email(),
5241
+ forgeProjectId: z181.string(),
5242
+ workspaceInvitationId: z181.string(),
5258
5243
  role: ForgeProjectRole,
5244
+ createdAt: z181.coerce.date(),
5245
+ updatedAt: z181.coerce.date(),
5246
+ createdById: z181.string()
5247
+ });
5248
+ var ForgeProjectIterationMergeMeta = z182.object({ mergeByUserId: z182.string(), mergeAt: z182.date() });
5249
+ var ForgeProjectIteration = z182.object({
5250
+ branchId: z182.string().optional(),
5251
+ buildArtifactId: z182.string(),
5259
5252
  createdAt: z182.coerce.date(),
5260
- updatedAt: z182.coerce.date(),
5261
- createdById: z182.string()
5253
+ forgeProjectId: z182.string(),
5254
+ id: z182.string(),
5255
+ locked: z182.boolean(),
5256
+ messages: z182.array(ForgeIterationMessage),
5257
+ artifacts: z182.array(ForgeArtifact),
5258
+ previousIterationId: z182.string().optional(),
5259
+ mergeMeta: ForgeProjectIterationMergeMeta.optional()
5262
5260
  });
5263
- var ForgeProjectIterationMergeMeta = z183.object({ mergeByUserId: z183.string(), mergeAt: z183.date() });
5264
- var ForgeProjectIteration = z183.object({
5265
- branchId: z183.string().optional(),
5266
- buildArtifactId: z183.string(),
5261
+ var ForgeProjectTag = z183.array(z183.string()).default([]);
5262
+ var ForgeProjectAccessMode = z183.enum(["InviteOnly", "Open"]);
5263
+ var ForgeProject = z183.object({
5267
5264
  createdAt: z183.coerce.date(),
5268
- forgeProjectId: z183.string(),
5265
+ createdByUserId: z183.string().optional(),
5266
+ fpContextId: z183.string(),
5269
5267
  id: z183.string(),
5270
- locked: z183.boolean(),
5271
- messages: z183.array(ForgeIterationMessage),
5272
- artifacts: z183.array(ForgeArtifact),
5273
- previousIterationId: z183.string().optional(),
5274
- mergeMeta: ForgeProjectIterationMergeMeta.optional()
5268
+ instruction: z183.string().nullable(),
5269
+ meta: ForgeMeta,
5270
+ name: z183.string(),
5271
+ tags: ForgeProjectTag,
5272
+ updatedAt: z183.coerce.date().optional(),
5273
+ workspaceId: z183.string(),
5274
+ accessMode: ForgeProjectAccessMode,
5275
+ isArchived: z183.boolean().optional(),
5276
+ emoji: z183.string().optional()
5275
5277
  });
5276
5278
  var ForgeProjectRoom = Entity.extend({
5277
5279
  projectId: z184.string(),
@@ -7218,6 +7220,33 @@ var DTOWorkspaceMembersListResponse = z245.object({
7218
7220
 
7219
7221
  // src/api/dto/workspaces/subscription.ts
7220
7222
  import z246 from "zod";
7223
+ var DTOCreditBalance = z246.object({
7224
+ paidTopUp: z246.object({
7225
+ total: z246.number(),
7226
+ used: z246.number(),
7227
+ balance: z246.number()
7228
+ }).optional(),
7229
+ paidRecurring: z246.object({
7230
+ total: z246.number(),
7231
+ used: z246.number(),
7232
+ balance: z246.number(),
7233
+ resetAt: z246.string().optional()
7234
+ }).optional(),
7235
+ free: z246.object({
7236
+ credits: z246.object({
7237
+ total: z246.number(),
7238
+ used: z246.number(),
7239
+ balance: z246.number(),
7240
+ resetAt: z246.string().optional()
7241
+ }),
7242
+ spendingLimit: z246.object({
7243
+ total: z246.number(),
7244
+ used: z246.number(),
7245
+ balance: z246.number(),
7246
+ resetAt: z246.string().optional()
7247
+ })
7248
+ }).optional()
7249
+ }).optional();
7221
7250
  var DTOSubscription = z246.object({
7222
7251
  stripeSubscriptionId: z246.string().optional(),
7223
7252
  stripeCustomerId: z246.string().optional(),
@@ -7245,23 +7274,11 @@ var DTOSubscription = z246.object({
7245
7274
  amount: z246.number(),
7246
7275
  isTrial: z246.boolean(),
7247
7276
  billingType: BillingTypeSchema.optional(),
7248
- daysUntilDue: z246.number().optional(),
7249
- creditBalance: z246.object({
7250
- oneTime: z246.object({
7251
- total: z246.number(),
7252
- used: z246.number(),
7253
- balance: z246.number()
7254
- }),
7255
- recurring: z246.object({
7256
- total: z246.number(),
7257
- used: z246.number(),
7258
- balance: z246.number(),
7259
- resetAt: z246.string().optional()
7260
- })
7261
- }).optional()
7277
+ daysUntilDue: z246.number().optional()
7262
7278
  });
7263
7279
  var DTOSubscriptionResponse = z246.object({
7264
- subscription: DTOSubscription
7280
+ subscription: DTOSubscription,
7281
+ creditBalance: DTOCreditBalance
7265
7282
  });
7266
7283
 
7267
7284
  // src/api/dto/workspaces/transfer-ownership.ts
@@ -9091,120 +9108,15 @@ var DTODeleteForgeIterationMessageResponse = z311.object({
9091
9108
  ok: z311.literal(true)
9092
9109
  });
9093
9110
 
9094
- // src/api/dto/forge/project.ts
9095
- import { z as z314 } from "zod";
9096
-
9097
- // src/api/dto/forge/project-member.ts
9098
- import { z as z313 } from "zod";
9099
-
9100
- // src/api/dto/forge/project-invitation.ts
9101
- import { z as z312 } from "zod";
9102
- var DTOForgeProjectInvitation = ForgeProjectInvitation;
9103
- var DTOCreateForgeProjectInvitation = DTOForgeProjectInvitation.pick({
9104
- email: true,
9105
- role: true
9106
- }).extend({
9107
- workspaceRole: WorkspaceRoleSchema
9108
- });
9109
- var DTOUpdateForgeProjectInvitation = DTOCreateForgeProjectInvitation.omit({
9110
- email: true,
9111
- workspaceRole: true
9112
- });
9113
- var DTORemoveForgeProjectInvitation = DTOCreateForgeProjectInvitation.pick({
9114
- email: true
9115
- });
9116
- var DTOForgeProjectInvitationsListResponse = z312.object({
9117
- invitations: z312.array(DTOForgeProjectInvitation)
9118
- });
9119
- var DTOForgeProjectInvitationGetResponse = z312.object({
9120
- invitation: DTOForgeProjectInvitation
9121
- });
9122
- var DTOForgeProjectInvitationCreateResponse = z312.object({
9123
- invitation: DTOForgeProjectInvitation
9124
- });
9125
- var DTOForgeProjectInvitationUpdateResponse = z312.object({
9126
- invitation: DTOForgeProjectInvitation.nullable()
9127
- });
9128
- var DTOForgeProjectInvitationRemoveResponse = z312.object({
9129
- ok: z312.literal(true)
9130
- });
9131
-
9132
- // src/api/dto/forge/project-member.ts
9133
- var DTOForgeProjectMemberRole = ForgeProjectRole;
9134
- var DTOForgeProjectMember = ForgeProjectMembership.extend({
9135
- user: DTOUser,
9136
- effectiveRole: DTOForgeProjectMemberRole
9137
- });
9138
- var DTOCreateForgeProjectMember = DTOForgeProjectMember.pick({
9139
- userId: true,
9140
- role: true
9141
- });
9142
- var DTOUpdateForgeProjectMember = DTOCreateForgeProjectMember.omit({ userId: true });
9143
- var DTORemoveForgeProjectMember = DTOForgeProjectMember.pick({
9144
- userId: true
9145
- });
9146
- var DTOForgeProjectMembersListResponse = z313.object({
9147
- members: z313.array(DTOForgeProjectMember),
9148
- invitations: z313.array(DTOForgeProjectInvitation)
9149
- });
9150
- var DTOForgeProjectMemberGetResponse = z313.object({
9151
- member: DTOForgeProjectMember
9152
- });
9153
- var DTOForgeProjectMemberCreateResponse = z313.object({
9154
- member: DTOForgeProjectMember
9155
- });
9156
- var DTOForgeProjectMemberUpdateResponse = z313.object({
9157
- member: DTOForgeProjectMember.nullable()
9158
- });
9159
- var DTOForgeProjectMemberRemoveResponse = z313.object({
9160
- ok: z313.literal(true)
9161
- });
9162
- var DTOAddMembersToForgeProject = z313.object({
9163
- membersToInvite: DTOCreateForgeProjectInvitation.array().min(1)
9164
- });
9165
-
9166
- // src/api/dto/forge/project.ts
9167
- var DTOForgeProject = ForgeProject.omit({ fpContextId: true }).extend({
9168
- context: ForgeProjectContext,
9169
- members: z314.array(DTOForgeProjectMember),
9170
- invitations: z314.array(DTOForgeProjectInvitation)
9171
- });
9172
- var DTOCreateForgeProject = ForgeProject.pick({
9173
- instruction: true,
9174
- name: true,
9175
- meta: true,
9176
- tags: true,
9177
- accessMode: true,
9178
- fpContextId: true,
9179
- isArchived: true,
9180
- emoji: true
9181
- }).extend({ membersToInvite: DTOCreateForgeProjectInvitation.array().min(1).optional() });
9182
- var DTOUpdateForgeProject = DTOCreateForgeProject.omit({ membersToInvite: true }).partial().extend({
9183
- id: z314.string(),
9184
- membersToRetain: z314.string().array().min(1).optional()
9185
- });
9186
- var DTOForgeProjectGetResponse = z314.object({ project: DTOForgeProject.nullable() });
9187
- var DTOForgeProjectsListResponse = z314.object({ projects: z314.array(DTOForgeProject) });
9188
- var DTOCreateForgeProjectResponse = z314.object({
9189
- project: DTOForgeProject
9190
- });
9191
- var DTOUpdateForgeProjectResponse = z314.object({
9192
- project: DTOForgeProject
9193
- });
9194
- var DTOUGetForgeProjectResponse = z314.object({
9195
- project: DTOForgeProject
9196
- });
9197
- var DTORemoveForgeProjectResponse = z314.object({ ok: z314.literal(true) });
9198
-
9199
9111
  // src/api/dto/forge/project-action.ts
9200
- import z318 from "zod";
9112
+ import z315 from "zod";
9201
9113
 
9202
9114
  // src/api/dto/forge/project-artifact.ts
9203
- import { z as z316 } from "zod";
9115
+ import { z as z313 } from "zod";
9204
9116
 
9205
9117
  // src/api/dto/forge/project-section.ts
9206
- import z315 from "zod";
9207
- var AfterSectionId = z315.string().uuid().nullish().optional();
9118
+ import z312 from "zod";
9119
+ var AfterSectionId = z312.string().uuid().nullish().optional();
9208
9120
  var DTOForgeSection = ForgeSection;
9209
9121
  var DTOForgeSectionCreateInput = DTOForgeSection.pick({
9210
9122
  id: true,
@@ -9215,12 +9127,12 @@ var DTOForgeSectionCreateInput = DTOForgeSection.pick({
9215
9127
  });
9216
9128
  var DTOForgeSectionUpdateInput = DTOForgeSection.pick({ id: true, name: true });
9217
9129
  var DTOForgeSectionDeleteInput = DTOForgeSection.pick({ id: true }).extend({
9218
- deleteChildren: z315.boolean().default(false)
9130
+ deleteChildren: z312.boolean().default(false)
9219
9131
  });
9220
9132
  var DTOForgeSectionMoveInput = DTOForgeSection.pick({ id: true }).extend({
9221
9133
  afterSectionId: AfterSectionId
9222
9134
  });
9223
- var DTOForgeSectionItemMoveInput = z315.object({
9135
+ var DTOForgeSectionItemMoveInput = z312.object({
9224
9136
  id: Id,
9225
9137
  sectionId: Id.nullish().optional(),
9226
9138
  // undefined=stay, null=no section, string=move to section
@@ -9230,116 +9142,117 @@ var DTOForgeSectionItemMoveInput = z315.object({
9230
9142
 
9231
9143
  // src/api/dto/forge/project-artifact.ts
9232
9144
  var DTOForgeProjectArtifact = ForgeProjectArtifact;
9233
- var DTOForgeProjectArtifactUpdateInput = z316.object({
9234
- id: z316.string(),
9235
- title: z316.string().optional()
9145
+ var DTOForgeProjectArtifactUpdateInput = z313.object({
9146
+ id: z313.string(),
9147
+ title: z313.string().optional()
9236
9148
  });
9237
- var DTOForgeProjectArtifactCreateInput = z316.object({
9238
- id: z316.string(),
9239
- title: z316.string(),
9240
- sectionId: z316.string().optional(),
9241
- afterArtifactId: z316.string().optional().nullable()
9149
+ var DTOForgeProjectArtifactCreateInput = z313.object({
9150
+ id: z313.string(),
9151
+ title: z313.string(),
9152
+ sectionId: z313.string().optional(),
9153
+ afterArtifactId: z313.string().optional().nullable()
9242
9154
  });
9243
- var DTOForgeProjectArtifactDeleteInput = z316.object({
9155
+ var DTOForgeProjectArtifactDeleteInput = z313.object({
9244
9156
  id: Id
9245
9157
  });
9246
9158
  var DTOForgeProjectArtifactMoveInput = DTOForgeSectionItemMoveInput;
9247
- var DTOForgeProjectArtifactGetResponse = z316.object({
9159
+ var DTOForgeProjectArtifactGetResponse = z313.object({
9248
9160
  artifact: DTOForgeProjectArtifact
9249
9161
  });
9250
- var DTOForgeProjectArtifactCreateResponse = z316.object({
9162
+ var DTOForgeProjectArtifactCreateResponse = z313.object({
9251
9163
  artifact: DTOForgeProjectArtifact
9252
9164
  });
9253
- var DTOForgeProjectArtifactUpdateResponse = z316.object({
9165
+ var DTOForgeProjectArtifactUpdateResponse = z313.object({
9254
9166
  artifact: DTOForgeProjectArtifact
9255
9167
  });
9256
- var DTOForgeProjectArtifactDeleteResponse = z316.object({
9257
- ok: z316.literal(true)
9168
+ var DTOForgeProjectArtifactDeleteResponse = z313.object({
9169
+ ok: z313.literal(true)
9258
9170
  });
9259
- var DTOForgeProjectArtifactMoveResponse = z316.object({
9171
+ var DTOForgeProjectArtifactMoveResponse = z313.object({
9260
9172
  artifact: DTOForgeProjectArtifact
9261
9173
  });
9262
- var DTOForgeProjectArtifactsListResponse = z316.object({
9263
- artifacts: z316.array(DTOForgeProjectArtifact)
9174
+ var DTOForgeProjectArtifactsListResponse = z313.object({
9175
+ artifacts: z313.array(DTOForgeProjectArtifact)
9264
9176
  });
9265
9177
 
9266
9178
  // src/api/dto/forge/project-feature.ts
9267
- import z317 from "zod";
9179
+ import z314 from "zod";
9268
9180
  var DTOForgeProjectFeature = ProjectFeature;
9269
- var DTOForgeProjectFeatureListResponse = z317.object({
9181
+ var DTOForgeProjectFeatureListResponse = z314.object({
9270
9182
  features: DTOForgeProjectFeature.array()
9271
9183
  });
9272
- var DTOForgeProjectFeatureGetResponse = z317.object({
9184
+ var DTOForgeProjectFeatureGetResponse = z314.object({
9273
9185
  feature: DTOForgeProjectFeature
9274
9186
  });
9275
- var DTOForgeProjectFeatureCreateInput = z317.object({
9187
+ var DTOForgeProjectFeatureCreateInput = z314.object({
9276
9188
  id: Id,
9277
- name: z317.string(),
9278
- description: z317.string(),
9189
+ name: z314.string(),
9190
+ description: z314.string(),
9279
9191
  sectionId: Id.optional(),
9280
9192
  afterFeatureId: Id.nullable().optional()
9281
9193
  });
9282
- var DTOForgeProjectFeatureUpdateInput = z317.object({
9194
+ var DTOForgeProjectFeatureUpdateInput = z314.object({
9283
9195
  id: Id,
9284
- name: z317.string().optional(),
9285
- description: z317.string().optional(),
9286
- isArchived: z317.boolean().optional()
9196
+ name: z314.string().optional(),
9197
+ description: z314.string().optional(),
9198
+ isArchived: z314.boolean().optional(),
9199
+ status: ProjectFeatureStatus.optional()
9287
9200
  });
9288
- var DTOForgeProjectFeatureDeleteInput = z317.object({
9201
+ var DTOForgeProjectFeatureDeleteInput = z314.object({
9289
9202
  id: Id
9290
9203
  });
9291
9204
  var DTOForgeProjectFeatureMoveInput = DTOForgeSectionItemMoveInput;
9292
9205
 
9293
9206
  // src/api/dto/forge/project-action.ts
9294
- var DTOForgeProjectActionFeatureCreate = z318.object({
9295
- type: z318.literal("FeatureCreate"),
9207
+ var DTOForgeProjectActionFeatureCreate = z315.object({
9208
+ type: z315.literal("FeatureCreate"),
9296
9209
  input: DTOForgeProjectFeatureCreateInput
9297
9210
  });
9298
- var DTOForgeProjectActionFeatureUpdate = z318.object({
9299
- type: z318.literal("FeatureUpdate"),
9211
+ var DTOForgeProjectActionFeatureUpdate = z315.object({
9212
+ type: z315.literal("FeatureUpdate"),
9300
9213
  input: DTOForgeProjectFeatureUpdateInput
9301
9214
  });
9302
- var DTOForgeProjectActionFeatureMove = z318.object({
9303
- type: z318.literal("FeatureMove"),
9215
+ var DTOForgeProjectActionFeatureMove = z315.object({
9216
+ type: z315.literal("FeatureMove"),
9304
9217
  input: DTOForgeProjectFeatureMoveInput
9305
9218
  });
9306
- var DTOForgeProjectActionFeatureDelete = z318.object({
9307
- type: z318.literal("FeatureDelete"),
9219
+ var DTOForgeProjectActionFeatureDelete = z315.object({
9220
+ type: z315.literal("FeatureDelete"),
9308
9221
  input: DTOForgeProjectFeatureDeleteInput
9309
9222
  });
9310
- var DTOForgeProjectActionArtifactCreate = z318.object({
9311
- type: z318.literal("ArtifactCreate"),
9223
+ var DTOForgeProjectActionArtifactCreate = z315.object({
9224
+ type: z315.literal("ArtifactCreate"),
9312
9225
  input: DTOForgeProjectArtifactCreateInput
9313
9226
  });
9314
- var DTOForgeProjectActionArtifactUpdate = z318.object({
9315
- type: z318.literal("ArtifactUpdate"),
9227
+ var DTOForgeProjectActionArtifactUpdate = z315.object({
9228
+ type: z315.literal("ArtifactUpdate"),
9316
9229
  input: DTOForgeProjectArtifactUpdateInput
9317
9230
  });
9318
- var DTOForgeProjectActionArtifactDelete = z318.object({
9319
- type: z318.literal("ArtifactDelete"),
9231
+ var DTOForgeProjectActionArtifactDelete = z315.object({
9232
+ type: z315.literal("ArtifactDelete"),
9320
9233
  input: DTOForgeProjectArtifactDeleteInput
9321
9234
  });
9322
- var DTOForgeProjectActionArtifactMove = z318.object({
9323
- type: z318.literal("ArtifactMove"),
9235
+ var DTOForgeProjectActionArtifactMove = z315.object({
9236
+ type: z315.literal("ArtifactMove"),
9324
9237
  input: DTOForgeProjectArtifactMoveInput
9325
9238
  });
9326
- var DTOForgeProjectActionSectionCreate = z318.object({
9327
- type: z318.literal("SectionCreate"),
9239
+ var DTOForgeProjectActionSectionCreate = z315.object({
9240
+ type: z315.literal("SectionCreate"),
9328
9241
  input: DTOForgeSectionCreateInput
9329
9242
  });
9330
- var DTOForgeProjectActionSectionUpdate = z318.object({
9331
- type: z318.literal("SectionUpdate"),
9243
+ var DTOForgeProjectActionSectionUpdate = z315.object({
9244
+ type: z315.literal("SectionUpdate"),
9332
9245
  input: DTOForgeSectionUpdateInput
9333
9246
  });
9334
- var DTOForgeProjectActionSectionDelete = z318.object({
9335
- type: z318.literal("SectionDelete"),
9247
+ var DTOForgeProjectActionSectionDelete = z315.object({
9248
+ type: z315.literal("SectionDelete"),
9336
9249
  input: DTOForgeSectionDeleteInput
9337
9250
  });
9338
- var DTOForgeProjectActionSectionMove = z318.object({
9339
- type: z318.literal("SectionMove"),
9251
+ var DTOForgeProjectActionSectionMove = z315.object({
9252
+ type: z315.literal("SectionMove"),
9340
9253
  input: DTOForgeSectionMoveInput
9341
9254
  });
9342
- var DTOForgeProjectAction = z318.discriminatedUnion("type", [
9255
+ var DTOForgeProjectAction = z315.discriminatedUnion("type", [
9343
9256
  //features
9344
9257
  DTOForgeProjectActionFeatureCreate,
9345
9258
  DTOForgeProjectActionFeatureUpdate,
@@ -9356,22 +9269,22 @@ var DTOForgeProjectAction = z318.discriminatedUnion("type", [
9356
9269
  DTOForgeProjectActionSectionDelete,
9357
9270
  DTOForgeProjectActionSectionMove
9358
9271
  ]).and(
9359
- z318.object({
9360
- tId: z318.string().optional()
9272
+ z315.object({
9273
+ tId: z315.string().optional()
9361
9274
  })
9362
9275
  );
9363
9276
 
9364
9277
  // src/api/dto/forge/project-artifact-room.ts
9365
- import { z as z319 } from "zod";
9366
- var DTOForgeProjectArtifactRoom = z319.object({
9367
- id: z319.string()
9278
+ import { z as z316 } from "zod";
9279
+ var DTOForgeProjectArtifactRoom = z316.object({
9280
+ id: z316.string()
9368
9281
  });
9369
- var DTOForgeProjectArtifactRoomResponse = z319.object({
9282
+ var DTOForgeProjectArtifactRoomResponse = z316.object({
9370
9283
  room: DTOForgeProjectArtifactRoom
9371
9284
  });
9372
9285
 
9373
9286
  // src/api/dto/forge/project-context.ts
9374
- import { z as z320 } from "zod";
9287
+ import { z as z317 } from "zod";
9375
9288
  var DTOForgeProjectContext = ForgeProjectContext;
9376
9289
  var DTOCreateForgeProjectContext = DTOForgeProjectContext.pick({
9377
9290
  definition: true,
@@ -9383,21 +9296,53 @@ var DTOCreateForgeProjectContext = DTOForgeProjectContext.pick({
9383
9296
  tailwindConfig: true,
9384
9297
  styling: true
9385
9298
  }).extend({ npmProxySettings: DTONpmRegistryConfig });
9386
- var DTOUpdateForgeProjectContext = DTOCreateForgeProjectContext.partial().extend({ id: z320.string() });
9387
- var DTOForgeProjectContextGetResponse = z320.object({ context: DTOForgeProjectContext });
9388
- var DTOForgeProjectContextListResponse = z320.object({ contexts: z320.array(DTOForgeProjectContext) });
9389
- var DTOForgeProjectContextCreateResponse = z320.object({ context: DTOForgeProjectContext });
9390
- var DTOForgeProjectContextUpdateResponse = z320.object({ context: DTOForgeProjectContext });
9391
- var DTOForgeProjectContextRemoveResponse = z320.object({
9392
- ok: z320.literal(true)
9299
+ var DTOUpdateForgeProjectContext = DTOCreateForgeProjectContext.partial().extend({ id: z317.string() });
9300
+ var DTOForgeProjectContextGetResponse = z317.object({ context: DTOForgeProjectContext });
9301
+ var DTOForgeProjectContextListResponse = z317.object({ contexts: z317.array(DTOForgeProjectContext) });
9302
+ var DTOForgeProjectContextCreateResponse = z317.object({ context: DTOForgeProjectContext });
9303
+ var DTOForgeProjectContextUpdateResponse = z317.object({ context: DTOForgeProjectContext });
9304
+ var DTOForgeProjectContextRemoveResponse = z317.object({
9305
+ ok: z317.literal(true)
9393
9306
  });
9394
9307
 
9395
9308
  // src/api/dto/forge/project-figma-node.ts
9396
9309
  var DTOForgeProjectFigmaNode = ForgeProjectFigmaNode;
9397
9310
  var DTOForgeProjectFigmaNodeRenderInput = ForgeProjectFigmaNodeRenderInput;
9398
9311
 
9312
+ // src/api/dto/forge/project-invitation.ts
9313
+ import { z as z318 } from "zod";
9314
+ var DTOForgeProjectInvitation = ForgeProjectInvitation;
9315
+ var DTOCreateForgeProjectInvitation = DTOForgeProjectInvitation.pick({
9316
+ email: true,
9317
+ role: true
9318
+ }).extend({
9319
+ workspaceRole: WorkspaceRoleSchema
9320
+ });
9321
+ var DTOUpdateForgeProjectInvitation = DTOCreateForgeProjectInvitation.omit({
9322
+ email: true,
9323
+ workspaceRole: true
9324
+ });
9325
+ var DTORemoveForgeProjectInvitation = DTOCreateForgeProjectInvitation.pick({
9326
+ email: true
9327
+ });
9328
+ var DTOForgeProjectInvitationsListResponse = z318.object({
9329
+ invitations: z318.array(DTOForgeProjectInvitation)
9330
+ });
9331
+ var DTOForgeProjectInvitationGetResponse = z318.object({
9332
+ invitation: DTOForgeProjectInvitation
9333
+ });
9334
+ var DTOForgeProjectInvitationCreateResponse = z318.object({
9335
+ invitation: DTOForgeProjectInvitation
9336
+ });
9337
+ var DTOForgeProjectInvitationUpdateResponse = z318.object({
9338
+ invitation: DTOForgeProjectInvitation.nullable()
9339
+ });
9340
+ var DTOForgeProjectInvitationRemoveResponse = z318.object({
9341
+ ok: z318.literal(true)
9342
+ });
9343
+
9399
9344
  // src/api/dto/forge/project-iteration.ts
9400
- import { z as z321 } from "zod";
9345
+ import { z as z319 } from "zod";
9401
9346
  var DTOForgeProjectIterationMergeMeta = ForgeProjectIterationMergeMeta;
9402
9347
  var DTOForgeProjectIteration = ForgeProjectIteration.omit({
9403
9348
  artifacts: true,
@@ -9408,7 +9353,7 @@ var DTOForgeProjectIteration = ForgeProjectIteration.omit({
9408
9353
  messages: DTOForgeIterationMessage.array(),
9409
9354
  mergeMeta: DTOForgeProjectIterationMergeMeta.optional()
9410
9355
  });
9411
- var DTOGetForgeProjectIterationResponse = z321.object({
9356
+ var DTOGetForgeProjectIterationResponse = z319.object({
9412
9357
  iteration: DTOForgeProjectIteration.nullable()
9413
9358
  });
9414
9359
  var DTOCreateForgeProjectIteration = DTOForgeProjectIteration.omit({
@@ -9418,27 +9363,96 @@ var DTOCreateForgeProjectIteration = DTOForgeProjectIteration.omit({
9418
9363
  mergeMeta: true,
9419
9364
  createdAt: true
9420
9365
  });
9421
- var DTOUpdateForgeProjectIteration = DTOCreateForgeProjectIteration.extend({ id: z321.string() });
9422
- var DTOCreateForgeProjectIterationResponse = z321.object({
9366
+ var DTOUpdateForgeProjectIteration = DTOCreateForgeProjectIteration.extend({ id: z319.string() });
9367
+ var DTOCreateForgeProjectIterationResponse = z319.object({
9423
9368
  iteration: DTOForgeProjectIteration
9424
9369
  });
9425
- var DTOUpdateForgeProjectIterationResponse = z321.object({
9370
+ var DTOUpdateForgeProjectIterationResponse = z319.object({
9426
9371
  iteration: DTOForgeProjectIteration.nullable()
9427
9372
  });
9428
- var DTODeleteForgeProjectIterationResponse = z321.object({
9429
- ok: z321.literal(true)
9373
+ var DTODeleteForgeProjectIterationResponse = z319.object({
9374
+ ok: z319.literal(true)
9375
+ });
9376
+ var DTOForgeProjectIterationListResponse = z319.object({ iterations: z319.array(DTOForgeProjectIteration) });
9377
+
9378
+ // src/api/dto/forge/project-member.ts
9379
+ import { z as z320 } from "zod";
9380
+ var DTOForgeProjectMemberRole = ForgeProjectRole;
9381
+ var DTOForgeProjectMember = ForgeProjectMembership.extend({
9382
+ user: DTOUser,
9383
+ effectiveRole: DTOForgeProjectMemberRole
9384
+ });
9385
+ var DTOCreateForgeProjectMember = DTOForgeProjectMember.pick({
9386
+ userId: true,
9387
+ role: true
9388
+ });
9389
+ var DTOUpdateForgeProjectMember = DTOCreateForgeProjectMember.omit({ userId: true });
9390
+ var DTORemoveForgeProjectMember = DTOForgeProjectMember.pick({
9391
+ userId: true
9392
+ });
9393
+ var DTOForgeProjectMembersListResponse = z320.object({
9394
+ members: z320.array(DTOForgeProjectMember),
9395
+ invitations: z320.array(DTOForgeProjectInvitation)
9396
+ });
9397
+ var DTOForgeProjectMemberGetResponse = z320.object({
9398
+ member: DTOForgeProjectMember
9399
+ });
9400
+ var DTOForgeProjectMemberCreateResponse = z320.object({
9401
+ member: DTOForgeProjectMember
9402
+ });
9403
+ var DTOForgeProjectMemberUpdateResponse = z320.object({
9404
+ member: DTOForgeProjectMember.nullable()
9405
+ });
9406
+ var DTOForgeProjectMemberRemoveResponse = z320.object({
9407
+ ok: z320.literal(true)
9408
+ });
9409
+ var DTOAddMembersToForgeProject = z320.object({
9410
+ membersToInvite: DTOCreateForgeProjectInvitation.array().min(1)
9430
9411
  });
9431
- var DTOForgeProjectIterationListResponse = z321.object({ iterations: z321.array(DTOForgeProjectIteration) });
9432
9412
 
9433
9413
  // src/api/dto/forge/project-room.ts
9434
- import { z as z322 } from "zod";
9435
- var DTOForgeProjectRoom = z322.object({
9436
- id: z322.string()
9414
+ import { z as z321 } from "zod";
9415
+ var DTOForgeProjectRoom = z321.object({
9416
+ id: z321.string()
9437
9417
  });
9438
- var DTOForgeProjectRoomResponse = z322.object({
9418
+ var DTOForgeProjectRoomResponse = z321.object({
9439
9419
  room: DTOForgeProjectRoom
9440
9420
  });
9441
9421
 
9422
+ // src/api/dto/forge/project.ts
9423
+ import { z as z322 } from "zod";
9424
+ var DTOForgeProject = ForgeProject.omit({ fpContextId: true }).extend({
9425
+ context: ForgeProjectContext,
9426
+ members: z322.array(DTOForgeProjectMember),
9427
+ invitations: z322.array(DTOForgeProjectInvitation)
9428
+ });
9429
+ var DTOCreateForgeProject = ForgeProject.pick({
9430
+ instruction: true,
9431
+ name: true,
9432
+ meta: true,
9433
+ tags: true,
9434
+ accessMode: true,
9435
+ fpContextId: true,
9436
+ isArchived: true,
9437
+ emoji: true
9438
+ }).extend({ membersToInvite: DTOCreateForgeProjectInvitation.array().min(1).optional() });
9439
+ var DTOUpdateForgeProject = DTOCreateForgeProject.omit({ membersToInvite: true }).partial().extend({
9440
+ id: z322.string(),
9441
+ membersToRetain: z322.string().array().min(1).optional()
9442
+ });
9443
+ var DTOForgeProjectGetResponse = z322.object({ project: DTOForgeProject.nullable() });
9444
+ var DTOForgeProjectsListResponse = z322.object({ projects: z322.array(DTOForgeProject) });
9445
+ var DTOCreateForgeProjectResponse = z322.object({
9446
+ project: DTOForgeProject
9447
+ });
9448
+ var DTOUpdateForgeProjectResponse = z322.object({
9449
+ project: DTOForgeProject
9450
+ });
9451
+ var DTOUGetForgeProjectResponse = z322.object({
9452
+ project: DTOForgeProject
9453
+ });
9454
+ var DTORemoveForgeProjectResponse = z322.object({ ok: z322.literal(true) });
9455
+
9442
9456
  // src/api/dto/forge/threads.ts
9443
9457
  import { z as z323 } from "zod";
9444
9458
  var DTOForgeChatMessage = ForgeChatMessage;
@@ -17215,18 +17229,24 @@ var LocalProjectActionExecutor = class {
17215
17229
  return this.artifactUpdate(trx);
17216
17230
  case "ArtifactDelete":
17217
17231
  return this.artifactDelete(trx);
17232
+ case "ArtifactMove":
17233
+ return this.artifactMove(trx);
17218
17234
  case "FeatureCreate":
17219
17235
  return this.featureCreate(trx);
17220
17236
  case "FeatureDelete":
17221
17237
  return this.featureDelete(trx);
17222
17238
  case "FeatureUpdate":
17223
17239
  return this.featureUpdate(trx);
17240
+ case "FeatureMove":
17241
+ return this.featureMove(trx);
17224
17242
  case "SectionCreate":
17225
17243
  return this.sectionCreate(trx);
17226
17244
  case "SectionUpdate":
17227
17245
  return this.sectionUpdate(trx);
17228
17246
  case "SectionDelete":
17229
17247
  return this.sectionDelete(trx);
17248
+ case "SectionMove":
17249
+ return this.sectionMove(trx);
17230
17250
  }
17231
17251
  }
17232
17252
  //
@@ -17234,11 +17254,13 @@ var LocalProjectActionExecutor = class {
17234
17254
  //
17235
17255
  artifactCreate(trx) {
17236
17256
  const { input } = trx;
17237
- const { id } = input;
17257
+ const { id, afterArtifactId, sectionId } = input;
17258
+ const sortOrder = this.calculateItemSortOrder(this.artifacts, afterArtifactId, sectionId);
17238
17259
  this.artifacts.set(id, {
17239
17260
  id,
17240
17261
  projectId: this.projectId,
17241
- sortOrder: 0,
17262
+ sectionId,
17263
+ sortOrder,
17242
17264
  title: input.title,
17243
17265
  updatedAt: /* @__PURE__ */ new Date(),
17244
17266
  createdAt: /* @__PURE__ */ new Date(),
@@ -17259,6 +17281,21 @@ var LocalProjectActionExecutor = class {
17259
17281
  };
17260
17282
  this.artifacts.set(id, mergedArtifact);
17261
17283
  }
17284
+ artifactMove(trx) {
17285
+ const { input } = trx;
17286
+ const { id, afterId, sectionId } = input;
17287
+ const existingArtifact = this.artifacts.get(id);
17288
+ if (!existingArtifact) {
17289
+ throw new Error(`Cannot move artifact: artifact ${id} was not found in local storage`);
17290
+ }
17291
+ const sortOrder = this.calculateItemSortOrder(this.artifacts, afterId, sectionId);
17292
+ const mergedArtifact = {
17293
+ ...existingArtifact,
17294
+ sortOrder,
17295
+ updatedAt: /* @__PURE__ */ new Date()
17296
+ };
17297
+ this.artifacts.set(id, mergedArtifact);
17298
+ }
17262
17299
  artifactDelete(trx) {
17263
17300
  const { input } = trx;
17264
17301
  const { id } = input;
@@ -17271,15 +17308,17 @@ var LocalProjectActionExecutor = class {
17271
17308
  //
17272
17309
  featureCreate(trx) {
17273
17310
  const { input } = trx;
17274
- const { id } = input;
17311
+ const { id, afterFeatureId, sectionId } = input;
17312
+ const sortOrder = this.calculateItemSortOrder(this.features, afterFeatureId, sectionId);
17275
17313
  this.features.set(id, {
17276
17314
  id,
17277
17315
  projectId: this.projectId,
17278
17316
  description: input.description,
17279
17317
  isArchived: false,
17280
17318
  sectionId: input.sectionId,
17281
- sortOrder: 0,
17319
+ sortOrder,
17282
17320
  name: input.name,
17321
+ status: "Draft",
17283
17322
  updatedAt: /* @__PURE__ */ new Date(),
17284
17323
  createdAt: /* @__PURE__ */ new Date(),
17285
17324
  createdByUserId: this.userId
@@ -17297,6 +17336,22 @@ var LocalProjectActionExecutor = class {
17297
17336
  name: input.name ?? existingFeature.name,
17298
17337
  description: input.description ?? existingFeature.description,
17299
17338
  isArchived: input.isArchived ?? existingFeature.isArchived,
17339
+ status: input.status ?? existingFeature.status,
17340
+ updatedAt: /* @__PURE__ */ new Date()
17341
+ };
17342
+ this.features.set(id, mergedFeature);
17343
+ }
17344
+ featureMove(trx) {
17345
+ const { input } = trx;
17346
+ const { id, afterId, sectionId } = input;
17347
+ const existingFeature = this.features.get(id);
17348
+ if (!existingFeature) {
17349
+ throw new Error(`Cannot move feature: feature ${id} was not found in local storage`);
17350
+ }
17351
+ const sortOrder = this.calculateItemSortOrder(this.features, afterId, sectionId);
17352
+ const mergedFeature = {
17353
+ ...existingFeature,
17354
+ sortOrder,
17300
17355
  updatedAt: /* @__PURE__ */ new Date()
17301
17356
  };
17302
17357
  this.features.set(id, mergedFeature);
@@ -17313,15 +17368,15 @@ var LocalProjectActionExecutor = class {
17313
17368
  //
17314
17369
  sectionCreate(trx) {
17315
17370
  const { input } = trx;
17316
- const { id } = input;
17371
+ const { id, afterSectionId } = input;
17317
17372
  const sections = input.childType === "Artifact" ? this.artifactSections : this.featureSections;
17373
+ const sortOrder = this.calculateSectionSortOrder(sections, afterSectionId);
17318
17374
  sections.set(id, {
17319
17375
  id,
17320
17376
  projectId: this.projectId,
17321
17377
  name: input.name,
17322
17378
  childType: input.childType,
17323
- sortOrder: 0,
17324
- // TODO: Use Roman's calculate functions
17379
+ sortOrder,
17325
17380
  updatedAt: /* @__PURE__ */ new Date(),
17326
17381
  createdAt: /* @__PURE__ */ new Date()
17327
17382
  });
@@ -17341,6 +17396,22 @@ var LocalProjectActionExecutor = class {
17341
17396
  const sections = existingSection.childType === "Artifact" ? this.artifactSections : this.featureSections;
17342
17397
  sections.set(id, mergedSection);
17343
17398
  }
17399
+ sectionMove(trx) {
17400
+ const { input } = trx;
17401
+ const { id, afterSectionId } = input;
17402
+ const existingSection = this.artifactSections.get(id) ?? this.featureSections.get(id);
17403
+ if (!existingSection) {
17404
+ throw new Error(`Cannot move section: section ${id} was not found in local storage`);
17405
+ }
17406
+ const sections = existingSection.childType === "Artifact" ? this.artifactSections : this.featureSections;
17407
+ const sortOrder = this.calculateSectionSortOrder(sections, afterSectionId);
17408
+ const mergedSection = {
17409
+ ...existingSection,
17410
+ sortOrder,
17411
+ updatedAt: /* @__PURE__ */ new Date()
17412
+ };
17413
+ sections.set(id, mergedSection);
17414
+ }
17344
17415
  sectionDelete(trx) {
17345
17416
  const { input } = trx;
17346
17417
  const { id } = input;
@@ -17350,6 +17421,59 @@ var LocalProjectActionExecutor = class {
17350
17421
  throw new Error(`Cannot delete section: section ${id} was not found in local storage`);
17351
17422
  }
17352
17423
  }
17424
+ calculateSectionSortOrder(items, afterItemId) {
17425
+ const sortedItems = Array.from(items.values()).sort((a, b) => a.sortOrder - b.sortOrder);
17426
+ const sortOrder = this.calculateSortOrderNoDb(
17427
+ (pId) => sortedItems.find((s) => s.projectId === pId),
17428
+ (pId) => sortedItems.findLast((s) => s.projectId === pId),
17429
+ (pId, id) => sortedItems.find((s) => s.projectId === pId && s.id === id),
17430
+ (pId, sortOrder2) => sortedItems.find((s) => s.projectId === pId && s.sortOrder > sortOrder2),
17431
+ (pId, sortOrder2, step) => items.forEach((s) => s.sortOrder > sortOrder2 && s.projectId === pId ? s.sortOrder += step : {}),
17432
+ this.projectId,
17433
+ afterItemId
17434
+ );
17435
+ return sortOrder ?? 0;
17436
+ }
17437
+ calculateItemSortOrder(items, afterItemId, sectionId) {
17438
+ const sortedItems = Array.from(items.values()).sort((a, b) => a.sortOrder - b.sortOrder);
17439
+ const matchIds = (i, pId, sId) => i.sectionId === sId && i.projectId === pId;
17440
+ const sortOrder = this.calculateSortOrderNoDb(
17441
+ (pId, sId) => sortedItems.find((i) => matchIds(i, pId, sId)),
17442
+ (pId, sId) => sortedItems.findLast((i) => matchIds(i, pId, sId)),
17443
+ (pId, id, sId) => sortedItems.find((i) => i.id === id && matchIds(i, pId, sId)),
17444
+ (pId, sortOrder2, sId) => sortedItems.find((i) => i.sortOrder > sortOrder2 && matchIds(i, pId, sId)),
17445
+ (pId, sortOrder2, step, sId) => items.forEach((i) => i.sortOrder > sortOrder2 && matchIds(i, pId, sId) ? i.sortOrder += step : {}),
17446
+ this.projectId,
17447
+ afterItemId,
17448
+ sectionId ?? void 0
17449
+ );
17450
+ return sortOrder ?? 0;
17451
+ }
17452
+ // See also calculateSectionSortOrder and calculateSectionedItemSortOrder
17453
+ calculateSortOrderNoDb(findFirst, findLast, findUnique, findNext, shiftAfter, projectId, afterItemId, sectionId) {
17454
+ const SORT_ORDER_STEP = 1e3;
17455
+ if (afterItemId === void 0) {
17456
+ const lastSection = findLast(projectId, sectionId);
17457
+ return (lastSection?.sortOrder ?? 0) + SORT_ORDER_STEP;
17458
+ } else if (afterItemId === null) {
17459
+ const firstSection = findFirst(projectId, sectionId);
17460
+ return (firstSection?.sortOrder ?? SORT_ORDER_STEP) - SORT_ORDER_STEP;
17461
+ } else {
17462
+ const targetSection = findUnique(projectId, afterItemId, sectionId);
17463
+ if (!targetSection) return null;
17464
+ const nextSection = findNext(projectId, targetSection.sortOrder, sectionId);
17465
+ if (nextSection) {
17466
+ let newSortOrder = Math.floor((targetSection.sortOrder + nextSection.sortOrder) / 2);
17467
+ if (newSortOrder <= targetSection.sortOrder) {
17468
+ newSortOrder = targetSection.sortOrder + SORT_ORDER_STEP / 2;
17469
+ shiftAfter(projectId, targetSection.sortOrder, SORT_ORDER_STEP, sectionId);
17470
+ }
17471
+ return newSortOrder;
17472
+ } else {
17473
+ return targetSection.sortOrder + SORT_ORDER_STEP;
17474
+ }
17475
+ }
17476
+ }
17353
17477
  };
17354
17478
 
17355
17479
  // src/sync/project-content-repo.ts
@@ -17568,6 +17692,7 @@ export {
17568
17692
  DTOCreateForgeProjectResponse,
17569
17693
  DTOCreateForgeSpecArtifact,
17570
17694
  DTOCreateVersionInput,
17695
+ DTOCreditBalance,
17571
17696
  DTODataSource,
17572
17697
  DTODataSourceFigma,
17573
17698
  DTODataSourceFigmaCloud,