@json-to-office/core-docx 0.1.1 → 0.2.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.
@@ -1,31 +1,16 @@
1
- import type { TSchema } from '@sinclair/typebox';
1
+ import type { TSchema, Static } from '@sinclair/typebox';
2
2
  import type { CustomComponent } from './createComponent';
3
3
  import type { ReportComponentDefinition } from '../types';
4
- import { type ValidationError, type ComponentValidationResult } from '@json-to-office/shared-docx/validation/unified';
4
+ import { type ComponentValidationResult } from '@json-to-office/shared/plugin';
5
5
  import type { ValidationResult } from '@json-to-office/shared';
6
- /**
7
- * Error thrown when attempting to register a component with a duplicate name
8
- */
9
- export declare class DuplicateComponentError extends Error {
10
- readonly componentName: string;
11
- readonly code = "DUPLICATE_COMPONENT";
12
- constructor(componentName: string);
13
- }
14
- /**
15
- * Custom validation error class
16
- */
17
- export declare class ComponentValidationError extends Error {
18
- errors: ValidationError[];
19
- props: unknown;
20
- constructor(errors: ValidationError[], props?: unknown);
21
- }
6
+ export { DuplicateComponentError, ComponentValidationError, } from '@json-to-office/shared/plugin';
22
7
  /**
23
8
  * Validate a component props against a schema.
24
9
  * Accepts a narrower interface — only needs { propsSchema }.
25
10
  */
26
11
  export declare function validateComponentProps<TPropsSchema extends TSchema>(schema: {
27
12
  propsSchema: TPropsSchema;
28
- }, props: unknown): ComponentValidationResult<TPropsSchema>;
13
+ }, props: unknown, componentName?: string): ComponentValidationResult<TPropsSchema>;
29
14
  /**
30
15
  * Validate document and all custom components (version-aware)
31
16
  */
@@ -34,12 +19,11 @@ export declare function validateDocument(document: ReportComponentDefinition, cu
34
19
  };
35
20
  /**
36
21
  * Validates component props and returns the typed props or throws.
37
- * Accepts a narrower interface — only needs { propsSchema }.
38
22
  */
39
23
  export declare function getValidatedProps<TPropsSchema extends TSchema>(schema: {
40
24
  propsSchema: TPropsSchema;
41
- }, props: unknown): TPropsSchema;
25
+ }, props: unknown): Static<TPropsSchema>;
42
26
  export type { ValidationError } from '@json-to-office/shared-docx/validation/unified';
43
- export type { ComponentValidationResult } from '@json-to-office/shared-docx/validation/unified';
27
+ export type { ComponentValidationResult } from '@json-to-office/shared/plugin';
44
28
  export declare const cleanComponentProps: typeof getValidatedProps;
45
29
  //# sourceMappingURL=validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/plugin/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,IAAI,yBAAyB;gBAEjC,aAAa,EAAE,MAAM;CAalC;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAC1C,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;gBAEV,MAAM,EAAE,eAAe,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO;CAWvD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,SAAS,OAAO,EACjE,MAAM,EAAE;IAAE,WAAW,EAAE,YAAY,CAAA;CAAE,EACrC,KAAK,EAAE,OAAO,GACb,yBAAyB,CAAC,YAAY,CAAC,CAKzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,yBAAyB,EACnC,gBAAgB,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GACjD,gB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BAAgB,iBAAiB,CAAC,YAAY,SAAS,OAAO,EAC5D,MAAM,EAAE;IAAE,WAAW,EAAE,YAAY,CAAA;CAAE,EACrC,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,YAAY,CAAC,CAQtB;AAGD,YAAY,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,YAAY,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE/E,eAAO,MAAM,mBAAmB,0BAAoB,CAAC"}
@@ -1,10 +1,2 @@
1
- import type { ComponentVersion, ComponentVersionMap } from './createComponent';
2
- /**
3
- * Resolve the correct version entry for a component.
4
- *
5
- * - If `requestedVersion` is provided and found, return it.
6
- * - If `requestedVersion` is provided but missing, throw with available versions.
7
- * - If `requestedVersion` is absent, return the latest semver version.
8
- */
9
- export declare function resolveComponentVersion(componentName: string, versions: ComponentVersionMap, requestedVersion?: string): ComponentVersion;
1
+ export { resolveComponentVersion } from '@json-to-office/shared/plugin';
10
2
  //# sourceMappingURL=version-resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-resolver.d.ts","sourceRoot":"","sources":["../../src/plugin/version-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,mBAAmB,EAC7B,gBAAgB,CAAC,EAAE,MAAM,GACxB,gBAAgB,CAgBlB"}
1
+ {"version":3,"file":"version-resolver.d.ts","sourceRoot":"","sources":["../../src/plugin/version-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC"}