@liquidmetal-ai/raindrop 0.3.2 → 0.3.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@liquidmetal-ai/raindrop",
3
3
  "description": "CLI for the Raindrop platform",
4
- "version": "0.3.2",
4
+ "version": "0.3.4",
5
5
  "author": "bosgood",
6
6
  "bin": {
7
7
  "raindrop": "./bin/run.js"
@@ -110,4 +110,4 @@
110
110
  "types": "./dist/*.d.ts"
111
111
  }
112
112
  }
113
- }
113
+ }
@@ -16,31 +16,3 @@ datasource db {
16
16
  url = "https://example.com/non-existant-database/required-but-unused-variable"
17
17
  }
18
18
 
19
- model User {
20
- id Int @id @default(autoincrement())
21
- name String
22
- email String @unique
23
- createdAt DateTime @default(now())
24
- updatedAt DateTime @updatedAt
25
- addresses Address[]
26
- }
27
-
28
- model Address {
29
- id Int @id @default(autoincrement())
30
- street String
31
- city String
32
- state String?
33
- postalCode String
34
- country String
35
- type AddressType
36
- user User? @relation(fields: [userId], references: [id])
37
- userId Int?
38
- createdAt DateTime @default(now())
39
- updatedAt DateTime @updatedAt
40
- }
41
-
42
- enum AddressType {
43
- PRIMARY
44
- SECONDARY
45
- MAILING
46
- }
@@ -20,165 +20,16 @@ async function seed() {
20
20
 
21
21
  console.log('🌱 Creating Seed SQL');
22
22
 
23
- //clear out the db
24
- await db.deleteFrom('Address').execute();
25
- await db.deleteFrom('User').execute();
26
-
27
- const currentTime = new Date().toISOString();
28
-
29
- // Sample Users
30
- const usersData = [
31
- {
32
- name: 'Alice Johnson',
33
- email: 'alice@example.com',
34
- updatedAt: currentTime,
35
- },
36
- {
37
- name: 'Bob Smith',
38
- email: 'bob@example.com',
39
- updatedAt: currentTime,
40
- },
41
- {
42
- name: 'Carol Williams',
43
- email: 'carol@example.com',
44
- updatedAt: currentTime,
45
- },
46
- {
47
- name: 'David Lee',
48
- email: 'david@example.com',
49
- updatedAt: currentTime,
50
- },
51
- {
52
- name: 'Emma Garcia',
53
- email: 'emma@example.com',
54
- updatedAt: currentTime,
55
- },
56
- ];
57
-
58
- // Insert users and store their IDs
59
- const userIds: Record<string, number> = {};
60
-
61
- for (const userData of usersData) {
62
- const result = await db.insertInto('User').values(userData).returningAll().executeTakeFirst();
63
-
64
- if (result) {
65
- userIds[userData.email] = result.id;
66
- console.log(`Created user: ${userData.name} with ID: ${result.id}`);
67
- }
68
- }
69
-
70
- // Sample Addresses
71
- const addressesData = [
72
- {
73
- userId: userIds['alice@example.com']!,
74
- street: '123 Main St',
75
- city: 'San Francisco',
76
- state: 'CA',
77
- postalCode: '94105',
78
- country: 'USA',
79
- type: AddressType.PRIMARY,
80
- updatedAt: currentTime,
81
- },
82
- {
83
- userId: userIds['alice@example.com']!,
84
- street: '456 Market St',
85
- city: 'San Francisco',
86
- state: 'CA',
87
- postalCode: '94103',
88
- country: 'USA',
89
- type: AddressType.SECONDARY,
90
- updatedAt: currentTime,
91
- },
92
- {
93
- userId: userIds['bob@example.com']!,
94
- street: '789 Oak Rd',
95
- city: 'Austin',
96
- state: 'TX',
97
- postalCode: '78701',
98
- country: 'USA',
99
- type: AddressType.PRIMARY,
100
- updatedAt: currentTime,
101
- },
102
- {
103
- userId: userIds['carol@example.com']!,
104
- street: '101 Pine Ave',
105
- city: 'Seattle',
106
- state: 'WA',
107
- postalCode: '98101',
108
- country: 'USA',
109
- type: AddressType.PRIMARY,
110
- updatedAt: currentTime,
111
- },
112
- {
113
- userId: userIds['carol@example.com']!,
114
- street: 'PO Box 123',
115
- city: 'Seattle',
116
- state: 'WA',
117
- postalCode: '98102',
118
- country: 'USA',
119
- type: AddressType.MAILING,
120
- updatedAt: currentTime,
121
- },
122
- {
123
- userId: userIds['david@example.com']!,
124
- street: '42 Tech Blvd',
125
- city: 'Boston',
126
- state: 'MA',
127
- postalCode: '02108',
128
- country: 'USA',
129
- type: AddressType.PRIMARY,
130
- updatedAt: currentTime,
131
- },
132
- {
133
- userId: userIds['emma@example.com']!,
134
- street: '555 Maple Dr',
135
- city: 'Chicago',
136
- state: 'IL',
137
- postalCode: '60601',
138
- country: 'USA',
139
- type: AddressType.PRIMARY,
140
- updatedAt: currentTime,
141
- },
142
- {
143
- userId: userIds['emma@example.com']!,
144
- street: '777 Elm St',
145
- city: 'New York',
146
- state: 'NY',
147
- postalCode: '10001',
148
- country: 'USA',
149
- type: AddressType.SECONDARY,
150
- updatedAt: currentTime,
151
- },
152
- ];
153
-
154
- // Insert addresses
155
- for (const addressData of addressesData) {
156
- const result = await db.insertInto('Address').values(addressData).returningAll().executeTakeFirst();
157
- if (result) {
158
- console.log(`Created address: ${addressData.street} for user ID: ${addressData.userId}`);
159
- }
160
- }
23
+ //Seed Data goes here
161
24
 
162
25
  console.log('✅ Seed completed successfully!');
163
26
  console.log('🌱 Generating SQL');
164
- // Generate SQL for Users
165
- const users = await db.selectFrom('User').selectAll().execute();
166
- const userInserts = users
167
- .map((user) => {
168
- return `INSERT INTO User (id, name, email, updatedAt) VALUES (${user.id}, '${user.name.replace(/'/g, "''")}', '${user.email}', '${user.updatedAt}');`;
169
- })
170
- .join('\n');
27
+ //have the outcome of each dump data into string varables that you then concatenate into a single SQL file
28
+ const table1 = ''
29
+ const table2 = ''
171
30
 
172
- // Generate SQL for Addresses
173
- const addresses = await db.selectFrom('Address').selectAll().execute();
174
- const addressInserts = addresses
175
- .map((address) => {
176
- return `INSERT INTO Address (id, userId, street, city, state, postalCode, country, type, updatedAt) VALUES (${address.id}, ${address.userId}, '${address.street.replace(/'/g, "''")}', '${address.city.replace(/'/g, "''")}', '${address.state}', '${address.postalCode}', '${address.country}', '${address.type}', '${address.updatedAt}');`;
177
- })
178
- .join('\n');
179
-
180
- // Combine and log all SQL
181
- const allSql = `-- Users\n${userInserts}\n\n-- Addresses\n${addressInserts}`;
31
+ // Combine and log all SQL
32
+ const allSql = `-- table1\n${table1}\n\n-- table2\n${table2}`;
182
33
  //write to the db migrations folder as the last thing to update
183
34
  // Import filesystem module
184
35
 
@@ -190,7 +41,7 @@ async function seed() {
190
41
  .filter((file) => file.endsWith('.sql'))
191
42
  .sort()
192
43
  .pop();
193
-
44
+ // Keep this, as it is used to generate the SQL file
194
45
  if (lastMigrationFile) {
195
46
  // Generate a new migration filename with a higher number
196
47
  const lastFileNumber = parseInt(lastMigrationFile.split('-')[0] || '0');
@@ -11,11 +11,11 @@
11
11
  "test:watch": "vitest"
12
12
  },
13
13
  "devDependencies": {
14
- "shx": "^0.3.3",
14
+ "shx": "^0.4.0",
15
15
  "ts-node": "^10",
16
16
  "typescript-eslint": "^8.7.0",
17
17
  "typescript": "^5.0.4",
18
- "vitest": "^2.0.2"
18
+ "vitest": "^3.1.3"
19
19
  },
20
20
  "dependencies": {
21
21
  "@liquidmetal-ai/raindrop-framework": "^{{ raindropFrameworkVersion }}"