@zodic/shared 0.0.162 → 0.0.164

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.
@@ -0,0 +1,59 @@
1
+ import { DurableObjectState } from '@cloudflare/workers-types';
2
+
3
+ export class ConceptNameDO {
4
+ state: DurableObjectState;
5
+ env: any;
6
+ names: { 'en-us': string[]; 'pt-br': string[] };
7
+
8
+ constructor(state: DurableObjectState, env: any) {
9
+ this.state = state;
10
+ this.env = env;
11
+ this.names = { 'en-us': [], 'pt-br': [] };
12
+ }
13
+
14
+ async fetch(request: Request): Promise<Response> {
15
+ const url = new URL(request.url);
16
+ const method = request.method;
17
+
18
+ if (method === 'GET' && url.pathname === '/names') {
19
+ await this.loadNames();
20
+ return new Response(JSON.stringify(this.names), {
21
+ headers: { 'Content-Type': 'application/json' },
22
+ });
23
+ }
24
+
25
+ if (method === 'POST' && url.pathname === '/add-name') {
26
+ const { language, name } = (await request.json()) as {
27
+ language: 'en-us' | 'pt-br';
28
+ name: string;
29
+ };
30
+
31
+ // ✅ Normalize language codes to match `generateBasicInfo`
32
+ if (!['en-us', 'pt-br'].includes(language)) {
33
+ return new Response('Invalid language', { status: 400 });
34
+ }
35
+
36
+ await this.addName(language, name);
37
+ return new Response('OK', { status: 200 });
38
+ }
39
+
40
+ return new Response('Not Found', { status: 404 });
41
+ }
42
+
43
+ async loadNames(): Promise<void> {
44
+ const stored = await this.state.storage.get<{
45
+ 'en-us': string[];
46
+ 'pt-br': string[];
47
+ }>('names');
48
+ if (stored) {
49
+ this.names = stored;
50
+ }
51
+ }
52
+
53
+ async addName(language: 'en-us' | 'pt-br', name: string): Promise<void> {
54
+ if (!this.names[language].includes(name)) {
55
+ this.names[language].push(name);
56
+ await this.state.storage.put('names', this.names);
57
+ }
58
+ }
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.162",
3
+ "version": "0.0.164",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Ai,
3
3
  D1Database,
4
+ DurableObject,
4
5
  KVNamespace,
5
6
  Queue,
6
7
  R2Bucket,
@@ -24,6 +25,7 @@ export type CentralBindings = {
24
25
  KV_CONCEPT_FAILURES: KVNamespace;
25
26
  KV_CONCEPT_NAMES: KVNamespace;
26
27
  CONCEPT_GENERATION_QUEUE: Queue;
28
+ CONCEPT_NAMES_DO: DurableObject;
27
29
 
28
30
  PROMPT_IMAGE_DESCRIBER: string;
29
31
  PROMPT_GENERATE_ARCHETYPE_BASIC_INFO: string;
@@ -112,6 +114,7 @@ export type BackendBindings = Env &
112
114
  | 'DEEPSEEK_API_KEY'
113
115
  | 'PROMPT_GENERATE_ARCHETYPE_BASIC_INFO'
114
116
  | 'TOGETHER_API_KEY'
117
+ | 'CONCEPT_NAMES_DO'
115
118
  >;
116
119
 
117
120
  export type BackendCtx = Context<
@@ -107,7 +107,7 @@ For the given combination, generate the following in both languages, ensuring th
107
107
  Rules & Formatting:
108
108
 
109
109
  • Do not mention zodiac signs or planets explicitly.
110
- • Do not mention the Scepter’s name in the description or poem.
110
+ • Do not mention the Scepter’s name in the description or poem. In the description, you can use "this Scepter" and similar unespecific terms.
111
111
  • Ensure both descriptions are structurally and emotionally equivalent.
112
112
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
113
113
  • Use rich, symbolic language while keeping it accessible and inspiring.
@@ -149,7 +149,7 @@ For the given combination, generate the following in both languages, ensuring th
149
149
  Rules & Formatting:
150
150
 
151
151
  • Do not mention zodiac signs or planets explicitly.
152
- • Do not mention the Ring’s name in the description or poem.
152
+ • Do not mention the Ring’s name in the description or poem. In the description, you can use "this Ring" and similar unespecific terms.
153
153
  • Ensure both descriptions are structurally and emotionally equivalent.
154
154
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
155
155
  • Use rich, symbolic language while keeping it accessible and inspiring.
@@ -189,7 +189,7 @@ For the given combination, generate the following in both languages, ensuring th
189
189
  Rules & Formatting:
190
190
 
191
191
  • Do not mention zodiac signs or planets explicitly.
192
- • Do not mention the Amulet’s name in the description or poem.
192
+ • Do not mention the Amulet’s name in the description or poem. In the description, you can use "this Amulet" and similar unespecific terms.
193
193
  • Ensure both descriptions are structurally and emotionally equivalent.
194
194
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
195
195
  • Use rich, symbolic language while keeping it accessible and inspiring.
@@ -216,7 +216,7 @@ A list of previously used names will be provided. The new name must be unique an
216
216
 
217
217
  For the given combination, generate the following in both languages, ensuring the content remains identical in meaning and tone except for the poem, which should be independently written in each language:
218
218
 
219
- 1. Name (Nome): Keep it sober and descriptive, focusing on the Lantern’s symbolic purpose. It should start with “The Lantern of…” in English and “A Lanterna de…” in Portuguese.
219
+ 1. Name (Nome): Keep it sober and descriptive, focusing on the Lantern’s symbolic purpose. It should start with “The Lantern of…” in English and “A Candeia de…” in Portuguese.
220
220
 
221
221
  2. Description (Descrição): Write a concise, grounded narrative that links the Lantern’s qualities to the traits of the zodiac combination. Emphasize themes of light, transformation, and introspection. Keep the Portuguese version faithful in tone and depth to the English version.
222
222
 
@@ -229,7 +229,7 @@ For the given combination, generate the following in both languages, ensuring th
229
229
  Rules & Formatting:
230
230
 
231
231
  • Do not mention zodiac signs or planets explicitly.
232
- • Do not mention the Lantern’s name in the description or poem.
232
+ • Do not mention the Lantern’s name in the description or poem. In the description, you can use "this Lantern" and similar unespecific terms.
233
233
  • Ensure both descriptions are structurally and emotionally equivalent.
234
234
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
235
235
  • Use rich, symbolic language while keeping it accessible and inspiring.
@@ -244,7 +244,7 @@ EN:
244
244
 
245
245
  PT:
246
246
 
247
- • Nome: A Lanterna de [Conceito Simbólico]
247
+ • Nome: A Candeia de [Conceito Simbólico]
248
248
  • Descrição: [Explicação concisa e bem fundamentada]
249
249
  • Passagem Poética:[4 poetic lines uniquely written in Portuguese]
250
250
  `;
@@ -269,7 +269,7 @@ For the given combination, generate the following in both languages, ensuring th
269
269
  Rules & Formatting:
270
270
 
271
271
  • Do not mention zodiac signs or planets explicitly.
272
- • Do not mention the Orb’s name in the description or poem.
272
+ • Do not mention the Orb’s name in the description or poem. In the description, you can use "this Orb" and similar unespecific terms.
273
273
  • Ensure both descriptions are structurally and emotionally equivalent.
274
274
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
275
275
  • Use rich, symbolic language while keeping it accessible and inspiring.