@lmzhen/dsh-evolution-state-domain 0.3.21 → 0.3.22
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/lib/index.js +20 -12
- package/lib/types/index.d.ts +2 -0
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -44,7 +44,9 @@ const pendingSchema = z.object({
|
|
|
44
44
|
]),
|
|
45
45
|
resolvedAt: z.string().optional(),
|
|
46
46
|
claimedBy: z.string().optional(),
|
|
47
|
-
claimedAt: z.string().optional()
|
|
47
|
+
claimedAt: z.string().optional(),
|
|
48
|
+
origin: z.string().optional(),
|
|
49
|
+
sessionId: z.string().optional()
|
|
48
50
|
});
|
|
49
51
|
const EVOLUTION_DOMAIN = defineDomain({
|
|
50
52
|
name: "evolution",
|
|
@@ -148,17 +150,23 @@ function apply(ctx) {
|
|
|
148
150
|
}
|
|
149
151
|
},
|
|
150
152
|
async releasePendingClaim(id, claimId) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
const table = (await ensure()).table("pending");
|
|
154
|
+
try {
|
|
155
|
+
await table.update(id, (current) => {
|
|
156
|
+
if (current.status !== "pending" && current.status !== "executing") return current;
|
|
157
|
+
if (current.claimedBy !== claimId) return current;
|
|
158
|
+
const released = {
|
|
159
|
+
...current,
|
|
160
|
+
status: releasedStatus(current.status)
|
|
161
|
+
};
|
|
162
|
+
delete released.claimedBy;
|
|
163
|
+
delete released.claimedAt;
|
|
164
|
+
return released;
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (error instanceof DomainError && error.code === "missing-key") return;
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
162
170
|
},
|
|
163
171
|
async tryResolvePending(id, status) {
|
|
164
172
|
const table = (await ensure()).table("pending");
|
package/lib/types/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export declare const pendingSchema: z.ZodObject<{
|
|
|
34
34
|
resolvedAt: z.ZodOptional<z.ZodString>;
|
|
35
35
|
claimedBy: z.ZodOptional<z.ZodString>;
|
|
36
36
|
claimedAt: z.ZodOptional<z.ZodString>;
|
|
37
|
+
origin: z.ZodOptional<z.ZodString>;
|
|
38
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
37
39
|
}, z.core.$strip>;
|
|
38
40
|
export declare const EVOLUTION_DOMAIN: {
|
|
39
41
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-state-domain",
|
|
3
3
|
"description": "storage-domain provider for evolution state (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.22",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
37
37
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
38
38
|
"@deepseek-ai/dsh-storage-domain": "^0.1.1-rc.2",
|
|
39
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
39
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.22"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
43
43
|
"@deepseek-ai/dsh-storage-domain": "^0.1.1-rc.2",
|
|
44
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
44
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.22"
|
|
45
45
|
}
|
|
46
46
|
}
|