@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.
- package/dist/core/index.cjs +471 -434
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -8
- package/dist/core/index.d.ts +1 -8
- package/dist/core/index.js +471 -434
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +471 -434
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +32 -28
- package/dist/react/index.d.ts +32 -28
- package/dist/react/index.js +471 -434
- package/dist/react/index.js.map +1 -1
- package/dist/workspace/index.cjs +83 -63
- package/dist/workspace/index.cjs.map +1 -1
- package/dist/workspace/index.d.cts +33 -23
- package/dist/workspace/index.d.ts +33 -23
- package/dist/workspace/index.js +83 -63
- package/dist/workspace/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -857,12 +857,26 @@ interface MergeResult {
|
|
|
857
857
|
readonly conflicts?: number;
|
|
858
858
|
readonly message?: string;
|
|
859
859
|
}
|
|
860
|
+
type WorkspaceLoadContext = Readonly<{
|
|
861
|
+
workspaceId: string;
|
|
862
|
+
actorId?: string;
|
|
863
|
+
branchId?: string;
|
|
864
|
+
since?: string | number;
|
|
865
|
+
}>;
|
|
866
|
+
type WorkspaceActorLoadContext = WorkspaceLoadContext & Readonly<{
|
|
867
|
+
actorId: string;
|
|
868
|
+
}>;
|
|
869
|
+
type WorkspaceBranchLoadContext = WorkspaceLoadContext & Readonly<{
|
|
870
|
+
branchId: string;
|
|
871
|
+
}>;
|
|
872
|
+
type WorkspaceActorBranchLoadContext = WorkspaceLoadContext & Readonly<{
|
|
873
|
+
actorId: string;
|
|
874
|
+
branchId: string;
|
|
875
|
+
}>;
|
|
860
876
|
type ServicesInput = readonly DgpServiceCapability[] | DgpServiceMap;
|
|
861
877
|
interface ServicesBackend {
|
|
862
|
-
get(
|
|
863
|
-
refresh(
|
|
864
|
-
since?: number | string;
|
|
865
|
-
}>): Result<ServicesInput>;
|
|
878
|
+
get(ctx: WorkspaceLoadContext): Result<ServicesInput>;
|
|
879
|
+
refresh(ctx: WorkspaceLoadContext): Result<ServicesInput>;
|
|
866
880
|
}
|
|
867
881
|
interface BranchParticipant {
|
|
868
882
|
readonly id: string;
|
|
@@ -879,10 +893,8 @@ interface BranchParticipant {
|
|
|
879
893
|
readonly updatedAt?: string;
|
|
880
894
|
}
|
|
881
895
|
interface BranchAccessBackend {
|
|
882
|
-
listParticipants(
|
|
883
|
-
refreshParticipants(
|
|
884
|
-
since?: number | string;
|
|
885
|
-
}>): Result<readonly BranchParticipant[]>;
|
|
896
|
+
listParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
|
|
897
|
+
refreshParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
|
|
886
898
|
}
|
|
887
899
|
interface ServiceSnapshot {
|
|
888
900
|
readonly schema_version: string;
|
|
@@ -996,12 +1008,13 @@ interface FieldTemplate {
|
|
|
996
1008
|
}
|
|
997
1009
|
/** Narrow list/search input */
|
|
998
1010
|
interface TemplatesListParams {
|
|
999
|
-
readonly workspaceId:
|
|
1000
|
-
readonly
|
|
1011
|
+
readonly workspaceId: WorkspaceLoadContext["workspaceId"];
|
|
1012
|
+
readonly actorId?: WorkspaceLoadContext["actorId"];
|
|
1013
|
+
readonly branchId?: WorkspaceLoadContext["branchId"];
|
|
1001
1014
|
readonly q?: string;
|
|
1002
1015
|
readonly tags?: readonly string[];
|
|
1003
1016
|
readonly category?: string;
|
|
1004
|
-
readonly since?:
|
|
1017
|
+
readonly since?: WorkspaceLoadContext["since"];
|
|
1005
1018
|
}
|
|
1006
1019
|
interface TemplateCreateInput {
|
|
1007
1020
|
readonly key?: string;
|
|
@@ -1121,23 +1134,23 @@ type LiveOptions = {
|
|
|
1121
1134
|
protocols?: readonly string[];
|
|
1122
1135
|
};
|
|
1123
1136
|
interface AuthorsBackend {
|
|
1124
|
-
list(
|
|
1137
|
+
list(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
|
|
1125
1138
|
get(authorId: string): Result<Author | null>;
|
|
1126
|
-
refresh(
|
|
1139
|
+
refresh(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
|
|
1127
1140
|
}
|
|
1128
1141
|
interface PermissionsBackend {
|
|
1129
|
-
get(
|
|
1130
|
-
refresh(
|
|
1142
|
+
get(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
|
|
1143
|
+
refresh(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
|
|
1131
1144
|
}
|
|
1132
1145
|
interface BranchesBackend {
|
|
1133
|
-
list(
|
|
1146
|
+
list(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
|
|
1134
1147
|
create(workspaceId: string, name: string, opts?: Readonly<{
|
|
1135
1148
|
fromId?: string;
|
|
1136
1149
|
}>): Result<Branch>;
|
|
1137
1150
|
setMain(workspaceId: string, branchId: string): Result<Branch>;
|
|
1138
1151
|
merge(workspaceId: string, sourceId: string, targetId: string): Result<MergeResult>;
|
|
1139
1152
|
delete(workspaceId: string, branchId: string): Result<void>;
|
|
1140
|
-
refresh(
|
|
1153
|
+
refresh(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
|
|
1141
1154
|
}
|
|
1142
1155
|
interface WorkspaceInfo {
|
|
1143
1156
|
readonly id: string;
|
|
@@ -1152,10 +1165,7 @@ interface WorkspaceInfo {
|
|
|
1152
1165
|
* This is intentionally transport-agnostic and minimal so other layers (e.g. canvas/comments)
|
|
1153
1166
|
* can reuse it without redefining identity types.
|
|
1154
1167
|
*/
|
|
1155
|
-
interface BackendScope {
|
|
1156
|
-
readonly workspaceId: string;
|
|
1157
|
-
readonly actorId: string;
|
|
1158
|
-
readonly branchId: string;
|
|
1168
|
+
interface BackendScope extends WorkspaceActorBranchLoadContext {
|
|
1159
1169
|
}
|
|
1160
1170
|
/**
|
|
1161
1171
|
* Generic canvas comments backend contract.
|
|
@@ -1206,7 +1216,7 @@ interface CommentsBackend<ThreadDTO = unknown, MessageDTO = unknown, AnchorDTO =
|
|
|
1206
1216
|
* - If branchId is provided -> branch-scoped policies
|
|
1207
1217
|
* - If branchId is omitted -> workspace-scoped policies
|
|
1208
1218
|
*/
|
|
1209
|
-
interface PolicyScope extends
|
|
1219
|
+
interface PolicyScope extends WorkspaceActorLoadContext {
|
|
1210
1220
|
}
|
|
1211
1221
|
interface PoliciesLoadResult {
|
|
1212
1222
|
/** the raw JSON the host stored (authoring format) */
|
|
@@ -2317,4 +2327,4 @@ interface WorkspaceProps {
|
|
|
2317
2327
|
*/
|
|
2318
2328
|
declare function Workspace(props: WorkspaceProps): React.JSX.Element;
|
|
2319
2329
|
|
|
2320
|
-
export { type Actor, type AdapterOptions, type Author, type AuthorsBackend, type BackendError, type BackendResult, type BackendScope, type Branch, type BranchAccessBackend, type BranchParticipant, type BranchesBackend, type BranchesSlice, Canvas, CanvasProvider, type CanvasSelection, type ClearTarget, type CommentsBackend, type Commit, type CreateMemoryWorkspaceBackendOptions, type Draft, type ErrorKind, type ErrorLog, type FieldTemplate, type FlowCanvasProps, type LabelPlacement, type LiveOptions, type Loadable, type MemoryBackendSeed, type MemorySeedBranchSnapshots, type MemorySeedComments, type MemorySeedParticipants, type MergeResult, type MergedErrors, type PermissionsBackend, type PermissionsMap, type PoliciesBackend, type PoliciesLoadResult, type PolicyScope, type Result, type SelectionCapabilities, type ServiceSnapshot, type ServicesBackend, type ServicesInput, type SnapshotSlice, type SnapshotsBackend, type SnapshotsLoadResult, type TemplateCreateInput, type TemplateUpdatePatch, type TemplateValidator, type TemplatesBackend, type TemplatesListParams, type ToolsConfig, type TreeNode, type UseCanvasReturn, type UseErrorsOptions, type UseErrorsReturn, type ValidationRow, Workspace, type WorkspaceAPI, type WorkspaceBackend, type WorkspaceBootSection, type WorkspaceBootSectionState, type WorkspaceBootSectionStatus, type WorkspaceBootState, WorkspaceContext, type WorkspaceEvent, type WorkspaceInfo, type WorkspaceLiveAdapter, type WorkspaceLiveAdapterContext, type WorkspaceLiveAdapterHandlers, type WorkspaceLiveAdapterRegistry, type WorkspaceLiveStatus, type WorkspaceLiveTick, type WorkspaceProps, WorkspaceProvider, type WorkspaceProviderProps, createMemoryWorkspaceBackend, createPollAdapter, deriveSelectionCapabilities, useCanvas, useCanvasAPI, useCanvasFromBuilder, useCanvasFromExisting, useCanvasOwned, useErrors, useWorkspace, useWorkspaceBoot, useWorkspaceMaybe };
|
|
2330
|
+
export { type Actor, type AdapterOptions, type Author, type AuthorsBackend, type BackendError, type BackendResult, type BackendScope, type Branch, type BranchAccessBackend, type BranchParticipant, type BranchesBackend, type BranchesSlice, Canvas, CanvasProvider, type CanvasSelection, type ClearTarget, type CommentsBackend, type Commit, type CreateMemoryWorkspaceBackendOptions, type Draft, type ErrorKind, type ErrorLog, type FieldTemplate, type FlowCanvasProps, type LabelPlacement, type LiveOptions, type Loadable, type MemoryBackendSeed, type MemorySeedBranchSnapshots, type MemorySeedComments, type MemorySeedParticipants, type MergeResult, type MergedErrors, type PermissionsBackend, type PermissionsMap, type PoliciesBackend, type PoliciesLoadResult, type PolicyScope, type Result, type SelectionCapabilities, type ServiceSnapshot, type ServicesBackend, type ServicesInput, type SnapshotSlice, type SnapshotsBackend, type SnapshotsLoadResult, type TemplateCreateInput, type TemplateUpdatePatch, type TemplateValidator, type TemplatesBackend, type TemplatesListParams, type ToolsConfig, type TreeNode, type UseCanvasReturn, type UseErrorsOptions, type UseErrorsReturn, type ValidationRow, Workspace, type WorkspaceAPI, type WorkspaceActorBranchLoadContext, type WorkspaceActorLoadContext, type WorkspaceBackend, type WorkspaceBootSection, type WorkspaceBootSectionState, type WorkspaceBootSectionStatus, type WorkspaceBootState, type WorkspaceBranchLoadContext, WorkspaceContext, type WorkspaceEvent, type WorkspaceInfo, type WorkspaceLiveAdapter, type WorkspaceLiveAdapterContext, type WorkspaceLiveAdapterHandlers, type WorkspaceLiveAdapterRegistry, type WorkspaceLiveStatus, type WorkspaceLiveTick, type WorkspaceLoadContext, type WorkspaceProps, WorkspaceProvider, type WorkspaceProviderProps, createMemoryWorkspaceBackend, createPollAdapter, deriveSelectionCapabilities, useCanvas, useCanvasAPI, useCanvasFromBuilder, useCanvasFromExisting, useCanvasOwned, useErrors, useWorkspace, useWorkspaceBoot, useWorkspaceMaybe };
|
|
@@ -857,12 +857,26 @@ interface MergeResult {
|
|
|
857
857
|
readonly conflicts?: number;
|
|
858
858
|
readonly message?: string;
|
|
859
859
|
}
|
|
860
|
+
type WorkspaceLoadContext = Readonly<{
|
|
861
|
+
workspaceId: string;
|
|
862
|
+
actorId?: string;
|
|
863
|
+
branchId?: string;
|
|
864
|
+
since?: string | number;
|
|
865
|
+
}>;
|
|
866
|
+
type WorkspaceActorLoadContext = WorkspaceLoadContext & Readonly<{
|
|
867
|
+
actorId: string;
|
|
868
|
+
}>;
|
|
869
|
+
type WorkspaceBranchLoadContext = WorkspaceLoadContext & Readonly<{
|
|
870
|
+
branchId: string;
|
|
871
|
+
}>;
|
|
872
|
+
type WorkspaceActorBranchLoadContext = WorkspaceLoadContext & Readonly<{
|
|
873
|
+
actorId: string;
|
|
874
|
+
branchId: string;
|
|
875
|
+
}>;
|
|
860
876
|
type ServicesInput = readonly DgpServiceCapability[] | DgpServiceMap;
|
|
861
877
|
interface ServicesBackend {
|
|
862
|
-
get(
|
|
863
|
-
refresh(
|
|
864
|
-
since?: number | string;
|
|
865
|
-
}>): Result<ServicesInput>;
|
|
878
|
+
get(ctx: WorkspaceLoadContext): Result<ServicesInput>;
|
|
879
|
+
refresh(ctx: WorkspaceLoadContext): Result<ServicesInput>;
|
|
866
880
|
}
|
|
867
881
|
interface BranchParticipant {
|
|
868
882
|
readonly id: string;
|
|
@@ -879,10 +893,8 @@ interface BranchParticipant {
|
|
|
879
893
|
readonly updatedAt?: string;
|
|
880
894
|
}
|
|
881
895
|
interface BranchAccessBackend {
|
|
882
|
-
listParticipants(
|
|
883
|
-
refreshParticipants(
|
|
884
|
-
since?: number | string;
|
|
885
|
-
}>): Result<readonly BranchParticipant[]>;
|
|
896
|
+
listParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
|
|
897
|
+
refreshParticipants(ctx: WorkspaceBranchLoadContext): Result<readonly BranchParticipant[]>;
|
|
886
898
|
}
|
|
887
899
|
interface ServiceSnapshot {
|
|
888
900
|
readonly schema_version: string;
|
|
@@ -996,12 +1008,13 @@ interface FieldTemplate {
|
|
|
996
1008
|
}
|
|
997
1009
|
/** Narrow list/search input */
|
|
998
1010
|
interface TemplatesListParams {
|
|
999
|
-
readonly workspaceId:
|
|
1000
|
-
readonly
|
|
1011
|
+
readonly workspaceId: WorkspaceLoadContext["workspaceId"];
|
|
1012
|
+
readonly actorId?: WorkspaceLoadContext["actorId"];
|
|
1013
|
+
readonly branchId?: WorkspaceLoadContext["branchId"];
|
|
1001
1014
|
readonly q?: string;
|
|
1002
1015
|
readonly tags?: readonly string[];
|
|
1003
1016
|
readonly category?: string;
|
|
1004
|
-
readonly since?:
|
|
1017
|
+
readonly since?: WorkspaceLoadContext["since"];
|
|
1005
1018
|
}
|
|
1006
1019
|
interface TemplateCreateInput {
|
|
1007
1020
|
readonly key?: string;
|
|
@@ -1121,23 +1134,23 @@ type LiveOptions = {
|
|
|
1121
1134
|
protocols?: readonly string[];
|
|
1122
1135
|
};
|
|
1123
1136
|
interface AuthorsBackend {
|
|
1124
|
-
list(
|
|
1137
|
+
list(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
|
|
1125
1138
|
get(authorId: string): Result<Author | null>;
|
|
1126
|
-
refresh(
|
|
1139
|
+
refresh(ctx: WorkspaceLoadContext): Result<readonly Author[]>;
|
|
1127
1140
|
}
|
|
1128
1141
|
interface PermissionsBackend {
|
|
1129
|
-
get(
|
|
1130
|
-
refresh(
|
|
1142
|
+
get(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
|
|
1143
|
+
refresh(ctx: WorkspaceActorLoadContext): Result<PermissionsMap>;
|
|
1131
1144
|
}
|
|
1132
1145
|
interface BranchesBackend {
|
|
1133
|
-
list(
|
|
1146
|
+
list(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
|
|
1134
1147
|
create(workspaceId: string, name: string, opts?: Readonly<{
|
|
1135
1148
|
fromId?: string;
|
|
1136
1149
|
}>): Result<Branch>;
|
|
1137
1150
|
setMain(workspaceId: string, branchId: string): Result<Branch>;
|
|
1138
1151
|
merge(workspaceId: string, sourceId: string, targetId: string): Result<MergeResult>;
|
|
1139
1152
|
delete(workspaceId: string, branchId: string): Result<void>;
|
|
1140
|
-
refresh(
|
|
1153
|
+
refresh(ctx: WorkspaceLoadContext): Result<readonly Branch[]>;
|
|
1141
1154
|
}
|
|
1142
1155
|
interface WorkspaceInfo {
|
|
1143
1156
|
readonly id: string;
|
|
@@ -1152,10 +1165,7 @@ interface WorkspaceInfo {
|
|
|
1152
1165
|
* This is intentionally transport-agnostic and minimal so other layers (e.g. canvas/comments)
|
|
1153
1166
|
* can reuse it without redefining identity types.
|
|
1154
1167
|
*/
|
|
1155
|
-
interface BackendScope {
|
|
1156
|
-
readonly workspaceId: string;
|
|
1157
|
-
readonly actorId: string;
|
|
1158
|
-
readonly branchId: string;
|
|
1168
|
+
interface BackendScope extends WorkspaceActorBranchLoadContext {
|
|
1159
1169
|
}
|
|
1160
1170
|
/**
|
|
1161
1171
|
* Generic canvas comments backend contract.
|
|
@@ -1206,7 +1216,7 @@ interface CommentsBackend<ThreadDTO = unknown, MessageDTO = unknown, AnchorDTO =
|
|
|
1206
1216
|
* - If branchId is provided -> branch-scoped policies
|
|
1207
1217
|
* - If branchId is omitted -> workspace-scoped policies
|
|
1208
1218
|
*/
|
|
1209
|
-
interface PolicyScope extends
|
|
1219
|
+
interface PolicyScope extends WorkspaceActorLoadContext {
|
|
1210
1220
|
}
|
|
1211
1221
|
interface PoliciesLoadResult {
|
|
1212
1222
|
/** the raw JSON the host stored (authoring format) */
|
|
@@ -2317,4 +2327,4 @@ interface WorkspaceProps {
|
|
|
2317
2327
|
*/
|
|
2318
2328
|
declare function Workspace(props: WorkspaceProps): React.JSX.Element;
|
|
2319
2329
|
|
|
2320
|
-
export { type Actor, type AdapterOptions, type Author, type AuthorsBackend, type BackendError, type BackendResult, type BackendScope, type Branch, type BranchAccessBackend, type BranchParticipant, type BranchesBackend, type BranchesSlice, Canvas, CanvasProvider, type CanvasSelection, type ClearTarget, type CommentsBackend, type Commit, type CreateMemoryWorkspaceBackendOptions, type Draft, type ErrorKind, type ErrorLog, type FieldTemplate, type FlowCanvasProps, type LabelPlacement, type LiveOptions, type Loadable, type MemoryBackendSeed, type MemorySeedBranchSnapshots, type MemorySeedComments, type MemorySeedParticipants, type MergeResult, type MergedErrors, type PermissionsBackend, type PermissionsMap, type PoliciesBackend, type PoliciesLoadResult, type PolicyScope, type Result, type SelectionCapabilities, type ServiceSnapshot, type ServicesBackend, type ServicesInput, type SnapshotSlice, type SnapshotsBackend, type SnapshotsLoadResult, type TemplateCreateInput, type TemplateUpdatePatch, type TemplateValidator, type TemplatesBackend, type TemplatesListParams, type ToolsConfig, type TreeNode, type UseCanvasReturn, type UseErrorsOptions, type UseErrorsReturn, type ValidationRow, Workspace, type WorkspaceAPI, type WorkspaceBackend, type WorkspaceBootSection, type WorkspaceBootSectionState, type WorkspaceBootSectionStatus, type WorkspaceBootState, WorkspaceContext, type WorkspaceEvent, type WorkspaceInfo, type WorkspaceLiveAdapter, type WorkspaceLiveAdapterContext, type WorkspaceLiveAdapterHandlers, type WorkspaceLiveAdapterRegistry, type WorkspaceLiveStatus, type WorkspaceLiveTick, type WorkspaceProps, WorkspaceProvider, type WorkspaceProviderProps, createMemoryWorkspaceBackend, createPollAdapter, deriveSelectionCapabilities, useCanvas, useCanvasAPI, useCanvasFromBuilder, useCanvasFromExisting, useCanvasOwned, useErrors, useWorkspace, useWorkspaceBoot, useWorkspaceMaybe };
|
|
2330
|
+
export { type Actor, type AdapterOptions, type Author, type AuthorsBackend, type BackendError, type BackendResult, type BackendScope, type Branch, type BranchAccessBackend, type BranchParticipant, type BranchesBackend, type BranchesSlice, Canvas, CanvasProvider, type CanvasSelection, type ClearTarget, type CommentsBackend, type Commit, type CreateMemoryWorkspaceBackendOptions, type Draft, type ErrorKind, type ErrorLog, type FieldTemplate, type FlowCanvasProps, type LabelPlacement, type LiveOptions, type Loadable, type MemoryBackendSeed, type MemorySeedBranchSnapshots, type MemorySeedComments, type MemorySeedParticipants, type MergeResult, type MergedErrors, type PermissionsBackend, type PermissionsMap, type PoliciesBackend, type PoliciesLoadResult, type PolicyScope, type Result, type SelectionCapabilities, type ServiceSnapshot, type ServicesBackend, type ServicesInput, type SnapshotSlice, type SnapshotsBackend, type SnapshotsLoadResult, type TemplateCreateInput, type TemplateUpdatePatch, type TemplateValidator, type TemplatesBackend, type TemplatesListParams, type ToolsConfig, type TreeNode, type UseCanvasReturn, type UseErrorsOptions, type UseErrorsReturn, type ValidationRow, Workspace, type WorkspaceAPI, type WorkspaceActorBranchLoadContext, type WorkspaceActorLoadContext, type WorkspaceBackend, type WorkspaceBootSection, type WorkspaceBootSectionState, type WorkspaceBootSectionStatus, type WorkspaceBootState, type WorkspaceBranchLoadContext, WorkspaceContext, type WorkspaceEvent, type WorkspaceInfo, type WorkspaceLiveAdapter, type WorkspaceLiveAdapterContext, type WorkspaceLiveAdapterHandlers, type WorkspaceLiveAdapterRegistry, type WorkspaceLiveStatus, type WorkspaceLiveTick, type WorkspaceLoadContext, type WorkspaceProps, WorkspaceProvider, type WorkspaceProviderProps, createMemoryWorkspaceBackend, createPollAdapter, deriveSelectionCapabilities, useCanvas, useCanvasAPI, useCanvasFromBuilder, useCanvasFromExisting, useCanvasOwned, useErrors, useWorkspace, useWorkspaceBoot, useWorkspaceMaybe };
|
package/dist/workspace/index.js
CHANGED
|
@@ -100,7 +100,7 @@ function useAuthorsSlice(params) {
|
|
|
100
100
|
});
|
|
101
101
|
const refreshAuthors = React3.useCallback(async () => {
|
|
102
102
|
setAuthors((s) => ({ ...s, loading: true }));
|
|
103
|
-
const res = await backend.authors.refresh(workspaceId);
|
|
103
|
+
const res = await backend.authors.refresh({ workspaceId });
|
|
104
104
|
if (res.ok) {
|
|
105
105
|
setAuthors({
|
|
106
106
|
data: res.value,
|
|
@@ -134,21 +134,29 @@ function usePermissionsSlice(params) {
|
|
|
134
134
|
loading: false,
|
|
135
135
|
updatedAt: initialPermissions ? runtime.now() : void 0
|
|
136
136
|
});
|
|
137
|
-
const refreshPermissions = React4.useCallback(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
const refreshPermissions = React4.useCallback(
|
|
138
|
+
async (params2) => {
|
|
139
|
+
setPermissions((s) => ({ ...s, loading: true }));
|
|
140
|
+
const res = await backend.permissions.refresh({
|
|
141
|
+
workspaceId,
|
|
142
|
+
actorId: actor.id,
|
|
143
|
+
branchId: params2 == null ? void 0 : params2.branchId,
|
|
144
|
+
since: params2 == null ? void 0 : params2.since
|
|
145
145
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
if (res.ok) {
|
|
147
|
+
setPermissions({
|
|
148
|
+
data: res.value,
|
|
149
|
+
loading: false,
|
|
150
|
+
updatedAt: runtime.now()
|
|
151
|
+
});
|
|
152
|
+
return res;
|
|
153
|
+
} else {
|
|
154
|
+
setLoadableError2(setPermissions, res.error);
|
|
155
|
+
return res;
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
[backend.permissions, workspaceId, actor.id, runtime]
|
|
159
|
+
);
|
|
152
160
|
const invalidatePermissions = React4.useCallback(() => {
|
|
153
161
|
setPermissions((s) => ({ ...s, updatedAt: void 0 }));
|
|
154
162
|
}, []);
|
|
@@ -217,7 +225,7 @@ function useBranchesSlice(params) {
|
|
|
217
225
|
const refreshBranches = React5.useCallback(async () => {
|
|
218
226
|
var _a;
|
|
219
227
|
setBranches((s) => ({ ...s, loading: true }));
|
|
220
|
-
const res = await backend.branches.refresh(workspaceId);
|
|
228
|
+
const res = await backend.branches.refresh({ workspaceId });
|
|
221
229
|
if (!res.ok) {
|
|
222
230
|
setBranches((s) => ({ ...s, loading: false, error: res.error }));
|
|
223
231
|
return res;
|
|
@@ -252,11 +260,11 @@ function useBranchesSlice(params) {
|
|
|
252
260
|
};
|
|
253
261
|
}
|
|
254
262
|
setParticipants((s) => ({ ...s, loading: true }));
|
|
255
|
-
const res = await backend.access.refreshParticipants(
|
|
263
|
+
const res = await backend.access.refreshParticipants({
|
|
256
264
|
workspaceId,
|
|
257
265
|
branchId,
|
|
258
|
-
|
|
259
|
-
);
|
|
266
|
+
since: (_b = params2 == null ? void 0 : params2.since) != null ? _b : participants.updatedAt
|
|
267
|
+
});
|
|
260
268
|
if (res.ok) {
|
|
261
269
|
setParticipants({
|
|
262
270
|
data: res.value,
|
|
@@ -571,23 +579,29 @@ function useServicesSlice(params) {
|
|
|
571
579
|
loading: false,
|
|
572
580
|
updatedAt: initialServices ? runtime.now() : void 0
|
|
573
581
|
});
|
|
574
|
-
const refreshServices = React7.useCallback(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
582
|
+
const refreshServices = React7.useCallback(
|
|
583
|
+
async (params2) => {
|
|
584
|
+
var _a;
|
|
585
|
+
setServices((s) => ({ ...s, loading: true }));
|
|
586
|
+
const res = await backend.services.refresh({
|
|
587
|
+
workspaceId,
|
|
588
|
+
branchId: params2 == null ? void 0 : params2.branchId,
|
|
589
|
+
since: (_a = params2 == null ? void 0 : params2.since) != null ? _a : services.updatedAt
|
|
590
|
+
});
|
|
591
|
+
if (!res.ok) {
|
|
592
|
+
setLoadableError5(setServices, res.error);
|
|
593
|
+
return res;
|
|
594
|
+
}
|
|
595
|
+
const map = toServiceMap(res.value);
|
|
596
|
+
setServices({
|
|
597
|
+
data: map != null ? map : {},
|
|
598
|
+
loading: false,
|
|
599
|
+
updatedAt: runtime.now()
|
|
600
|
+
});
|
|
601
|
+
return { ok: true, value: map != null ? map : {} };
|
|
602
|
+
},
|
|
603
|
+
[backend.services, workspaceId, services.updatedAt, runtime]
|
|
604
|
+
);
|
|
591
605
|
const invalidateServices = React7.useCallback(() => {
|
|
592
606
|
setServices((s) => ({ ...s, updatedAt: void 0 }));
|
|
593
607
|
}, []);
|
|
@@ -2040,6 +2054,7 @@ function useWorkspaceBoot2(params) {
|
|
|
2040
2054
|
setCurrentBranchId,
|
|
2041
2055
|
refreshAuthors,
|
|
2042
2056
|
refreshPermissions,
|
|
2057
|
+
refreshPermissionsWithBranch,
|
|
2043
2058
|
refreshBranches,
|
|
2044
2059
|
refreshServices,
|
|
2045
2060
|
refreshParticipants,
|
|
@@ -2178,8 +2193,11 @@ function useWorkspaceBoot2(params) {
|
|
|
2178
2193
|
const branchId = (_b = resolveActiveBranch(opts == null ? void 0 : opts.branchId)) != null ? _b : opts == null ? void 0 : opts.branchId;
|
|
2179
2194
|
if ((_c = opts == null ? void 0 : opts.includeWorkspaceData) != null ? _c : true) {
|
|
2180
2195
|
tasks.push(["authors", refreshAuthors]);
|
|
2181
|
-
tasks.push([
|
|
2182
|
-
|
|
2196
|
+
tasks.push([
|
|
2197
|
+
"permissions",
|
|
2198
|
+
() => refreshPermissionsWithBranch(branchId)
|
|
2199
|
+
]);
|
|
2200
|
+
tasks.push(["services", () => refreshServices(branchId)]);
|
|
2183
2201
|
}
|
|
2184
2202
|
if (!branchId) {
|
|
2185
2203
|
markBranchScopedNoBranch();
|
|
@@ -2310,6 +2328,7 @@ function useWorkspaceBoot2(params) {
|
|
|
2310
2328
|
refreshComments,
|
|
2311
2329
|
refreshParticipants,
|
|
2312
2330
|
refreshPermissions,
|
|
2331
|
+
refreshPermissionsWithBranch,
|
|
2313
2332
|
refreshPolicies,
|
|
2314
2333
|
refreshServices,
|
|
2315
2334
|
refreshSnapshotPointers,
|
|
@@ -2569,8 +2588,9 @@ function WorkspaceProvider(props) {
|
|
|
2569
2588
|
setCurrentBranchId: branchesSlice.setCurrentBranchId,
|
|
2570
2589
|
refreshAuthors: authorsSlice.refreshAuthors,
|
|
2571
2590
|
refreshPermissions: permissionsSlice.refreshPermissions,
|
|
2591
|
+
refreshPermissionsWithBranch: (branchId) => permissionsSlice.refreshPermissions({ branchId }),
|
|
2572
2592
|
refreshBranches: branchesSlice.refreshBranches,
|
|
2573
|
-
refreshServices: servicesSlice.refreshServices,
|
|
2593
|
+
refreshServices: (branchId) => servicesSlice.refreshServices({ branchId }),
|
|
2574
2594
|
refreshParticipants: (branchId) => branchesSlice.refreshParticipants({ branchId }),
|
|
2575
2595
|
refreshTemplates: (branchId) => templatesSlice.refreshTemplates({ branchId }),
|
|
2576
2596
|
refreshSnapshotPointers: (branchId) => snapshotsSlice.refreshSnapshotPointersForBranch(branchId),
|
|
@@ -12396,8 +12416,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12396
12416
|
};
|
|
12397
12417
|
void initStore();
|
|
12398
12418
|
const authorsBase = {
|
|
12399
|
-
list: async (
|
|
12400
|
-
if (workspaceId !== info.id)
|
|
12419
|
+
list: async (ctx) => {
|
|
12420
|
+
if (ctx.workspaceId !== info.id)
|
|
12401
12421
|
return fail("not_found", "Workspace not found.");
|
|
12402
12422
|
return ok(Array.from(store.authors.values()));
|
|
12403
12423
|
},
|
|
@@ -12405,8 +12425,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12405
12425
|
const a = store.authors.get(authorId);
|
|
12406
12426
|
return ok(a != null ? a : null);
|
|
12407
12427
|
},
|
|
12408
|
-
refresh: async (
|
|
12409
|
-
if (workspaceId !== info.id)
|
|
12428
|
+
refresh: async (ctx) => {
|
|
12429
|
+
if (ctx.workspaceId !== info.id)
|
|
12410
12430
|
return fail("not_found", "Workspace not found.");
|
|
12411
12431
|
return ok(Array.from(store.authors.values()));
|
|
12412
12432
|
}
|
|
@@ -12418,18 +12438,18 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12418
12438
|
[]
|
|
12419
12439
|
);
|
|
12420
12440
|
const permissionsBase = {
|
|
12421
|
-
get: async (
|
|
12441
|
+
get: async (ctx) => {
|
|
12422
12442
|
var _a, _b;
|
|
12423
|
-
if (workspaceId !== info.id)
|
|
12443
|
+
if (ctx.workspaceId !== info.id)
|
|
12424
12444
|
return fail("not_found", "Workspace not found.");
|
|
12425
|
-
const seeded = (_b = (_a = store.permissionsByActor.get(
|
|
12445
|
+
const seeded = (_b = (_a = store.permissionsByActor.get(ctx.actorId)) != null ? _a : store.permissionsByActor.get("*")) != null ? _b : void 0;
|
|
12426
12446
|
return ok(seeded != null ? seeded : permissivePermissions());
|
|
12427
12447
|
},
|
|
12428
|
-
refresh: async (
|
|
12448
|
+
refresh: async (ctx) => {
|
|
12429
12449
|
var _a, _b;
|
|
12430
|
-
if (workspaceId !== info.id)
|
|
12450
|
+
if (ctx.workspaceId !== info.id)
|
|
12431
12451
|
return fail("not_found", "Workspace not found.");
|
|
12432
|
-
const seeded = (_b = (_a = store.permissionsByActor.get(
|
|
12452
|
+
const seeded = (_b = (_a = store.permissionsByActor.get(ctx.actorId)) != null ? _a : store.permissionsByActor.get("*")) != null ? _b : void 0;
|
|
12433
12453
|
return ok(seeded != null ? seeded : permissivePermissions());
|
|
12434
12454
|
}
|
|
12435
12455
|
};
|
|
@@ -12440,8 +12460,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12440
12460
|
[]
|
|
12441
12461
|
);
|
|
12442
12462
|
const branchesBase = {
|
|
12443
|
-
list: async (
|
|
12444
|
-
if (workspaceId !== info.id)
|
|
12463
|
+
list: async (ctx) => {
|
|
12464
|
+
if (ctx.workspaceId !== info.id)
|
|
12445
12465
|
return fail("not_found", "Workspace not found.");
|
|
12446
12466
|
return ok(Array.from(store.branches.values()));
|
|
12447
12467
|
},
|
|
@@ -12547,8 +12567,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12547
12567
|
store.policiesByBranch.delete(branchId);
|
|
12548
12568
|
return ok(void 0);
|
|
12549
12569
|
},
|
|
12550
|
-
refresh: async (
|
|
12551
|
-
if (workspaceId !== info.id)
|
|
12570
|
+
refresh: async (ctx) => {
|
|
12571
|
+
if (ctx.workspaceId !== info.id)
|
|
12552
12572
|
return fail("not_found", "Workspace not found.");
|
|
12553
12573
|
return ok(Array.from(store.branches.values()));
|
|
12554
12574
|
}
|
|
@@ -12560,18 +12580,18 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12560
12580
|
["create", "setMain", "merge", "delete"]
|
|
12561
12581
|
);
|
|
12562
12582
|
const accessBase = {
|
|
12563
|
-
listParticipants: async (
|
|
12583
|
+
listParticipants: async (ctx) => {
|
|
12564
12584
|
var _a;
|
|
12565
|
-
if (workspaceId !== info.id)
|
|
12585
|
+
if (ctx.workspaceId !== info.id)
|
|
12566
12586
|
return fail("not_found", "Workspace not found.");
|
|
12567
|
-
const list = (_a = store.participantsByBranch.get(branchId)) != null ? _a : [];
|
|
12587
|
+
const list = (_a = store.participantsByBranch.get(ctx.branchId)) != null ? _a : [];
|
|
12568
12588
|
return ok(list);
|
|
12569
12589
|
},
|
|
12570
|
-
refreshParticipants: async (
|
|
12590
|
+
refreshParticipants: async (ctx) => {
|
|
12571
12591
|
var _a;
|
|
12572
|
-
if (workspaceId !== info.id)
|
|
12592
|
+
if (ctx.workspaceId !== info.id)
|
|
12573
12593
|
return fail("not_found", "Workspace not found.");
|
|
12574
|
-
const list = (_a = store.participantsByBranch.get(branchId)) != null ? _a : [];
|
|
12594
|
+
const list = (_a = store.participantsByBranch.get(ctx.branchId)) != null ? _a : [];
|
|
12575
12595
|
return ok(list);
|
|
12576
12596
|
}
|
|
12577
12597
|
};
|
|
@@ -12582,14 +12602,14 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12582
12602
|
[]
|
|
12583
12603
|
);
|
|
12584
12604
|
const servicesBase = {
|
|
12585
|
-
get: async (
|
|
12586
|
-
if (workspaceId !== info.id)
|
|
12605
|
+
get: async (ctx) => {
|
|
12606
|
+
if (ctx.workspaceId !== info.id)
|
|
12587
12607
|
return fail("not_found", "Workspace not found.");
|
|
12588
12608
|
if (!store.services) return ok([]);
|
|
12589
12609
|
return ok(store.services);
|
|
12590
12610
|
},
|
|
12591
|
-
refresh: async (
|
|
12592
|
-
if (workspaceId !== info.id)
|
|
12611
|
+
refresh: async (ctx) => {
|
|
12612
|
+
if (ctx.workspaceId !== info.id)
|
|
12593
12613
|
return fail("not_found", "Workspace not found.");
|
|
12594
12614
|
if (!store.services) return ok([]);
|
|
12595
12615
|
return ok(store.services);
|