@softr/sdk 0.0.17 → 0.0.18

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.
@@ -68,7 +68,7 @@ const getSoftrContext = createServerFn({ method: "GET" }).handler(async () => {
68
68
  function initialSoftrContext() {
69
69
  return {
70
70
  user: null,
71
- permissions: { datasourcePermissions: {} }
71
+ permissions: { datasources: {} }
72
72
  };
73
73
  }
74
74
  /**
@@ -105,7 +105,7 @@ function useCurrentUser() {
105
105
  function usePermissions(datasourceId) {
106
106
  return useRouteContext({
107
107
  from: rootRouteId,
108
- select: (context) => requireDefined(context.permissions.datasourcePermissions[datasourceId], `the application has no datasource "${datasourceId}"`)
108
+ select: (context) => requireDefined(context.permissions.datasources[datasourceId], `the application has no datasource "${datasourceId}"`)
109
109
  });
110
110
  }
111
111
 
@@ -11,7 +11,7 @@ import { z } from "zod";
11
11
  */
12
12
  type Permissions = {
13
13
  /** Keyed by datasource id. */
14
- datasourcePermissions: Record<string, DatasourcePermissions>;
14
+ datasources: Record<string, DatasourcePermissions>;
15
15
  };
16
16
  //#endregion
17
17
  export { Permissions };
@@ -7,7 +7,7 @@ const datasourcePermissionsSchema = z.object({
7
7
  update: z.boolean(),
8
8
  delete: z.boolean()
9
9
  });
10
- const permissionsSchema = z.object({ datasourcePermissions: z.record(z.string(), datasourcePermissionsSchema) });
10
+ const permissionsSchema = z.object({ datasources: z.record(z.string(), datasourcePermissionsSchema) });
11
11
 
12
12
  //#endregion
13
13
  export { permissionsSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
@@ -105,7 +105,7 @@ export function getRouter() {
105
105
  ```ts
106
106
  type SoftrContext = {
107
107
  user: User | null // null means signed out
108
- permissions: { datasourcePermissions: Record<string, DatasourcePermissions> }
108
+ permissions: { datasources: Record<string, DatasourcePermissions> }
109
109
  }
110
110
 
111
111
  type User = {