@zodic/shared 0.0.296 → 0.0.297

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.
@@ -92,6 +92,13 @@
92
92
  "when": 1743545371795,
93
93
  "tag": "0012_sudden_doctor_spectrum",
94
94
  "breakpoints": true
95
+ },
96
+ {
97
+ "idx": 13,
98
+ "version": "6",
99
+ "when": 1743645500734,
100
+ "tag": "0013_lean_frightful_four",
101
+ "breakpoints": true
95
102
  }
96
103
  ]
97
104
  }
package/db/schema.ts CHANGED
@@ -388,8 +388,10 @@ export const userArtifacts = sqliteTable(
388
388
  .references(() => artifacts.id, { onDelete: 'cascade' }),
389
389
  gender: text('gender').notNull(), // Gender of the user or chosen archetype
390
390
  archetypeIndex: text('archetype_index').notNull(), // Chosen archetype for the artifact
391
- archetypeDataId: text('archetype_data_id')
392
- .references(() => archetypesData.id, { onDelete: 'cascade' }), // New: References archetypesData.id, nullable
391
+ archetypeDataId: text('archetype_data_id').references(
392
+ () => archetypesData.id,
393
+ { onDelete: 'cascade' }
394
+ ), // New: References archetypesData.id, nullable
393
395
  postImageId: text('post_image_id'), // URL for the Instagram post image
394
396
  reelImageId: text('reel_image_id'), // URL for the Instagram reels/TikTok image
395
397
  postImageUrl: text('post_image_url'), // URL for the Instagram post image
@@ -437,6 +439,18 @@ export const archetypesData = sqliteTable(
437
439
  ]
438
440
  );
439
441
 
442
+ export const archetypeNameDumps = sqliteTable(
443
+ 'archetype_name_dumps',
444
+ {
445
+ id: text('id').primaryKey(), // combination
446
+ combination: text('combination').notNull(),
447
+ rawText: text('raw_text').notNull(),
448
+ parsedSuccessfully: integer('parsed_successfully').default(0),
449
+ createdAt: integer('created_at').default(sql`CURRENT_TIMESTAMP`),
450
+ },
451
+ () => []
452
+ );
453
+
440
454
  export const generations = sqliteTable(
441
455
  'generations',
442
456
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.296",
3
+ "version": "0.0.297",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -0,0 +1,22 @@
1
+ import { and, eq } from 'drizzle-orm';
2
+ import { DrizzleD1Database } from 'drizzle-orm/d1';
3
+ import { schema } from '..';
4
+
5
+ export async function isEnglishNameDuplicate(
6
+ name: string,
7
+ db: DrizzleD1Database
8
+ ): Promise<boolean> {
9
+ const result = await db
10
+ .select({ name: schema.archetypesData.name })
11
+ .from(schema.archetypesData)
12
+ .where(
13
+ and(
14
+ eq(schema.archetypesData.language, 'en-us'),
15
+ eq(schema.archetypesData.name, name)
16
+ )
17
+ )
18
+ .limit(1)
19
+ .execute();
20
+
21
+ return result.length > 0;
22
+ }