@canon-protocol/sdk 8.0.0 → 8.0.1
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/repositories/CachePaths.d.ts +5 -0
- package/dist/repositories/CachePaths.js +12 -0
- package/dist/repositories/RepositoryFactory.js +3 -2
- package/dist/repositories/index.d.ts +1 -0
- package/dist/repositories/index.js +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { InMemoryCanonDocumentRepository, FileSystemCanonDocumentRepository, CompositeCanonDocumentRepository, RepositoryFactory, DocumentLocation, HttpCanonDocumentRepository, PublisherIndex, PublisherConfigResolver } from './repositories/index.js';
|
|
1
|
+
export { InMemoryCanonDocumentRepository, FileSystemCanonDocumentRepository, CompositeCanonDocumentRepository, RepositoryFactory, DocumentLocation, HttpCanonDocumentRepository, PublisherIndex, PublisherConfigResolver, getGlobalCachePath } from './repositories/index.js';
|
|
2
2
|
export type { PublisherConfig } from './repositories/index.js';
|
|
3
3
|
export { GitIgnoreFilter } from './filtering/index.js';
|
|
4
4
|
export type { IGitIgnoreFilter } from './filtering/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { InMemoryCanonDocumentRepository, FileSystemCanonDocumentRepository, CompositeCanonDocumentRepository, RepositoryFactory, DocumentLocation, HttpCanonDocumentRepository, PublisherIndex, PublisherConfigResolver } from './repositories/index.js';
|
|
1
|
+
export { InMemoryCanonDocumentRepository, FileSystemCanonDocumentRepository, CompositeCanonDocumentRepository, RepositoryFactory, DocumentLocation, HttpCanonDocumentRepository, PublisherIndex, PublisherConfigResolver, getGlobalCachePath } from './repositories/index.js';
|
|
2
2
|
export { GitIgnoreFilter } from './filtering/index.js';
|
|
3
3
|
export { CanonParser, CanonObjectParser, PropertyMetadata } from './parsing/index.js';
|
|
4
4
|
export { ResourceResolver, CanonUri, CanonUriBuilder, TypeResolver } from './resolution/index.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the global Canon package cache directory.
|
|
5
|
+
* Priority: CANON_PACKAGE_CACHE env var > ~/.canon/packages
|
|
6
|
+
*/
|
|
7
|
+
export function getGlobalCachePath() {
|
|
8
|
+
const envOverride = process.env.CANON_PACKAGE_CACHE;
|
|
9
|
+
if (envOverride)
|
|
10
|
+
return envOverride;
|
|
11
|
+
return join(homedir(), '.canon', 'packages');
|
|
12
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CompositeCanonDocumentRepository } from './CompositeCanonDocumentRepository.js';
|
|
2
|
+
import { getGlobalCachePath } from './CachePaths.js';
|
|
2
3
|
export class RepositoryFactory {
|
|
3
4
|
static createComposite(cachePath, workspacePath, parser) {
|
|
4
|
-
const cache = cachePath ??
|
|
5
|
+
const cache = cachePath ?? getGlobalCachePath();
|
|
5
6
|
const workspace = workspacePath ?? '.';
|
|
6
7
|
return new CompositeCanonDocumentRepository(cache, workspace, parser);
|
|
7
8
|
}
|
|
8
9
|
static createFromEnvironment(parser) {
|
|
9
|
-
const cachePath =
|
|
10
|
+
const cachePath = getGlobalCachePath();
|
|
10
11
|
const workspacePath = process.env.CANON_WORKSPACE_PATH ?? '.';
|
|
11
12
|
return RepositoryFactory.createComposite(cachePath, workspacePath, parser);
|
|
12
13
|
}
|
|
@@ -6,4 +6,5 @@ export { HttpCanonDocumentRepository } from './HttpCanonDocumentRepository.js';
|
|
|
6
6
|
export { PublisherIndex } from './PublisherIndex.js';
|
|
7
7
|
export { PublisherConfigResolver } from './PublisherConfig.js';
|
|
8
8
|
export type { PublisherConfig } from './PublisherConfig.js';
|
|
9
|
+
export { getGlobalCachePath } from './CachePaths.js';
|
|
9
10
|
export type { ICanonDocumentRepository, CanonDocument, DocumentReference } from '@canon-protocol/types/document/models';
|
|
@@ -5,3 +5,4 @@ export { RepositoryFactory } from './RepositoryFactory.js';
|
|
|
5
5
|
export { HttpCanonDocumentRepository } from './HttpCanonDocumentRepository.js';
|
|
6
6
|
export { PublisherIndex } from './PublisherIndex.js';
|
|
7
7
|
export { PublisherConfigResolver } from './PublisherConfig.js';
|
|
8
|
+
export { getGlobalCachePath } from './CachePaths.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canon-protocol/sdk",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "Canon Protocol SDK - Document repository and parsing implementations for TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"yaml-parser"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@canon-protocol/types": "^8.0.
|
|
65
|
+
"@canon-protocol/types": "^8.0.1",
|
|
66
66
|
"ignore": "^7.0.5",
|
|
67
67
|
"js-yaml": "^4.1.0"
|
|
68
68
|
},
|