fossyl 0.10.0 → 0.11.0
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/dist/index.js +17 -17
- package/dist/index.mjs +17 -17
- package/package.json +10 -2
package/dist/index.js
CHANGED
|
@@ -488,7 +488,7 @@ function generateDbTypes() {
|
|
|
488
488
|
|
|
489
489
|
// Ping table types
|
|
490
490
|
export interface PingTable {
|
|
491
|
-
id: Generated<
|
|
491
|
+
id: Generated<number>;
|
|
492
492
|
message: string;
|
|
493
493
|
created_by: string;
|
|
494
494
|
created_at: Generated<Date>;
|
|
@@ -522,7 +522,7 @@ export const migration = defineMigration({
|
|
|
522
522
|
async up(db) {
|
|
523
523
|
await db.schema
|
|
524
524
|
.createTable('ping')
|
|
525
|
-
.addColumn('id', '
|
|
525
|
+
.addColumn('id', 'integer', (col) => col.primaryKey().autoIncrement())
|
|
526
526
|
.addColumn('message', 'text', (col) => col.notNull())
|
|
527
527
|
.addColumn('created_by', 'text', (col) => col.notNull())
|
|
528
528
|
.addColumn('created_at', 'text', (col) =>
|
|
@@ -545,7 +545,7 @@ export const migration = defineMigration({
|
|
|
545
545
|
async up(db) {
|
|
546
546
|
await db.schema
|
|
547
547
|
.createTable('ping')
|
|
548
|
-
.addColumn('id', '
|
|
548
|
+
.addColumn('id', 'integer', (col) => col.primaryKey().autoIncrement())
|
|
549
549
|
.addColumn('message', 'varchar(255)', (col) => col.notNull())
|
|
550
550
|
.addColumn('created_by', 'varchar(255)', (col) => col.notNull())
|
|
551
551
|
.addColumn('created_at', 'timestamp', (col) =>
|
|
@@ -567,9 +567,7 @@ export const migration = defineMigration({
|
|
|
567
567
|
async up(db) {
|
|
568
568
|
await db.schema
|
|
569
569
|
.createTable('ping')
|
|
570
|
-
.addColumn('id', '
|
|
571
|
-
col.primaryKey().defaultTo(sql\`gen_random_uuid()\`)
|
|
572
|
-
)
|
|
570
|
+
.addColumn('id', 'serial', (col) => col.primaryKey())
|
|
573
571
|
.addColumn('message', 'varchar(255)', (col) => col.notNull())
|
|
574
572
|
.addColumn('created_by', 'varchar(255)', (col) => col.notNull())
|
|
575
573
|
.addColumn('created_at', 'timestamp', (col) =>
|
|
@@ -825,7 +823,7 @@ function generatePingService(_options) {
|
|
|
825
823
|
return `import * as pingRepo from '../repo/ping.repo';
|
|
826
824
|
|
|
827
825
|
export interface PingData {
|
|
828
|
-
id:
|
|
826
|
+
id: number;
|
|
829
827
|
message: string;
|
|
830
828
|
created_by: string;
|
|
831
829
|
created_at: Date;
|
|
@@ -901,7 +899,7 @@ export async function findById(id: string): Promise<Ping | undefined> {
|
|
|
901
899
|
const db = getTransaction<DB>();
|
|
902
900
|
return db
|
|
903
901
|
.selectFrom('ping')
|
|
904
|
-
.where('id', '=', id)
|
|
902
|
+
.where('id', '=', Number(id))
|
|
905
903
|
.selectAll()
|
|
906
904
|
.executeTakeFirst();
|
|
907
905
|
}
|
|
@@ -920,14 +918,14 @@ export async function update(id: string, data: PingUpdate): Promise<Ping> {
|
|
|
920
918
|
return db
|
|
921
919
|
.updateTable('ping')
|
|
922
920
|
.set(data)
|
|
923
|
-
.where('id', '=', id)
|
|
921
|
+
.where('id', '=', Number(id))
|
|
924
922
|
.returningAll()
|
|
925
923
|
.executeTakeFirstOrThrow();
|
|
926
924
|
}
|
|
927
925
|
|
|
928
926
|
export async function remove(id: string): Promise<void> {
|
|
929
927
|
const db = getTransaction<DB>();
|
|
930
|
-
await db.deleteFrom('ping').where('id', '=', id).execute();
|
|
928
|
+
await db.deleteFrom('ping').where('id', '=', Number(id)).execute();
|
|
931
929
|
}
|
|
932
930
|
`;
|
|
933
931
|
}
|
|
@@ -940,14 +938,15 @@ function generateByoPingRepo() {
|
|
|
940
938
|
*/
|
|
941
939
|
|
|
942
940
|
export interface Ping {
|
|
943
|
-
id:
|
|
941
|
+
id: number;
|
|
944
942
|
message: string;
|
|
945
943
|
created_by: string;
|
|
946
944
|
created_at: Date;
|
|
947
945
|
}
|
|
948
946
|
|
|
949
947
|
// In-memory store for demo purposes - replace with actual database
|
|
950
|
-
const pings: Map<
|
|
948
|
+
const pings: Map<number, Ping> = new Map();
|
|
949
|
+
let nextId = 1;
|
|
951
950
|
|
|
952
951
|
export async function findAll(limit: number, offset: number): Promise<Ping[]> {
|
|
953
952
|
// TODO: Replace with actual database query
|
|
@@ -957,13 +956,13 @@ export async function findAll(limit: number, offset: number): Promise<Ping[]> {
|
|
|
957
956
|
|
|
958
957
|
export async function findById(id: string): Promise<Ping | undefined> {
|
|
959
958
|
// TODO: Replace with actual database query
|
|
960
|
-
return pings.get(id);
|
|
959
|
+
return pings.get(Number(id));
|
|
961
960
|
}
|
|
962
961
|
|
|
963
962
|
export async function create(data: { message: string; created_by: string }): Promise<Ping> {
|
|
964
963
|
// TODO: Replace with actual database insert
|
|
965
964
|
const ping: Ping = {
|
|
966
|
-
id:
|
|
965
|
+
id: nextId++,
|
|
967
966
|
message: data.message,
|
|
968
967
|
created_by: data.created_by,
|
|
969
968
|
created_at: new Date(),
|
|
@@ -974,18 +973,19 @@ export async function create(data: { message: string; created_by: string }): Pro
|
|
|
974
973
|
|
|
975
974
|
export async function update(id: string, data: { message?: string }): Promise<Ping> {
|
|
976
975
|
// TODO: Replace with actual database update
|
|
977
|
-
const
|
|
976
|
+
const numId = Number(id);
|
|
977
|
+
const existing = pings.get(numId);
|
|
978
978
|
if (!existing) {
|
|
979
979
|
throw new Error('Not found');
|
|
980
980
|
}
|
|
981
981
|
const updated = { ...existing, ...data };
|
|
982
|
-
pings.set(
|
|
982
|
+
pings.set(numId, updated);
|
|
983
983
|
return updated;
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
export async function remove(id: string): Promise<void> {
|
|
987
987
|
// TODO: Replace with actual database delete
|
|
988
|
-
pings.delete(id);
|
|
988
|
+
pings.delete(Number(id));
|
|
989
989
|
}
|
|
990
990
|
`;
|
|
991
991
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -464,7 +464,7 @@ function generateDbTypes() {
|
|
|
464
464
|
|
|
465
465
|
// Ping table types
|
|
466
466
|
export interface PingTable {
|
|
467
|
-
id: Generated<
|
|
467
|
+
id: Generated<number>;
|
|
468
468
|
message: string;
|
|
469
469
|
created_by: string;
|
|
470
470
|
created_at: Generated<Date>;
|
|
@@ -498,7 +498,7 @@ export const migration = defineMigration({
|
|
|
498
498
|
async up(db) {
|
|
499
499
|
await db.schema
|
|
500
500
|
.createTable('ping')
|
|
501
|
-
.addColumn('id', '
|
|
501
|
+
.addColumn('id', 'integer', (col) => col.primaryKey().autoIncrement())
|
|
502
502
|
.addColumn('message', 'text', (col) => col.notNull())
|
|
503
503
|
.addColumn('created_by', 'text', (col) => col.notNull())
|
|
504
504
|
.addColumn('created_at', 'text', (col) =>
|
|
@@ -521,7 +521,7 @@ export const migration = defineMigration({
|
|
|
521
521
|
async up(db) {
|
|
522
522
|
await db.schema
|
|
523
523
|
.createTable('ping')
|
|
524
|
-
.addColumn('id', '
|
|
524
|
+
.addColumn('id', 'integer', (col) => col.primaryKey().autoIncrement())
|
|
525
525
|
.addColumn('message', 'varchar(255)', (col) => col.notNull())
|
|
526
526
|
.addColumn('created_by', 'varchar(255)', (col) => col.notNull())
|
|
527
527
|
.addColumn('created_at', 'timestamp', (col) =>
|
|
@@ -543,9 +543,7 @@ export const migration = defineMigration({
|
|
|
543
543
|
async up(db) {
|
|
544
544
|
await db.schema
|
|
545
545
|
.createTable('ping')
|
|
546
|
-
.addColumn('id', '
|
|
547
|
-
col.primaryKey().defaultTo(sql\`gen_random_uuid()\`)
|
|
548
|
-
)
|
|
546
|
+
.addColumn('id', 'serial', (col) => col.primaryKey())
|
|
549
547
|
.addColumn('message', 'varchar(255)', (col) => col.notNull())
|
|
550
548
|
.addColumn('created_by', 'varchar(255)', (col) => col.notNull())
|
|
551
549
|
.addColumn('created_at', 'timestamp', (col) =>
|
|
@@ -801,7 +799,7 @@ function generatePingService(_options) {
|
|
|
801
799
|
return `import * as pingRepo from '../repo/ping.repo';
|
|
802
800
|
|
|
803
801
|
export interface PingData {
|
|
804
|
-
id:
|
|
802
|
+
id: number;
|
|
805
803
|
message: string;
|
|
806
804
|
created_by: string;
|
|
807
805
|
created_at: Date;
|
|
@@ -877,7 +875,7 @@ export async function findById(id: string): Promise<Ping | undefined> {
|
|
|
877
875
|
const db = getTransaction<DB>();
|
|
878
876
|
return db
|
|
879
877
|
.selectFrom('ping')
|
|
880
|
-
.where('id', '=', id)
|
|
878
|
+
.where('id', '=', Number(id))
|
|
881
879
|
.selectAll()
|
|
882
880
|
.executeTakeFirst();
|
|
883
881
|
}
|
|
@@ -896,14 +894,14 @@ export async function update(id: string, data: PingUpdate): Promise<Ping> {
|
|
|
896
894
|
return db
|
|
897
895
|
.updateTable('ping')
|
|
898
896
|
.set(data)
|
|
899
|
-
.where('id', '=', id)
|
|
897
|
+
.where('id', '=', Number(id))
|
|
900
898
|
.returningAll()
|
|
901
899
|
.executeTakeFirstOrThrow();
|
|
902
900
|
}
|
|
903
901
|
|
|
904
902
|
export async function remove(id: string): Promise<void> {
|
|
905
903
|
const db = getTransaction<DB>();
|
|
906
|
-
await db.deleteFrom('ping').where('id', '=', id).execute();
|
|
904
|
+
await db.deleteFrom('ping').where('id', '=', Number(id)).execute();
|
|
907
905
|
}
|
|
908
906
|
`;
|
|
909
907
|
}
|
|
@@ -916,14 +914,15 @@ function generateByoPingRepo() {
|
|
|
916
914
|
*/
|
|
917
915
|
|
|
918
916
|
export interface Ping {
|
|
919
|
-
id:
|
|
917
|
+
id: number;
|
|
920
918
|
message: string;
|
|
921
919
|
created_by: string;
|
|
922
920
|
created_at: Date;
|
|
923
921
|
}
|
|
924
922
|
|
|
925
923
|
// In-memory store for demo purposes - replace with actual database
|
|
926
|
-
const pings: Map<
|
|
924
|
+
const pings: Map<number, Ping> = new Map();
|
|
925
|
+
let nextId = 1;
|
|
927
926
|
|
|
928
927
|
export async function findAll(limit: number, offset: number): Promise<Ping[]> {
|
|
929
928
|
// TODO: Replace with actual database query
|
|
@@ -933,13 +932,13 @@ export async function findAll(limit: number, offset: number): Promise<Ping[]> {
|
|
|
933
932
|
|
|
934
933
|
export async function findById(id: string): Promise<Ping | undefined> {
|
|
935
934
|
// TODO: Replace with actual database query
|
|
936
|
-
return pings.get(id);
|
|
935
|
+
return pings.get(Number(id));
|
|
937
936
|
}
|
|
938
937
|
|
|
939
938
|
export async function create(data: { message: string; created_by: string }): Promise<Ping> {
|
|
940
939
|
// TODO: Replace with actual database insert
|
|
941
940
|
const ping: Ping = {
|
|
942
|
-
id:
|
|
941
|
+
id: nextId++,
|
|
943
942
|
message: data.message,
|
|
944
943
|
created_by: data.created_by,
|
|
945
944
|
created_at: new Date(),
|
|
@@ -950,18 +949,19 @@ export async function create(data: { message: string; created_by: string }): Pro
|
|
|
950
949
|
|
|
951
950
|
export async function update(id: string, data: { message?: string }): Promise<Ping> {
|
|
952
951
|
// TODO: Replace with actual database update
|
|
953
|
-
const
|
|
952
|
+
const numId = Number(id);
|
|
953
|
+
const existing = pings.get(numId);
|
|
954
954
|
if (!existing) {
|
|
955
955
|
throw new Error('Not found');
|
|
956
956
|
}
|
|
957
957
|
const updated = { ...existing, ...data };
|
|
958
|
-
pings.set(
|
|
958
|
+
pings.set(numId, updated);
|
|
959
959
|
return updated;
|
|
960
960
|
}
|
|
961
961
|
|
|
962
962
|
export async function remove(id: string): Promise<void> {
|
|
963
963
|
// TODO: Replace with actual database delete
|
|
964
|
-
pings.delete(id);
|
|
964
|
+
pings.delete(Number(id));
|
|
965
965
|
}
|
|
966
966
|
`;
|
|
967
967
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fossyl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "CLI for scaffolding fossyl projects",
|
|
5
5
|
"bin": {
|
|
6
6
|
"fossyl": "./bin/fossyl.js"
|
|
@@ -25,7 +25,15 @@
|
|
|
25
25
|
"cli",
|
|
26
26
|
"scaffolding",
|
|
27
27
|
"rest-api",
|
|
28
|
-
"typescript"
|
|
28
|
+
"typescript",
|
|
29
|
+
"generator",
|
|
30
|
+
"project-generator",
|
|
31
|
+
"create-app",
|
|
32
|
+
"starter",
|
|
33
|
+
"boilerplate",
|
|
34
|
+
"api-generator",
|
|
35
|
+
"nodejs",
|
|
36
|
+
"backend"
|
|
29
37
|
],
|
|
30
38
|
"author": "YoyoSaur",
|
|
31
39
|
"license": "GPL-3.0",
|