@timeax/digital-service-engine 0.3.2 → 0.3.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.
@@ -1042,12 +1042,6 @@ type BackendResult<T> = {
1042
1042
  error: BackendError;
1043
1043
  };
1044
1044
  type Result<T> = Promise<BackendResult<T>>;
1045
- interface Actor {
1046
- readonly id: string;
1047
- readonly name?: string;
1048
- readonly roles?: readonly string[];
1049
- readonly meta?: Readonly<Record<string, unknown>>;
1050
- }
1051
1045
  interface Author {
1052
1046
  readonly id: string;
1053
1047
  readonly name: string;
@@ -1072,12 +1066,26 @@ interface MergeResult {
1072
1066
  readonly conflicts?: number;
1073
1067
  readonly message?: string;
1074
1068
  }
1069
+ type WorkspaceLoadContext = Readonly<{
1070
+ workspaceId: string;
1071
+ actorId?: string;
1072
+ branchId?: string;
1073
+ since?: string | number;
1074
+ }>;
1075
+ type WorkspaceActorLoadContext = WorkspaceLoadContext & Readonly<{
1076
+ actorId: string;
1077
+ }>;
1078
+ type WorkspaceBranchLoadContext = WorkspaceLoadContext & Readonly<{
1079
+ branchId: string;
1080
+ }>;
1081
+ type WorkspaceActorBranchLoadContext = WorkspaceLoadContext & Readonly<{
1082
+ actorId: string;
1083
+ branchId: string;
1084
+ }>;
1075
1085
  type ServicesInput = readonly DgpServiceCapability[] | DgpServiceMap;
1076
1086
  interface ServicesBackend {
1077
- get(workspaceId: string): Result<ServicesInput>;
1078
- refresh(workspaceId: string, params?: Readonly<{
1079
- since?: number | string;
1080
- }>): Result<ServicesInput>;
1087
+ get(ctx: WorkspaceLoadContext): Result<ServicesInput>;
1088
+ refresh(ctx: WorkspaceLoadContext): Result<ServicesInput>;
1081
1089
  }
1082
1090
  interface BranchParticipant {
1083
1091
  readonly id: string;
@@ -1094,10 +1102,8 @@ interface BranchParticipant {
1094
1102
  readonly updatedAt?: string;
1095
1103
  }
1096
1104
  interface BranchAccessBackend {
1097
- listParticipants(workspaceId: string, branchId: string): Result<readonly BranchParticipant[]>;
1098
- refreshParticipants(workspaceId: string, branchId: string, params?: Readonly<{
1099
- since?: number | string;
1100
- }>): Result<readonly BranchParticipant[]>;
1105
+ listParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
1106
+ refreshParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
1101
1107
  }
1102
1108
  interface ServiceSnapshot {
1103
1109
  readonly schema_version: string;
@@ -1211,12 +1217,13 @@ interface FieldTemplate {
1211
1217
  }
1212
1218
  /** Narrow list/search input */
1213
1219
  interface TemplatesListParams {
1214
- readonly workspaceId: string;
1215
- readonly branchId?: string;
1220
+ readonly workspaceId: WorkspaceLoadContext["workspaceId"];
1221
+ readonly actorId?: WorkspaceLoadContext["actorId"];
1222
+ readonly branchId?: WorkspaceLoadContext["branchId"];
1216
1223
  readonly q?: string;
1217
1224
  readonly tags?: readonly string[];
1218
1225
  readonly category?: string;
1219
- readonly since?: string | number;
1226
+ readonly since?: WorkspaceLoadContext["since"];
1220
1227
  }
1221
1228
  interface TemplateCreateInput {
1222
1229
  readonly key?: string;
@@ -1264,23 +1271,23 @@ interface TemplatesBackend {
1264
1271
  refresh(params: Omit<TemplatesListParams, "q" | "tags" | "category">): Result<readonly FieldTemplate[]>;
1265
1272
  }
1266
1273
  interface AuthorsBackend {
1267
- list(workspaceId: string): Result<readonly Author[]>;
1274
+ list(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
1268
1275
  get(authorId: string): Result<Author | null>;
1269
- refresh(workspaceId: string): Result<readonly Author[]>;
1276
+ refresh(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
1270
1277
  }
1271
1278
  interface PermissionsBackend {
1272
- get(workspaceId: string, actor: Actor): Result<PermissionsMap>;
1273
- refresh(workspaceId: string, actor: Actor): Result<PermissionsMap>;
1279
+ get(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
1280
+ refresh(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
1274
1281
  }
1275
1282
  interface BranchesBackend {
1276
- list(workspaceId: string): Result<readonly Branch[]>;
1283
+ list(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
1277
1284
  create(workspaceId: string, name: string, opts?: Readonly<{
1278
1285
  fromId?: string;
1279
1286
  }>): Result<Branch>;
1280
1287
  setMain(workspaceId: string, branchId: string): Result<Branch>;
1281
1288
  merge(workspaceId: string, sourceId: string, targetId: string): Result<MergeResult>;
1282
1289
  delete(workspaceId: string, branchId: string): Result<void>;
1283
- refresh(workspaceId: string): Result<readonly Branch[]>;
1290
+ refresh(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
1284
1291
  }
1285
1292
  interface WorkspaceInfo {
1286
1293
  readonly id: string;
@@ -1295,10 +1302,7 @@ interface WorkspaceInfo {
1295
1302
  * This is intentionally transport-agnostic and minimal so other layers (e.g. canvas/comments)
1296
1303
  * can reuse it without redefining identity types.
1297
1304
  */
1298
- interface BackendScope {
1299
- readonly workspaceId: string;
1300
- readonly actorId: string;
1301
- readonly branchId: string;
1305
+ interface BackendScope extends WorkspaceActorBranchLoadContext {
1302
1306
  }
1303
1307
  /**
1304
1308
  * Generic canvas comments backend contract.
@@ -1349,7 +1353,7 @@ interface CommentsBackend<ThreadDTO = unknown, MessageDTO = unknown, AnchorDTO =
1349
1353
  * - If branchId is provided -> branch-scoped policies
1350
1354
  * - If branchId is omitted -> workspace-scoped policies
1351
1355
  */
1352
- interface PolicyScope extends BackendScope {
1356
+ interface PolicyScope extends WorkspaceActorLoadContext {
1353
1357
  }
1354
1358
  interface PoliciesLoadResult {
1355
1359
  /** the raw JSON the host stored (authoring format) */
@@ -1042,12 +1042,6 @@ type BackendResult<T> = {
1042
1042
  error: BackendError;
1043
1043
  };
1044
1044
  type Result<T> = Promise<BackendResult<T>>;
1045
- interface Actor {
1046
- readonly id: string;
1047
- readonly name?: string;
1048
- readonly roles?: readonly string[];
1049
- readonly meta?: Readonly<Record<string, unknown>>;
1050
- }
1051
1045
  interface Author {
1052
1046
  readonly id: string;
1053
1047
  readonly name: string;
@@ -1072,12 +1066,26 @@ interface MergeResult {
1072
1066
  readonly conflicts?: number;
1073
1067
  readonly message?: string;
1074
1068
  }
1069
+ type WorkspaceLoadContext = Readonly<{
1070
+ workspaceId: string;
1071
+ actorId?: string;
1072
+ branchId?: string;
1073
+ since?: string | number;
1074
+ }>;
1075
+ type WorkspaceActorLoadContext = WorkspaceLoadContext & Readonly<{
1076
+ actorId: string;
1077
+ }>;
1078
+ type WorkspaceBranchLoadContext = WorkspaceLoadContext & Readonly<{
1079
+ branchId: string;
1080
+ }>;
1081
+ type WorkspaceActorBranchLoadContext = WorkspaceLoadContext & Readonly<{
1082
+ actorId: string;
1083
+ branchId: string;
1084
+ }>;
1075
1085
  type ServicesInput = readonly DgpServiceCapability[] | DgpServiceMap;
1076
1086
  interface ServicesBackend {
1077
- get(workspaceId: string): Result<ServicesInput>;
1078
- refresh(workspaceId: string, params?: Readonly<{
1079
- since?: number | string;
1080
- }>): Result<ServicesInput>;
1087
+ get(ctx: WorkspaceLoadContext): Result<ServicesInput>;
1088
+ refresh(ctx: WorkspaceLoadContext): Result<ServicesInput>;
1081
1089
  }
1082
1090
  interface BranchParticipant {
1083
1091
  readonly id: string;
@@ -1094,10 +1102,8 @@ interface BranchParticipant {
1094
1102
  readonly updatedAt?: string;
1095
1103
  }
1096
1104
  interface BranchAccessBackend {
1097
- listParticipants(workspaceId: string, branchId: string): Result<readonly BranchParticipant[]>;
1098
- refreshParticipants(workspaceId: string, branchId: string, params?: Readonly<{
1099
- since?: number | string;
1100
- }>): Result<readonly BranchParticipant[]>;
1105
+ listParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
1106
+ refreshParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
1101
1107
  }
1102
1108
  interface ServiceSnapshot {
1103
1109
  readonly schema_version: string;
@@ -1211,12 +1217,13 @@ interface FieldTemplate {
1211
1217
  }
1212
1218
  /** Narrow list/search input */
1213
1219
  interface TemplatesListParams {
1214
- readonly workspaceId: string;
1215
- readonly branchId?: string;
1220
+ readonly workspaceId: WorkspaceLoadContext["workspaceId"];
1221
+ readonly actorId?: WorkspaceLoadContext["actorId"];
1222
+ readonly branchId?: WorkspaceLoadContext["branchId"];
1216
1223
  readonly q?: string;
1217
1224
  readonly tags?: readonly string[];
1218
1225
  readonly category?: string;
1219
- readonly since?: string | number;
1226
+ readonly since?: WorkspaceLoadContext["since"];
1220
1227
  }
1221
1228
  interface TemplateCreateInput {
1222
1229
  readonly key?: string;
@@ -1264,23 +1271,23 @@ interface TemplatesBackend {
1264
1271
  refresh(params: Omit<TemplatesListParams, "q" | "tags" | "category">): Result<readonly FieldTemplate[]>;
1265
1272
  }
1266
1273
  interface AuthorsBackend {
1267
- list(workspaceId: string): Result<readonly Author[]>;
1274
+ list(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
1268
1275
  get(authorId: string): Result<Author | null>;
1269
- refresh(workspaceId: string): Result<readonly Author[]>;
1276
+ refresh(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
1270
1277
  }
1271
1278
  interface PermissionsBackend {
1272
- get(workspaceId: string, actor: Actor): Result<PermissionsMap>;
1273
- refresh(workspaceId: string, actor: Actor): Result<PermissionsMap>;
1279
+ get(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
1280
+ refresh(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
1274
1281
  }
1275
1282
  interface BranchesBackend {
1276
- list(workspaceId: string): Result<readonly Branch[]>;
1283
+ list(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
1277
1284
  create(workspaceId: string, name: string, opts?: Readonly<{
1278
1285
  fromId?: string;
1279
1286
  }>): Result<Branch>;
1280
1287
  setMain(workspaceId: string, branchId: string): Result<Branch>;
1281
1288
  merge(workspaceId: string, sourceId: string, targetId: string): Result<MergeResult>;
1282
1289
  delete(workspaceId: string, branchId: string): Result<void>;
1283
- refresh(workspaceId: string): Result<readonly Branch[]>;
1290
+ refresh(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
1284
1291
  }
1285
1292
  interface WorkspaceInfo {
1286
1293
  readonly id: string;
@@ -1295,10 +1302,7 @@ interface WorkspaceInfo {
1295
1302
  * This is intentionally transport-agnostic and minimal so other layers (e.g. canvas/comments)
1296
1303
  * can reuse it without redefining identity types.
1297
1304
  */
1298
- interface BackendScope {
1299
- readonly workspaceId: string;
1300
- readonly actorId: string;
1301
- readonly branchId: string;
1305
+ interface BackendScope extends WorkspaceActorBranchLoadContext {
1302
1306
  }
1303
1307
  /**
1304
1308
  * Generic canvas comments backend contract.
@@ -1349,7 +1353,7 @@ interface CommentsBackend<ThreadDTO = unknown, MessageDTO = unknown, AnchorDTO =
1349
1353
  * - If branchId is provided -> branch-scoped policies
1350
1354
  * - If branchId is omitted -> workspace-scoped policies
1351
1355
  */
1352
- interface PolicyScope extends BackendScope {
1356
+ interface PolicyScope extends WorkspaceActorLoadContext {
1353
1357
  }
1354
1358
  interface PoliciesLoadResult {
1355
1359
  /** the raw JSON the host stored (authoring format) */