@procedures/fs 0.33.0 → 0.35.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,78 @@
1
1
  # @procedures/fs
2
2
 
3
+ ## 0.35.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @procedures/client@0.35.0
8
+
9
+ ## 0.34.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d4376c2: A path segment with a dot or a `%` comes back the same after a trip over the wire (roadmap CLI-75, decision D36).
14
+
15
+ Before, the method name of `["collections", "e2e.tabs", "find"]` was `collections.e2e.tabs.find`. The server read it back as four segments, so the call got `NOT_FOUND`. In this release, each segment encodes `%` as `%25` and then `.` as `%2E` before the join:
16
+
17
+ - `pathToMethod(["collections", "e2e.tabs", "find"])` gives `{ service: "collections.e2e%2Etabs", operation: "find" }`, and `methodToPath()` gives the same path again.
18
+ - `pathToKey()`, `keyToPath()`, the body path of an HTTP request and `server.call` use the same encoding.
19
+ - The topic of a collection without a partition encodes the name too: `collectionChangeTopic("e2e.tabs")` gives `collections.e2e%2Etabs`. The topic of a partition already encoded the name (roadmap CLI-42).
20
+ - The decode accepts `%2E` and `%2e`, and it keeps each other `%` sequence. A topic must have the canonical form.
21
+ - A segment without `.` and `%` keeps its text. Thus the method names and the topics of such names do not change.
22
+
23
+ The new exports `encodeSegment()`, `decodeSegment()`, `segmentsToTopic()` and `topicToSegments()` do the encoding. Use them. Do not join or split the segments yourself.
24
+
25
+ Two collections thus do not have the same topic, and `ProcedureServer` accepts a storage of `a.b` next to partitions of `a` (before, roadmap CLI-57 and CLI-70 refused the two together). `CollectionTopicCollisionError` is deprecated, and no server throws it. A later release removes it.
26
+
27
+ MINOR (breaking, pre-1.0): a name with `.` or `%` gets a new method name, a new registry key and a new topic. The MCP tool names do not change.
28
+
29
+ The procedures `fs.read.json` and `fs.write.json` have the paths `["fs", "read", "json"]` and `["fs", "write", "json"]`. Before, their paths were `["fs", "read.json"]` and `["fs", "write.json"]`. With the encoding, those paths get the key `fs.read%2Ejson`, so the key `fs.read.json` of the callers does not find them. With three segments, the method name, the key and the MCP tool name stay the same.
30
+
31
+ The command line of `mark` reads the longest path that names a procedure. Thus `mark fs read json a.json` starts `fs.read.json`, and `mark fs read notes.txt` starts `fs.read`.
32
+
33
+ Migration:
34
+
35
+ - Upgrade the clients and the servers of a name with `.` or `%` together.
36
+ - A caller or a stored program that names the path as the list `["fs", "read.json"]` uses `["fs", "read", "json"]`, and `["fs", "write.json"]` becomes `["fs", "write", "json"]`. The text name `fs.read.json` and the MCP tool name `fs_read_json` do not change.
37
+ - There is no D13 alias at the old list paths. No consumer uses the list form, and an alias would give the MCP tool name `fs_read_json` twice.
38
+ - A host whose `expose`, policy or limit pattern names such a path in text uses the encoded form, for example `collections.e2e%2Etabs.*`.
39
+ - An `mcpExclude` entry, an `expose` deny entry or a limit entry in the old raw form, for example `collections.e2e.tabs.drop`, does not match. The check compares the encoded key, so the procedure becomes visible, or the limit does not apply. Write each such entry in the encoded form, for example `collections.e2e%2Etabs.drop`.
40
+ - A subscriber of a dotted collection uses `collectionChangeTopic(name)`. The raw topic `collections.a.b` is the topic of the partition `b` of `a`.
41
+ - Graph: read the collection of a topic with `collectionTopicPartition(topic)`, not with a pattern, for example `/^collections\.([^.]+)\./`.
42
+ - The site, MiniMongo and jarvis: no change, if their collection names have no `.` and no `%`.
43
+
44
+ ### Patch Changes
45
+
46
+ - fa1a61a: Less boilerplate in each procedure definition (dedupe review F1, tracker item O58).
47
+
48
+ PATCH (pre-1.0): this change adds exports and deprecates names. It removes no export and changes no behavior.
49
+
50
+ - `@procedures/client` has the new export `typed<T>()`. It is the one pass-through schema that gives only the type `T`.
51
+ - `@procedures/client` has the new export `definePackage(name, procedures, requires?)`. It gives `{ module, register }` and registers nothing at the call. The new type `PackageDefinition` is its result.
52
+ - `zodAdapter` is deprecated. `input()` and `output()` take each Standard Schema and infer its type, so a zod schema goes in directly.
53
+ - `typedAnySchema` and `outputSchema` are deprecated. Use `typed<T>()`. They give the same pass-through schema.
54
+ - The procedures of the packages give their zod schemas to `input()` and `output()` directly. The `.build() as AnyProcedure` casts are gone. The schemas, the types of the exports and the validation do not change.
55
+ - `mark procedure new` writes `.input(<Name>InputSchema)` and `.output(<Name>OutputSchema)`, without `zodAdapter`.
56
+
57
+ Migration:
58
+
59
+ - The site, MiniMongo, Graph and jarvis: no change at this time. The deprecated names work until the next MINOR.
60
+ - Before the next MINOR, replace `zodAdapter<T>(schema)` with `schema`. To keep the check of a schema against a type, write `const schema: z.ZodType<T> = ...`.
61
+ - Before the next MINOR, replace `typedAnySchema<T>()` and `outputSchema<T>()` with `typed<T>()`.
62
+ - A parse-only object (`{ parse }`) in `zodAdapter` becomes a Standard Schema with a `~standard` property.
63
+ - 67a53ea: The atomic writes use `writeFileAtomic()` of `@procedures/fs/files` (dedupe review F3, tracker item O59).
64
+
65
+ PATCH (pre-1.0): this change is internal. It changes no export and no signature.
66
+
67
+ - `fs.write.json`, the file store of `@procedures/schedule`, the manifest of `mark` and the `current.json` record of `@procedures/node/fresh-bundle` replace their own temporary file and rename with `writeFileAtomic()` or `writeFileAtomicSync()`.
68
+ - Each write now flushes the file to the disk. On Windows, a locked target gets more tries of the rename, for 2 seconds.
69
+ - A replaced file keeps the permissions of the old file. A symlink target stays a symlink, and the write goes to the file of the link.
70
+ - The temporary file has the name `.<name>.<16 hex digits>.tmp` in the folder of the target.
71
+ - `@procedures/schedule`, `@procedures/mark` and `@procedures/node` declare `@procedures/fs` in `dependencies`.
72
+ - Updated dependencies [d4376c2]
73
+ - Updated dependencies [fa1a61a]
74
+ - @procedures/client@0.34.0
75
+
3
76
  ## 0.33.0
