bunsane 0.1.4 → 0.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.
package/core/App.ts CHANGED
@@ -386,7 +386,7 @@ export default class App {
386
386
 
387
387
  async start() {
388
388
  logger.info("Application Started");
389
- const port = parseInt(process.env.PORT || "3000");
389
+ const port = parseInt(process.env.APP_PORT || "3000");
390
390
  const server = Bun.serve({
391
391
  port: port,
392
392
  fetch: this.handleRequest.bind(this),
package/core/ArcheType.ts CHANGED
@@ -80,8 +80,29 @@ export function weaveAllArchetypes() {
80
80
  const archetypeSchemas = Array.from(allArchetypeZodObjects.values());
81
81
  const componentSchemas = Array.from(componentSchemaCache.values());
82
82
 
83
- // Combine both archetype and component schemas for weaving
84
- const allSchemas = [...archetypeSchemas, ...componentSchemas];
83
+ // Collect all unique Zod objects to avoid duplicates
84
+ const allZodObjects = new Map<string, any>();
85
+
86
+ function collectZodObjects(schema: any) {
87
+ if (schema && typeof schema === 'object' && schema._def?.typeName === 'ZodObject') {
88
+ const shape = schema._def.shape();
89
+ const typename = shape.__typename?._def?.value;
90
+ if (typename && !allZodObjects.has(typename)) {
91
+ allZodObjects.set(typename, schema);
92
+ }
93
+ for (const [key, value] of Object.entries(shape)) {
94
+ if (value instanceof ZodObject) {
95
+ collectZodObjects(value);
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ for (const schema of [...archetypeSchemas, ...componentSchemas]) {
102
+ collectZodObjects(schema);
103
+ }
104
+
105
+ const allSchemas = Array.from(allZodObjects.values());
85
106
 
86
107
  const schema = weave(ZodWeaver, ...allSchemas);
87
108
  let schemaString = printSchema(schema);
@@ -1082,7 +1103,7 @@ export class BaseArcheType {
1082
1103
  }
1083
1104
 
1084
1105
  // Weave archetype schema along with its component schemas
1085
- const schemasToWeave = [r, ...componentSchemasToWeave];
1106
+ const schemasToWeave = [r];
1086
1107
  const schema = weave(ZodWeaver, ...schemasToWeave);
1087
1108
  let graphqlSchemaString = printSchema(schema);
1088
1109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunsane",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "author": {
5
5
  "name": "yaaruu"
6
6
  },