@clowder-ai/plugin-contract 0.1.0-beta.6 → 0.1.0-beta.7
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/validation/index.d.ts +1 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/manifest.d.ts +23 -0
- package/dist/validation/manifest.d.ts.map +1 -0
- package/dist/validation/manifest.js +33 -0
- package/dist/validation/manifest.js.map +1 -0
- package/package.json +5 -3
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { validateMessagingSemantics, type SemanticValidationError, type SemanticValidationResult, } from './messaging-semantic.js';
|
|
2
|
+
export { validateManifest, type ManifestValidationError, type ManifestValidationResult, } from './manifest.js';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAC"}
|
package/dist/validation/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAG3B,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAG3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,GAGjB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PluginManifest } from '../generated/contract.generated.js';
|
|
2
|
+
export interface ManifestValidationError {
|
|
3
|
+
readonly instancePath: string;
|
|
4
|
+
readonly schemaPath: string;
|
|
5
|
+
readonly keyword: string;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
}
|
|
8
|
+
export type ManifestValidationResult = {
|
|
9
|
+
readonly valid: true;
|
|
10
|
+
readonly manifest: PluginManifest;
|
|
11
|
+
readonly errors: readonly [];
|
|
12
|
+
} | {
|
|
13
|
+
readonly valid: false;
|
|
14
|
+
readonly errors: readonly ManifestValidationError[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Validates an untrusted plugin manifest against the contract-owned schema.
|
|
18
|
+
*
|
|
19
|
+
* The schema is resolved through the package's public export so runtime users
|
|
20
|
+
* and the conformance suite share one manifest definition and Ajv policy.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateManifest(value: unknown): ManifestValidationResult;
|
|
23
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/validation/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AA6BzE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,wBAAwB,GAChC;IACE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAC;CACrD,CAAC;AAMN;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAkBzE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
const Ajv2020 = require('ajv/dist/2020');
|
|
4
|
+
const addFormats = require('ajv-formats');
|
|
5
|
+
const manifestSchema = require('@clowder-ai/plugin-contract/schemas/manifest');
|
|
6
|
+
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
7
|
+
addFormats(ajv);
|
|
8
|
+
const validateSchema = ajv.compile(manifestSchema);
|
|
9
|
+
/**
|
|
10
|
+
* Validates an untrusted plugin manifest against the contract-owned schema.
|
|
11
|
+
*
|
|
12
|
+
* The schema is resolved through the package's public export so runtime users
|
|
13
|
+
* and the conformance suite share one manifest definition and Ajv policy.
|
|
14
|
+
*/
|
|
15
|
+
export function validateManifest(value) {
|
|
16
|
+
if (validateSchema(value)) {
|
|
17
|
+
return {
|
|
18
|
+
valid: true,
|
|
19
|
+
manifest: value,
|
|
20
|
+
errors: [],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
valid: false,
|
|
25
|
+
errors: (validateSchema.errors ?? []).map((error) => ({
|
|
26
|
+
instancePath: error.instancePath,
|
|
27
|
+
schemaPath: error.schemaPath,
|
|
28
|
+
keyword: error.keyword,
|
|
29
|
+
message: error.message ?? 'manifest validation failed',
|
|
30
|
+
})),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 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name": "@clowder-ai/plugin-contract",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Clowder AI plugin contract — the single machine-readable truth source for plugin schema, types, capability table, and conformance fixtures (P15)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,11 +42,13 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.17.0",
|
|
45
|
-
"ajv": "^8.17.0",
|
|
46
|
-
"ajv-formats": "^3.0.0",
|
|
47
45
|
"tsx": "^4.19.0",
|
|
48
46
|
"typescript": "^5.7.0"
|
|
49
47
|
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"ajv": "^8.17.0",
|
|
50
|
+
"ajv-formats": "^3.0.0"
|
|
51
|
+
},
|
|
50
52
|
"publishConfig": {
|
|
51
53
|
"access": "public"
|
|
52
54
|
},
|