@arcote.tech/arc 0.3.1 → 0.3.2
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/adapters/event-publisher.d.ts +18 -0
- package/dist/adapters/index.d.ts +3 -0
- package/dist/adapters/query-wire.d.ts +34 -0
- package/dist/adapters/wire.d.ts +9 -1
- package/dist/context/context.d.ts +104 -2
- package/dist/context/index.d.ts +1 -1
- package/dist/context-element/index.d.ts +3 -1
- package/dist/context-element/listener/index.d.ts +2 -0
- package/dist/context-element/listener/listener.d.ts +170 -0
- package/dist/context-element/route/index.d.ts +3 -0
- package/dist/context-element/route/route-data.d.ts +42 -0
- package/dist/context-element/route/route.d.ts +163 -0
- package/dist/context-element/view/view-data.d.ts +5 -6
- package/dist/context-element/view/view.d.ts +15 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +725 -69
- package/dist/model/live-query/live-query.d.ts +2 -1
- package/dist/model/model-adapters.d.ts +5 -0
- package/dist/streaming/index.d.ts +6 -0
- package/dist/streaming/streaming-event-publisher.d.ts +51 -0
- package/dist/streaming/streaming-live-query.d.ts +23 -0
- package/dist/streaming/streaming-query-cache.d.ts +57 -0
- package/dist/token/index.d.ts +2 -5
- package/package.json +1 -1
|
@@ -115,18 +115,25 @@ export declare class ArcView<const Data extends ArcViewData> extends ArcContextE
|
|
|
115
115
|
getElements(): Data["elements"];
|
|
116
116
|
/**
|
|
117
117
|
* Add token-based protection to this view
|
|
118
|
-
* Defines read
|
|
118
|
+
* Defines read access conditions based on token params
|
|
119
|
+
* Write protection is handled by event protections, not view protections
|
|
119
120
|
*
|
|
120
121
|
* @param token - Token definition to protect with
|
|
121
|
-
* @param protectionFn - Function returning read
|
|
122
|
+
* @param protectionFn - Function returning read conditions (where clause) or false to deny
|
|
122
123
|
*
|
|
123
124
|
* @example
|
|
124
125
|
* ```typescript
|
|
125
126
|
* view("tasks", taskId, taskSchema)
|
|
126
|
-
* .protectBy(userToken, (params) => ({
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
127
|
+
* .protectBy(userToken, (params) => ({ userId: params.userId }));
|
|
128
|
+
* // Users can only read their own tasks
|
|
129
|
+
*
|
|
130
|
+
* view("publicPosts", postId, postSchema)
|
|
131
|
+
* .protectBy(userToken, () => ({}));
|
|
132
|
+
* // All authenticated users can read all posts
|
|
133
|
+
*
|
|
134
|
+
* view("adminOnly", id, schema)
|
|
135
|
+
* .protectBy(userToken, (params) => params.isAdmin ? {} : false);
|
|
136
|
+
* // Only admins can read, others get empty results
|
|
130
137
|
* ```
|
|
131
138
|
*/
|
|
132
139
|
protectBy<T extends ArcTokenAny>(token: T, protectionFn: ViewProtectionFn<any>): ArcView<Data>;
|
|
@@ -142,12 +149,9 @@ export declare class ArcView<const Data extends ArcViewData> extends ArcContextE
|
|
|
142
149
|
* Get protection config for a specific token instance
|
|
143
150
|
*
|
|
144
151
|
* @param tokenInstance - Token instance to get protection for
|
|
145
|
-
* @returns Protection config or null if no matching protection
|
|
152
|
+
* @returns Protection config (where clause) or null if no matching protection
|
|
146
153
|
*/
|
|
147
|
-
getProtectionFor(tokenInstance: TokenInstanceAny):
|
|
148
|
-
read: any;
|
|
149
|
-
write: any;
|
|
150
|
-
} | null;
|
|
154
|
+
getProtectionFor(tokenInstance: TokenInstanceAny): Record<string, any> | false | null;
|
|
151
155
|
/**
|
|
152
156
|
* Generate database store schema for this view
|
|
153
157
|
* Returns the view table with _id as primary key
|
package/dist/index.d.ts
CHANGED