@wildo-ai/zod-decorators 1.1.3 → 1.1.5

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.
Files changed (57) hide show
  1. package/dist/esm/files/agent-file-formats.d.ts +51 -37
  2. package/dist/esm/files/agent-file-formats.d.ts.map +1 -1
  3. package/dist/esm/files/agent-file-formats.js +54 -47
  4. package/dist/esm/files/agent-file-formats.js.map +1 -1
  5. package/dist/esm/files/unified-registry.d.ts +2 -2
  6. package/dist/esm/files/unified-registry.js +1 -1
  7. package/dist/esm/files/unified-registry.js.map +1 -1
  8. package/dist/esm/index.d.ts +1 -0
  9. package/dist/esm/index.d.ts.map +1 -1
  10. package/dist/esm/index.js +1 -0
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/testing.d.ts +11 -0
  13. package/dist/esm/testing.d.ts.map +1 -1
  14. package/dist/esm/testing.js +11 -0
  15. package/dist/esm/testing.js.map +1 -1
  16. package/dist/esm/zod-address.d.ts +146 -0
  17. package/dist/esm/zod-address.d.ts.map +1 -0
  18. package/dist/esm/zod-address.js +176 -0
  19. package/dist/esm/zod-address.js.map +1 -0
  20. package/dist/esm/zod-code.d.ts +2 -0
  21. package/dist/esm/zod-code.d.ts.map +1 -1
  22. package/dist/esm/zod-code.js.map +1 -1
  23. package/dist/esm/zod-decorators.types.d.ts +275 -23
  24. package/dist/esm/zod-decorators.types.d.ts.map +1 -1
  25. package/dist/esm/zod-decorators.types.js +152 -4
  26. package/dist/esm/zod-decorators.types.js.map +1 -1
  27. package/dist/esm/zod-duration.d.ts +2 -0
  28. package/dist/esm/zod-duration.d.ts.map +1 -1
  29. package/dist/esm/zod-duration.js.map +1 -1
  30. package/dist/esm/zod-file.d.ts +70 -4
  31. package/dist/esm/zod-file.d.ts.map +1 -1
  32. package/dist/esm/zod-file.js +85 -64
  33. package/dist/esm/zod-file.js.map +1 -1
  34. package/dist/esm/zod-money.d.ts +2 -0
  35. package/dist/esm/zod-money.d.ts.map +1 -1
  36. package/dist/esm/zod-money.js.map +1 -1
  37. package/dist/esm/zod-phone.d.ts +8 -0
  38. package/dist/esm/zod-phone.d.ts.map +1 -1
  39. package/dist/esm/zod-phone.js +6 -1
  40. package/dist/esm/zod-phone.js.map +1 -1
  41. package/dist/esm/zod-utils.shared.d.ts +311 -9
  42. package/dist/esm/zod-utils.shared.d.ts.map +1 -1
  43. package/dist/esm/zod-utils.shared.js +898 -86
  44. package/dist/esm/zod-utils.shared.js.map +1 -1
  45. package/dist/esm/zod-versioned.d.ts.map +1 -1
  46. package/dist/esm/zod-versioned.js.map +1 -1
  47. package/dist/esm/zod.module-override.d.ts +27 -1
  48. package/dist/esm/zod.module-override.d.ts.map +1 -1
  49. package/dist/esm/zod.module-override.js +52 -7
  50. package/dist/esm/zod.module-override.js.map +1 -1
  51. package/dist/tsconfig.build.tsbuildinfo +1 -1
  52. package/package.json +2 -7
  53. package/dist/esm/.native.tsbuildinfo +0 -1
  54. package/dist/esm/companion-exports.d.ts +0 -8
  55. package/dist/esm/companion-exports.d.ts.map +0 -1
  56. package/dist/esm/companion-exports.js +0 -8
  57. package/dist/esm/companion-exports.js.map +0 -1
@@ -1,72 +1,86 @@
1
1
  /**
2
- * Agent/Blueprint File Format Registry
2
+ * Agent file-format registry — the ONE named source for the formats an agent reads or writes.
3
3
  *
4
- * Handles file formats specific to agent/blueprint operations.
5
- * Maps AppsBlueprint_FileFormat to extensions and MIME types.
4
+ * This vocabulary used to exist twice: as `AppsBlueprint_FileFormat` / `AppsBlueprint_FileMimes` in
5
+ * `@wildo-ai/saas-models`, and as string literals here that a comment said were kept in step "to
6
+ * avoid circular dependencies". The duplication was the tell that the enum sat in the wrong
7
+ * package: `saas-models` depends on `zod-decorators`, never the reverse, so the lower layer is the
8
+ * only placement that can serve both without a cycle.
6
9
  *
7
- * NOTE: This registry uses string literals that match AppsBlueprint_FileFormat
8
- * and AppsBlueprint_FileMimes from @wildo-ai/saas-models to avoid circular
9
- * dependencies. The registry methods return/accept these string values which
10
- * are compatible with the enums defined in saas-models.
10
+ * The `saas-models` copy was deleted on 2026-09-19 with the rest of the `apps-blueprint` tree, and
11
+ * `FlowsActors_Agent_OutputSpecSchema` now reaches this enum directly. Nothing about a file format
12
+ * was ever app-creation-specific; the name was.
13
+ *
14
+ * @see `.claude/rules/design-philosophy.md` — one named runtime source per closed vocabulary.
11
15
  */
12
16
  /**
13
- * Agent/Blueprint file format string literals.
14
- * These match AppsBlueprint_FileFormat enum values from @wildo-ai/saas-models.
17
+ * Formats an agent may be asked to emit, and that the framework can map to an extension and a MIME
18
+ * type. Closed on purpose: a format belongs here only once the registry below can answer both
19
+ * mappings for it.
15
20
  */
16
- export declare const AgentFileFormat: {
17
- readonly TEXT: "text";
18
- readonly TYPESCRIPT: "typescript";
19
- readonly TYPESCRIPT_JSX: "typescript_react";
20
- readonly MARKDOWN: "markdown";
21
- readonly JSON: "json";
22
- readonly YAML: "yaml";
23
- };
21
+ export declare enum AgentFileFormat {
22
+ /** Unstructured prose. The default when no format is declared. */
23
+ TEXT = "text",
24
+ /** TypeScript source. `.ts` — module code, schemas, configuration. */
25
+ TYPESCRIPT = "typescript",
26
+ /** TypeScript with JSX. `.tsx` — a component; distinct from TYPESCRIPT because the extension differs and a `.ts` file containing JSX does not compile. */
27
+ TYPESCRIPT_JSX = "typescript_react",
28
+ /** Markdown. Documentation, prompts, authored prose an agent produces for a human. */
29
+ MARKDOWN = "markdown",
30
+ /** JSON. Structured data an agent emits for a machine. */
31
+ JSON = "json",
32
+ /** YAML. Configuration and manifests, where comments and readability matter. */
33
+ YAML = "yaml"
34
+ }
24
35
  /**
25
- * Agent/Blueprint file MIME type string literals.
26
- * These match AppsBlueprint_FileMimes enum values from @wildo-ai/saas-models.
36
+ * The MIME type each {@link AgentFileFormat} is served and recognised as.
37
+ *
38
+ * Kept as a separate vocabulary rather than derived, because the reverse map below accepts
39
+ * ALTERNATIVES this enum deliberately does not name as canonical (`text/yaml` for YAML).
27
40
  */