4
77
 
5
78
  ### Patch Changes
package/README.md CHANGED
@@ -653,7 +653,7 @@ Read and parse a JSON file.
653
653
 
654
654
  ```typescript
655
655
  const result = await client.exec(
656
- ["fs", "read.json"],
656
+ ["fs", "read", "json"],
657
657
  { path: "./package.json" }
658
658
  );
659
659
 
@@ -685,7 +685,7 @@ interface PackageJson {
685
685
  }
686
686
 
687
687
  const result = await client.exec(
688
- ["fs", "read.json"],
688
+ ["fs", "read", "json"],
689
689
  { path: "./package.json" }
690
690
  );
691
691
 
@@ -698,7 +698,7 @@ console.log(pkg.name, pkg.version);
698
698
  The procedure writes a value as a JSON file, with 2 spaces of indent and a line break at the end. It writes a file next to the target first, then renames it. Thus a reader sees the old file or the whole new file.
699
699
 
700
700
  ```typescript
701
- await client.exec(["fs", "write.json"], { path: "./data.json", value: { a: 1 }, indent: 2 });
701
+ await client.exec(["fs", "write", "json"], { path: "./data.json", value: { a: 1 }, indent: 2 });
702
702
  ```
703
703
 
704
704
  #### `fs.hash`
@@ -898,7 +898,7 @@ const { matches: configs } = await client.exec(
898
898
  ```typescript
899
899
  // Read package.json
900
900
  const { data: pkg } = await client.exec(
901
- ["fs", "read.json"],
901
+ ["fs", "read", "json"],
902
902
  { path: "./package.json" }
903
903
  );
904
904
 
@@ -906,7 +906,7 @@ console.log(`Package: ${pkg.name}@${pkg.version}`);
906
906
 
907
907
  // Read tsconfig.json
908
908
  const { data: tsconfig } = await client.exec(
909
- ["fs", "read.json"],
909
+ ["fs", "read", "json"],
910
910
  { path: "./tsconfig.json" }
911
911
  );
912
912
 
@@ -914,7 +914,7 @@ console.log("Compiler options:", tsconfig.compilerOptions);
914
914
 
915
915
  // Read and modify JSON
916
916
  const { data: config } = await client.exec(
917
- ["fs", "read.json"],
917
+ ["fs", "read", "json"],
918
918
  { path: "./config.json" }
919
919
  );
920
920