@hydranium/cli 1.0.0-next.289 → 1.0.0-next.292
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/commands/create.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import {
|
|
9
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
10
10
|
import type { DataServerProtocol } from '@hydranium/protocol/data';
|
|
11
11
|
import { type LogOptions } from '../log-level.js';
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK1D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC9D,sFAAsF;IACtF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjE;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB5E"}
|
package/lib/commands/create.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { TransferDocument, textHash } from '@hydranium/protocol';
|
|
10
9
|
import { logEnv } from '../log-level.js';
|
|
11
10
|
import { withDataServer } from '../spawn-data-server.js';
|
|
12
11
|
import { withClientSession } from './client-session.js';
|
|
@@ -30,18 +29,15 @@ export async function runCreate(options) {
|
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
31
|
* Create `uri` with `text` as the session `clientId` and persist it, then end
|
|
33
|
-
* the session. The persist is gated on the version the create
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
32
|
+
* the session. The persist is gated on the version the create made, so a
|
|
33
|
+
* write that landed before the create's answer or after it, another client's
|
|
34
|
+
* or an integrity repair, fails the command with a conflict and nothing
|
|
35
|
+
* persists.
|
|
37
36
|
*/
|
|
38
37
|
function createPersisted(server, uri, clientId, text) {
|
|
39
38
|
return withClientSession(server, clientId, async () => {
|
|
40
39
|
const created = await server.createModelDocument({ uri, clientId, text });
|
|
41
|
-
|
|
42
|
-
throw new Error(`Cannot create ${uri}: another client wrote to it before the create answered`);
|
|
43
|
-
}
|
|
44
|
-
return server.persistModelDocument({ uri, clientId, baseVersion: TransferDocument.assertLoaded(created).model.version });
|
|
40
|
+
return server.persistModelDocument({ uri, clientId, baseVersion: created.created.version });
|
|
45
41
|
});
|
|
46
42
|
}
|
|
47
43
|
//# sourceMappingURL=create.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4BnD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA6B;IAC1D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE9E,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC1B,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,eAAe,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACzG,OAAO;IACV,CAAC;IAED,MAAM,cAAc,CACjB;QACG,OAAO,EAAE,OAAO,CAAC,aAAa;QAC9B,IAAI,EAAE,OAAO,CAAC,UAAU;QACxB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC;KACtB,EACD,KAAK,EAAC,MAAM,EAAC,EAAE;QACZ,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5F,CAAC,CACH,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,eAAe,CACrB,MAAoI,EACpI,GAAW,EACX,QAAgB,EAChB,IAAY;IAEZ,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1E,OAAO,MAAM,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/cli",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.292",
|
|
4
4
|
"description": "Build-time codegen tools + data-server subcommands for the hydranium framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@eclipse-glsp/graph": "2.7.0",
|
|
73
73
|
"@eclipse-glsp/server": "2.7.0",
|
|
74
|
-
"@hydranium/core": "1.0.0-next.
|
|
75
|
-
"@hydranium/data-server": "1.0.0-next.
|
|
76
|
-
"@hydranium/glsp-server": "1.0.0-next.
|
|
77
|
-
"@hydranium/langium": "1.0.0-next.
|
|
78
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
74
|
+
"@hydranium/core": "1.0.0-next.292",
|
|
75
|
+
"@hydranium/data-server": "1.0.0-next.292",
|
|
76
|
+
"@hydranium/glsp-server": "1.0.0-next.292",
|
|
77
|
+
"@hydranium/langium": "1.0.0-next.292",
|
|
78
|
+
"@hydranium/protocol": "1.0.0-next.292",
|
|
79
79
|
"@types/node": "^22.0.0",
|
|
80
80
|
"inversify": "6.2.2",
|
|
81
81
|
"langium": "4.3.1",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"vscode-languageserver-protocol": "3.18.1"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
|
-
"@hydranium/core": "1.0.0-next.
|
|
93
|
-
"@hydranium/data-server": "1.0.0-next.
|
|
94
|
-
"@hydranium/langium": "1.0.0-next.
|
|
95
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
92
|
+
"@hydranium/core": "1.0.0-next.292",
|
|
93
|
+
"@hydranium/data-server": "1.0.0-next.292",
|
|
94
|
+
"@hydranium/langium": "1.0.0-next.292",
|
|
95
|
+
"@hydranium/protocol": "1.0.0-next.292",
|
|
96
96
|
"@memlab/core": "^2.0.3",
|
|
97
97
|
"@memlab/heap-analysis": "^2.0.3",
|
|
98
98
|
"vscode-jsonrpc": "^9.0.0"
|
package/src/commands/create.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
11
11
|
import type { DataServerProtocol } from '@hydranium/protocol/data';
|
|
12
12
|
import { logEnv, type LogOptions } from '../log-level.js';
|
|
13
13
|
import { withDataServer } from '../spawn-data-server.js';
|
|
@@ -65,10 +65,10 @@ export async function runCreate(options: CreateCommandOptions): Promise<void> {
|
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Create `uri` with `text` as the session `clientId` and persist it, then end
|
|
68
|
-
* the session. The persist is gated on the version the create
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
68
|
+
* the session. The persist is gated on the version the create made, so a
|
|
69
|
+
* write that landed before the create's answer or after it, another client's
|
|
70
|
+
* or an integrity repair, fails the command with a conflict and nothing
|
|
71
|
+
* persists.
|
|
72
72
|
*/
|
|
73
73
|
function createPersisted(
|
|
74
74
|
server: Pick<DataServerProtocol<TransferElement>, 'createSession' | 'createModelDocument' | 'persistModelDocument' | 'closeSession'>,
|
|
@@ -78,9 +78,6 @@ function createPersisted(
|
|
|
78
78
|
): Promise<unknown> {
|
|
79
79
|
return withClientSession(server, clientId, async () => {
|
|
80
80
|
const created = await server.createModelDocument({ uri, clientId, text });
|
|
81
|
-
|
|
82
|
-
throw new Error(`Cannot create ${uri}: another client wrote to it before the create answered`);
|
|
83
|
-
}
|
|
84
|
-
return server.persistModelDocument({ uri, clientId, baseVersion: TransferDocument.assertLoaded(created).model.version });
|
|
81
|
+
return server.persistModelDocument({ uri, clientId, baseVersion: created.created.version });
|
|
85
82
|
});
|
|
86
83
|
}
|