@timeax/digital-service-engine 0.3.2 → 0.3.4
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 +2 -2
package/dist/workspace/index.cjs
CHANGED
|
@@ -152,7 +152,7 @@ function useAuthorsSlice(params) {
|
|
|
152
152
|
});
|
|
153
153
|
const refreshAuthors = React3.useCallback(async () => {
|
|
154
154
|
setAuthors((s) => ({ ...s, loading: true }));
|
|
155
|
-
const res = await backend.authors.refresh(workspaceId);
|
|
155
|
+
const res = await backend.authors.refresh({ workspaceId });
|
|
156
156
|
if (res.ok) {
|
|
157
157
|
setAuthors({
|
|
158
158
|
data: res.value,
|
|
@@ -186,21 +186,29 @@ function usePermissionsSlice(params) {
|
|
|
186
186
|
loading: false,
|
|
187
187
|
updatedAt: initialPermissions ? runtime.now() : void 0
|
|
188
188
|
});
|
|
189
|
-
const refreshPermissions = React4.useCallback(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
189
|
+
const refreshPermissions = React4.useCallback(
|
|
190
|
+
async (params2) => {
|
|
191
|
+
setPermissions((s) => ({ ...s, loading: true }));
|
|
192
|
+
const res = await backend.permissions.refresh({
|
|
193
|
+
workspaceId,
|
|
194
|
+
actorId: actor.id,
|
|
195
|
+
branchId: params2 == null ? void 0 : params2.branchId,
|
|
196
|
+
since: params2 == null ? void 0 : params2.since
|
|
197
197
|
});
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
198
|
+
if (res.ok) {
|
|
199
|
+
setPermissions({
|
|
200
|
+
data: res.value,
|
|
201
|
+
loading: false,
|
|
202
|
+
updatedAt: runtime.now()
|
|
203
|
+
});
|
|
204
|
+
return res;
|
|
205
|
+
} else {
|
|
206
|
+
setLoadableError2(setPermissions, res.error);
|
|
207
|
+
return res;
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
[backend.permissions, workspaceId, actor.id, runtime]
|
|
211
|
+
);
|
|
204
212
|
const invalidatePermissions = React4.useCallback(() => {
|
|
205
213
|
setPermissions((s) => ({ ...s, updatedAt: void 0 }));
|
|
206
214
|
}, []);
|
|
@@ -269,7 +277,7 @@ function useBranchesSlice(params) {
|
|
|
269
277
|
const refreshBranches = React5.useCallback(async () => {
|
|
270
278
|
var _a;
|
|
271
279
|
setBranches((s) => ({ ...s, loading: true }));
|
|
272
|
-
const res = await backend.branches.refresh(workspaceId);
|
|
280
|
+
const res = await backend.branches.refresh({ workspaceId });
|
|
273
281
|
if (!res.ok) {
|
|
274
282
|
setBranches((s) => ({ ...s, loading: false, error: res.error }));
|
|
275
283
|
return res;
|
|
@@ -304,11 +312,11 @@ function useBranchesSlice(params) {
|
|
|
304
312
|
};
|
|
305
313
|
}
|
|
306
314
|
setParticipants((s) => ({ ...s, loading: true }));
|
|
307
|
-
const res = await backend.access.refreshParticipants(
|
|
315
|
+
const res = await backend.access.refreshParticipants({
|
|
308
316
|
workspaceId,
|
|
309
317
|
branchId,
|
|
310
|
-
|
|
311
|
-
);
|
|
318
|
+
since: (_b = params2 == null ? void 0 : params2.since) != null ? _b : participants.updatedAt
|
|
319
|
+
});
|
|
312
320
|
if (res.ok) {
|
|
313
321
|
setParticipants({
|
|
314
322
|
data: res.value,
|
|
@@ -623,23 +631,29 @@ function useServicesSlice(params) {
|
|
|
623
631
|
loading: false,
|
|
624
632
|
updatedAt: initialServices ? runtime.now() : void 0
|
|
625
633
|
});
|
|
626
|
-
const refreshServices = React7.useCallback(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
634
|
+
const refreshServices = React7.useCallback(
|
|
635
|
+
async (params2) => {
|
|
636
|
+
var _a;
|
|
637
|
+
setServices((s) => ({ ...s, loading: true }));
|
|
638
|
+
const res = await backend.services.refresh({
|
|
639
|
+
workspaceId,
|
|
640
|
+
branchId: params2 == null ? void 0 : params2.branchId,
|
|
641
|
+
since: (_a = params2 == null ? void 0 : params2.since) != null ? _a : services.updatedAt
|
|
642
|
+
});
|
|
643
|
+
if (!res.ok) {
|
|
644
|
+
setLoadableError5(setServices, res.error);
|
|
645
|
+
return res;
|
|
646
|
+
}
|
|
647
|
+
const map = toServiceMap(res.value);
|
|
648
|
+
setServices({
|
|
649
|
+
data: map != null ? map : {},
|
|
650
|
+
loading: false,
|
|
651
|
+
updatedAt: runtime.now()
|
|
652
|
+
});
|
|
653
|
+
return { ok: true, value: map != null ? map : {} };
|
|
654
|
+
},
|
|
655
|
+
[backend.services, workspaceId, services.updatedAt, runtime]
|
|
656
|
+
);
|
|
643
657
|
const invalidateServices = React7.useCallback(() => {
|
|
644
658
|
setServices((s) => ({ ...s, updatedAt: void 0 }));
|
|
645
659
|
}, []);
|
|
@@ -2092,6 +2106,7 @@ function useWorkspaceBoot2(params) {
|
|
|
2092
2106
|
setCurrentBranchId,
|
|
2093
2107
|
refreshAuthors,
|
|
2094
2108
|
refreshPermissions,
|
|
2109
|
+
refreshPermissionsWithBranch,
|
|
2095
2110
|
refreshBranches,
|
|
2096
2111
|
refreshServices,
|
|
2097
2112
|
refreshParticipants,
|
|
@@ -2230,8 +2245,11 @@ function useWorkspaceBoot2(params) {
|
|
|
2230
2245
|
const branchId = (_b = resolveActiveBranch(opts == null ? void 0 : opts.branchId)) != null ? _b : opts == null ? void 0 : opts.branchId;
|
|
2231
2246
|
if ((_c = opts == null ? void 0 : opts.includeWorkspaceData) != null ? _c : true) {
|
|
2232
2247
|
tasks.push(["authors", refreshAuthors]);
|
|
2233
|
-
tasks.push([
|
|
2234
|
-
|
|
2248
|
+
tasks.push([
|
|
2249
|
+
"permissions",
|
|
2250
|
+
() => refreshPermissionsWithBranch(branchId)
|
|
2251
|
+
]);
|
|
2252
|
+
tasks.push(["services", () => refreshServices(branchId)]);
|
|
2235
2253
|
}
|
|
2236
2254
|
if (!branchId) {
|
|
2237
2255
|
markBranchScopedNoBranch();
|
|
@@ -2362,6 +2380,7 @@ function useWorkspaceBoot2(params) {
|
|
|
2362
2380
|
refreshComments,
|
|
2363
2381
|
refreshParticipants,
|
|
2364
2382
|
refreshPermissions,
|
|
2383
|
+
refreshPermissionsWithBranch,
|
|
2365
2384
|
refreshPolicies,
|
|
2366
2385
|
refreshServices,
|
|
2367
2386
|
refreshSnapshotPointers,
|
|
@@ -2621,8 +2640,9 @@ function WorkspaceProvider(props) {
|
|
|
2621
2640
|
setCurrentBranchId: branchesSlice.setCurrentBranchId,
|
|
2622
2641
|
refreshAuthors: authorsSlice.refreshAuthors,
|
|
2623
2642
|
refreshPermissions: permissionsSlice.refreshPermissions,
|
|
2643
|
+
refreshPermissionsWithBranch: (branchId) => permissionsSlice.refreshPermissions({ branchId }),
|
|
2624
2644
|
refreshBranches: branchesSlice.refreshBranches,
|
|
2625
|
-
refreshServices: servicesSlice.refreshServices,
|
|
2645
|
+
refreshServices: (branchId) => servicesSlice.refreshServices({ branchId }),
|
|
2626
2646
|
refreshParticipants: (branchId) => branchesSlice.refreshParticipants({ branchId }),
|
|
2627
2647
|
refreshTemplates: (branchId) => templatesSlice.refreshTemplates({ branchId }),
|
|
2628
2648
|
refreshSnapshotPointers: (branchId) => snapshotsSlice.refreshSnapshotPointersForBranch(branchId),
|
|
@@ -12440,8 +12460,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12440
12460
|
};
|
|
12441
12461
|
void initStore();
|
|
12442
12462
|
const authorsBase = {
|
|
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.authors.values()));
|
|
12447
12467
|
},
|
|
@@ -12449,8 +12469,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12449
12469
|
const a = store.authors.get(authorId);
|
|
12450
12470
|
return ok(a != null ? a : null);
|
|
12451
12471
|
},
|
|
12452
|
-
refresh: async (
|
|
12453
|
-
if (workspaceId !== info.id)
|
|
12472
|
+
refresh: async (ctx) => {
|
|
12473
|
+
if (ctx.workspaceId !== info.id)
|
|
12454
12474
|
return fail("not_found", "Workspace not found.");
|
|
12455
12475
|
return ok(Array.from(store.authors.values()));
|
|
12456
12476
|
}
|
|
@@ -12462,18 +12482,18 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12462
12482
|
[]
|
|
12463
12483
|
);
|
|
12464
12484
|
const permissionsBase = {
|
|
12465
|
-
get: async (
|
|
12485
|
+
get: async (ctx) => {
|
|
12466
12486
|
var _a, _b;
|
|
12467
|
-
if (workspaceId !== info.id)
|
|
12487
|
+
if (ctx.workspaceId !== info.id)
|
|
12468
12488
|
return fail("not_found", "Workspace not found.");
|
|
12469
|
-
const seeded = (_b = (_a = store.permissionsByActor.get(
|
|
12489
|
+
const seeded = (_b = (_a = store.permissionsByActor.get(ctx.actorId)) != null ? _a : store.permissionsByActor.get("*")) != null ? _b : void 0;
|
|
12470
12490
|
return ok(seeded != null ? seeded : permissivePermissions());
|
|
12471
12491
|
},
|
|
12472
|
-
refresh: async (
|
|
12492
|
+
refresh: async (ctx) => {
|
|
12473
12493
|
var _a, _b;
|
|
12474
|
-
if (workspaceId !== info.id)
|
|
12494
|
+
if (ctx.workspaceId !== info.id)
|
|
12475
12495
|
return fail("not_found", "Workspace not found.");
|
|
12476
|
-
const seeded = (_b = (_a = store.permissionsByActor.get(
|
|
12496
|
+
const seeded = (_b = (_a = store.permissionsByActor.get(ctx.actorId)) != null ? _a : store.permissionsByActor.get("*")) != null ? _b : void 0;
|
|
12477
12497
|
return ok(seeded != null ? seeded : permissivePermissions());
|
|
12478
12498
|
}
|
|
12479
12499
|
};
|
|
@@ -12484,8 +12504,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12484
12504
|
[]
|
|
12485
12505
|
);
|
|
12486
12506
|
const branchesBase = {
|
|
12487
|
-
list: async (
|
|
12488
|
-
if (workspaceId !== info.id)
|
|
12507
|
+
list: async (ctx) => {
|
|
12508
|
+
if (ctx.workspaceId !== info.id)
|
|
12489
12509
|
return fail("not_found", "Workspace not found.");
|
|
12490
12510
|
return ok(Array.from(store.branches.values()));
|
|
12491
12511
|
},
|
|
@@ -12591,8 +12611,8 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12591
12611
|
store.policiesByBranch.delete(branchId);
|
|
12592
12612
|
return ok(void 0);
|
|
12593
12613
|
},
|
|
12594
|
-
refresh: async (
|
|
12595
|
-
if (workspaceId !== info.id)
|
|
12614
|
+
refresh: async (ctx) => {
|
|
12615
|
+
if (ctx.workspaceId !== info.id)
|
|
12596
12616
|
return fail("not_found", "Workspace not found.");
|
|
12597
12617
|
return ok(Array.from(store.branches.values()));
|
|
12598
12618
|
}
|
|
@@ -12604,18 +12624,18 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12604
12624
|
["create", "setMain", "merge", "delete"]
|
|
12605
12625
|
);
|
|
12606
12626
|
const accessBase = {
|
|
12607
|
-
listParticipants: async (
|
|
12627
|
+
listParticipants: async (ctx) => {
|
|
12608
12628
|
var _a;
|
|
12609
|
-
if (workspaceId !== info.id)
|
|
12629
|
+
if (ctx.workspaceId !== info.id)
|
|
12610
12630
|
return fail("not_found", "Workspace not found.");
|
|
12611
|
-
const list = (_a = store.participantsByBranch.get(branchId)) != null ? _a : [];
|
|
12631
|
+
const list = (_a = store.participantsByBranch.get(ctx.branchId)) != null ? _a : [];
|
|
12612
12632
|
return ok(list);
|
|
12613
12633
|
},
|
|
12614
|
-
refreshParticipants: async (
|
|
12634
|
+
refreshParticipants: async (ctx) => {
|
|
12615
12635
|
var _a;
|
|
12616
|
-
if (workspaceId !== info.id)
|
|
12636
|
+
if (ctx.workspaceId !== info.id)
|
|
12617
12637
|
return fail("not_found", "Workspace not found.");
|
|
12618
|
-
const list = (_a = store.participantsByBranch.get(branchId)) != null ? _a : [];
|
|
12638
|
+
const list = (_a = store.participantsByBranch.get(ctx.branchId)) != null ? _a : [];
|
|
12619
12639
|
return ok(list);
|
|
12620
12640
|
}
|
|
12621
12641
|
};
|
|
@@ -12626,14 +12646,14 @@ function createMemoryWorkspaceBackend(opts) {
|
|
|
12626
12646
|
[]
|
|
12627
12647
|
);
|
|
12628
12648
|
const servicesBase = {
|
|
12629
|
-
get: async (
|
|
12630
|
-
if (workspaceId !== info.id)
|
|
12649
|
+
get: async (ctx) => {
|
|
12650
|
+
if (ctx.workspaceId !== info.id)
|
|
12631
12651
|
return fail("not_found", "Workspace not found.");
|
|
12632
12652
|
if (!store.services) return ok([]);
|
|
12633
12653
|
return ok(store.services);
|
|
12634
12654
|
},
|
|
12635
|
-
refresh: async (
|
|
12636
|
-
if (workspaceId !== info.id)
|
|
12655
|
+
refresh: async (ctx) => {
|
|
12656
|
+
if (ctx.workspaceId !== info.id)
|
|
12637
12657
|
return fail("not_found", "Workspace not found.");
|
|
12638
12658
|
if (!store.services) return ok([]);
|
|
12639
12659
|
return ok(store.services);
|