@gitgov/core 2.1.2 → 2.3.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/README.md +70 -8
- package/dist/src/{agent_runner-ByOUWOt6.d.ts → agent_runner-D7JahEKk.d.ts} +8 -1198
- package/dist/src/fs.d.ts +34 -22
- package/dist/src/fs.js +66 -14
- package/dist/src/fs.js.map +1 -1
- package/dist/src/github.d.ts +473 -0
- package/dist/src/github.js +1281 -0
- package/dist/src/github.js.map +1 -0
- package/dist/src/{index--ahcnsG3.d.ts → index-Bhc341pf.d.ts} +6 -265
- package/dist/src/index.d.ts +54 -60
- package/dist/src/index.js +5048 -5047
- package/dist/src/index.js.map +1 -1
- package/dist/src/key_provider-CRpHFGjN.d.ts +227 -0
- package/dist/src/memory.d.ts +27 -5
- package/dist/src/memory.js +31 -2
- package/dist/src/memory.js.map +1 -1
- package/dist/src/{memory_file_lister-BkQ_C3ZU.d.ts → memory_file_lister-C978PA8g.d.ts} +2 -1
- package/dist/src/prisma.d.ts +71 -0
- package/dist/src/prisma.js +67 -0
- package/dist/src/prisma.js.map +1 -0
- package/dist/src/record_projection.types-B8AM7u8U.d.ts +1207 -0
- package/dist/src/record_store-BXKWqon5.d.ts +64 -0
- package/package.json +10 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdEncoder for transforming IDs to storage-safe filenames.
|
|
3
|
+
* Useful for characters not allowed in filesystem (e.g., `:` on Windows)
|
|
4
|
+
* or URL-unsafe characters in remote backends.
|
|
5
|
+
*/
|
|
6
|
+
interface IdEncoder {
|
|
7
|
+
/** Transform ID to storage-safe string */
|
|
8
|
+
encode: (id: string) => string;
|
|
9
|
+
/** Recover original ID from encoded string */
|
|
10
|
+
decode: (encoded: string) => string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Default encoder: `:` → `_` (for IDs like "human:camilo")
|
|
14
|
+
* Reversible because IDs cannot contain `_` (see id_generator.ts)
|
|
15
|
+
*/
|
|
16
|
+
declare const DEFAULT_ID_ENCODER: IdEncoder;
|
|
17
|
+
/**
|
|
18
|
+
* RecordStore<V, R, O> - Generic interface for record persistence
|
|
19
|
+
*
|
|
20
|
+
* Abstracts CRUD operations without assuming storage backend.
|
|
21
|
+
* Each implementation decides how to persist (fs, memory, db, remote).
|
|
22
|
+
*
|
|
23
|
+
* @typeParam V - Value type (the record being stored)
|
|
24
|
+
* @typeParam R - Return type for write operations (default: void for local, GitHubWriteResult for GitHub)
|
|
25
|
+
* @typeParam O - Options type for write operations (default: void for local, GitHubWriteOpts for GitHub)
|
|
26
|
+
*/
|
|
27
|
+
interface RecordStore<V, R = void, O = void> {
|
|
28
|
+
/**
|
|
29
|
+
* Gets a record by ID
|
|
30
|
+
* @returns The record or null if it doesn't exist
|
|
31
|
+
*/
|
|
32
|
+
get(id: string): Promise<V | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Persists a record
|
|
35
|
+
* @param id - Unique identifier
|
|
36
|
+
* @param value - The record to persist
|
|
37
|
+
*/
|
|
38
|
+
put(id: string, value: V, ...opts: O extends void ? [] : [opts?: O]): Promise<R>;
|
|
39
|
+
/**
|
|
40
|
+
* Persists multiple records in a single operation.
|
|
41
|
+
* Local backends iterate sequentially; GitHub backend uses atomic commits.
|
|
42
|
+
*/
|
|
43
|
+
putMany(entries: Array<{
|
|
44
|
+
id: string;
|
|
45
|
+
value: V;
|
|
46
|
+
}>, ...opts: O extends void ? [] : [opts?: O]): Promise<R>;
|
|
47
|
+
/**
|
|
48
|
+
* Deletes a record
|
|
49
|
+
* @param id - Identifier of the record to delete
|
|
50
|
+
*/
|
|
51
|
+
delete(id: string, ...opts: O extends void ? [] : [opts?: O]): Promise<R>;
|
|
52
|
+
/**
|
|
53
|
+
* Lists all record IDs
|
|
54
|
+
* @returns Array of IDs
|
|
55
|
+
*/
|
|
56
|
+
list(): Promise<string[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a record exists
|
|
59
|
+
* @param id - Identifier to check
|
|
60
|
+
*/
|
|
61
|
+
exists(id: string): Promise<boolean>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { DEFAULT_ID_ENCODER as D, type IdEncoder as I, type RecordStore as R };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitgov/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "SDK for the GitGovernance ecosystem, providing a type-safe, local-first API to manage identities, agents, and workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
"types": "./dist/src/memory.d.ts",
|
|
22
22
|
"import": "./dist/src/memory.js"
|
|
23
23
|
},
|
|
24
|
+
"./github": {
|
|
25
|
+
"types": "./dist/src/github.d.ts",
|
|
26
|
+
"import": "./dist/src/github.js"
|
|
27
|
+
},
|
|
28
|
+
"./prisma": {
|
|
29
|
+
"types": "./dist/src/prisma.d.ts",
|
|
30
|
+
"import": "./dist/src/prisma.js"
|
|
31
|
+
},
|
|
24
32
|
"./package.json": "./package.json"
|
|
25
33
|
},
|
|
26
34
|
"scripts": {
|
|
@@ -63,6 +71,7 @@
|
|
|
63
71
|
"access": "public"
|
|
64
72
|
},
|
|
65
73
|
"dependencies": {
|
|
74
|
+
"@octokit/rest": "^22.0.1",
|
|
66
75
|
"ajv": "^8.17.1",
|
|
67
76
|
"ajv-formats": "^3.0.1",
|
|
68
77
|
"chokidar": "^3.6.0",
|