longcelot-sheet-db 0.1.2 → 0.1.3
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/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# 📦 longcelot-sheet-db
|
|
2
2
|
|
|
3
|
+
[](https://github.com/vannseavlong/longcelot-sheet-staging/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/longcelot-sheet-db)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
3
7
|
**Google Sheets-backed Staging Database for Node.js**
|
|
4
8
|
|
|
5
9
|
A schema-first, actor-aware database adapter that uses Google Sheets as the storage engine. Perfect for MVPs, prototypes, staging environments, and internal tools where cost and simplicity matter.
|
|
@@ -276,12 +280,7 @@ user-sheet-123
|
|
|
276
280
|
|
|
277
281
|
## 🎓 Complete Example
|
|
278
282
|
|
|
279
|
-
|
|
280
|
-
- 4 actors (admin, student, teacher, parent)
|
|
281
|
-
- 20+ schema definitions
|
|
282
|
-
- Authentication flow
|
|
283
|
-
- Role-based permissions
|
|
284
|
-
- CRUD operations
|
|
283
|
+
Coming Soon!
|
|
285
284
|
|
|
286
285
|
## 🔄 Migration Path
|
|
287
286
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AA4BA,wBAAsB,WAAW,kBA8GhC"}
|
|
@@ -8,8 +8,29 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
function printBanner() {
|
|
12
|
+
const c = chalk_1.default.hex('#05b5fb').bold;
|
|
13
|
+
const lines = [
|
|
14
|
+
'█ ██ █ █ ██ ███ ████ █ ██ ████',
|
|
15
|
+
'█ █ █ ██ █ █ █ █ █ █ █ █ ',
|
|
16
|
+
'█ █ █ █ ██ █ ██ █ ███ █ █ █ █ ',
|
|
17
|
+
'█ █ █ █ █ █ █ █ █ █ █ █ █ ',
|
|
18
|
+
'████ ██ █ █ ███ ███ ████ ████ ██ █ ',
|
|
19
|
+
'',
|
|
20
|
+
' ███ █ █ ████ ████ ████ ███ ███ ',
|
|
21
|
+
' █ █ █ █ █ █ █ █ █ █ ',
|
|
22
|
+
' ██ ████ ███ ███ █ █ █ ███ ',
|
|
23
|
+
' █ █ █ █ █ █ █ █ █ █ ',
|
|
24
|
+
' ███ █ █ ████ ████ █ ███ ███ ',
|
|
25
|
+
];
|
|
26
|
+
console.log();
|
|
27
|
+
lines.forEach((line) => console.log(' ' + c(line)));
|
|
28
|
+
console.log();
|
|
29
|
+
console.log(' ' + chalk_1.default.hex('#05b5fb')('Google Sheets-backed Staging Database Adapter'));
|
|
30
|
+
console.log();
|
|
31
|
+
}
|
|
11
32
|
async function initCommand() {
|
|
12
|
-
|
|
33
|
+
printBanner();
|
|
13
34
|
const answers = await inquirer_1.default.prompt([
|
|
14
35
|
{
|
|
15
36
|
type: 'input',
|
|
@@ -30,27 +51,6 @@ async function initCommand() {
|
|
|
30
51
|
default: 'admin,user',
|
|
31
52
|
filter: (input) => input.split(',').map((s) => s.trim()),
|
|
32
53
|
},
|
|
33
|
-
{
|
|
34
|
-
type: 'input',
|
|
35
|
-
name: 'googleClientId',
|
|
36
|
-
message: 'Google Client ID:',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
type: 'input',
|
|
40
|
-
name: 'googleClientSecret',
|
|
41
|
-
message: 'Google Client Secret:',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
type: 'input',
|
|
45
|
-
name: 'googleRedirectUri',
|
|
46
|
-
message: 'Google Redirect URI:',
|
|
47
|
-
default: 'http://localhost:3000/auth/callback',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: 'input',
|
|
51
|
-
name: 'adminSheetId',
|
|
52
|
-
message: 'Admin Sheet ID (leave empty to create later):',
|
|
53
|
-
},
|
|
54
54
|
]);
|
|
55
55
|
const configContent = `export default {
|
|
56
56
|
projectName: "${answers.projectName}",
|
|
@@ -58,10 +58,17 @@ async function initCommand() {
|
|
|
58
58
|
actors: ${JSON.stringify(answers.actors, null, 2)}
|
|
59
59
|
};
|
|
60
60
|
`;
|
|
61
|
-
const envContent =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const envContent = `# Google OAuth credentials
|
|
62
|
+
# Get these at: https://console.cloud.google.com/apis/credentials
|
|
63
|
+
GOOGLE_CLIENT_ID=
|
|
64
|
+
GOOGLE_CLIENT_SECRET=
|
|
65
|
+
GOOGLE_REDIRECT_URI=http://localhost:3000/auth/callback
|
|
66
|
+
|
|
67
|
+
# Your central admin Google Sheet ID
|
|
68
|
+
# Create a blank Google Sheet and paste the ID from its URL here
|
|
69
|
+
ADMIN_SHEET_ID=
|
|
70
|
+
|
|
71
|
+
# Super admin email (new user sheets will be shared with this account)
|
|
65
72
|
SUPER_ADMIN_EMAIL=${answers.superAdminEmail}
|
|
66
73
|
`;
|
|
67
74
|
fs_1.default.writeFileSync('sheet-db.config.ts', configContent);
|
|
@@ -109,14 +116,18 @@ export default defineTable({
|
|
|
109
116
|
}
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
|
-
console.log(chalk_1.default.green('✅ Project initialized
|
|
113
|
-
console.log(chalk_1.default.yellow('Created
|
|
114
|
-
console.log('
|
|
115
|
-
console.log('
|
|
116
|
-
console.log('
|
|
119
|
+
console.log(chalk_1.default.green('\n✅ Project initialized!\n'));
|
|
120
|
+
console.log(chalk_1.default.yellow('Created:'));
|
|
121
|
+
console.log(' ' + chalk_1.default.white('sheet-db.config.ts'));
|
|
122
|
+
console.log(' ' + chalk_1.default.white('.env'));
|
|
123
|
+
console.log(' ' + chalk_1.default.white('schemas/'));
|
|
117
124
|
console.log(chalk_1.default.cyan('\nNext steps:'));
|
|
118
|
-
console.log(' 1.
|
|
119
|
-
console.log('
|
|
120
|
-
console.log('
|
|
125
|
+
console.log(' 1. ' + chalk_1.default.white('Fill in your .env file:'));
|
|
126
|
+
console.log(' ' + chalk_1.default.gray('GOOGLE_CLIENT_ID=<your-client-id>'));
|
|
127
|
+
console.log(' ' + chalk_1.default.gray('GOOGLE_CLIENT_SECRET=<your-client-secret>'));
|
|
128
|
+
console.log(' ' + chalk_1.default.gray('ADMIN_SHEET_ID=<your-sheet-id>'));
|
|
129
|
+
console.log(' ' + chalk_1.default.dim('→ https://console.cloud.google.com/apis/credentials'));
|
|
130
|
+
console.log(' 2. ' + chalk_1.default.white('Generate tables: sheet-db generate <table-name>'));
|
|
131
|
+
console.log(' 3. ' + chalk_1.default.white('Sync to sheets: sheet-db sync\n'));
|
|
121
132
|
}
|
|
122
133
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":";;;;;AA4BA,kCA8GC;AA1ID,4CAAoB;AACpB,gDAAwB;AACxB,wDAAgC;AAChC,kDAA0B;AAE1B,SAAS,WAAW;IAClB,MAAM,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;IACpC,MAAM,KAAK,GAAG;QACZ,6CAA6C;QAC7C,8CAA8C;QAC9C,6CAA6C;QAC7C,6CAA6C;QAC7C,8CAA8C;QAC9C,EAAE;QACF,8CAA8C;QAC9C,8CAA8C;QAC9C,8CAA8C;QAC9C,8CAA8C;QAC9C,8CAA8C;KAC/C,CAAC;IAEF,OAAO,CAAC,GAAG,EAAE,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