@squidcloud/backend 1.0.481 → 1.0.482
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/backend/src/actions.d.ts +31 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +2 -2
|
@@ -57,6 +57,37 @@ export declare function secureAiQuery(integrationId?: IntegrationId): ActionMeth
|
|
|
57
57
|
* @category Decorator
|
|
58
58
|
*/
|
|
59
59
|
export declare function secureCollection<T extends DatabaseActionType>(collectionName: CollectionName, type: T, integrationId?: IntegrationId): ActionMethodDecorator<SecureDatabaseAction<T>>;
|
|
60
|
+
/**
|
|
61
|
+
* Class decorator that declares reads from a collection as intentionally public.
|
|
62
|
+
*
|
|
63
|
+
* Public reads bypass security-rule evaluation entirely: Core serves them without calling backend
|
|
64
|
+
* code, so any client can read the collection, including unauthenticated ones. Use it only for data
|
|
65
|
+
* that is safe to expose to everyone; prefer a `@secureCollection` read rule when access must depend
|
|
66
|
+
* on the caller.
|
|
67
|
+
*
|
|
68
|
+
* Only reads can be made public. Writes always go through their security rules, so a public-read
|
|
69
|
+
* collection can still restrict `insert`/`update`/`delete`/`write` with `@secureCollection`.
|
|
70
|
+
*
|
|
71
|
+
* Secure wins on conflict: if a `@secureCollection` or `@secureDatabase` read (or `all`) rule also
|
|
72
|
+
* applies to the same collection, that rule takes precedence at runtime and the public declaration
|
|
73
|
+
* is ignored.
|
|
74
|
+
*
|
|
75
|
+
* @param collectionName The name of the public collection.
|
|
76
|
+
* @param type The public action type. Only `read` is supported.
|
|
77
|
+
* @param integrationId The ID of the integration containing the collection. Defaults to the built-in database.
|
|
78
|
+
* @category Database
|
|
79
|
+
* @category Decorator
|
|
80
|
+
* @example
|
|
81
|
+
* // Anyone can read the `articles` collection, but only authors can write to it.
|
|
82
|
+
* @publicCollection('articles', 'read')
|
|
83
|
+
* export class ArticleService extends SquidService {
|
|
84
|
+
* @secureCollection('articles', 'write')
|
|
85
|
+
* async secureArticlesWrite(context: MutationContext): Promise<boolean> {
|
|
86
|
+
* return this.isAuthenticated();
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
*/
|
|
90
|
+
export declare function publicCollection(collectionName: CollectionName, type: 'read', integrationId?: IntegrationId): ClassDecorator;
|
|
60
91
|
/**
|
|
61
92
|
* The decorator allows protects storage buckets so only authorized users can access it.
|
|
62
93
|
* @category Storage
|