28
- export declare const AgentFileMime: {
29
- readonly TEXT_PLAIN: "text/plain";
30
- readonly MARKDOWN: "text/markdown";
31
- readonly JSON: "application/json";
32
- readonly TYPESCRIPT: "application/typescript";
33
- readonly TYPESCRIPT_JSX: "application/typescript-jsx";
34
- readonly YAML: "application/yaml";
35
- };
41
+ export declare enum AgentFileMime {
42
+ TEXT_PLAIN = "text/plain",
43
+ MARKDOWN = "text/markdown",
44
+ JSON = "application/json",
45
+ TYPESCRIPT = "application/typescript",
46
+ TYPESCRIPT_JSX = "application/typescript-jsx",
47
+ YAML = "application/yaml"
48
+ }
36
49
  /**
37
- * Type for agent file format (compatible with AppsBlueprint_FileFormat).
50
+ * The format union, kept as a named alias because callers that hold a plain `string` from a
51
+ * registry lookup need something to widen to.
38
52
  */
39
- export type AgentFileFormatType = typeof AgentFileFormat[keyof typeof AgentFileFormat];
53
+ export type AgentFileFormatType = `${AgentFileFormat}`;
40
54
  /**
41
55
  * Registry for agent/blueprint file formats.
42
56
  */
