@xemahq/platform-common 0.14.1 → 0.16.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.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/enums/index.d.ts +0 -1
- package/dist/lib/enums/index.d.ts.map +1 -1
- package/dist/lib/enums/index.js +0 -1
- package/dist/lib/enums/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/lib/advisory-lock.d.ts +0 -10
- package/dist/lib/advisory-lock.d.ts.map +0 -1
- package/dist/lib/advisory-lock.js +0 -32
- package/dist/lib/advisory-lock.js.map +0 -1
- package/dist/lib/biome-database.d.ts +0 -14
- package/dist/lib/biome-database.d.ts.map +0 -1
- package/dist/lib/biome-database.js +0 -88
- package/dist/lib/biome-database.js.map +0 -1
- package/dist/lib/enums/scope-source.d.ts +0 -24
- package/dist/lib/enums/scope-source.d.ts.map +0 -1
- package/dist/lib/enums/scope-source.js +0 -73
- package/dist/lib/enums/scope-source.js.map +0 -1
- package/dist/lib/llm-stream/anthropic-adapter.d.ts +0 -25
- package/dist/lib/llm-stream/anthropic-adapter.d.ts.map +0 -1
- package/dist/lib/llm-stream/anthropic-adapter.js +0 -278
- package/dist/lib/llm-stream/anthropic-adapter.js.map +0 -1
- package/dist/lib/redaction/redaction.interceptor.d.ts +0 -11
- package/dist/lib/redaction/redaction.interceptor.d.ts.map +0 -1
- package/dist/lib/redaction/redaction.interceptor.js +0 -41
- package/dist/lib/redaction/redaction.interceptor.js.map +0 -1
- package/dist/lib/redaction/redaction.service.d.ts +0 -9
- package/dist/lib/redaction/redaction.service.d.ts.map +0 -1
- package/dist/lib/redaction/redaction.service.js +0 -110
- package/dist/lib/redaction/redaction.service.js.map +0 -1
- package/dist/lib/to-prisma-json.d.ts +0 -6
- package/dist/lib/to-prisma-json.d.ts.map +0 -1
- package/dist/lib/to-prisma-json.js +0 -12
- package/dist/lib/to-prisma-json.js.map +0 -1
- package/dist/lib/tool-usage-counter.d.ts +0 -20
- package/dist/lib/tool-usage-counter.d.ts.map +0 -1
- package/dist/lib/tool-usage-counter.js +0 -50
- package/dist/lib/tool-usage-counter.js.map +0 -1
- package/dist/lib/write-policy.d.ts +0 -30
- package/dist/lib/write-policy.d.ts.map +0 -1
- package/dist/lib/write-policy.js +0 -54
- package/dist/lib/write-policy.js.map +0 -1
- package/dist/nestjs/auth/org-authority-observations.d.ts +0 -15
- package/dist/nestjs/auth/org-authority-observations.d.ts.map +0 -1
- package/dist/nestjs/auth/org-authority-observations.js +0 -47
- package/dist/nestjs/auth/org-authority-observations.js.map +0 -1
- package/dist/nestjs/auth/org-authority.d.ts +0 -32
- package/dist/nestjs/auth/org-authority.d.ts.map +0 -1
- package/dist/nestjs/auth/org-authority.js +0 -102
- package/dist/nestjs/auth/org-authority.js.map +0 -1
- package/dist/nestjs/auth/org-claim.d.ts +0 -12
- package/dist/nestjs/auth/org-claim.d.ts.map +0 -1
- package/dist/nestjs/auth/org-claim.js +0 -25
- package/dist/nestjs/auth/org-claim.js.map +0 -1
- package/dist/nestjs/auth/org-role.d.ts +0 -13
- package/dist/nestjs/auth/org-role.d.ts.map +0 -1
- package/dist/nestjs/auth/org-role.js +0 -75
- package/dist/nestjs/auth/org-role.js.map +0 -1
- package/dist/nestjs/idempotency/prisma-idempotency.service.d.ts +0 -20
- package/dist/nestjs/idempotency/prisma-idempotency.service.d.ts.map +0 -1
- package/dist/nestjs/idempotency/prisma-idempotency.service.js +0 -58
- package/dist/nestjs/idempotency/prisma-idempotency.service.js.map +0 -1
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildAnthropicMessages = buildAnthropicMessages;
|
|
4
|
-
exports.buildAnthropicTools = buildAnthropicTools;
|
|
5
|
-
exports.parseAnthropicResponse = parseAnthropicResponse;
|
|
6
|
-
exports.normalizeAnthropicStream = normalizeAnthropicStream;
|
|
7
|
-
const common_1 = require("@nestjs/common");
|
|
8
|
-
const logger = new common_1.Logger('AnthropicAdapter');
|
|
9
|
-
function buildAnthropicMessages(messages) {
|
|
10
|
-
const systemParts = [];
|
|
11
|
-
const anthropicMessages = [];
|
|
12
|
-
let toolResultBuffer = [];
|
|
13
|
-
for (const m of messages) {
|
|
14
|
-
if (m.role === 'system') {
|
|
15
|
-
if (m.content)
|
|
16
|
-
systemParts.push(m.content);
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
if (m.role !== 'tool' && toolResultBuffer.length > 0) {
|
|
20
|
-
anthropicMessages.push({ role: 'user', content: toolResultBuffer });
|
|
21
|
-
toolResultBuffer = [];
|
|
22
|
-
}
|
|
23
|
-
if (m.role === 'assistant' && m.tool_calls?.length) {
|
|
24
|
-
const content = [];
|
|
25
|
-
if (m.content) {
|
|
26
|
-
content.push({ type: 'text', text: m.content });
|
|
27
|
-
}
|
|
28
|
-
for (const tc of m.tool_calls) {
|
|
29
|
-
let input;
|
|
30
|
-
try {
|
|
31
|
-
input = JSON.parse(tc.function.arguments);
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
input = tc.function.arguments;
|
|
35
|
-
}
|
|
36
|
-
content.push({
|
|
37
|
-
type: 'tool_use',
|
|
38
|
-
id: tc.id,
|
|
39
|
-
name: tc.function.name,
|
|
40
|
-
input,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
anthropicMessages.push({ role: 'assistant', content });
|
|
44
|
-
}
|
|
45
|
-
else if (m.role === 'tool' && m.tool_call_id) {
|
|
46
|
-
toolResultBuffer.push({
|
|
47
|
-
type: 'tool_result',
|
|
48
|
-
tool_use_id: m.tool_call_id,
|
|
49
|
-
content: m.content ?? '',
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else if (m.role === 'assistant') {
|
|
53
|
-
anthropicMessages.push({ role: 'assistant', content: m.content ?? '' });
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
anthropicMessages.push({ role: 'user', content: m.content ?? '' });
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (toolResultBuffer.length > 0) {
|
|
60
|
-
anthropicMessages.push({ role: 'user', content: toolResultBuffer });
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
system: systemParts.length > 0 ? systemParts.join('\n') : undefined,
|
|
64
|
-
messages: anthropicMessages,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function buildAnthropicTools(tools) {
|
|
68
|
-
return tools.map((t) => ({
|
|
69
|
-
name: t.function.name,
|
|
70
|
-
description: t.function.description,
|
|
71
|
-
input_schema: t.function.parameters,
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
function parseAnthropicResponse(body) {
|
|
75
|
-
const blocks = body.content ?? [];
|
|
76
|
-
let textContent = '';
|
|
77
|
-
const toolCalls = [];
|
|
78
|
-
for (const block of blocks) {
|
|
79
|
-
if (block.type === 'text') {
|
|
80
|
-
textContent += block.text;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
toolCalls.push({
|
|
84
|
-
id: block.id,
|
|
85
|
-
type: 'function',
|
|
86
|
-
function: {
|
|
87
|
-
name: block.name,
|
|
88
|
-
arguments: typeof block.input === 'string'
|
|
89
|
-
? block.input
|
|
90
|
-
: JSON.stringify(block.input),
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
let finishReason = 'stop';
|
|
96
|
-
if (body.stop_reason === 'tool_use')
|
|
97
|
-
finishReason = 'tool_calls';
|
|
98
|
-
else if (body.stop_reason === 'max_tokens')
|
|
99
|
-
finishReason = 'length';
|
|
100
|
-
return {
|
|
101
|
-
content: textContent,
|
|
102
|
-
...(toolCalls.length > 0 ? { toolCalls } : {}),
|
|
103
|
-
finishReason,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function normalizeAnthropicStream(input) {
|
|
107
|
-
const reader = input.getReader();
|
|
108
|
-
const decoder = new TextDecoder();
|
|
109
|
-
const encoder = new TextEncoder();
|
|
110
|
-
let messageId = '';
|
|
111
|
-
let model = '';
|
|
112
|
-
let nextToolCallIndex = 0;
|
|
113
|
-
const toolCallIndexMap = new Map();
|
|
114
|
-
const toolBlockHasInput = new Map();
|
|
115
|
-
const makeChunk = (delta, finishReason = null) => `data: ${JSON.stringify({
|
|
116
|
-
id: messageId,
|
|
117
|
-
object: 'chat.completion.chunk',
|
|
118
|
-
model,
|
|
119
|
-
choices: [{ index: 0, delta, finish_reason: finishReason }],
|
|
120
|
-
})}\n\n`;
|
|
121
|
-
const processEvent = (parsed) => {
|
|
122
|
-
switch (parsed.type) {
|
|
123
|
-
case 'message_start': {
|
|
124
|
-
const msg = parsed.message;
|
|
125
|
-
messageId = msg.id || `msg_${Date.now()}`;
|
|
126
|
-
model = msg.model || '';
|
|
127
|
-
return [makeChunk({ role: 'assistant', content: '' })];
|
|
128
|
-
}
|
|
129
|
-
case 'content_block_start': {
|
|
130
|
-
const block = parsed.content_block;
|
|
131
|
-
const index = parsed.index;
|
|
132
|
-
if (block.type === 'tool_use') {
|
|
133
|
-
const tcIdx = nextToolCallIndex++;
|
|
134
|
-
toolCallIndexMap.set(index, tcIdx);
|
|
135
|
-
toolBlockHasInput.set(index, false);
|
|
136
|
-
logger.debug(`Tool call started: index=${index} tcIdx=${tcIdx} id=${block.id} name=${block.name}`);
|
|
137
|
-
return [
|
|
138
|
-
makeChunk({
|
|
139
|
-
tool_calls: [
|
|
140
|
-
{
|
|
141
|
-
index: tcIdx,
|
|
142
|
-
id: block.id,
|
|
143
|
-
type: 'function',
|
|
144
|
-
function: { name: block.name, arguments: '' },
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
}),
|
|
148
|
-
];
|
|
149
|
-
}
|
|
150
|
-
return [];
|
|
151
|
-
}
|
|
152
|
-
case 'content_block_delta': {
|
|
153
|
-
const delta = parsed.delta;
|
|
154
|
-
const index = parsed.index;
|
|
155
|
-
if (delta.type === 'text_delta') {
|
|
156
|
-
return [makeChunk({ content: delta.text })];
|
|
157
|
-
}
|
|
158
|
-
if (delta.type === 'thinking_delta') {
|
|
159
|
-
return [makeChunk({ reasoning_content: delta.thinking })];
|
|
160
|
-
}
|
|
161
|
-
if (delta.type === 'input_json_delta') {
|
|
162
|
-
const partialJson = delta.partial_json;
|
|
163
|
-
if (!partialJson)
|
|
164
|
-
return [];
|
|
165
|
-
const tcIdx = toolCallIndexMap.get(index) ?? 0;
|
|
166
|
-
toolBlockHasInput.set(index, true);
|
|
167
|
-
logger.debug(`Tool call args delta: index=${index} tcIdx=${tcIdx} partial_json=${JSON.stringify(partialJson)}`);
|
|
168
|
-
return [
|
|
169
|
-
makeChunk({
|
|
170
|
-
tool_calls: [
|
|
171
|
-
{
|
|
172
|
-
index: tcIdx,
|
|
173
|
-
function: { arguments: partialJson },
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
}),
|
|
177
|
-
];
|
|
178
|
-
}
|
|
179
|
-
return [];
|
|
180
|
-
}
|
|
181
|
-
case 'content_block_stop': {
|
|
182
|
-
const index = parsed.index;
|
|
183
|
-
if (toolCallIndexMap.has(index) && !toolBlockHasInput.get(index)) {
|
|
184
|
-
const tcIdx = toolCallIndexMap.get(index);
|
|
185
|
-
logger.debug(`Tool call block stopped with no input — emitting empty args: index=${index} tcIdx=${tcIdx}`);
|
|
186
|
-
return [
|
|
187
|
-
makeChunk({
|
|
188
|
-
tool_calls: [
|
|
189
|
-
{
|
|
190
|
-
index: tcIdx,
|
|
191
|
-
function: { arguments: '{}' },
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
}),
|
|
195
|
-
];
|
|
196
|
-
}
|
|
197
|
-
return [];
|
|
198
|
-
}
|
|
199
|
-
case 'message_delta': {
|
|
200
|
-
const d = parsed.delta;
|
|
201
|
-
let fr = 'stop';
|
|
202
|
-
if (d.stop_reason === 'tool_use')
|
|
203
|
-
fr = 'tool_calls';
|
|
204
|
-
else if (d.stop_reason === 'max_tokens')
|
|
205
|
-
fr = 'length';
|
|
206
|
-
return [makeChunk({}, fr)];
|
|
207
|
-
}
|
|
208
|
-
case 'message_stop':
|
|
209
|
-
return ['data: [DONE]\n\n'];
|
|
210
|
-
default:
|
|
211
|
-
return [];
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
return new ReadableStream({
|
|
215
|
-
async start(controller) {
|
|
216
|
-
let buffer = '';
|
|
217
|
-
try {
|
|
218
|
-
for (;;) {
|
|
219
|
-
const { done, value } = await reader.read();
|
|
220
|
-
if (done)
|
|
221
|
-
break;
|
|
222
|
-
buffer += decoder.decode(value, { stream: true });
|
|
223
|
-
const lines = buffer.split('\n');
|
|
224
|
-
buffer = lines.pop() ?? '';
|
|
225
|
-
for (const line of lines) {
|
|
226
|
-
const trimmed = line.trim();
|
|
227
|
-
if (!trimmed.startsWith('data: '))
|
|
228
|
-
continue;
|
|
229
|
-
const dataStr = trimmed.slice(6).trim();
|
|
230
|
-
if (dataStr === '[DONE]') {
|
|
231
|
-
controller.enqueue(encoder.encode('data: [DONE]\n\n'));
|
|
232
|
-
continue;
|
|
233
|
-
}
|
|
234
|
-
let parsed;
|
|
235
|
-
try {
|
|
236
|
-
parsed = JSON.parse(dataStr);
|
|
237
|
-
}
|
|
238
|
-
catch {
|
|
239
|
-
logger.warn(`Skipping unparseable SSE line: ${dataStr.slice(0, 200)}`);
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
for (const chunk of processEvent(parsed)) {
|
|
243
|
-
controller.enqueue(encoder.encode(chunk));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
if (buffer.trim()) {
|
|
248
|
-
const trimmed = buffer.trim();
|
|
249
|
-
if (trimmed.startsWith('data: ')) {
|
|
250
|
-
const dataStr = trimmed.slice(6).trim();
|
|
251
|
-
if (dataStr === '[DONE]') {
|
|
252
|
-
controller.enqueue(encoder.encode('data: [DONE]\n\n'));
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
try {
|
|
256
|
-
const parsed = JSON.parse(dataStr);
|
|
257
|
-
for (const chunk of processEvent(parsed)) {
|
|
258
|
-
controller.enqueue(encoder.encode(chunk));
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
catch {
|
|
262
|
-
logger.warn(`Skipping unparseable final SSE buffer: ${dataStr.slice(0, 200)}`);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
controller.close();
|
|
268
|
-
}
|
|
269
|
-
catch (err) {
|
|
270
|
-
controller.error(err);
|
|
271
|
-
}
|
|
272
|
-
finally {
|
|
273
|
-
reader.releaseLock();
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
//# sourceMappingURL=anthropic-adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-adapter.js","sourceRoot":"","sources":["../../../src/lib/llm-stream/anthropic-adapter.ts"],"names":[],"mappings":";;AAkCA,wDA+DC;AAGD,kDAQC;AAcD,wDAsCC;AAYD,4DA8MC;AA1WD,2CAAwC;AAQxC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAkB,CAAC,CAAC;AAU9C,SAAgB,sBAAsB,CAAC,QAAuB;IAI5D,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,iBAAiB,GAAmC,EAAE,CAAC;IAC7D,IAAI,gBAAgB,GAAmC,EAAE,CAAC;IAE1D,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACxB,IAAI,CAAC,CAAC,OAAO;gBAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC3C,SAAS;QACX,CAAC;QAGD,IAAI,CAAC,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,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RedactionService } from './redaction.service';
|
|
4
|
-
export declare const REDACT_RESPONSE_KEY = "xema:redact-response";
|
|
5
|
-
export declare const RedactResponse: () => ClassDecorator & MethodDecorator;
|
|
6
|
-
export declare class RedactionInterceptor implements NestInterceptor {
|
|
7
|
-
private readonly redaction;
|
|
8
|
-
constructor(redaction: RedactionService);
|
|
9
|
-
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=redaction.interceptor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redaction.interceptor.d.ts","sourceRoot":"","sources":["../../../src/lib/redaction/redaction.interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAEhB,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAO,MAAM,MAAM,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAavD,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAC1D,eAAO,MAAM,cAAc,QAAO,cAAc,GAAG,eACX,CAAC;AAEzC,qBACa,oBAAqB,YAAW,eAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,gBAAgB;IAExD,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC;CAU7E"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RedactionInterceptor = exports.RedactResponse = exports.REDACT_RESPONSE_KEY = void 0;
|
|
13
|
-
const common_1 = require("@nestjs/common");
|
|
14
|
-
const rxjs_1 = require("rxjs");
|
|
15
|
-
const decorator_metadata_1 = require("../../nestjs/decorator-metadata");
|
|
16
|
-
const redaction_service_1 = require("./redaction.service");
|
|
17
|
-
exports.REDACT_RESPONSE_KEY = 'xema:redact-response';
|
|
18
|
-
const RedactResponse = () => (0, common_1.SetMetadata)(exports.REDACT_RESPONSE_KEY, true);
|
|
19
|
-
exports.RedactResponse = RedactResponse;
|
|
20
|
-
let RedactionInterceptor = class RedactionInterceptor {
|
|
21
|
-
redaction;
|
|
22
|
-
constructor(redaction) {
|
|
23
|
-
this.redaction = redaction;
|
|
24
|
-
}
|
|
25
|
-
intercept(context, next) {
|
|
26
|
-
const enabled = (0, decorator_metadata_1.readDecoratorOverride)(exports.REDACT_RESPONSE_KEY, [
|
|
27
|
-
context.getHandler(),
|
|
28
|
-
context.getClass(),
|
|
29
|
-
]);
|
|
30
|
-
if (!enabled) {
|
|
31
|
-
return next.handle();
|
|
32
|
-
}
|
|
33
|
-
return next.handle().pipe((0, rxjs_1.map)((value) => this.redaction.redact(value)));
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
exports.RedactionInterceptor = RedactionInterceptor;
|
|
37
|
-
exports.RedactionInterceptor = RedactionInterceptor = __decorate([
|
|
38
|
-
(0, common_1.Injectable)(),
|
|
39
|
-
__metadata("design:paramtypes", [redaction_service_1.RedactionService])
|
|
40
|
-
], RedactionInterceptor);
|
|
41
|
-
//# sourceMappingURL=redaction.interceptor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redaction.interceptor.js","sourceRoot":"","sources":["../../../src/lib/redaction/redaction.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAMwB;AACxB,+BAAuC;AAEvC,wEAAwE;AACxE,2DAAuD;AAa1C,QAAA,mBAAmB,GAAG,sBAAsB,CAAC;AACnD,MAAM,cAAc,GAAG,GAAqC,EAAE,CACnE,IAAA,oBAAW,EAAC,2BAAmB,EAAE,IAAI,CAAC,CAAC;AAD5B,QAAA,cAAc,kBACc;AAGlC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACF;IAA7B,YAA6B,SAA2B;QAA3B,cAAS,GAAT,SAAS,CAAkB;IAAG,CAAC;IAE5D,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,MAAM,OAAO,GAAG,IAAA,0CAAqB,EAAU,2BAAmB,EAAE;YAClE,OAAO,CAAC,UAAU,EAAE;YACpB,OAAO,CAAC,QAAQ,EAAE;SACnB,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAA,UAAG,EAAC,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;CACF,CAAA;AAbY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAE6B,oCAAgB;GAD7C,oBAAoB,CAahC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RedactionRule } from './redaction-rule';
|
|
2
|
-
export declare class RedactionService {
|
|
3
|
-
private readonly rules;
|
|
4
|
-
constructor();
|
|
5
|
-
static withRules(rules: readonly RedactionRule[]): RedactionService;
|
|
6
|
-
redact<T>(value: T): T;
|
|
7
|
-
private walk;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=redaction.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redaction.service.d.ts","sourceRoot":"","sources":["../../../src/lib/redaction/redaction.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAsBtD,qBACa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2B;;IAajD,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,gBAAgB;IAUnE,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;IAItB,OAAO,CAAC,IAAI;CAqDb"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var RedactionService_1;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.RedactionService = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const default_rules_1 = require("./default-rules");
|
|
16
|
-
const DISABLED_RULES_ENV = 'REDACTION_DISABLED_RULES';
|
|
17
|
-
let RedactionService = RedactionService_1 = class RedactionService {
|
|
18
|
-
rules;
|
|
19
|
-
constructor() {
|
|
20
|
-
const disabled = parseDisabledRules(process.env[DISABLED_RULES_ENV]);
|
|
21
|
-
this.rules = default_rules_1.DEFAULT_REDACTION_RULES.filter((r) => !disabled.has(r.name));
|
|
22
|
-
}
|
|
23
|
-
static withRules(rules) {
|
|
24
|
-
const svc = Object.create(RedactionService_1.prototype);
|
|
25
|
-
const disabled = parseDisabledRules(process.env[DISABLED_RULES_ENV]);
|
|
26
|
-
svc.rules = rules.filter((r) => !disabled.has(r.name));
|
|
27
|
-
return svc;
|
|
28
|
-
}
|
|
29
|
-
redact(value) {
|
|
30
|
-
return this.walk(value, undefined, new WeakSet());
|
|
31
|
-
}
|
|
32
|
-
walk(value, key, seen) {
|
|
33
|
-
if (key !== undefined) {
|
|
34
|
-
for (const rule of this.rules) {
|
|
35
|
-
if (rule.fieldName && rule.fieldName.test(key)) {
|
|
36
|
-
return rule.replacement;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (typeof value === 'string') {
|
|
41
|
-
return applyStringRules(value, this.rules);
|
|
42
|
-
}
|
|
43
|
-
if (Array.isArray(value)) {
|
|
44
|
-
if (seen.has(value)) {
|
|
45
|
-
return '[redacted-cycle]';
|
|
46
|
-
}
|
|
47
|
-
seen.add(value);
|
|
48
|
-
let mutated = false;
|
|
49
|
-
const next = new Array(value.length);
|
|
50
|
-
for (let i = 0; i < value.length; i++) {
|
|
51
|
-
const v = value[i];
|
|
52
|
-
const w = this.walk(v, undefined, seen);
|
|
53
|
-
if (w !== v) {
|
|
54
|
-
mutated = true;
|
|
55
|
-
}
|
|
56
|
-
next[i] = w;
|
|
57
|
-
}
|
|
58
|
-
seen.delete(value);
|
|
59
|
-
return mutated ? next : value;
|
|
60
|
-
}
|
|
61
|
-
if (value !== null && typeof value === 'object') {
|
|
62
|
-
if (seen.has(value)) {
|
|
63
|
-
return '[redacted-cycle]';
|
|
64
|
-
}
|
|
65
|
-
seen.add(value);
|
|
66
|
-
const record = value;
|
|
67
|
-
let mutated = false;
|
|
68
|
-
const out = {};
|
|
69
|
-
for (const k of Object.keys(record)) {
|
|
70
|
-
const v = record[k];
|
|
71
|
-
const w = this.walk(v, k, seen);
|
|
72
|
-
if (w !== v) {
|
|
73
|
-
mutated = true;
|
|
74
|
-
}
|
|
75
|
-
out[k] = w;
|
|
76
|
-
}
|
|
77
|
-
seen.delete(value);
|
|
78
|
-
return mutated ? out : value;
|
|
79
|
-
}
|
|
80
|
-
return value;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
exports.RedactionService = RedactionService;
|
|
84
|
-
exports.RedactionService = RedactionService = RedactionService_1 = __decorate([
|
|
85
|
-
(0, common_1.Injectable)(),
|
|
86
|
-
__metadata("design:paramtypes", [])
|
|
87
|
-
], RedactionService);
|
|
88
|
-
function applyStringRules(value, rules) {
|
|
89
|
-
let current = value;
|
|
90
|
-
for (const rule of rules) {
|
|
91
|
-
if (!rule.stringPattern) {
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (rule.stringPattern.test(current)) {
|
|
95
|
-
const regex = new RegExp(rule.stringPattern.source, rule.stringPattern.flags);
|
|
96
|
-
current = current.replace(regex, rule.replacement);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return current;
|
|
100
|
-
}
|
|
101
|
-
function parseDisabledRules(raw) {
|
|
102
|
-
if (!raw) {
|
|
103
|
-
return new Set();
|
|
104
|
-
}
|
|
105
|
-
return new Set(raw
|
|
106
|
-
.split(',')
|
|
107
|
-
.map((s) => s.trim())
|
|
108
|
-
.filter((s) => s.length > 0));
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=redaction.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redaction.service.js","sourceRoot":"","sources":["../../../src/lib/redaction/redaction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,mDAA0D;AAS1D,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAe/C,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IACV,KAAK,CAA2B;IAQjD;QACE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,KAAK,GAAG,uCAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,KAA+B;QAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAgB,CAAC,SAAS,CAAqB,CAAC;QAC1E,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpE,GAAsD,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAC1E,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAC7B,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC;IAGD,MAAM,CAAI,KAAQ;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,OAAO,EAAE,CAAM,CAAC;IACzD,CAAC;IAEO,IAAI,CAAC,KAAc,EAAE,GAAuB,EAAE,IAAqB;QAGzE,IAAI,GAAG,KAAK,SAAS,EAAE,C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K,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC9E,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAuB;IACjD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,GAAG,CACZ,GAAG;SACA,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-prisma-json.d.ts","sourceRoot":"","sources":["../../src/lib/to-prisma-json.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAmBnC,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,KAAK,EAAE,CAAC,EACR,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,OAAO,CAYT"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toPrismaJson = toPrismaJson;
|
|
4
|
-
const pipeline_errors_1 = require("./errors/pipeline-errors");
|
|
5
|
-
function toPrismaJson(schema, value, context = {}) {
|
|
6
|
-
const parsed = schema.safeParse(value);
|
|
7
|
-
if (!parsed.success) {
|
|
8
|
-
throw new pipeline_errors_1.WorkItemPayloadInvalidError(`Work-item payload failed schema validation${context.hint ? ` (${context.hint})` : ''}`, context.workItemId ?? 'unknown', parsed.error.issues);
|
|
9
|
-
}
|
|
10
|
-
return structuredClone(parsed.data);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=to-prisma-json.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-prisma-json.js","sourceRoot":"","sources":["../../src/lib/to-prisma-json.ts"],"names":[],"mappings":";;AAwCA,oCAgBC;AAlCD,8DAAuE;AAkBvE,SAAgB,YAAY,CAC1B,MAAkB,EAClB,KAAQ,EACR,UAAkD,EAAE;IAEpD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,6CAA2B,CACnC,6CAA6C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EACvF,OAAO,CAAC,UAAU,IAAI,SAAS,EAC/B,MAAM,CAAC,KAAK,CAAC,MAAM,CACpB,CAAC;IACJ,CAAC;IAGD,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const TOOL_USAGE_KEY_PREFIX = "xema:mcp:tool-usage";
|
|
2
|
-
export declare const TOOL_USAGE_TTL_SECONDS: number;
|
|
3
|
-
export declare function buildToolUsageKey(input: {
|
|
4
|
-
orgId: string;
|
|
5
|
-
sessionId: string;
|
|
6
|
-
mcpServiceSlug: string;
|
|
7
|
-
command: string;
|
|
8
|
-
}): string;
|
|
9
|
-
export declare function buildToolUsageSessionScanPattern(input: {
|
|
10
|
-
orgId: string;
|
|
11
|
-
sessionId: string;
|
|
12
|
-
}): string;
|
|
13
|
-
export interface ParsedToolUsageKey {
|
|
14
|
-
readonly orgId: string;
|
|
15
|
-
readonly sessionId: string;
|
|
16
|
-
readonly mcpServiceSlug: string;
|
|
17
|
-
readonly command: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function parseToolUsageKey(key: string): ParsedToolUsageKey | null;
|
|
20
|
-
//# sourceMappingURL=tool-usage-counter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-usage-counter.d.ts","sourceRoot":"","sources":["../../src/lib/tool-usage-counter.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAS3D,eAAO,MAAM,sBAAsB,QAAoB,CAAC;AAMxD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAeT;AAMD,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAST;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAkBD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAaxE"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TOOL_USAGE_TTL_SECONDS = exports.TOOL_USAGE_KEY_PREFIX = void 0;
|
|
4
|
-
exports.buildToolUsageKey = buildToolUsageKey;
|
|
5
|
-
exports.buildToolUsageSessionScanPattern = buildToolUsageSessionScanPattern;
|
|
6
|
-
exports.parseToolUsageKey = parseToolUsageKey;
|
|
7
|
-
exports.TOOL_USAGE_KEY_PREFIX = 'xema:mcp:tool-usage';
|
|
8
|
-
exports.TOOL_USAGE_TTL_SECONDS = 30 * 24 * 60 * 60;
|
|
9
|
-
function buildToolUsageKey(input) {
|
|
10
|
-
const { orgId, sessionId, mcpServiceSlug, command } = input;
|
|
11
|
-
if (!orgId) {
|
|
12
|
-
throw new Error('buildToolUsageKey: orgId is required');
|
|
13
|
-
}
|
|
14
|
-
if (!sessionId) {
|
|
15
|
-
throw new Error('buildToolUsageKey: sessionId is required');
|
|
16
|
-
}
|
|
17
|
-
if (!mcpServiceSlug) {
|
|
18
|
-
throw new Error('buildToolUsageKey: mcpServiceSlug is required');
|
|
19
|
-
}
|
|
20
|
-
if (!command) {
|
|
21
|
-
throw new Error('buildToolUsageKey: command is required');
|
|
22
|
-
}
|
|
23
|
-
return `${exports.TOOL_USAGE_KEY_PREFIX}:${orgId}:${sessionId}:${mcpServiceSlug}:${command}`;
|
|
24
|
-
}
|
|
25
|
-
function buildToolUsageSessionScanPattern(input) {
|
|
26
|
-
const { orgId, sessionId } = input;
|
|
27
|
-
if (!orgId) {
|
|
28
|
-
throw new Error('buildToolUsageSessionScanPattern: orgId is required');
|
|
29
|
-
}
|
|
30
|
-
if (!sessionId) {
|
|
31
|
-
throw new Error('buildToolUsageSessionScanPattern: sessionId is required');
|
|
32
|
-
}
|
|
33
|
-
return `${exports.TOOL_USAGE_KEY_PREFIX}:${orgId}:${sessionId}:*:*`;
|
|
34
|
-
}
|
|
35
|
-
function parseToolUsageKey(key) {
|
|
36
|
-
const parts = key.split(':');
|
|
37
|
-
if (parts.length < 7)
|
|
38
|
-
return null;
|
|
39
|
-
if (parts[0] !== 'xema' || parts[1] !== 'mcp' || parts[2] !== 'tool-usage') {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const orgId = parts[3];
|
|
43
|
-
const sessionId = parts[4];
|
|
44
|
-
const command = parts[parts.length - 1];
|
|
45
|
-
const mcpServiceSlug = parts.slice(5, parts.length - 1).join(':');
|
|
46
|
-
if (!orgId || !sessionId || !mcpServiceSlug || !command)
|
|
47
|
-
return null;
|
|
48
|
-
return { orgId, sessionId, mcpServiceSlug, command };
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=tool-usage-counter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-usage-counter.js","sourceRoot":"","sources":["../../src/lib/tool-usage-counter.ts"],"names":[],"mappings":";;;AA2CA,8CAoBC;AAMD,4EAYC;AAyBD,8CAaC;AA3FY,QAAA,qBAAqB,GAAG,qBAAqB,CAAC;AAS9C,QAAA,sBAAsB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAMxD,SAAgB,iBAAiB,CAAC,KAKjC;IACC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC5D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,GAAG,6BAAqB,IAAI,KAAK,IAAI,SAAS,IAAI,cAAc,IAAI,OAAO,EAAE,CAAC;AACvF,CAAC;AAMD,SAAgB,gCAAgC,CAAC,KAGh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ritePolicyContext {
|
|
2
|
-
allowedPageSlugs: string[];
|
|
3
|
-
allowedPageSlugPrefixes: string[];
|
|
4
|
-
allowedParentPageId: string | null;
|
|
5
|
-
allowedBacklogParent: string | null;
|
|
6
|
-
backlogMode: 'canonical' | 'proposal';
|
|
7
|
-
backlogCanonicalPrerequisites?: {
|
|
8
|
-
parentPredetermined: boolean;
|
|
9
|
-
ownershipClear: boolean;
|
|
10
|
-
duplicateDetectionDeterministic: boolean;
|
|
11
|
-
};
|
|
12
|
-
coordinatorOwned: boolean;
|
|
13
|
-
memoryWriteAllowed: boolean;
|
|
14
|
-
createPagesDisabled: boolean;
|
|
15
|
-
editOnlyPageSlugs: string[];
|
|
16
|
-
authorizedWritePaths: string[];
|
|
17
|
-
authorizedReadPaths: string[];
|
|
18
|
-
}
|
|
19
|
-
export declare function parseWritePolicy(headerValue: string | undefined): WritePolicyContext;
|
|
20
|
-
export declare function validatePageSlugWrite(policy: WritePolicyContext, slug: string): string | null;
|
|
21
|
-
export declare function validateParentPageWrite(policy: WritePolicyContext, parentPageId: string | null | undefined): string | null;
|
|
22
|
-
export declare function validateMemoryWrite(policy: WritePolicyContext): string | null;
|
|
23
|
-
export declare function validateBacklogWrite(policy: WritePolicyContext): {
|
|
24
|
-
allowed: true;
|
|
25
|
-
mode: 'canonical' | 'proposal';
|
|
26
|
-
} | {
|
|
27
|
-
allowed: false;
|
|
28
|
-
reason: string;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=write-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-policy.d.ts","sourceRoot":"","sources":["../../src/lib/write-policy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CA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