@cedarjs/internal 8.0.0-canary.3539 → 8.0.0-canary.3541

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.
@@ -0,0 +1,9 @@
1
+ import '@cedarjs/auth'
2
+
3
+ import type { Permission } from '${packageName}'
4
+
5
+ // The permission names from ${packageName}, so useAuth().hasPermission()
6
+ // only takes those
7
+ declare module '@cedarjs/auth' {
8
+ interface AvailablePermissions extends Record<Permission, true> {}
9
+ }
@@ -19,6 +19,13 @@ export declare const generateTypeDefRouterRoutes: () => string[];
19
19
  export declare const generateTypeDefRouterPages: () => string[];
20
20
  export declare const generateTypeDefCurrentUser: () => string[];
21
21
  export declare const generateTypeDefGqlorm: () => string[];
22
+ /**
23
+ * The permission names for `useAuth().hasPermission()`, from the app's
24
+ * permission definitions: `packages/permissions`, when it's the package
25
+ * `cedar setup tenancy` makes (it depends on `@cedarjs/tenancy`). None
26
+ * otherwise, and a stale file goes.
27
+ */
28
+ export declare const generateTypeDefPermissions: () => string[];
22
29
  /**
23
30
  * The full type of the GraphQL handler's `realtime` option, when the api side
24
31
  * depends on `@cedarjs/realtime` (`cedar setup realtime` adds it). None
@@ -1 +1 @@
1
- {"version":3,"file":"typeDefinitions.d.ts","sourceRoot":"","sources":["../../src/generate/typeDefinitions.ts"],"names":[],"mappings":"AA8CA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;EA4B5B,CAAA;AAED,eAAO,MAAM,mCAAmC,gBAK/C,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC7C,GAAG,MAAM,EACT,mDAAsB,aASvB,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC7C,GAAG,MAAM,EACT,mDAAsB,WAoDvB,CAAA;AAED,eAAO,MAAM,mBAAmB,gBAG/B,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,EAAE,mDAAsB,aAQlE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,GAAG,MAA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B,gBAgCtC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,gBA8BnC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,gBA8BlC,CAAA;AAED,eAAO,MAAM,wBAAwB,gBAEpC,CAAA;AAED,eAAO,MAAM,wBAAwB,gBAKpC,CAAA;AAED,eAAO,MAAM,0BAA0B,gBAEtC,CAAA;AAED,eAAO,MAAM,4BAA4B,gBAExC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,gBAW5C,CAAA"}
@@ -31,6 +31,7 @@ const generateTypeDefs = async () => {
31
31
  ...generateTypeDefRouterPages(),
32
32
  ...generateTypeDefCurrentUser(),
33
33
  ...generateTypeDefGqlorm(),
34
+ ...generateTypeDefPermissions(),
34
35
  ...generateTypeDefRealtime(),
35
36
  ...generateTypeDefTenancy(),
36
37
  ...generateTypeDefRouterRoutes(),
@@ -308,6 +309,32 @@ const generateTypeDefCurrentUser = () => {
308
309
  const generateTypeDefGqlorm = () => {
309
310
  return writeTypeDefIncludeFile("all-gqlorm.d.ts.template");
310
311
  };
312
+ const generateTypeDefPermissions = () => {
313
+ const paths = getPaths();
314
+ const typeDefPath = path.join(
315
+ paths.generated.types.includes,
316
+ "all-permissions.d.ts"
317
+ );
318
+ const packageJsonPath = path.join(
319
+ paths.packages,
320
+ "permissions",
321
+ "package.json"
322
+ );
323
+ let packageJson;
324
+ try {
325
+ packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
326
+ } catch {
327
+ fs.rmSync(typeDefPath, { force: true });
328
+ return [];
329
+ }
330
+ if (typeof packageJson.name !== "string" || !packageJson.dependencies?.["@cedarjs/tenancy"]) {
331
+ fs.rmSync(typeDefPath, { force: true });
332
+ return [];
333
+ }
334
+ return writeTypeDefIncludeFile("all-permissions.d.ts.template", {
335
+ packageName: packageJson.name
336
+ });
337
+ };
311
338
  const generateTypeDefRealtime = () => {
312
339
  const paths = getPaths();
313
340
  const typeDefPath = path.join(
@@ -415,6 +442,7 @@ export {
415
442
  generateTypeDefGlobImports,
416
443
  generateTypeDefGlobalContext,
417
444
  generateTypeDefGqlorm,
445
+ generateTypeDefPermissions,
418
446
  generateTypeDefRealtime,
419
447
  generateTypeDefRouterPages,
420
448
  generateTypeDefRouterRoutes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/internal",
3
- "version": "8.0.0-canary.3539",
3
+ "version": "8.0.0-canary.3541",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -120,14 +120,14 @@
120
120
  "@babel/core": "^7.26.10",
121
121
  "@babel/parser": "7.29.11",
122
122
  "@babel/traverse": "7.29.10",
123
- "@cedarjs/api": "8.0.0-canary.3539",
124
- "@cedarjs/babel-config": "8.0.0-canary.3539",
125
- "@cedarjs/cli-helpers": "8.0.0-canary.3539",
126
- "@cedarjs/graphql-server": "8.0.0-canary.3539",
127
- "@cedarjs/project-config": "8.0.0-canary.3539",
128
- "@cedarjs/router": "8.0.0-canary.3539",
129
- "@cedarjs/structure": "8.0.0-canary.3539",
130
- "@cedarjs/utils": "8.0.0-canary.3539",
123
+ "@cedarjs/api": "8.0.0-canary.3541",
124
+ "@cedarjs/babel-config": "8.0.0-canary.3541",
125
+ "@cedarjs/cli-helpers": "8.0.0-canary.3541",
126
+ "@cedarjs/graphql-server": "8.0.0-canary.3541",
127
+ "@cedarjs/project-config": "8.0.0-canary.3541",
128
+ "@cedarjs/router": "8.0.0-canary.3541",
129
+ "@cedarjs/structure": "8.0.0-canary.3541",
130
+ "@cedarjs/utils": "8.0.0-canary.3541",
131
131
  "@graphql-codegen/add": "6.0.1",
132
132
  "@graphql-codegen/cli": "6.3.1",
133
133
  "@graphql-codegen/client-preset": "5.3.0",
@@ -165,7 +165,7 @@
165
165
  "vite-tsconfig-paths": "6.1.1"
166
166
  },
167
167
  "devDependencies": {
168
- "@cedarjs/framework-tools": "8.0.0-canary.3539",
168
+ "@cedarjs/framework-tools": "8.0.0-canary.3541",
169
169
  "@jridgewell/trace-mapping": "0.3.31",
170
170
  "@oxc-project/types": "^0.155.0",
171
171
  "concurrently": "9.2.5",