43
57
  export declare class AgentFileFormatRegistry {
44
58
  /**
45
- * Get MIME type for AppsBlueprint_FileFormat.
59
+ * Get the MIME type for a format.
46
60
  *
47
- * @param format - AppsBlueprint_FileFormat enum value (or compatible string)
61
+ * @param format - an `AgentFileFormat` value (or a compatible string)
48
62
  * @returns MIME type string
49
63
  */
50
64
  static getMimeType(format: string): string;
51
65
  /**
52
- * Get extension for AppsBlueprint_FileFormat.
66
+ * Get the file extension for a format.
53
67
  *
54
- * @param format - AppsBlueprint_FileFormat enum value (or compatible string)
68
+ * @param format - an `AgentFileFormat` value (or a compatible string)
55
69
  * @returns Extension string (without dot)
56
70
  */
57
71
  static getExtension(format: string): string;
58
72
  /**
59
- * Get AppsBlueprint_FileFormat from extension.
73
+ * Get the format for a file extension.
60
74
  *
61
75
  * @param extension - File extension (without dot)
62
- * @returns Format string (compatible with AppsBlueprint_FileFormat) or undefined
76
+ * @returns an `AgentFileFormat` value as a string, or undefined
63
77
  */
64
78
  static getFormatFromExtension(extension: string): string | undefined;
65
79
  /**
66
- * Get AppsBlueprint_FileFormat from MIME type.
80
+ * Get the format for a MIME type.
67
81
  *
68
82
  * @param mimeType - MIME type string
69
- * @returns Format string (compatible with AppsBlueprint_FileFormat) or undefined
83
+ * @returns an `AgentFileFormat` value as a string, or undefined
70
84
  */
71
85
  static getFormatFromMimeType(mimeType: string): string | undefined;
72
86
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"agent-file-formats.d.ts","sourceRoot":"","sources":["../../../../src/files/agent-file-formats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;CAOhB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAoDvF;;GAEG;AACH,qBAAa,uBAAuB;IAClC;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI3C;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOpE;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOlE;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIhD;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIjD;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM,EAAE;IAInC;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,MAAM,EAAE;CAGnC"}
1
+ {"version":3,"file":"agent-file-formats.d.ts","sourceRoot":"","sources":["../../../../src/files/agent-file-formats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;GAIG;AACH,oBAAY,eAAe;IACzB,kEAAkE;IAClE,IAAI,SAAS;IACb,sEAAsE;IACtE,UAAU,eAAe;IACzB,0JAA0J;IAC1J,cAAc,qBAAqB;IACnC,sFAAsF;IACtF,QAAQ,aAAa;IACrB,0DAA0D;IAC1D,IAAI,SAAS;IACb,gFAAgF;IAChF,IAAI,SAAS;CACd;AAED;;;;;GAKG;AACH,oBAAY,aAAa;IACvB,UAAU,eAAe;IACzB,QAAQ,kBAAkB;IAC1B,IAAI,qBAAqB;IACzB,UAAU,2BAA2B;IACrC,cAAc,+BAA+B;IAC7C,IAAI,qBAAqB;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,GAAG,eAAe,EAAE,CAAC;AA4CvD;;GAEG;AACH,qBAAa,uBAAuB;IAClC;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI3C;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOpE;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOlE;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIhD;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIjD;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM,EAAE;IAInC;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,MAAM,EAAE;CAGnC"}
@@ -1,41 +1,54 @@
1
1
  /**
2
- * Agent/Blueprint File Format Registry
2
+ * Agent file-format registry — the ONE named source for the formats an agent reads or writes.
3
3
  *
4
- * Handles file formats specific to agent/blueprint operations.
5
- * Maps AppsBlueprint_FileFormat to extensions and MIME types.
4
+ * This vocabulary used to exist twice: as `AppsBlueprint_FileFormat` / `AppsBlueprint_FileMimes` in
5
+ * `@wildo-ai/saas-models`, and as string literals here that a comment said were kept in step "to
6
+ * avoid circular dependencies". The duplication was the tell that the enum sat in the wrong
7
+ * package: `saas-models` depends on `zod-decorators`, never the reverse, so the lower layer is the
8
+ * only placement that can serve both without a cycle.
6
9
  *
7
- * NOTE: This registry uses string literals that match AppsBlueprint_FileFormat
8
- * and AppsBlueprint_FileMimes from @wildo-ai/saas-models to avoid circular
9
- * dependencies. The registry methods return/accept these string values which
10
- * are compatible with the enums defined in saas-models.
11
- */
12
- /**
13
- * Agent/Blueprint file format string literals.
14
- * These match AppsBlueprint_FileFormat enum values from @wildo-ai/saas-models.
10
+ * The `saas-models` copy was deleted on 2026-09-19 with the rest of the `apps-blueprint` tree, and
11
+ * `FlowsActors_Agent_OutputSpecSchema` now reaches this enum directly. Nothing about a file format
12
+ * was ever app-creation-specific; the name was.
13
+ *
14
+ * @see `.claude/rules/design-philosophy.md` — one named runtime source per closed vocabulary.
15
15
  */
16
- export const AgentFileFormat = {
17
- TEXT: 'text',
18
- TYPESCRIPT: 'typescript',
19
- TYPESCRIPT_JSX: 'typescript_react',
20
- MARKDOWN: 'markdown',
21
- JSON: 'json',
22
- YAML: 'yaml',
23
- };
24
16
  /**
25
- * Agent/Blueprint file MIME type string literals.
26
- * These match AppsBlueprint_FileMimes enum values from @wildo-ai/saas-models.
17
+ * Formats an agent may be asked to emit, and that the framework can map to an extension and a MIME
18
+ * type. Closed on purpose: a format belongs here only once the registry below can answer both
19
+ * mappings for it.
27
20
  */
28
- export const AgentFileMime = {
29
- TEXT_PLAIN: 'text/plain',
30
- MARKDOWN: 'text/markdown',
31
- JSON: 'application/json',
32
- TYPESCRIPT: 'application/typescript',
33
- TYPESCRIPT_JSX: 'application/typescript-jsx',
34
- YAML: 'application/yaml',
35
- };
21
+ export var AgentFileFormat;
22
+ (function (AgentFileFormat) {
23
+ /** Unstructured prose. The default when no format is declared. */
24
+ AgentFileFormat["TEXT"] = "text";
25
+ /** TypeScript source. `.ts` — module code, schemas, configuration. */
26
+ AgentFileFormat["TYPESCRIPT"] = "typescript";
27
+ /** TypeScript with JSX. `.tsx` — a component; distinct from TYPESCRIPT because the extension differs and a `.ts` file containing JSX does not compile. */
28
+ AgentFileFormat["TYPESCRIPT_JSX"] = "typescript_react";
29
+ /** Markdown. Documentation, prompts, authored prose an agent produces for a human. */
30
+ AgentFileFormat["MARKDOWN"] = "markdown";
31
+ /** JSON. Structured data an agent emits for a machine. */
32
+ AgentFileFormat["JSON"] = "json";
33
+ /** YAML. Configuration and manifests, where comments and readability matter. */
34
+ AgentFileFormat["YAML"] = "yaml";
35
+ })(AgentFileFormat || (AgentFileFormat = {}));
36
36
  /**
37
- * Maps AppsBlueprint_FileFormat to MIME types.
37
+ * The MIME type each {@link AgentFileFormat} is served and recognised as.
38
+ *
39
+ * Kept as a separate vocabulary rather than derived, because the reverse map below accepts
40
+ * ALTERNATIVES this enum deliberately does not name as canonical (`text/yaml` for YAML).
38
41
  */
42
+ export var AgentFileMime;
43
+ (function (AgentFileMime) {
44
+ AgentFileMime["TEXT_PLAIN"] = "text/plain";
45
+ AgentFileMime["MARKDOWN"] = "text/markdown";
46
+ AgentFileMime["JSON"] = "application/json";
47
+ AgentFileMime["TYPESCRIPT"] = "application/typescript";
48
+ AgentFileMime["TYPESCRIPT_JSX"] = "application/typescript-jsx";
49
+ AgentFileMime["YAML"] = "application/yaml";
50
+ })(AgentFileMime || (AgentFileMime = {}));
51
+ /** Canonical MIME type per format. */
39
52
  const FORMAT_TO_MIME = {
40
53
  [AgentFileFormat.TEXT]: AgentFileMime.TEXT_PLAIN,
41
54
  [AgentFileFormat.MARKDOWN]: AgentFileMime.MARKDOWN,
@@ -44,9 +57,7 @@ const FORMAT_TO_MIME = {
44
57
  [AgentFileFormat.TYPESCRIPT_JSX]: AgentFileMime.TYPESCRIPT_JSX,
45
58
  [AgentFileFormat.YAML]: AgentFileMime.YAML,
46
59
  };
47
- /**
48
- * Maps AppsBlueprint_FileFormat to extensions.
49
- */
60
+ /** Canonical file extension per format. */
50
61
  const FORMAT_TO_EXTENSION = {
51
62
  [AgentFileFormat.TEXT]: 'txt',
52
63
  [AgentFileFormat.MARKDOWN]: 'md',
@@ -55,9 +66,7 @@ const FORMAT_TO_EXTENSION = {
55
66
  [AgentFileFormat.TYPESCRIPT_JSX]: 'tsx',
56
67
  [AgentFileFormat.YAML]: 'yaml',
57
68
  };
58
- /**
59
- * Reverse mapping: extension to AppsBlueprint_FileFormat.
60
- */
69
+ /** Extension to format, including accepted alternatives. */
61
70
  const EXTENSION_TO_FORMAT = {
62
71
  'txt': AgentFileFormat.TEXT,
63
72
  'md': AgentFileFormat.MARKDOWN,
@@ -67,9 +76,7 @@ const EXTENSION_TO_FORMAT = {
67
76
  'yaml': AgentFileFormat.YAML,
68
77
  'yml': AgentFileFormat.YAML, // Alternative extension for YAML
69
78
  };
70
- /**
71
- * Reverse mapping: MIME type to AppsBlueprint_FileFormat.
72
- */
79
+ /** MIME type to format, including accepted alternatives. */
73
80
  const MIME_TO_FORMAT = {
74
81
  'text/plain': AgentFileFormat.TEXT,
75
82
  'text/markdown': AgentFileFormat.MARKDOWN,
@@ -84,28 +91,28 @@ const MIME_TO_FORMAT = {
84
91
  */
85
92
  export class AgentFileFormatRegistry {
86
93
  /**
87
- * Get MIME type for AppsBlueprint_FileFormat.
94
+ * Get the MIME type for a format.
88
95
  *
89
- * @param format - AppsBlueprint_FileFormat enum value (or compatible string)
96
+ * @param format - an `AgentFileFormat` value (or a compatible string)
90
97
  * @returns MIME type string
91
98
  */
92
99
  static getMimeType(format) {
93
100
  return FORMAT_TO_MIME[format] || '';
94
101
  }
95
102
  /**
96
- * Get extension for AppsBlueprint_FileFormat.
103
+ * Get the file extension for a format.
97
104
  *
98
- * @param format - AppsBlueprint_FileFormat enum value (or compatible string)
105
+ * @param format - an `AgentFileFormat` value (or a compatible string)
99
106
  * @returns Extension string (without dot)
100
107
  */
101
108
  static getExtension(format) {
102
109
  return FORMAT_TO_EXTENSION[format] || '';
103
110
  }
104
111
  /**
105
- * Get AppsBlueprint_FileFormat from extension.
112
+ * Get the format for a file extension.
106
113
  *
107
114
  * @param extension - File extension (without dot)
108
- * @returns Format string (compatible with AppsBlueprint_FileFormat) or undefined
115
+ * @returns an `AgentFileFormat` value as a string, or undefined
109
116
  */
110
117
  static getFormatFromExtension(extension) {
111
118
  if (!extension)
@@ -114,10 +121,10 @@ export class AgentFileFormatRegistry {
114
121
  return EXTENSION_TO_FORMAT[normalizedExt];
115
122
  }
116
123
  /**
117
- * Get AppsBlueprint_FileFormat from MIME type.
124
+ * Get the format for a MIME type.
118
125
  *
119
126
  * @param mimeType - MIME type string
120
- * @returns Format string (compatible with AppsBlueprint_FileFormat) or undefined
127
+ * @returns an `AgentFileFormat` value as a string, or undefined
121
128
  */
122
129
  static getFormatFromMimeType(mimeType) {
123
130
  if (!mimeType)
@@ -1 +1 @@
1
- {"version":3,"file":"agent-file-formats.js","sourceRoot":"","sources":["../../../../src/files/agent-file-formats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,kBAAkB;IAClC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,eAAe;IACzB,IAAI,EAAE,kBAAkB;IACxB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BAAqB,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,eAAe;QACpB,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * Agent/Blueprint File Format Registry\n * \n * Handles file formats specific to agent/blueprint operations.\n * Maps AppsBlueprint_FileFormat to extensions and MIME types.\n * \n * NOTE: This registry uses string literals that match AppsBlueprint_FileFormat\n * and AppsBlueprint_FileMimes from @wildo-ai/saas-models to avoid circular\n * dependencies. The registry methods return/accept these string values which\n * are compatible with the enums defined in saas-models.\n */\n\nimport mime from 'mime';\n\n/**\n * Agent/Blueprint file format string literals.\n * These match AppsBlueprint_FileFormat enum values from @wildo-ai/saas-models.\n */\nexport const AgentFileFormat = {\n TEXT: 'text',\n TYPESCRIPT: 'typescript',\n TYPESCRIPT_JSX: 'typescript_react',\n MARKDOWN: 'markdown',\n JSON: 'json',\n YAML: 'yaml',\n} as const;\n\n/**\n * Agent/Blueprint file MIME type string literals.\n * These match AppsBlueprint_FileMimes enum values from @wildo-ai/saas-models.\n */\nexport const AgentFileMime = {\n TEXT_PLAIN: 'text/plain',\n MARKDOWN: 'text/markdown',\n JSON: 'application/json',\n TYPESCRIPT: 'application/typescript',\n TYPESCRIPT_JSX: 'application/typescript-jsx',\n YAML: 'application/yaml',\n} as const;\n\n/**\n * Type for agent file format (compatible with AppsBlueprint_FileFormat).\n */\nexport type AgentFileFormatType = typeof AgentFileFormat[keyof typeof AgentFileFormat];\n\n/**\n * Maps AppsBlueprint_FileFormat to MIME types.\n */\nconst FORMAT_TO_MIME: Record<string, string> = {\n [AgentFileFormat.TEXT]: AgentFileMime.TEXT_PLAIN,\n [AgentFileFormat.MARKDOWN]: AgentFileMime.MARKDOWN,\n [AgentFileFormat.JSON]: AgentFileMime.JSON,\n [AgentFileFormat.TYPESCRIPT]: AgentFileMime.TYPESCRIPT,\n [AgentFileFormat.TYPESCRIPT_JSX]: AgentFileMime.TYPESCRIPT_JSX,\n [AgentFileFormat.YAML]: AgentFileMime.YAML,\n};\n\n/**\n * Maps AppsBlueprint_FileFormat to extensions.\n */\nconst FORMAT_TO_EXTENSION: Record<string, string> = {\n [AgentFileFormat.TEXT]: 'txt',\n [AgentFileFormat.MARKDOWN]: 'md',\n [AgentFileFormat.JSON]: 'json',\n [AgentFileFormat.TYPESCRIPT]: 'ts',\n [AgentFileFormat.TYPESCRIPT_JSX]: 'tsx',\n [AgentFileFormat.YAML]: 'yaml',\n};\n\n/**\n * Reverse mapping: extension to AppsBlueprint_FileFormat.\n */\nconst EXTENSION_TO_FORMAT: Record<string, string> = {\n 'txt': AgentFileFormat.TEXT,\n 'md': AgentFileFormat.MARKDOWN,\n 'json': AgentFileFormat.JSON,\n 'ts': AgentFileFormat.TYPESCRIPT,\n 'tsx': AgentFileFormat.TYPESCRIPT_JSX,\n 'yaml': AgentFileFormat.YAML,\n 'yml': AgentFileFormat.YAML, // Alternative extension for YAML\n};\n\n/**\n * Reverse mapping: MIME type to AppsBlueprint_FileFormat.\n */\nconst MIME_TO_FORMAT: Record<string, string> = {\n 'text/plain': AgentFileFormat.TEXT,\n 'text/markdown': AgentFileFormat.MARKDOWN,\n 'application/json': AgentFileFormat.JSON,\n 'application/typescript': AgentFileFormat.TYPESCRIPT,\n 'application/typescript-jsx': AgentFileFormat.TYPESCRIPT_JSX,\n 'application/yaml': AgentFileFormat.YAML,\n 'text/yaml': AgentFileFormat.YAML, // Alternative MIME type\n};\n\n/**\n * Registry for agent/blueprint file formats.\n */\nexport class AgentFileFormatRegistry {\n /**\n * Get MIME type for AppsBlueprint_FileFormat.\n * \n * @param format - AppsBlueprint_FileFormat enum value (or compatible string)\n * @returns MIME type string\n */\n static getMimeType(format: string): string {\n return FORMAT_TO_MIME[format] || '';\n }\n \n /**\n * Get extension for AppsBlueprint_FileFormat.\n * \n * @param format - AppsBlueprint_FileFormat enum value (or compatible string)\n * @returns Extension string (without dot)\n */\n static getExtension(format: string): string {\n return FORMAT_TO_EXTENSION[format] || '';\n }\n \n /**\n * Get AppsBlueprint_FileFormat from extension.\n * \n * @param extension - File extension (without dot)\n * @returns Format string (compatible with AppsBlueprint_FileFormat) or undefined\n */\n static getFormatFromExtension(extension: string): string | undefined {\n if (!extension) return undefined;\n \n const normalizedExt = extension.toLowerCase().trim();\n return EXTENSION_TO_FORMAT[normalizedExt];\n }\n \n /**\n * Get AppsBlueprint_FileFormat from MIME type.\n * \n * @param mimeType - MIME type string\n * @returns Format string (compatible with AppsBlueprint_FileFormat) or undefined\n */\n static getFormatFromMimeType(mimeType: string): string | undefined {\n if (!mimeType) return undefined;\n \n const normalizedMime = mimeType.toLowerCase().trim();\n return MIME_TO_FORMAT[normalizedMime];\n }\n \n /**\n * Check if extension is an agent file format.\n * \n * @param extension - File extension (without dot)\n * @returns true if extension is an agent format\n */\n static isAgentFormat(extension: string): boolean {\n return this.getFormatFromExtension(extension) !== undefined;\n }\n \n /**\n * Check if MIME type is an agent file format.\n * \n * @param mimeType - MIME type string\n * @returns true if MIME type is an agent format\n */\n static isAgentMimeType(mimeType: string): boolean {\n return this.getFormatFromMimeType(mimeType) !== undefined;\n }\n \n /**\n * Get all agent format extensions.\n * \n * @returns Array of extension strings\n */\n static getAllExtensions(): string[] {\n return Object.values(FORMAT_TO_EXTENSION);\n }\n \n /**\n * Get all agent format MIME types.\n * \n * @returns Array of MIME type strings\n */\n static getAllMimeTypes(): string[] {\n return Object.values(FORMAT_TO_MIME);\n }\n}\n"]}
1
+ {"version":3,"file":"agent-file-formats.js","sourceRoot":"","sources":["../../../../src/files/agent-file-formats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,e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BAAqB,CAAC,QAAgB;QAC3C,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAEhC,MAAM,cAAc,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QACrD,OAAO,cAAc,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,SAAiB;QACpC,OAAO,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,QAAgB;QACrC,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,eAAe;QACpB,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * Agent file-format registry — the ONE named source for the formats an agent reads or writes.\n *\n * This vocabulary used to exist twice: as `AppsBlueprint_FileFormat` / `AppsBlueprint_FileMimes` in\n * `@wildo-ai/saas-models`, and as string literals here that a comment said were kept in step \"to\n * avoid circular dependencies\". The duplication was the tell that the enum sat in the wrong\n * package: `saas-models` depends on `zod-decorators`, never the reverse, so the lower layer is the\n * only placement that can serve both without a cycle.\n *\n * The `saas-models` copy was deleted on 2026-09-19 with the rest of the `apps-blueprint` tree, and\n * `FlowsActors_Agent_OutputSpecSchema` now reaches this enum directly. Nothing about a file format\n * was ever app-creation-specific; the name was.\n *\n * @see `.claude/rules/design-philosophy.md` — one named runtime source per closed vocabulary.\n */\n\nimport mime from 'mime';\n\n/**\n * Formats an agent may be asked to emit, and that the framework can map to an extension and a MIME\n * type. Closed on purpose: a format belongs here only once the registry below can answer both\n * mappings for it.\n */\nexport enum AgentFileFormat {\n /** Unstructured prose. The default when no format is declared. */\n TEXT = 'text',\n /** TypeScript source. `.ts` — module code, schemas, configuration. */\n TYPESCRIPT = 'typescript',\n /** TypeScript with JSX. `.tsx` — a component; distinct from TYPESCRIPT because the extension differs and a `.ts` file containing JSX does not compile. */\n TYPESCRIPT_JSX = 'typescript_react',\n /** Markdown. Documentation, prompts, authored prose an agent produces for a human. */\n MARKDOWN = 'markdown',\n /** JSON. Structured data an agent emits for a machine. */\n JSON = 'json',\n /** YAML. Configuration and manifests, where comments and readability matter. */\n YAML = 'yaml',\n}\n\n/**\n * The MIME type each {@link AgentFileFormat} is served and recognised as.\n *\n * Kept as a separate vocabulary rather than derived, because the reverse map below accepts\n * ALTERNATIVES this enum deliberately does not name as canonical (`text/yaml` for YAML).\n */\nexport enum AgentFileMime {\n TEXT_PLAIN = 'text/plain',\n MARKDOWN = 'text/markdown',\n JSON = 'application/json',\n TYPESCRIPT = 'application/typescript',\n TYPESCRIPT_JSX = 'application/typescript-jsx',\n YAML = 'application/yaml',\n}\n\n/**\n * The format union, kept as a named alias because callers that hold a plain `string` from a\n * registry lookup need something to widen to.\n */\nexport type AgentFileFormatType = `${AgentFileFormat}`;\n\n/** Canonical MIME type per format. */\nconst FORMAT_TO_MIME: Record<string, string> = {\n [AgentFileFormat.TEXT]: AgentFileMime.TEXT_PLAIN,\n [AgentFileFormat.MARKDOWN]: AgentFileMime.MARKDOWN,\n [AgentFileFormat.JSON]: AgentFileMime.JSON,\n [AgentFileFormat.TYPESCRIPT]: AgentFileMime.TYPESCRIPT,\n [AgentFileFormat.TYPESCRIPT_JSX]: AgentFileMime.TYPESCRIPT_JSX,\n [AgentFileFormat.YAML]: AgentFileMime.YAML,\n};\n\n/** Canonical file extension per format. */\nconst FORMAT_TO_EXTENSION: Record<string, string> = {\n [AgentFileFormat.TEXT]: 'txt',\n [AgentFileFormat.MARKDOWN]: 'md',\n [AgentFileFormat.JSON]: 'json',\n [AgentFileFormat.TYPESCRIPT]: 'ts',\n [AgentFileFormat.TYPESCRIPT_JSX]: 'tsx',\n [AgentFileFormat.YAML]: 'yaml',\n};\n\n/** Extension to format, including accepted alternatives. */\nconst EXTENSION_TO_FORMAT: Record<string, string> = {\n 'txt': AgentFileFormat.TEXT,\n 'md': AgentFileFormat.MARKDOWN,\n 'json': AgentFileFormat.JSON,\n 'ts': AgentFileFormat.TYPESCRIPT,\n 'tsx': AgentFileFormat.TYPESCRIPT_JSX,\n 'yaml': AgentFileFormat.YAML,\n 'yml': AgentFileFormat.YAML, // Alternative extension for YAML\n};\n\n/** MIME type to format, including accepted alternatives. */\nconst MIME_TO_FORMAT: Record<string, string> = {\n 'text/plain': AgentFileFormat.TEXT,\n 'text/markdown': AgentFileFormat.MARKDOWN,\n 'application/json': AgentFileFormat.JSON,\n 'application/typescript': AgentFileFormat.TYPESCRIPT,\n 'application/typescript-jsx': AgentFileFormat.TYPESCRIPT_JSX,\n 'application/yaml': AgentFileFormat.YAML,\n 'text/yaml': AgentFileFormat.YAML, // Alternative MIME type\n};\n\n/**\n * Registry for agent/blueprint file formats.\n */\nexport class AgentFileFormatRegistry {\n /**\n * Get the MIME type for a format.\n * \n * @param format - an `AgentFileFormat` value (or a compatible string)\n * @returns MIME type string\n */\n static getMimeType(format: string): string {\n return FORMAT_TO_MIME[format] || '';\n }\n \n /**\n * Get the file extension for a format.\n * \n * @param format - an `AgentFileFormat` value (or a compatible string)\n * @returns Extension string (without dot)\n */\n static getExtension(format: string): string {\n return FORMAT_TO_EXTENSION[format] || '';\n }\n \n /**\n * Get the format for a file extension.\n * \n * @param extension - File extension (without dot)\n * @returns an `AgentFileFormat` value as a string, or undefined\n */\n static getFormatFromExtension(extension: string): string | undefined {\n if (!extension) return undefined;\n \n const normalizedExt = extension.toLowerCase().trim();\n return EXTENSION_TO_FORMAT[normalizedExt];\n }\n \n /**\n * Get the format for a MIME type.\n * \n * @param mimeType - MIME type string\n * @returns an `AgentFileFormat` value as a string, or undefined\n */\n static getFormatFromMimeType(mimeType: string): string | undefined {\n if (!mimeType) return undefined;\n \n const normalizedMime = mimeType.toLowerCase().trim();\n return MIME_TO_FORMAT[normalizedMime];\n }\n \n /**\n * Check if extension is an agent file format.\n * \n * @param extension - File extension (without dot)\n * @returns true if extension is an agent format\n */\n static isAgentFormat(extension: string): boolean {\n return this.getFormatFromExtension(extension) !== undefined;\n }\n \n /**\n * Check if MIME type is an agent file format.\n * \n * @param mimeType - MIME type string\n * @returns true if MIME type is an agent format\n */\n static isAgentMimeType(mimeType: string): boolean {\n return this.getFormatFromMimeType(mimeType) !== undefined;\n }\n \n /**\n * Get all agent format extensions.\n * \n * @returns Array of extension strings\n */\n static getAllExtensions(): string[] {\n return Object.values(FORMAT_TO_EXTENSION);\n }\n \n /**\n * Get all agent format MIME types.\n * \n * @returns Array of MIME type strings\n */\n static getAllMimeTypes(): string[] {\n return Object.values(FORMAT_TO_MIME);\n }\n}\n"]}
@@ -7,7 +7,7 @@
7
7
  import { FileNature } from '../zod-decorators.types';
8
8
  /**
9
9
  * Result type for format type detection.
10
- * format is a string compatible with AppsBlueprint_FileFormat enum.
10
+ * format is a string compatible with the `AgentFileFormat` enum.
11
11
  */
12
12
  export type FormatTypeResult = {
13
13
  type: 'nature';
@@ -43,7 +43,7 @@ export declare class UnifiedFileFormatRegistry {
43
43
  */
44
44
  static getExtensions(mimeType: string): string[];
45
45
  /**
46
- * Get format type (FileNature or AppsBlueprint_FileFormat) from extension.
46
+ * Get format type (FileNature or `AgentFileFormat`) from extension.
47
47
  *
48
48
  * @param extension - File extension (without dot)
49
49
  * @returns FormatTypeResult indicating whether it's a nature or agent format
@@ -61,7 +61,7 @@ export class UnifiedFileFormatRegistry {
61
61
  return FileMimeTypeRegistry.getExtensions(mimeType);
62
62
  }
63
63
  /**
64
- * Get format type (FileNature or AppsBlueprint_FileFormat) from extension.
64
+ * Get format type (FileNature or `AgentFileFormat`) from extension.
65
65
  *
66
66
  * @param extension - File extension (without dot)
67
67
  * @returns FormatTypeResult indicating whether it's a nature or agent format
@@ -1 +1 @@
1
- {"version":3,"file":"unified-registry.js","sourceRoot":"","sources":["../../../../src/files/unified-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAW/D;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpC;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAgB;QACtC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,OAAO,KAAK,CAAC,CAAC,IAAI,OAAO,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,EAAE,CAAC;QACjE,OAAO,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,SAAiB;QAClC,IAAI,CAAC,SAAS;YAAE,OAAO,SAAS,CAAC;QAEjC,4CAA4C;QAC5C,MAAM,WAAW,GAAG,uBAAuB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAC9E,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,uBAAuB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAC1D,CAAC;QAED,qCAAqC;QACrC,OAAO,oBAAoB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,CAAC,QAAgB;QACnC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QAEzB,4BAA4B;QAC5B,MAAM,WAAW,GAAG,uBAAuB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAA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;QACjC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,MAAkB;QAC9C,OAAO,oBAAoB,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,MAAkB;QAC7C,OAAO,oBAAoB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["/**\n * Unified File Format Registry\n * \n * Unified registry that handles both general files and agent/blueprint formats.\n * Provides a single API for all file format operations.\n */\n\nimport { FileNature } from '../zod-decorators.types';\nimport { FileMimeTypeRegistry } from './mime-registry';\nimport { AgentFileFormatRegistry } from './agent-file-formats';\n\n/**\n * Result type for format type detection.\n * format is a string compatible with AppsBlueprint_FileFormat enum.\n */\nexport type FormatTypeResult =\n | { type: 'nature'; nature: FileNature }\n | { type: 'agent'; format: string } // Compatible with AppsBlueprint_FileFormat\n | undefined;\n\n/**\n * Unified registry for all file formats (general + agent).\n */\nexport class UnifiedFileFormatRegistry {\n /**\n * Extract file extension from filename (without dot, lowercase).\n * \n * @param filename - Full filename or path\n * @returns File extension (without dot) or empty string if not found\n */\n static getFileExtension(filename: string): string {\n if (!filename) return '';\n const lastDot = filename.lastIndexOf('.');\n if (lastDot === -1 || lastDot === filename.length - 1) return '';\n return filename.substring(lastDot + 1).toLowerCase();\n }\n\n /**\n * Get MIME type from extension (works for both general files and agent formats).\n * \n * @param extension - File extension (without dot)\n * @returns MIME type string or undefined if not found\n */\n static getMimeType(extension: string): string | undefined {\n if (!extension) return undefined;\n \n // Check agent formats first (more specific)\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n return AgentFileFormatRegistry.getMimeType(agentFormat);\n }\n \n // Fall back to general file registry\n return FileMimeTypeRegistry.getMimeType(extension);\n }\n \n /**\n * Get all extensions for a MIME type.\n * Works for both general files and agent formats.\n * \n * @param mimeType - MIME type string\n * @returns Array of extensions (without dots)\n */\n static getExtensions(mimeType: string): string[] {\n if (!mimeType) return [];\n \n // Check agent formats first\n const agentFormat = AgentFileFormatRegistry.getFormatFromMimeType(mimeType);\n if (agentFormat) {\n const ext = AgentFileFormatRegistry.getExtension(agentFormat);\n return ext ? [ext] : [];\n }\n \n // Fall back to general file registry\n return FileMimeTypeRegistry.getExtensions(mimeType);\n }\n\n /**\n * Get format type (FileNature or AppsBlueprint_FileFormat) from extension.\n * \n * @param extension - File extension (without dot)\n * @returns FormatTypeResult indicating whether it's a nature or agent format\n */\n static getFormatType(extension: string): FormatTypeResult {\n if (!extension) return undefined;\n \n // Check agent formats first (more specific)\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n return { type: 'agent', format: agentFormat };\n }\n \n // Check general file nature\n const nature = FileMimeTypeRegistry.getNatureFromExtension(extension);\n if (nature) {\n return { type: 'nature', nature };\n }\n \n return undefined;\n }\n \n /**\n * Get format type from extension (alias for getFormatType for consistency).\n * \n * @param extension - File extension (without dot)\n * @returns FormatTypeResult indicating whether it's a nature or agent format\n */\n static getFormatTypeFromExtension(extension: string): FormatTypeResult {\n return this.getFormatType(extension);\n }\n\n /**\n * Get format type from MIME type.\n * \n * @param mimeType - MIME type string\n * @returns FormatTypeResult indicating whether it's a nature or agent format\n */\n static getFormatTypeFromMimeType(mimeType: string): FormatTypeResult {\n if (!mimeType) return undefined;\n \n // Check agent formats first (more specific)\n const agentFormat = AgentFileFormatRegistry.getFormatFromMimeType(mimeType);\n if (agentFormat) {\n return { type: 'agent', format: agentFormat };\n }\n \n // Check general file nature\n const nature = FileMimeTypeRegistry.getNatureFromMimeType(mimeType);\n if (nature) {\n return { type: 'nature', nature };\n }\n \n return undefined;\n }\n \n /**\n * Check if file is an agent/blueprint format.\n * \n * @param extension - File extension (without dot)\n * @returns true if extension is an agent format\n */\n static isAgentFormat(extension: string): boolean {\n return AgentFileFormatRegistry.isAgentFormat(extension);\n }\n \n /**\n * Check if MIME type is an agent/blueprint format.\n * \n * @param mimeType - MIME type string\n * @returns true if MIME type is an agent format\n */\n static isAgentMimeType(mimeType: string): boolean {\n return AgentFileFormatRegistry.isAgentMimeType(mimeType);\n }\n \n /**\n * Validate that extension matches MIME type.\n * Works for both general files and agent formats.\n * \n * @param extension - File extension (without dot)\n * @param mimeType - MIME type string\n * @returns true if extension matches MIME type\n */\n static validateExtensionMimeMatch(extension: string, mimeType: string): boolean {\n if (!extension || !mimeType) return false;\n \n // Check agent formats first\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n const expectedMime = AgentFileFormatRegistry.getMimeType(agentFormat);\n return expectedMime === mimeType;\n }\n \n // Fall back to general file validation\n return FileMimeTypeRegistry.validateExtensionMimeMatch(extension, mimeType);\n }\n \n /**\n * Normalize extension to canonical format name.\n * Works for both general files and agent formats.\n * \n * @param extension - File extension (without dot)\n * @returns Normalized format name\n */\n static normalizeExtension(extension: string): string {\n if (!extension) return extension;\n \n // Check if it's an agent format\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n // For agent formats, return the format name directly\n return agentFormat;\n }\n \n // Use general file normalization\n return FileMimeTypeRegistry.normalizeExtension(extension);\n }\n \n /**\n * Get all extensions for a FileNature.\n * \n * @param nature - FileNature enum value\n * @returns Array of extensions (without dots)\n */\n static getExtensionsForNature(nature: FileNature): string[] {\n return FileMimeTypeRegistry.getExtensionsForNature(nature);\n }\n \n /**\n * Get all MIME types for a FileNature.\n * \n * @param nature - FileNature enum value\n * @returns Array of MIME type strings\n */\n static getMimeTypesForNature(nature: FileNature): string[] {\n return FileMimeTypeRegistry.getMimeTypesForNature(nature);\n }\n}\n"]}
1
+ {"version":3,"file":"unified-registry.js","sourceRoot":"","sources":["../../../../src/files/unified-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE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CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,MAAkB;QAC7C,OAAO,oBAAoB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["/**\n * Unified File Format Registry\n * \n * Unified registry that handles both general files and agent/blueprint formats.\n * Provides a single API for all file format operations.\n */\n\nimport { FileNature } from '../zod-decorators.types';\nimport { FileMimeTypeRegistry } from './mime-registry';\nimport { AgentFileFormatRegistry } from './agent-file-formats';\n\n/**\n * Result type for format type detection.\n * format is a string compatible with the `AgentFileFormat` enum.\n */\nexport type FormatTypeResult =\n | { type: 'nature'; nature: FileNature }\n | { type: 'agent'; format: string } // Compatible with `AgentFileFormat`\n | undefined;\n\n/**\n * Unified registry for all file formats (general + agent).\n */\nexport class UnifiedFileFormatRegistry {\n /**\n * Extract file extension from filename (without dot, lowercase).\n * \n * @param filename - Full filename or path\n * @returns File extension (without dot) or empty string if not found\n */\n static getFileExtension(filename: string): string {\n if (!filename) return '';\n const lastDot = filename.lastIndexOf('.');\n if (lastDot === -1 || lastDot === filename.length - 1) return '';\n return filename.substring(lastDot + 1).toLowerCase();\n }\n\n /**\n * Get MIME type from extension (works for both general files and agent formats).\n * \n * @param extension - File extension (without dot)\n * @returns MIME type string or undefined if not found\n */\n static getMimeType(extension: string): string | undefined {\n if (!extension) return undefined;\n \n // Check agent formats first (more specific)\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n return AgentFileFormatRegistry.getMimeType(agentFormat);\n }\n \n // Fall back to general file registry\n return FileMimeTypeRegistry.getMimeType(extension);\n }\n \n /**\n * Get all extensions for a MIME type.\n * Works for both general files and agent formats.\n * \n * @param mimeType - MIME type string\n * @returns Array of extensions (without dots)\n */\n static getExtensions(mimeType: string): string[] {\n if (!mimeType) return [];\n \n // Check agent formats first\n const agentFormat = AgentFileFormatRegistry.getFormatFromMimeType(mimeType);\n if (agentFormat) {\n const ext = AgentFileFormatRegistry.getExtension(agentFormat);\n return ext ? [ext] : [];\n }\n \n // Fall back to general file registry\n return FileMimeTypeRegistry.getExtensions(mimeType);\n }\n\n /**\n * Get format type (FileNature or `AgentFileFormat`) from extension.\n * \n * @param extension - File extension (without dot)\n * @returns FormatTypeResult indicating whether it's a nature or agent format\n */\n static getFormatType(extension: string): FormatTypeResult {\n if (!extension) return undefined;\n \n // Check agent formats first (more specific)\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n return { type: 'agent', format: agentFormat };\n }\n \n // Check general file nature\n const nature = FileMimeTypeRegistry.getNatureFromExtension(extension);\n if (nature) {\n return { type: 'nature', nature };\n }\n \n return undefined;\n }\n \n /**\n * Get format type from extension (alias for getFormatType for consistency).\n * \n * @param extension - File extension (without dot)\n * @returns FormatTypeResult indicating whether it's a nature or agent format\n */\n static getFormatTypeFromExtension(extension: string): FormatTypeResult {\n return this.getFormatType(extension);\n }\n\n /**\n * Get format type from MIME type.\n * \n * @param mimeType - MIME type string\n * @returns FormatTypeResult indicating whether it's a nature or agent format\n */\n static getFormatTypeFromMimeType(mimeType: string): FormatTypeResult {\n if (!mimeType) return undefined;\n \n // Check agent formats first (more specific)\n const agentFormat = AgentFileFormatRegistry.getFormatFromMimeType(mimeType);\n if (agentFormat) {\n return { type: 'agent', format: agentFormat };\n }\n \n // Check general file nature\n const nature = FileMimeTypeRegistry.getNatureFromMimeType(mimeType);\n if (nature) {\n return { type: 'nature', nature };\n }\n \n return undefined;\n }\n \n /**\n * Check if file is an agent/blueprint format.\n * \n * @param extension - File extension (without dot)\n * @returns true if extension is an agent format\n */\n static isAgentFormat(extension: string): boolean {\n return AgentFileFormatRegistry.isAgentFormat(extension);\n }\n \n /**\n * Check if MIME type is an agent/blueprint format.\n * \n * @param mimeType - MIME type string\n * @returns true if MIME type is an agent format\n */\n static isAgentMimeType(mimeType: string): boolean {\n return AgentFileFormatRegistry.isAgentMimeType(mimeType);\n }\n \n /**\n * Validate that extension matches MIME type.\n * Works for both general files and agent formats.\n * \n * @param extension - File extension (without dot)\n * @param mimeType - MIME type string\n * @returns true if extension matches MIME type\n */\n static validateExtensionMimeMatch(extension: string, mimeType: string): boolean {\n if (!extension || !mimeType) return false;\n \n // Check agent formats first\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n const expectedMime = AgentFileFormatRegistry.getMimeType(agentFormat);\n return expectedMime === mimeType;\n }\n \n // Fall back to general file validation\n return FileMimeTypeRegistry.validateExtensionMimeMatch(extension, mimeType);\n }\n \n /**\n * Normalize extension to canonical format name.\n * Works for both general files and agent formats.\n * \n * @param extension - File extension (without dot)\n * @returns Normalized format name\n */\n static normalizeExtension(extension: string): string {\n if (!extension) return extension;\n \n // Check if it's an agent format\n const agentFormat = AgentFileFormatRegistry.getFormatFromExtension(extension);\n if (agentFormat) {\n // For agent formats, return the format name directly\n return agentFormat;\n }\n \n // Use general file normalization\n return FileMimeTypeRegistry.normalizeExtension(extension);\n }\n \n /**\n * Get all extensions for a FileNature.\n * \n * @param nature - FileNature enum value\n * @returns Array of extensions (without dots)\n */\n static getExtensionsForNature(nature: FileNature): string[] {\n return FileMimeTypeRegistry.getExtensionsForNature(nature);\n }\n \n /**\n * Get all MIME types for a FileNature.\n * \n * @param nature - FileNature enum value\n * @returns Array of MIME type strings\n */\n static getMimeTypesForNature(nature: FileNature): string[] {\n return FileMimeTypeRegistry.getMimeTypesForNature(nature);\n }\n}\n"]}
@@ -8,6 +8,7 @@ export * from './zod-money';
8
8
  export * from './zod-bigdecimal';
9
9
  export * from './zod-duration';
10
10
  export * from './zod-phone';
11
+ export * from './zod-address';
11
12
  export * from './zod-code';
12
13
  export * from './zod-file';
13
14
  export * from './zod-versioned';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AAIzC;;;;;;GAMG"}
package/dist/esm/index.js CHANGED
@@ -23,6 +23,7 @@ export * from './zod-money.js';
23
23
  export * from './zod-bigdecimal.js';
24
24
  export * from './zod-duration.js';
25
25
  export * from './zod-phone.js';
26
+ export * from './zod-address.js';
26
27
  export * from './zod-code.js';
27
28
  export * from './zod-file.js';
28
29
  export * from './zod-versioned.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,uEAAuE;AACvE,4FAA4F;AAC5F,0FAA0F;AAC1F,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAE7B,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,kFAAkF;AAClF,mFAAmF;AACnF,kFAAkF;AAClF,yBAAyB,EAAE,CAAC;AAE5B,MAAM,UAAU,iBAAiB,CAAC,cAAwB,CAAC;IACzD,OAAO,yBAAyB,CAAC,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,cAAc,WAAW,CAAC;AAE1B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AAIzC;;;;;;GAMG","sourcesContent":["import { z } from 'zod';\nimport { ensureZodDecoratorsLoaded } from './zod.module-override';\nimport { installBigIntJsonEncoding } from './install-bigint-json-encoding';\n\n// CRITICAL: Apply decorators immediately when this module is imported.\n// This ensures z.string().isUnique() etc. work without needing to call initZodDecorators().\n// The bundler may tree-shake the call in zod.module-override.ts, so we duplicate it here.\nensureZodDecoratorsLoaded(z);\n\n// Install the type-level `bigint → decimal string` JSON encoding at the SAME\n// bootstrap. `z_money` (owned by this package) stores `amount` as a `bigint`,\n// which `JSON.stringify` cannot serialize (it has no `toJSON`, unlike `Date`).\n// Installing it here — the earliest point, before any schema or serializer runs —\n// makes every JSON boundary (res.json, socket.io, queue, redis, HMAC, third-party)\n// bigint-safe with no per-boundary opt-in. See `install-bigint-json-encoding.ts`.\ninstallBigIntJsonEncoding();\n\nexport function initZodDecorators(zodInstance: typeof z = z): typeof z {\n return ensureZodDecoratorsLoaded(zodInstance);\n}\n\nexport * from './commons';\n\nexport * from './install-bigint-json-encoding';\nexport * from './zod-color';\nexport * from './zod-range';\nexport * from './zod-money';\nexport * from './zod-bigdecimal';\nexport * from './zod-duration';\nexport * from './zod-phone';\nexport * from './zod-code';\nexport * from './zod-file';\nexport * from './zod-versioned';\nexport * from './currencies.shared.schemas';\nexport * from './zod-utils.shared';\nexport * from './zod-decorators.types';\nexport * from './zod.module-override';\nexport * from './files/file-extensions.enum';\nexport * from './files/extension-nature-map';\nexport * from './files/mime-registry';\nexport * from './files/agent-file-formats';\nexport * from './files/unified-registry';\n\n\n\n/**\n * Initialize Zod decorators for the current Zod instance.\n * Safe to call multiple times - will only apply decorators once.\n *\n * This function should be called early in your application startup,\n * especially when using custom-shared-lib or custom-backend-lib packages.\n */\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,uEAAuE;AACvE,4FAA4F;AAC5F,0FAA0F;AAC1F,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAE7B,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,kFAAkF;AAClF,mFAAmF;AACnF,kFAAkF;AAClF,yBAAyB,EAAE,CAAC;AAE5B,MAAM,UAAU,iBAAiB,CAAC,cAAwB,CAAC;IACzD,OAAO,yBAAyB,CAAC,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,cAAc,WAAW,CAAC;AAE1B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AAIzC;;;;;;GAMG","sourcesContent":["import { z } from 'zod';\nimport { ensureZodDecoratorsLoaded } from './zod.module-override';\nimport { installBigIntJsonEncoding } from './install-bigint-json-encoding';\n\n// CRITICAL: Apply decorators immediately when this module is imported.\n// This ensures z.string().isUnique() etc. work without needing to call initZodDecorators().\n// The bundler may tree-shake the call in zod.module-override.ts, so we duplicate it here.\nensureZodDecoratorsLoaded(z);\n\n// Install the type-level `bigint → decimal string` JSON encoding at the SAME\n// bootstrap. `z_money` (owned by this package) stores `amount` as a `bigint`,\n// which `JSON.stringify` cannot serialize (it has no `toJSON`, unlike `Date`).\n// Installing it here — the earliest point, before any schema or serializer runs —\n// makes every JSON boundary (res.json, socket.io, queue, redis, HMAC, third-party)\n// bigint-safe with no per-boundary opt-in. See `install-bigint-json-encoding.ts`.\ninstallBigIntJsonEncoding();\n\nexport function initZodDecorators(zodInstance: typeof z = z): typeof z {\n return ensureZodDecoratorsLoaded(zodInstance);\n}\n\nexport * from './commons';\n\nexport * from './install-bigint-json-encoding';\nexport * from './zod-color';\nexport * from './zod-range';\nexport * from './zod-money';\nexport * from './zod-bigdecimal';\nexport * from './zod-duration';\nexport * from './zod-phone';\nexport * from './zod-address';\nexport * from './zod-code';\nexport * from './zod-file';\nexport * from './zod-versioned';\nexport * from './currencies.shared.schemas';\nexport * from './zod-utils.shared';\nexport * from './zod-decorators.types';\nexport * from './zod.module-override';\nexport * from './files/file-extensions.enum';\nexport * from './files/extension-nature-map';\nexport * from './files/mime-registry';\nexport * from './files/agent-file-formats';\nexport * from './files/unified-registry';\n\n\n\n/**\n * Initialize Zod decorators for the current Zod instance.\n * Safe to call multiple times - will only apply decorators once.\n *\n * This function should be called early in your application startup,\n * especially when using custom-shared-lib or custom-backend-lib packages.\n */\n"]}
@@ -1,6 +1,17 @@
1
1
  /**
2
2
  * Public testing surface for @wildo-ai/zod-decorators.
3
3
  * Import from `@wildo-ai/zod-decorators/testing`.
4
+ *
5
+ * entrypoint-waiver: an AUDIENCE boundary, not a file alias. Folding these fixtures into the root
6
+ * barrel would put them in the production graph of every consumer — the root is `sideEffects`-marked
7
+ * and reaches every frontend bundle — so the subpath is what keeps a test-only surface out of it.
8
+ * Rule 3 counts re-exported FILES and cannot see that distinction; the sibling `/testing` surfaces on
9
+ * `saas-models` and `saas-frontend-lib` are the same shape. Growing a second file purely to satisfy
10
+ * the count was rejected: it would invent surface nobody asked for.
11
+ *
12
+ * The waiver also suppresses rule 1 (`root-barrel-overlap`) for this barrel, which is a real loss.
13
+ * `published-testing-surface.contract.test.ts` restores it: it asserts the root barrel publishes
14
+ * none of the symbols below, which is the overlap rule 1 would have caught.
4
15
  */
5
16
  export * from './testing/decorated-test-schemas';
6
17
  //# sourceMappingURL=testing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,kCAAkC,CAAC"}
@@ -1,6 +1,17 @@
1
1
  /**
2
2
  * Public testing surface for @wildo-ai/zod-decorators.
3
3
  * Import from `@wildo-ai/zod-decorators/testing`.
4
+ *
5
+ * entrypoint-waiver: an AUDIENCE boundary, not a file alias. Folding these fixtures into the root
6
+ * barrel would put them in the production graph of every consumer — the root is `sideEffects`-marked
7
+ * and reaches every frontend bundle — so the subpath is what keeps a test-only surface out of it.
8
+ * Rule 3 counts re-exported FILES and cannot see that distinction; the sibling `/testing` surfaces on
9
+ * `saas-models` and `saas-frontend-lib` are the same shape. Growing a second file purely to satisfy
10
+ * the count was rejected: it would invent surface nobody asked for.
11
+ *
12
+ * The waiver also suppresses rule 1 (`root-barrel-overlap`) for this barrel, which is a real loss.
13
+ * `published-testing-surface.contract.test.ts` restores it: it asserts the root barrel publishes
14
+ * none of the symbols below, which is the overlap rule 1 would have caught.
4
15
  */
5
16
  export * from './testing/decorated-test-schemas.js';
6
17
  //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,kCAAkC,CAAC","sourcesContent":["/**\n * Public testing surface for @wildo-ai/zod-decorators.\n * Import from `@wildo-ai/zod-decorators/testing`.\n */\nexport * from './testing/decorated-test-schemas';\n"]}
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,kCAAkC,CAAC","sourcesContent":["/**\n * Public testing surface for @wildo-ai/zod-decorators.\n * Import from `@wildo-ai/zod-decorators/testing`.\n *\n * entrypoint-waiver: an AUDIENCE boundary, not a file alias. Folding these fixtures into the root\n * barrel would put them in the production graph of every consumer — the root is `sideEffects`-marked\n * and reaches every frontend bundle — so the subpath is what keeps a test-only surface out of it.\n * Rule 3 counts re-exported FILES and cannot see that distinction; the sibling `/testing` surfaces on\n * `saas-models` and `saas-frontend-lib` are the same shape. Growing a second file purely to satisfy\n * the count was rejected: it would invent surface nobody asked for.\n *\n * The waiver also suppresses rule 1 (`root-barrel-overlap`) for this barrel, which is a real loss.\n * `published-testing-surface.contract.test.ts` restores it: it asserts the root barrel publishes\n * none of the symbols below, which is the overlap rule 1 would have caught.\n */\nexport * from './testing/decorated-test-schemas';\n"]}