baasix 0.1.4 → 0.1.6

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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # baasix
2
+
3
+ ## 0.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated to new monorepo structure.
package/README.md CHANGED
@@ -130,7 +130,7 @@ baasix generate --url http://localhost:8056 --output ./src/types/baasix.d.ts
130
130
 
131
131
  ```typescript
132
132
  import type { Product, Category, BaasixUser } from "./types/baasix";
133
- import { createBaasix } from "@tspvivek/baasix-sdk";
133
+ import { createBaasix } from "@baasix/sdk";
134
134
 
135
135
  const baasix = createBaasix({ url: "http://localhost:8056" });
136
136
 
@@ -201,7 +201,7 @@ baasix extension --type endpoint --name analytics
201
201
 
202
202
  ```javascript
203
203
  // extensions/baasix-endpoint-analytics/index.js
204
- import { APIError } from "@tspvivek/baasix";
204
+ import { APIError } from "@baasix/baasix";
205
205
 
206
206
  export default {
207
207
  id: "analytics",
package/dist/index.mjs CHANGED
@@ -341,19 +341,22 @@ async function createApiProject(projectPath, config) {
341
341
  version: "0.1.0",
342
342
  type: "module",
343
343
  scripts: {
344
- dev: "node --watch server.js",
345
- start: "node server.js"
344
+ dev: "tsx watch server.js",
345
+ start: "tsx server.js"
346
346
  },
347
347
  dependencies: {
348
- "@tspvivek/baasix": "latest",
348
+ "@baasix/baasix": "latest",
349
349
  "dotenv": "^16.3.1"
350
+ },
351
+ devDependencies: {
352
+ "tsx": "^4.16.0"
350
353
  }
351
354
  };
352
355
  await fs.writeFile(
353
356
  path2.join(projectPath, "package.json"),
354
357
  JSON.stringify(packageJson, null, 2)
355
358
  );
356
- const serverJs = `import { startServer } from "@tspvivek/baasix";
359
+ const serverJs = `import { startServer } from "@baasix/baasix";
357
360
 
358
361
  startServer({
359
362
  port: process.env.PORT || 8056,
@@ -697,7 +700,7 @@ async function createNextJsProject(projectPath, config, useAppRouter) {
697
700
  lint: "next lint"
698
701
  },
699
702
  dependencies: {
700
- "@tspvivek/baasix-sdk": "latest",
703
+ "@baasix/sdk": "latest",
701
704
  next: "^14.0.0",
702
705
  react: "^18.2.0",
703
706
  "react-dom": "^18.2.0"
@@ -753,7 +756,7 @@ export default nextConfig;
753
756
  if (useAppRouter) {
754
757
  await fs.mkdir(path2.join(projectPath, "src", "app"), { recursive: true });
755
758
  await fs.mkdir(path2.join(projectPath, "src", "lib"), { recursive: true });
756
- const baasixClient = `import { createBaasix } from "@tspvivek/baasix-sdk";
759
+ const baasixClient = `import { createBaasix } from "@baasix/sdk";
757
760
 
758
761
  export const baasix = createBaasix({
759
762
  url: process.env.NEXT_PUBLIC_BAASIX_URL || "http://localhost:8056",
@@ -762,7 +765,7 @@ export const baasix = createBaasix({
762
765
  });
763
766
 
764
767
  // Re-export for convenience
765
- export type { User, Role, QueryParams, Filter } from "@tspvivek/baasix-sdk";
768
+ export type { User, Role, QueryParams, Filter } from "@baasix/sdk";
766
769
  `;
767
770
  await fs.writeFile(path2.join(projectPath, "src", "lib", "baasix.ts"), baasixClient);
768
771
  const layout = `import type { Metadata } from "next";
@@ -939,7 +942,7 @@ export default function Home() {
939
942
  await fs.mkdir(path2.join(projectPath, "pages"), { recursive: true });
940
943
  await fs.mkdir(path2.join(projectPath, "lib"), { recursive: true });
941
944
  await fs.mkdir(path2.join(projectPath, "styles"), { recursive: true });
942
- const baasixClient = `import { createBaasix } from "@tspvivek/baasix-sdk";
945
+ const baasixClient = `import { createBaasix } from "@baasix/sdk";
943
946
 
944
947
  export const baasix = createBaasix({
945
948
  url: process.env.NEXT_PUBLIC_BAASIX_URL || "http://localhost:8056",
@@ -947,7 +950,7 @@ export const baasix = createBaasix({
947
950
  autoRefresh: true,
948
951
  });
949
952
 
950
- export type { User, Role, QueryParams, Filter } from "@tspvivek/baasix-sdk";
953
+ export type { User, Role, QueryParams, Filter } from "@baasix/sdk";
951
954
  `;
952
955
  await fs.writeFile(path2.join(projectPath, "lib", "baasix.ts"), baasixClient);
953
956
  const app = `import type { AppProps } from "next/app";
@@ -1686,8 +1689,8 @@ function generateSDKTypes(schemas) {
1686
1689
  " * Do not edit this file manually. Re-run 'baasix generate sdk-types' to update.",
1687
1690
  " */",
1688
1691
  "",
1689
- 'import { createBaasix } from "@tspvivek/baasix-sdk";',
1690
- 'import type { QueryParams, Filter, PaginatedResponse } from "@tspvivek/baasix-sdk";',
1692
+ 'import { createBaasix } from "@baasix/sdk";',
1693
+ 'import type { QueryParams, Filter, PaginatedResponse } from "@baasix/sdk";',
1691
1694
  ""
1692
1695
  ];
1693
1696
  lines.push(generateTypeScriptTypes(schemas));
@@ -1846,7 +1849,7 @@ async function extensionAction(opts) {
1846
1849
  async function createHookExtension(extensionDir, name, collection, useTypeScript) {
1847
1850
  const ext = useTypeScript ? "ts" : "js";
1848
1851
  const typeAnnotations = useTypeScript ? `
1849
- import type { HooksService } from "@tspvivek/baasix";
1852
+ import type { HooksService } from "@baasix/baasix";
1850
1853
 
1851
1854
  interface HookContext {
1852
1855
  ItemsService: any;
@@ -1969,7 +1972,7 @@ async function createEndpointExtension(extensionDir, name, useTypeScript) {
1969
1972
  const ext = useTypeScript ? "ts" : "js";
1970
1973
  const typeAnnotations = useTypeScript ? `
1971
1974
  import type { FastifyInstance, FastifyRequest, FastifyReply } from "fastify";
1972
- import { APIError } from "@tspvivek/baasix";
1975
+ import { APIError } from "@baasix/baasix";
1973
1976
 
1974
1977
  interface EndpointContext {
1975
1978
  ItemsService: any;
@@ -1983,7 +1986,7 @@ interface RequestWithAccountability extends FastifyRequest {
1983
1986
  role: { id: string; name: string };
1984
1987
  };
1985
1988
  }
1986
- ` : `import { APIError } from "@tspvivek/baasix";`;
1989
+ ` : `import { APIError } from "@baasix/baasix";`;
1987
1990
  const endpointContent = `${typeAnnotations}
1988
1991
 
1989
1992
  /**
@@ -2337,7 +2340,7 @@ async function createMigration(s, cwd, name) {
2337
2340
 
2338
2341
  /**
2339
2342
  * Run the migration
2340
- * @param {import("@tspvivek/baasix-sdk").BaasixClient} baasix - Baasix client
2343
+ * @param {import("@baasix/sdk").BaasixClient} baasix - Baasix client
2341
2344
  */
2342
2345
  export async function up(baasix) {
2343
2346
  // Example: Create a collection
@@ -2363,7 +2366,7 @@ export async function up(baasix) {
2363
2366
 
2364
2367
  /**
2365
2368
  * Reverse the migration
2366
- * @param {import("@tspvivek/baasix-sdk").BaasixClient} baasix - Baasix client
2369
+ * @param {import("@baasix/sdk").BaasixClient} baasix - Baasix client
2367
2370
  */
2368
2371
  export async function down(baasix) {
2369
2372
  // Reverse the changes made in up()
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "baasix",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "CLI for Baasix Backend-as-a-Service",
6
6
  "module": "dist/index.mjs",
7
7
  "main": "./dist/index.mjs",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/tspvivek/baasix.git",
11
- "directory": "cli"
10
+ "url": "git+https://github.com/baasix/baasix.git",
11
+ "directory": "packages/cli"
12
12
  },
13
13
  "homepage": "https://baasix.com/docs/cli-guide",
14
14
  "scripts": {
@@ -173,7 +173,7 @@ async function createHookExtension(
173
173
 
174
174
  const typeAnnotations = useTypeScript
175
175
  ? `
176
- import type { HooksService } from "@tspvivek/baasix";
176
+ import type { HooksService } from "@baasix/baasix";
177
177
 
178
178
  interface HookContext {
179
179
  ItemsService: any;
@@ -309,7 +309,7 @@ async function createEndpointExtension(
309
309
  const typeAnnotations = useTypeScript
310
310
  ? `
311
311
  import type { FastifyInstance, FastifyRequest, FastifyReply } from "fastify";
312
- import { APIError } from "@tspvivek/baasix";
312
+ import { APIError } from "@baasix/baasix";
313
313
 
314
314
  interface EndpointContext {
315
315
  ItemsService: any;
@@ -324,7 +324,7 @@ interface RequestWithAccountability extends FastifyRequest {
324
324
  };
325
325
  }
326
326
  `
327
- : `import { APIError } from "@tspvivek/baasix";`;
327
+ : `import { APIError } from "@baasix/baasix";`;
328
328
 
329
329
  const endpointContent = `${typeAnnotations}
330
330
 
@@ -463,8 +463,8 @@ function generateSDKTypes(schemas: SchemaInfo[]): string {
463
463
  " * Do not edit this file manually. Re-run 'baasix generate sdk-types' to update.",
464
464
  " */",
465
465
  "",
466
- 'import { createBaasix } from "@tspvivek/baasix-sdk";',
467
- 'import type { QueryParams, Filter, PaginatedResponse } from "@tspvivek/baasix-sdk";',
466
+ 'import { createBaasix } from "@baasix/sdk";',
467
+ 'import type { QueryParams, Filter, PaginatedResponse } from "@baasix/sdk";',
468
468
  "",
469
469
  ];
470
470
 
@@ -394,13 +394,16 @@ async function createApiProject(projectPath: string, config: ProjectConfig) {
394
394
  version: "0.1.0",
395
395
  type: "module",
396
396
  scripts: {
397
- dev: "node --watch server.js",
398
- start: "node server.js",
397
+ dev: "tsx watch server.js",
398
+ start: "tsx server.js",
399
399
  },
400
400
  dependencies: {
401
- "@tspvivek/baasix": "latest",
401
+ "@baasix/baasix": "latest",
402
402
  "dotenv": "^16.3.1",
403
403
  },
404
+ devDependencies: {
405
+ "tsx": "^4.16.0",
406
+ },
404
407
  };
405
408
 
406
409
  await fs.writeFile(
@@ -409,7 +412,7 @@ async function createApiProject(projectPath: string, config: ProjectConfig) {
409
412
  );
410
413
 
411
414
  // server.js
412
- const serverJs = `import { startServer } from "@tspvivek/baasix";
415
+ const serverJs = `import { startServer } from "@baasix/baasix";
413
416
 
414
417
  startServer({
415
418
  port: process.env.PORT || 8056,
@@ -809,7 +812,7 @@ async function createNextJsProject(projectPath: string, config: ProjectConfig, u
809
812
  lint: "next lint",
810
813
  },
811
814
  dependencies: {
812
- "@tspvivek/baasix-sdk": "latest",
815
+ "@baasix/sdk": "latest",
813
816
  next: "^14.0.0",
814
817
  react: "^18.2.0",
815
818
  "react-dom": "^18.2.0",
@@ -878,7 +881,7 @@ export default nextConfig;
878
881
  await fs.mkdir(path.join(projectPath, "src", "lib"), { recursive: true });
879
882
 
880
883
  // src/lib/baasix.ts - SDK client
881
- const baasixClient = `import { createBaasix } from "@tspvivek/baasix-sdk";
884
+ const baasixClient = `import { createBaasix } from "@baasix/sdk";
882
885
 
883
886
  export const baasix = createBaasix({
884
887
  url: process.env.NEXT_PUBLIC_BAASIX_URL || "http://localhost:8056",
@@ -887,7 +890,7 @@ export const baasix = createBaasix({
887
890
  });
888
891
 
889
892
  // Re-export for convenience
890
- export type { User, Role, QueryParams, Filter } from "@tspvivek/baasix-sdk";
893
+ export type { User, Role, QueryParams, Filter } from "@baasix/sdk";
891
894
  `;
892
895
 
893
896
  await fs.writeFile(path.join(projectPath, "src", "lib", "baasix.ts"), baasixClient);
@@ -1078,7 +1081,7 @@ export default function Home() {
1078
1081
  await fs.mkdir(path.join(projectPath, "styles"), { recursive: true });
1079
1082
 
1080
1083
  // lib/baasix.ts
1081
- const baasixClient = `import { createBaasix } from "@tspvivek/baasix-sdk";
1084
+ const baasixClient = `import { createBaasix } from "@baasix/sdk";
1082
1085
 
1083
1086
  export const baasix = createBaasix({
1084
1087
  url: process.env.NEXT_PUBLIC_BAASIX_URL || "http://localhost:8056",
@@ -1086,7 +1089,7 @@ export const baasix = createBaasix({
1086
1089
  autoRefresh: true,
1087
1090
  });
1088
1091
 
1089
- export type { User, Role, QueryParams, Filter } from "@tspvivek/baasix-sdk";
1092
+ export type { User, Role, QueryParams, Filter } from "@baasix/sdk";
1090
1093
  `;
1091
1094
 
1092
1095
  await fs.writeFile(path.join(projectPath, "lib", "baasix.ts"), baasixClient);
@@ -344,7 +344,7 @@ async function createMigration(
344
344
 
345
345
  /**
346
346
  * Run the migration
347
- * @param {import("@tspvivek/baasix-sdk").BaasixClient} baasix - Baasix client
347
+ * @param {import("@baasix/sdk").BaasixClient} baasix - Baasix client
348
348
  */
349
349
  export async function up(baasix) {
350
350
  // Example: Create a collection
@@ -370,7 +370,7 @@ export async function up(baasix) {
370
370
 
371
371
  /**
372
372
  * Reverse the migration
373
- * @param {import("@tspvivek/baasix-sdk").BaasixClient} baasix - Baasix client
373
+ * @param {import("@baasix/sdk").BaasixClient} baasix - Baasix client
374
374
  */
375
375
  export async function down(baasix) {
376
376
  // Reverse the changes made in up()