@drodil/backstage-plugin-qeta-node 3.26.0 → 3.27.0
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/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +43 -20
- package/dist/permissionRules.cjs.js +24 -1
- package/dist/permissionRules.cjs.js.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs.js
CHANGED
|
@@ -29,6 +29,7 @@ exports.isCollectionOwner = permissionRules.isCollectionOwner;
|
|
|
29
29
|
exports.isCommentAuthor = permissionRules.isCommentAuthor;
|
|
30
30
|
exports.isPostAuthor = permissionRules.isPostAuthor;
|
|
31
31
|
exports.isTag = permissionRules.isTag;
|
|
32
|
+
exports.isTagExpert = permissionRules.isTagExpert;
|
|
32
33
|
exports.postAuthorConditionFactory = permissionRules.postAuthorConditionFactory;
|
|
33
34
|
exports.postHasEntities = permissionRules.postHasEntities;
|
|
34
35
|
exports.postHasEntitiesConditionFactory = permissionRules.postHasEntitiesConditionFactory;
|
|
@@ -39,6 +40,7 @@ exports.postHasTypeConditionFactory = permissionRules.postHasTypeConditionFactor
|
|
|
39
40
|
exports.postRules = permissionRules.postRules;
|
|
40
41
|
exports.rules = permissionRules.rules;
|
|
41
42
|
exports.tagConditionFactory = permissionRules.tagConditionFactory;
|
|
43
|
+
exports.tagExpertConditionFactory = permissionRules.tagExpertConditionFactory;
|
|
42
44
|
exports.tagRules = permissionRules.tagRules;
|
|
43
45
|
exports.answerConditions = conditionExports.answerConditions;
|
|
44
46
|
exports.collectionConditions = conditionExports.collectionConditions;
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
|
2
2
|
import { BackstageCredentials, BackstageUserPrincipal } from '@backstage/backend-plugin-api';
|
|
3
3
|
import * as _drodil_backstage_plugin_qeta_common from '@drodil/backstage-plugin-qeta-common';
|
|
4
4
|
import { Question, AIResponse, Article, Post, PostFilter, Answer, AnswerFilter, Comment, CommentFilter, TagResponse, TagFilter, Collection, CollectionFilter } from '@drodil/backstage-plugin-qeta-common';
|
|
5
|
-
import * as
|
|
5
|
+
import * as _backstage_plugin_permission_common from '@backstage/plugin-permission-common';
|
|
6
|
+
import { PolicyDecision } from '@backstage/plugin-permission-common';
|
|
6
7
|
import * as _backstage_plugin_permission_node from '@backstage/plugin-permission-node';
|
|
7
8
|
import { PermissionPolicy, PolicyQuery } from '@backstage/plugin-permission-node';
|
|
8
9
|
import { BackstageIdentityResponse } from '@backstage/plugin-auth-node';
|
|
9
|
-
import { PolicyDecision } from '@backstage/plugin-permission-common';
|
|
10
10
|
import { Config } from '@backstage/config';
|
|
11
11
|
|
|
12
12
|
interface AIHandler {
|
|
@@ -73,7 +73,7 @@ declare const isPostAuthor: _backstage_plugin_permission_node.PermissionRule<Pos
|
|
|
73
73
|
declare const postAuthorConditionFactory: (params: {
|
|
74
74
|
userRef?: string | undefined;
|
|
75
75
|
claims?: string[] | undefined;
|
|
76
|
-
}) =>
|
|
76
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"post", {
|
|
77
77
|
userRef?: string | undefined;
|
|
78
78
|
claims?: string[] | undefined;
|
|
79
79
|
}>;
|
|
@@ -82,7 +82,7 @@ declare const postHasTags: _backstage_plugin_permission_node.PermissionRule<Post
|
|
|
82
82
|
}>;
|
|
83
83
|
declare const postHasTagsConditionFactory: (params: {
|
|
84
84
|
tags: string[];
|
|
85
|
-
}) =>
|
|
85
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"post", {
|
|
86
86
|
tags: string[];
|
|
87
87
|
}>;
|
|
88
88
|
declare const postHasEntities: _backstage_plugin_permission_node.PermissionRule<Post, PostFilter, "post", {
|
|
@@ -90,7 +90,7 @@ declare const postHasEntities: _backstage_plugin_permission_node.PermissionRule<
|
|
|
90
90
|
}>;
|
|
91
91
|
declare const postHasEntitiesConditionFactory: (params: {
|
|
92
92
|
entityRefs: string[];
|
|
93
|
-
}) =>
|
|
93
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"post", {
|
|
94
94
|
entityRefs: string[];
|
|
95
95
|
}>;
|
|
96
96
|
declare const postHasType: _backstage_plugin_permission_node.PermissionRule<Post, PostFilter, "post", {
|
|
@@ -98,7 +98,7 @@ declare const postHasType: _backstage_plugin_permission_node.PermissionRule<Post
|
|
|
98
98
|
}>;
|
|
99
99
|
declare const postHasTypeConditionFactory: (params: {
|
|
100
100
|
type: string;
|
|
101
|
-
}) =>
|
|
101
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"post", {
|
|
102
102
|
type: string;
|
|
103
103
|
}>;
|
|
104
104
|
declare const postRules: {
|
|
@@ -123,7 +123,7 @@ declare const isAnswerAuthor: _backstage_plugin_permission_node.PermissionRule<A
|
|
|
123
123
|
declare const answerAuthorConditionFactory: (params: {
|
|
124
124
|
userRef?: string | undefined;
|
|
125
125
|
claims?: string[] | undefined;
|
|
126
|
-
}) =>
|
|
126
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"answer", {
|
|
127
127
|
userRef?: string | undefined;
|
|
128
128
|
claims?: string[] | undefined;
|
|
129
129
|
}>;
|
|
@@ -132,7 +132,7 @@ declare const answerQuestionHasTags: _backstage_plugin_permission_node.Permissio
|
|
|
132
132
|
}>;
|
|
133
133
|
declare const answerQuestionTagsConditionFactory: (params: {
|
|
134
134
|
tags: string[];
|
|
135
|
-
}) =>
|
|
135
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"answer", {
|
|
136
136
|
tags: string[];
|
|
137
137
|
}>;
|
|
138
138
|
declare const answerQuestionHasEntityRefs: _backstage_plugin_permission_node.PermissionRule<Answer, AnswerFilter, "answer", {
|
|
@@ -140,7 +140,7 @@ declare const answerQuestionHasEntityRefs: _backstage_plugin_permission_node.Per
|
|
|
140
140
|
}>;
|
|
141
141
|
declare const answerQuestionEntitiesConditionFactory: (params: {
|
|
142
142
|
entityRefs: string[];
|
|
143
|
-
}) =>
|
|
143
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"answer", {
|
|
144
144
|
entityRefs: string[];
|
|
145
145
|
}>;
|
|
146
146
|
declare const answerRules: {
|
|
@@ -162,7 +162,7 @@ declare const isCommentAuthor: _backstage_plugin_permission_node.PermissionRule<
|
|
|
162
162
|
declare const commentAuthorConditionFactory: (params: {
|
|
163
163
|
userRef?: string | undefined;
|
|
164
164
|
claims?: string[] | undefined;
|
|
165
|
-
}) =>
|
|
165
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"comment", {
|
|
166
166
|
userRef?: string | undefined;
|
|
167
167
|
claims?: string[] | undefined;
|
|
168
168
|
}>;
|
|
@@ -177,13 +177,28 @@ declare const isTag: _backstage_plugin_permission_node.PermissionRule<TagRespons
|
|
|
177
177
|
}>;
|
|
178
178
|
declare const tagConditionFactory: (params: {
|
|
179
179
|
tag: string;
|
|
180
|
-
}) =>
|
|
180
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"tag", {
|
|
181
181
|
tag: string;
|
|
182
182
|
}>;
|
|
183
|
+
declare const isTagExpert: _backstage_plugin_permission_node.PermissionRule<TagResponse, TagFilter, "tag", {
|
|
184
|
+
userRef?: string | undefined;
|
|
185
|
+
claims?: string[] | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
declare const tagExpertConditionFactory: (params: {
|
|
188
|
+
userRef?: string | undefined;
|
|
189
|
+
claims?: string[] | undefined;
|
|
190
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"tag", {
|
|
191
|
+
userRef?: string | undefined;
|
|
192
|
+
claims?: string[] | undefined;
|
|
193
|
+
}>;
|
|
183
194
|
declare const tagRules: {
|
|
184
195
|
isTag: _backstage_plugin_permission_node.PermissionRule<TagResponse, TagFilter, "tag", {
|
|
185
196
|
tag: string;
|
|
186
197
|
}>;
|
|
198
|
+
isTagExpert: _backstage_plugin_permission_node.PermissionRule<TagResponse, TagFilter, "tag", {
|
|
199
|
+
userRef?: string | undefined;
|
|
200
|
+
claims?: string[] | undefined;
|
|
201
|
+
}>;
|
|
187
202
|
};
|
|
188
203
|
declare const isCollectionOwner: _backstage_plugin_permission_node.PermissionRule<Collection, CollectionFilter, "collection", {
|
|
189
204
|
userRef?: string | undefined;
|
|
@@ -192,7 +207,7 @@ declare const isCollectionOwner: _backstage_plugin_permission_node.PermissionRul
|
|
|
192
207
|
declare const collectionOwnerConditionFactory: (params: {
|
|
193
208
|
userRef?: string | undefined;
|
|
194
209
|
claims?: string[] | undefined;
|
|
195
|
-
}) =>
|
|
210
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"collection", {
|
|
196
211
|
userRef?: string | undefined;
|
|
197
212
|
claims?: string[] | undefined;
|
|
198
213
|
}>;
|
|
@@ -201,7 +216,7 @@ declare const collectionHasTags: _backstage_plugin_permission_node.PermissionRul
|
|
|
201
216
|
}>;
|
|
202
217
|
declare const collectionHasTagsConditionFactory: (params: {
|
|
203
218
|
tags: string[];
|
|
204
|
-
}) =>
|
|
219
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"collection", {
|
|
205
220
|
tags: string[];
|
|
206
221
|
}>;
|
|
207
222
|
declare const collectionHasEntities: _backstage_plugin_permission_node.PermissionRule<Collection, CollectionFilter, "collection", {
|
|
@@ -209,7 +224,7 @@ declare const collectionHasEntities: _backstage_plugin_permission_node.Permissio
|
|
|
209
224
|
}>;
|
|
210
225
|
declare const collectionHasEntitiesConditionFactory: (params: {
|
|
211
226
|
entityRefs: string[];
|
|
212
|
-
}) =>
|
|
227
|
+
}) => _backstage_plugin_permission_common.PermissionCondition<"collection", {
|
|
213
228
|
entityRefs: string[];
|
|
214
229
|
}>;
|
|
215
230
|
declare const collectionRules: {
|
|
@@ -238,6 +253,10 @@ declare const rules: {
|
|
|
238
253
|
isTag: _backstage_plugin_permission_node.PermissionRule<TagResponse, TagFilter, "tag", {
|
|
239
254
|
tag: string;
|
|
240
255
|
}>;
|
|
256
|
+
isTagExpert: _backstage_plugin_permission_node.PermissionRule<TagResponse, TagFilter, "tag", {
|
|
257
|
+
userRef?: string | undefined;
|
|
258
|
+
claims?: string[] | undefined;
|
|
259
|
+
}>;
|
|
241
260
|
isPostAuthor: _backstage_plugin_permission_node.PermissionRule<Post, PostFilter, "post", {
|
|
242
261
|
userRef?: string | undefined;
|
|
243
262
|
claims?: string[] | undefined;
|
|
@@ -282,7 +301,7 @@ declare const questionConditions: _backstage_plugin_permission_node.Conditions<{
|
|
|
282
301
|
type: string;
|
|
283
302
|
}>;
|
|
284
303
|
}>;
|
|
285
|
-
declare const createPostConditionalDecision: (permission:
|
|
304
|
+
declare const createPostConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"post">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"post">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
286
305
|
declare const answerConditions: _backstage_plugin_permission_node.Conditions<{
|
|
287
306
|
isAnswerAuthor: _backstage_plugin_permission_node.PermissionRule<_drodil_backstage_plugin_qeta_common.Answer, _drodil_backstage_plugin_qeta_common.AnswerFilter, "answer", {
|
|
288
307
|
userRef?: string | undefined;
|
|
@@ -295,20 +314,24 @@ declare const answerConditions: _backstage_plugin_permission_node.Conditions<{
|
|
|
295
314
|
entityRefs: string[];
|
|
296
315
|
}>;
|
|
297
316
|
}>;
|
|
298
|
-
declare const createAnswerConditionalDecision: (permission:
|
|
317
|
+
declare const createAnswerConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"answer">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"answer">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
299
318
|
declare const commentConditions: _backstage_plugin_permission_node.Conditions<{
|
|
300
319
|
isCommentAuthor: _backstage_plugin_permission_node.PermissionRule<_drodil_backstage_plugin_qeta_common.Comment, _drodil_backstage_plugin_qeta_common.CommentFilter, "comment", {
|
|
301
320
|
userRef?: string | undefined;
|
|
302
321
|
claims?: string[] | undefined;
|
|
303
322
|
}>;
|
|
304
323
|
}>;
|
|
305
|
-
declare const createCommentConditionalDecision: (permission:
|
|
324
|
+
declare const createCommentConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"comment">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"comment">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
306
325
|
declare const tagConditions: _backstage_plugin_permission_node.Conditions<{
|
|
307
326
|
isTag: _backstage_plugin_permission_node.PermissionRule<_drodil_backstage_plugin_qeta_common.TagResponse, _drodil_backstage_plugin_qeta_common.TagFilter, "tag", {
|
|
308
327
|
tag: string;
|
|
309
328
|
}>;
|
|
329
|
+
isTagExpert: _backstage_plugin_permission_node.PermissionRule<_drodil_backstage_plugin_qeta_common.TagResponse, _drodil_backstage_plugin_qeta_common.TagFilter, "tag", {
|
|
330
|
+
userRef?: string | undefined;
|
|
331
|
+
claims?: string[] | undefined;
|
|
332
|
+
}>;
|
|
310
333
|
}>;
|
|
311
|
-
declare const createTagConditionalDecision: (permission:
|
|
334
|
+
declare const createTagConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"tag">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"tag">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
312
335
|
declare const collectionConditions: _backstage_plugin_permission_node.Conditions<{
|
|
313
336
|
isCollectionOwner: _backstage_plugin_permission_node.PermissionRule<_drodil_backstage_plugin_qeta_common.Collection, _drodil_backstage_plugin_qeta_common.CollectionFilter, "collection", {
|
|
314
337
|
userRef?: string | undefined;
|
|
@@ -321,7 +344,7 @@ declare const collectionConditions: _backstage_plugin_permission_node.Conditions
|
|
|
321
344
|
entityRefs: string[];
|
|
322
345
|
}>;
|
|
323
346
|
}>;
|
|
324
|
-
declare const createCollectionConditionalDecision: (permission:
|
|
347
|
+
declare const createCollectionConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"collection">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"collection">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
325
348
|
|
|
326
349
|
declare const postPermissionResourceRef: _backstage_plugin_permission_node.PermissionResourceRef<Post, PostFilter, "post", "qeta">;
|
|
327
350
|
declare const answerPermissionResourceRef: _backstage_plugin_permission_node.PermissionResourceRef<Answer, AnswerFilter, "answer", "qeta">;
|
|
@@ -335,4 +358,4 @@ declare class DefaultQetaPermissionPolicy implements PermissionPolicy {
|
|
|
335
358
|
handle(request: PolicyQuery, user?: BackstageIdentityResponse): Promise<PolicyDecision>;
|
|
336
359
|
}
|
|
337
360
|
|
|
338
|
-
export { type AIHandler, DefaultQetaPermissionPolicy, type QetaAIExtensionPoint, type QetaTagDatabaseExtensionPoint, type TagDatabase, answerAuthorConditionFactory, answerConditions, answerPermissionResourceRef, answerQuestionEntitiesConditionFactory, answerQuestionHasEntityRefs, answerQuestionHasTags, answerQuestionTagsConditionFactory, answerRules, collectionConditions, collectionHasEntities, collectionHasEntitiesConditionFactory, collectionHasTags, collectionHasTagsConditionFactory, collectionOwnerConditionFactory, collectionPermissionResourceRef, collectionRules, commentAuthorConditionFactory, commentConditions, commentPermissionResourceRef, commentRules, createAnswerConditionalDecision, createCollectionConditionalDecision, createCommentConditionalDecision, createPostConditionalDecision, createTagConditionalDecision, isAnswerAuthor, isCollectionOwner, isCommentAuthor, isPostAuthor, isTag, postAuthorConditionFactory, postHasEntities, postHasEntitiesConditionFactory, postHasTags, postHasTagsConditionFactory, postHasType, postHasTypeConditionFactory, postPermissionResourceRef, postRules, qetaAIExtensionPoint, qetaTagDatabaseExtensionPoint, questionConditions, rules, tagConditionFactory, tagConditions, tagPermissionResourceRef, tagRules };
|
|
361
|
+
export { type AIHandler, DefaultQetaPermissionPolicy, type QetaAIExtensionPoint, type QetaTagDatabaseExtensionPoint, type TagDatabase, answerAuthorConditionFactory, answerConditions, answerPermissionResourceRef, answerQuestionEntitiesConditionFactory, answerQuestionHasEntityRefs, answerQuestionHasTags, answerQuestionTagsConditionFactory, answerRules, collectionConditions, collectionHasEntities, collectionHasEntitiesConditionFactory, collectionHasTags, collectionHasTagsConditionFactory, collectionOwnerConditionFactory, collectionPermissionResourceRef, collectionRules, commentAuthorConditionFactory, commentConditions, commentPermissionResourceRef, commentRules, createAnswerConditionalDecision, createCollectionConditionalDecision, createCommentConditionalDecision, createPostConditionalDecision, createTagConditionalDecision, isAnswerAuthor, isCollectionOwner, isCommentAuthor, isPostAuthor, isTag, isTagExpert, postAuthorConditionFactory, postHasEntities, postHasEntitiesConditionFactory, postHasTags, postHasTagsConditionFactory, postHasType, postHasTypeConditionFactory, postPermissionResourceRef, postRules, qetaAIExtensionPoint, qetaTagDatabaseExtensionPoint, questionConditions, rules, tagConditionFactory, tagConditions, tagExpertConditionFactory, tagPermissionResourceRef, tagRules };
|
|
@@ -185,7 +185,28 @@ const isTag = pluginPermissionNode.createPermissionRule({
|
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
187
|
const tagConditionFactory = pluginPermissionNode.createConditionFactory(isTag);
|
|
188
|
-
const
|
|
188
|
+
const isTagExpert = pluginPermissionNode.createPermissionRule({
|
|
189
|
+
name: "IS_TAG_EXPERT",
|
|
190
|
+
description: "Allows only if user is tag expert",
|
|
191
|
+
resourceRef: permissionResources.tagPermissionResourceRef,
|
|
192
|
+
paramsSchema: zod.z.object({
|
|
193
|
+
userRef: zod.z.string().describe("User ID to match on the tag expert").optional(),
|
|
194
|
+
claims: zod.z.array(zod.z.string()).optional().describe("List of claims to match at least one on within tag expert")
|
|
195
|
+
}),
|
|
196
|
+
apply: (resource, { userRef, claims }) => {
|
|
197
|
+
return Boolean(
|
|
198
|
+
resource?.experts?.some((e) => e === userRef || claims?.includes(e))
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
toQuery: ({ claims = [], userRef }) => {
|
|
202
|
+
return {
|
|
203
|
+
property: "tag.experts",
|
|
204
|
+
values: [userRef, ...claims].filter(Boolean)
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const tagExpertConditionFactory = pluginPermissionNode.createConditionFactory(isTagExpert);
|
|
209
|
+
const tagRules = { isTag, isTagExpert };
|
|
189
210
|
const isCollectionOwner = pluginPermissionNode.createPermissionRule({
|
|
190
211
|
name: "IS_OWNER",
|
|
191
212
|
description: "Should allow only if the collection is owned by the user",
|
|
@@ -275,6 +296,7 @@ exports.isCollectionOwner = isCollectionOwner;
|
|
|
275
296
|
exports.isCommentAuthor = isCommentAuthor;
|
|
276
297
|
exports.isPostAuthor = isPostAuthor;
|
|
277
298
|
exports.isTag = isTag;
|
|
299
|
+
exports.isTagExpert = isTagExpert;
|
|
278
300
|
exports.postAuthorConditionFactory = postAuthorConditionFactory;
|
|
279
301
|
exports.postHasEntities = postHasEntities;
|
|
280
302
|
exports.postHasEntitiesConditionFactory = postHasEntitiesConditionFactory;
|
|
@@ -285,5 +307,6 @@ exports.postHasTypeConditionFactory = postHasTypeConditionFactory;
|
|
|
285
307
|
exports.postRules = postRules;
|
|
286
308
|
exports.rules = rules;
|
|
287
309
|
exports.tagConditionFactory = tagConditionFactory;
|
|
310
|
+
exports.tagExpertConditionFactory = tagExpertConditionFactory;
|
|
288
311
|
exports.tagRules = tagRules;
|
|
289
312
|
//# sourceMappingURL=permissionRules.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissionRules.cjs.js","sources":["../src/permissionRules.ts"],"sourcesContent":["import {\n createConditionFactory,\n createPermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\nimport {\n Answer,\n AnswerFilter,\n Collection,\n CollectionFilter,\n Comment,\n CommentFilter,\n Post,\n PostFilter,\n TagFilter,\n TagResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n answerPermissionResourceRef,\n collectionPermissionResourceRef,\n commentPermissionResourceRef,\n postPermissionResourceRef,\n tagPermissionResourceRef,\n} from './permissionResources';\n\nexport const isPostAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the post is created by the user',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Post, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'posts.author' as PostFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const postAuthorConditionFactory = createConditionFactory(isPostAuthor);\n\nexport const postHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description: 'Should allow only if the post has all the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as PostFilter['property'],\n values: tags,\n };\n },\n});\n\nexport const postHasTagsConditionFactory = createConditionFactory(postHasTags);\n\nexport const postHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description: 'Should allow only if the post has all the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Entity refs to match the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as PostFilter['property'],\n values: entityRefs,\n };\n },\n});\n\nexport const postHasEntitiesConditionFactory =\n createConditionFactory(postHasEntities);\n\nexport const postHasType = createPermissionRule({\n name: 'HAS_TYPE',\n description: 'Should allow only if the post has the specific type',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n type: z.string().describe('Type to match the post'),\n }),\n apply: (resource: Post, { type }) => {\n return resource?.type === type;\n },\n toQuery: ({ type }) => {\n return {\n property: 'posts.type' as PostFilter['property'],\n values: [type],\n };\n },\n});\n\nexport const postHasTypeConditionFactory = createConditionFactory(postHasType);\n\nexport const postRules = {\n isPostAuthor,\n postHasTags,\n postHasEntities,\n postHasType,\n};\n\nexport const isAnswerAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the answer is created by the user',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Answer, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'answers.author' as AnswerFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const answerAuthorConditionFactory =\n createConditionFactory(isAnswerAuthor);\n\nexport const answerQuestionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the answers question has all the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return tags.every(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as AnswerFilter['property'],\n values: tags,\n };\n },\n});\n\nexport const answerQuestionTagsConditionFactory = createConditionFactory(\n answerQuestionHasTags,\n);\n\nexport const answerQuestionHasEntityRefs = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the answers question has all the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return entityRefs.every(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as AnswerFilter['property'],\n values: entityRefs,\n };\n },\n});\n\nexport const answerQuestionEntitiesConditionFactory = createConditionFactory(\n answerQuestionHasEntityRefs,\n);\n\nexport const answerRules = {\n isAnswerAuthor,\n answerQuestionHasTags,\n answerQuestionHasEntityRefs,\n};\n\nexport const isCommentAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the comment is created by the user',\n resourceRef: commentPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Comment, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'comments.author' as CommentFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const commentAuthorConditionFactory =\n createConditionFactory(isCommentAuthor);\n\nexport const commentRules = { isCommentAuthor };\n\nexport const isTag = createPermissionRule({\n name: 'IS_TAG',\n description: 'Should allow only if the tag exists',\n resourceRef: tagPermissionResourceRef,\n paramsSchema: z.object({\n tag: z.string().describe('Tag to match the post'),\n }),\n apply: (resource: TagResponse, { tag }) => {\n return resource?.tag === tag;\n },\n toQuery: ({ tag }) => {\n return {\n property: 'tags.tag' as TagFilter['property'],\n values: [tag],\n };\n },\n});\n\nexport const tagConditionFactory = createConditionFactory(isTag);\n\nexport const tagRules = { isTag };\n\nexport const isCollectionOwner = createPermissionRule({\n name: 'IS_OWNER',\n description: 'Should allow only if the collection is owned by the user',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User reference to match on the owner')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within owner'),\n }),\n apply: (resource: Collection, { userRef, claims = [] }) => {\n return resource?.owner === userRef || claims.includes(resource?.owner);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'collections.owner' as CollectionFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const collectionOwnerConditionFactory =\n createConditionFactory(isCollectionOwner);\n\nexport const collectionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the posts in the collection have the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as CollectionFilter['property'],\n values: tags,\n };\n },\n});\n\nexport const collectionHasTagsConditionFactory =\n createConditionFactory(collectionHasTags);\n\nexport const collectionHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the posts in the collection have the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs to match the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as CollectionFilter['property'],\n values: entityRefs,\n };\n },\n});\n\nexport const collectionHasEntitiesConditionFactory = createConditionFactory(\n collectionHasEntities,\n);\n\nexport const collectionRules = {\n isCollectionOwner,\n collectionHasTags,\n collectionHasEntities,\n};\n\nexport const rules = {\n ...commentRules,\n ...answerRules,\n ...postRules,\n ...tagRules,\n ...collectionRules,\n};\n"],"names":["createPermissionRule","postPermissionResourceRef","z","createConditionFactory","answerPermissionResourceRef","commentPermissionResourceRef","tagPermissionResourceRef","collectionPermissionResourceRef"],"mappings":";;;;;;AAyBO,MAAM,eAAeA,yCAAqB,CAAA;AAAA,EAC/C,IAAM,EAAA,WAAA;AAAA,EACN,WAAa,EAAA,sDAAA;AAAA,EACb,WAAa,EAAAC,6CAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,SAASA,KAAE,CAAA,MAAA,GAAS,QAAS,CAAA,gCAAgC,EAAE,QAAS,EAAA;AAAA,IACxE,MAAA,EAAQA,KACL,CAAA,KAAA,CAAMA,KAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,uDAAuD;AAAA,GACpE,CAAA;AAAA,EACD,KAAA,EAAO,CAAC,QAAgB,EAAA,EAAE,SAAS,MAAS,GAAA,IAAS,KAAA;AACnD,IAAA,OAAO,UAAU,MAAW,KAAA,OAAA,IAAW,MAAO,CAAA,QAAA,CAAS,UAAU,MAAM,CAAA;AAAA,GACzE;AAAA,EACA,SAAS,CAAC,EAAE,SAAS,MAAS,GAAA,IAAS,KAAA;AACrC,IAAO,OAAA;AAAA,MACL,QAAU,EAAA,cAAA;AAAA,MACV,QAAQ,CAAC,OAAA,EAAS,GAAG,MAAM,CAAA,CAAE,OAAO,OAAO;AAAA,KAC7C;AAAA;AAEJ,CAAC;AAEY,MAAA,0BAAA,GAA6BC,4CAAuB,YAAY;AAEtE,MAAM,cAAcH,yCAAqB,CAAA;AAAA,EAC9C,IAAM,EAAA,UAAA;AAAA,EACN,WAAa,EAAA,yDAAA;AAAA,EACb,WAAa,EAAAC,6CAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,IAAA,EAAMA,MAAE,KAAM,CAAAA,KAAA,CAAE,QAAQ,CAAA,CAAE,SAAS,uBAAuB;AAAA,GAC3D,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAAgB,EAAA,E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ACL,QAAU,EAAA,YAAA;AAAA,MACV,MAAQ,EAAA;AAAA,KACV;AAAA;AAEJ,CAAC;AAEM,MAAM,qCAAwC,GAAAC,2CAAA;AAAA,EACnD;AACF;AAEO,MAAM,eAAkB,GAAA;AAAA,EAC7B,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF;AAEO,MAAM,KAAQ,GAAA;AAAA,EACnB,GAAG,YAAA;AAAA,EACH,GAAG,WAAA;AAAA,EACH,GAAG,SAAA;AAAA,EACH,GAAG,QAAA;AAAA,EACH,GAAG;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"permissionRules.cjs.js","sources":["../src/permissionRules.ts"],"sourcesContent":["import {\n createConditionFactory,\n createPermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { z } from 'zod';\nimport {\n Answer,\n AnswerFilter,\n Collection,\n CollectionFilter,\n Comment,\n CommentFilter,\n Post,\n PostFilter,\n TagFilter,\n TagResponse,\n} from '@drodil/backstage-plugin-qeta-common';\nimport {\n answerPermissionResourceRef,\n collectionPermissionResourceRef,\n commentPermissionResourceRef,\n postPermissionResourceRef,\n tagPermissionResourceRef,\n} from './permissionResources';\n\nexport const isPostAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the post is created by the user',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Post, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'posts.author' as PostFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const postAuthorConditionFactory = createConditionFactory(isPostAuthor);\n\nexport const postHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description: 'Should allow only if the post has all the specific tags',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the post'),\n }),\n apply: (resource: Post, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as PostFilter['property'],\n values: tags,\n };\n },\n});\n\nexport const postHasTagsConditionFactory = createConditionFactory(postHasTags);\n\nexport const postHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description: 'Should allow only if the post has all the specific entities',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Entity refs to match the post'),\n }),\n apply: (resource: Post, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as PostFilter['property'],\n values: entityRefs,\n };\n },\n});\n\nexport const postHasEntitiesConditionFactory =\n createConditionFactory(postHasEntities);\n\nexport const postHasType = createPermissionRule({\n name: 'HAS_TYPE',\n description: 'Should allow only if the post has the specific type',\n resourceRef: postPermissionResourceRef,\n paramsSchema: z.object({\n type: z.string().describe('Type to match the post'),\n }),\n apply: (resource: Post, { type }) => {\n return resource?.type === type;\n },\n toQuery: ({ type }) => {\n return {\n property: 'posts.type' as PostFilter['property'],\n values: [type],\n };\n },\n});\n\nexport const postHasTypeConditionFactory = createConditionFactory(postHasType);\n\nexport const postRules = {\n isPostAuthor,\n postHasTags,\n postHasEntities,\n postHasType,\n};\n\nexport const isAnswerAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the answer is created by the user',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Answer, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'answers.author' as AnswerFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const answerAuthorConditionFactory =\n createConditionFactory(isAnswerAuthor);\n\nexport const answerQuestionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the answers question has all the specific tags',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { tags }) => {\n return tags.every(t => resource?.post?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as AnswerFilter['property'],\n values: tags,\n };\n },\n});\n\nexport const answerQuestionTagsConditionFactory = createConditionFactory(\n answerQuestionHasTags,\n);\n\nexport const answerQuestionHasEntityRefs = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the answers question has all the specific entities',\n resourceRef: answerPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z.array(z.string()).describe('Tag to match the question'),\n }),\n apply: (resource: Answer, { entityRefs }) => {\n return entityRefs.every(t => resource?.post?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as AnswerFilter['property'],\n values: entityRefs,\n };\n },\n});\n\nexport const answerQuestionEntitiesConditionFactory = createConditionFactory(\n answerQuestionHasEntityRefs,\n);\n\nexport const answerRules = {\n isAnswerAuthor,\n answerQuestionHasTags,\n answerQuestionHasEntityRefs,\n};\n\nexport const isCommentAuthor = createPermissionRule({\n name: 'IS_AUTHOR',\n description: 'Should allow only if the comment is created by the user',\n resourceRef: commentPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z.string().describe('User ID to match on the author').optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within author'),\n }),\n apply: (resource: Comment, { userRef, claims = [] }) => {\n return resource?.author === userRef || claims.includes(resource?.author);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'comments.author' as CommentFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const commentAuthorConditionFactory =\n createConditionFactory(isCommentAuthor);\n\nexport const commentRules = { isCommentAuthor };\n\nexport const isTag = createPermissionRule({\n name: 'IS_TAG',\n description: 'Should allow only if the tag exists',\n resourceRef: tagPermissionResourceRef,\n paramsSchema: z.object({\n tag: z.string().describe('Tag to match the post'),\n }),\n apply: (resource: TagResponse, { tag }) => {\n return resource?.tag === tag;\n },\n toQuery: ({ tag }) => {\n return {\n property: 'tags.tag' as TagFilter['property'],\n values: [tag],\n };\n },\n});\n\nexport const tagConditionFactory = createConditionFactory(isTag);\n\nexport const isTagExpert = createPermissionRule({\n name: 'IS_TAG_EXPERT',\n description: 'Allows only if user is tag expert',\n resourceRef: tagPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User ID to match on the tag expert')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within tag expert'),\n }),\n apply: (resource: TagResponse, { userRef, claims }) => {\n return Boolean(\n resource?.experts?.some(e => e === userRef || claims?.includes(e)),\n );\n },\n toQuery: ({ claims = [], userRef }) => {\n return {\n property: 'tag.experts' as TagFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const tagExpertConditionFactory = createConditionFactory(isTagExpert);\n\nexport const tagRules = { isTag, isTagExpert };\n\nexport const isCollectionOwner = createPermissionRule({\n name: 'IS_OWNER',\n description: 'Should allow only if the collection is owned by the user',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n userRef: z\n .string()\n .describe('User reference to match on the owner')\n .optional(),\n claims: z\n .array(z.string())\n .optional()\n .describe('List of claims to match at least one on within owner'),\n }),\n apply: (resource: Collection, { userRef, claims = [] }) => {\n return resource?.owner === userRef || claims.includes(resource?.owner);\n },\n toQuery: ({ userRef, claims = [] }) => {\n return {\n property: 'collections.owner' as CollectionFilter['property'],\n values: [userRef, ...claims].filter(Boolean),\n };\n },\n});\n\nexport const collectionOwnerConditionFactory =\n createConditionFactory(isCollectionOwner);\n\nexport const collectionHasTags = createPermissionRule({\n name: 'HAS_TAGS',\n description:\n 'Should allow only if the posts in the collection have the specific tags',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n tags: z.array(z.string()).describe('Tag to match the collection'),\n }),\n apply: (resource: Collection, { tags }) => {\n return tags.every(t => resource?.tags?.includes(t));\n },\n toQuery: ({ tags }) => {\n return {\n property: 'tags' as CollectionFilter['property'],\n values: tags,\n };\n },\n});\n\nexport const collectionHasTagsConditionFactory =\n createConditionFactory(collectionHasTags);\n\nexport const collectionHasEntities = createPermissionRule({\n name: 'HAS_ENTITIES',\n description:\n 'Should allow only if the posts in the collection have the specific entities',\n resourceRef: collectionPermissionResourceRef,\n paramsSchema: z.object({\n entityRefs: z\n .array(z.string())\n .describe('Entity refs to match the collection'),\n }),\n apply: (resource: Collection, { entityRefs }) => {\n return entityRefs.every(t => resource?.entities?.includes(t));\n },\n toQuery: ({ entityRefs }) => {\n return {\n property: 'entityRefs' as CollectionFilter['property'],\n values: entityRefs,\n };\n },\n});\n\nexport const collectionHasEntitiesConditionFactory = createConditionFactory(\n collectionHasEntities,\n);\n\nexport const collectionRules = {\n isCollectionOwner,\n collectionHasTags,\n collectionHasEntities,\n};\n\nexport const rules = {\n ...commentRules,\n ...answerRules,\n ...postRules,\n ...tagRules,\n ...collectionRules,\n};\n"],"names":["createPermissionRule","postPermissionResourceRef","z","createConditionFactory","answerPermissionResourceRef","commentPermissionResourceRef","tagPermissionResourceRef","collectionPermissionResourceRef"],"mappings":";;;;;;AAyBO,MAAM,eAAeA,yCAAqB,CAAA;AAAA,EAC/C,IAAM,EAAA,WAAA;AAAA,EACN,WAAa,EAAA,sDAAA;AAAA,EACb,WAAa,EAAAC,6CAAA;AAAA,EACb,YAAA,EAAcC,MAAE,MAAO,CAAA;AAAA,IACrB,SAASA,KAAE,CAAA,MAAA,GAAS,QAAS,CAAA,gCAAgC,EAAE,QAAS,EAAA;AAAA,IACxE,MAAA,EAAQA,KACL,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AAwBH,yCAAqB,CAAA;AAAA,EACxD,IAAM,EAAA,cAAA;AAAA,EACN,WACE,EAAA,6EAAA;AAAA,EACF,WAAa,EAAAO,mDAAA;AAAA,EACb,YAAA,EAAcL,MAAE,MAAO,CAAA;AAAA,IACrB,UAAA,EAAYA,MACT,KAAM,CAAAA,KAAA,CAAE,QAAQ,CAAA,CAChB,SAAS,qCAAqC;AAAA,GAClD,CAAA;AAAA,EACD,KAAO,EAAA,CAAC,QAAsB,EAAA,EAAE,YAAiB,KAAA;AAC/C,IAAA,OAAO,WAAW,KAAM,CAAA,CAAA,CAAA,KAAK,UAAU,QAAU,EAAA,QAAA,CAAS,CAAC,CAAC,CAAA;AAAA,GAC9D;AAAA,EACA,OAAS,EAAA,CAAC,EAAE,UAAA,EAAiB,KAAA;AAC3B,IAAO,OAAA;AAAA,MACL,QAAU,EAAA,YAAA;AAAA,MACV,MAAQ,EAAA;AAAA,KACV;AAAA;AAEJ,CAAC;AAEM,MAAM,qCAAwC,GAAAC,2CAAA;AAAA,EACnD;AACF;AAEO,MAAM,eAAkB,GAAA;AAAA,EAC7B,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF;AAEO,MAAM,KAAQ,GAAA;AAAA,EACnB,GAAG,YAAA;AAAA,EACH,GAAG,WAAA;AAAA,EACH,GAAG,SAAA;AAAA,EACH,GAAG,QAAA;AAAA,EACH,GAAG;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"backstage.io",
|
|
8
8
|
"node"
|
|
9
9
|
],
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.27.0",
|
|
11
11
|
"main": "dist/index.cjs.js",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"prepublishOnly": "yarn tsc && yarn build",
|
|
@@ -47,20 +47,20 @@
|
|
|
47
47
|
"tsc": "tsc"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@backstage/cli": "^0.32.
|
|
50
|
+
"@backstage/cli": "^0.32.1"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
53
53
|
"dist"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@backstage/backend-plugin-api": "^1.3.
|
|
57
|
-
"@backstage/catalog-client": "^1.
|
|
58
|
-
"@backstage/catalog-model": "^1.7.
|
|
56
|
+
"@backstage/backend-plugin-api": "^1.3.1",
|
|
57
|
+
"@backstage/catalog-client": "^1.10.0",
|
|
58
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
59
59
|
"@backstage/config": "^1.3.2",
|
|
60
|
-
"@backstage/plugin-auth-node": "^0.6.
|
|
61
|
-
"@backstage/plugin-permission-common": "^0.
|
|
62
|
-
"@backstage/plugin-permission-node": "^0.
|
|
63
|
-
"@drodil/backstage-plugin-qeta-common": "^3.
|
|
60
|
+
"@backstage/plugin-auth-node": "^0.6.3",
|
|
61
|
+
"@backstage/plugin-permission-common": "^0.9.0",
|
|
62
|
+
"@backstage/plugin-permission-node": "^0.10.0",
|
|
63
|
+
"@drodil/backstage-plugin-qeta-common": "^3.27.0",
|
|
64
64
|
"zod": "^3.22.4"
|
|
65
65
|
},
|
|
66
66
|
"typesVersions": {
|