@synap-core/sdk 1.4.0 → 1.5.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/CHANGELOG.md +133 -0
- package/README.md +136 -10
- package/dist/{chunk-J7XHAAFJ.js → chunk-UK2U6SMA.js} +14 -2
- package/dist/chunk-UK2U6SMA.js.map +1 -0
- package/dist/{client-C5sF20f1.d.cts → client-B50KC2aJ.d.cts} +14 -9
- package/dist/{client-C5sF20f1.d.ts → client-B50KC2aJ.d.ts} +14 -9
- package/dist/connect.cjs +412 -64
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +400 -32
- package/dist/connect.d.ts +400 -32
- package/dist/connect.js +407 -65
- package/dist/connect.js.map +1 -1
- package/dist/public.cjs +9 -2
- package/dist/public.cjs.map +1 -1
- package/dist/public.d.cts +19 -4
- package/dist/public.d.ts +19 -4
- package/dist/public.js +8 -2
- package/dist/public.js.map +1 -1
- package/dist/testing.cjs +234 -12
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +122 -27
- package/dist/testing.d.ts +122 -27
- package/dist/testing.js +230 -12
- package/dist/testing.js.map +1 -1
- package/dist/{types-C2KGNXEn.d.cts → types-DZYNBCq7.d.cts} +28 -5
- package/dist/{types-C2KGNXEn.d.ts → types-DZYNBCq7.d.ts} +28 -5
- package/package.json +30 -6
- package/src/connect/auth.ts +156 -27
- package/src/connect/client.ts +374 -34
- package/src/connect/cloud.ts +14 -10
- package/src/connect/discovery.ts +66 -32
- package/src/connect/encoding.ts +1 -1
- package/src/connect/errors.ts +7 -0
- package/src/connect/flow.ts +42 -14
- package/src/connect/http.ts +42 -0
- package/src/connect/hub-types.ts +254 -0
- package/src/connect/index.ts +60 -42
- package/src/connect/rules.ts +18 -0
- package/src/connect/store.ts +9 -5
- package/src/connect/types.ts +28 -4
- package/src/public/client.ts +14 -2
- package/src/public/safe-markdown.ts +13 -0
- package/src/public/share-model.ts +6 -2
- package/src/public/site-model.ts +5 -3
- package/src/testing/auth-server.ts +239 -14
- package/src/testing/cloud.ts +3 -4
- package/src/testing/fixtures.ts +26 -0
- package/src/testing/index.ts +8 -6
- package/src/testing/seed.ts +120 -0
- package/dist/chunk-J7XHAAFJ.js.map +0 -1
package/dist/testing.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(testing_exports, {
|
|
|
27
27
|
MOCK_FAILURE_TOKENS: () => MOCK_FAILURE_TOKENS,
|
|
28
28
|
MOCK_FORM: () => MOCK_FORM,
|
|
29
29
|
MOCK_GRANT: () => MOCK_GRANT,
|
|
30
|
+
MOCK_HTML_SHARE: () => MOCK_HTML_SHARE,
|
|
30
31
|
MOCK_POD_URL: () => MOCK_POD_URL,
|
|
31
32
|
MOCK_RETRY_AFTER_SEC: () => MOCK_RETRY_AFTER_SEC,
|
|
32
33
|
MOCK_SHARE: () => MOCK_SHARE,
|
|
@@ -35,7 +36,8 @@ __export(testing_exports, {
|
|
|
35
36
|
MOCK_USER: () => MOCK_USER,
|
|
36
37
|
createMockAuthServer: () => createMockAuthServer,
|
|
37
38
|
createMockCloud: () => createMockCloud,
|
|
38
|
-
createMockPod: () => createMockPod
|
|
39
|
+
createMockPod: () => createMockPod,
|
|
40
|
+
parseMockPodSeed: () => parseMockPodSeed
|
|
39
41
|
});
|
|
40
42
|
module.exports = __toCommonJS(testing_exports);
|
|
41
43
|
|
|
@@ -78,6 +80,26 @@ var MOCK_SHARE = {
|
|
|
78
80
|
},
|
|
79
81
|
publishedOn: "2026-09-27"
|
|
80
82
|
};
|
|
83
|
+
var MOCK_HTML_SHARE = {
|
|
84
|
+
resourceType: "entity",
|
|
85
|
+
title: "Estimate for Northwind",
|
|
86
|
+
properties: { total: "4 800 \u20AC", validUntil: "2026-11-30" },
|
|
87
|
+
body: {
|
|
88
|
+
format: "html",
|
|
89
|
+
content: [
|
|
90
|
+
"<!doctype html>",
|
|
91
|
+
'<html lang="en"><head><meta charset="utf-8"><title>Estimate</title>',
|
|
92
|
+
"<style>body{font-family:Georgia,serif;max-width:40rem;margin:2rem auto;line-height:1.5}td{padding:.25rem .75rem}</style>",
|
|
93
|
+
"</head><body>",
|
|
94
|
+
"<h1>Estimate for Northwind</h1>",
|
|
95
|
+
"<table><tr><td>Discovery workshop</td><td>1 200 \u20AC</td></tr><tr><td>Build</td><td>3 600 \u20AC</td></tr></table>",
|
|
96
|
+
"<p><strong>Total: 4 800 \u20AC</strong></p>",
|
|
97
|
+
"<script>document.body.textContent = 'scripts never run in a sandboxed frame'</script>",
|
|
98
|
+
"</body></html>"
|
|
99
|
+
].join("")
|
|
100
|
+
},
|
|
101
|
+
publishedOn: "2026-10-22"
|
|
102
|
+
};
|
|
81
103
|
function publicId(prefix, n) {
|
|
82
104
|
return `p_${prefix}${String(n).padStart(16 - prefix.length, "0")}`;
|
|
83
105
|
}
|
|
@@ -190,7 +212,29 @@ function createMockAuthServer(options = {}) {
|
|
|
190
212
|
const requests = [];
|
|
191
213
|
const writes = [];
|
|
192
214
|
const proposals = [];
|
|
193
|
-
const
|
|
215
|
+
const seed = options.seed ?? {};
|
|
216
|
+
const entities = [...seed.entities ?? [], ...options.entities ?? []];
|
|
217
|
+
const sessions = [...seed.sessions ?? []];
|
|
218
|
+
const documents = [...seed.documents ?? []];
|
|
219
|
+
const relations = [...seed.relations ?? []];
|
|
220
|
+
const templateOf = new Map((seed.spaces ?? []).filter((sp) => sp.templateSlug).map((sp) => [sp.id, sp.templateSlug]));
|
|
221
|
+
const approvals = [];
|
|
222
|
+
const seededAt = new Date(now()).toISOString();
|
|
223
|
+
for (const p of seed.proposals ?? []) {
|
|
224
|
+
proposals.push({
|
|
225
|
+
proposalType: "create",
|
|
226
|
+
targetType: "entity",
|
|
227
|
+
targetId: null,
|
|
228
|
+
status: "pending",
|
|
229
|
+
workspaceId: null,
|
|
230
|
+
createdAt: seededAt,
|
|
231
|
+
correlationId: null,
|
|
232
|
+
sessionId: null,
|
|
233
|
+
agentUserId: null,
|
|
234
|
+
...p
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
const writeMode = options.writeMode ?? (options.actsAs === "person" ? "applied" : "proposed");
|
|
194
238
|
const graceMs = (options.refreshGraceSec ?? 30) * 1e3;
|
|
195
239
|
const app = options.app === void 0 ? MOCK_APP : options.app;
|
|
196
240
|
let proposalSeq = 0;
|
|
@@ -232,9 +276,11 @@ function createMockAuthServer(options = {}) {
|
|
|
232
276
|
// As the pod: what the key has left, never an assumed hour.
|
|
233
277
|
expires_in: Math.max(0, Math.floor((row.expiresAt - now()) / 1e3)),
|
|
234
278
|
scope: scope.join(" "),
|
|
235
|
-
|
|
279
|
+
// Each grant row names its space's template when it came from one.
|
|
280
|
+
synap_grant: grant.filter((g) => scope.includes(g.permission)).map((g) => g.templateSlug || !templateOf.has(g.workspaceId) ? g : { ...g, templateSlug: templateOf.get(g.workspaceId) }),
|
|
236
281
|
synap_user: user,
|
|
237
|
-
...app ? { synap_app: app } : {}
|
|
282
|
+
...app ? { synap_app: app } : {},
|
|
283
|
+
...options.actsAs ? { synap_acts_as: options.actsAs } : {}
|
|
238
284
|
};
|
|
239
285
|
if (pair) {
|
|
240
286
|
body.refresh_token = pair.refreshToken;
|
|
@@ -297,6 +343,122 @@ function createMockAuthServer(options = {}) {
|
|
|
297
343
|
}
|
|
298
344
|
return oauthError("unsupported_grant_type", "Unsupported grant_type");
|
|
299
345
|
}
|
|
346
|
+
const sessionRow = (s) => ({
|
|
347
|
+
workspaceId: null,
|
|
348
|
+
projectId: null,
|
|
349
|
+
userId: user.id,
|
|
350
|
+
correlationId: null,
|
|
351
|
+
title: null,
|
|
352
|
+
goal: "",
|
|
353
|
+
status: "active",
|
|
354
|
+
templateId: null,
|
|
355
|
+
expectedOutputs: [],
|
|
356
|
+
channelId: null,
|
|
357
|
+
progress: null,
|
|
358
|
+
currentStage: null,
|
|
359
|
+
agentIds: [],
|
|
360
|
+
closedAt: null,
|
|
361
|
+
verificationReport: null,
|
|
362
|
+
metadata: {},
|
|
363
|
+
startedAt: seededAt,
|
|
364
|
+
createdAt: seededAt,
|
|
365
|
+
updatedAt: seededAt,
|
|
366
|
+
kind: "work",
|
|
367
|
+
triage: { pending: false, acceptedAt: null, acceptedBy: null },
|
|
368
|
+
...s
|
|
369
|
+
});
|
|
370
|
+
function readSeeded(path, query) {
|
|
371
|
+
const conn = /^\/entities\/([^/]+)\/connections$/.exec(path);
|
|
372
|
+
if (conn) {
|
|
373
|
+
const id = decodeURIComponent(conn[1]);
|
|
374
|
+
const ws = query.get("workspaceId");
|
|
375
|
+
const limit = Math.min(Math.max(Number(query.get("limit") ?? 50) || 50, 1), 200);
|
|
376
|
+
const inLens = (e) => !ws || e.workspaceId === ws || e.workspaceId == null;
|
|
377
|
+
const connections = [];
|
|
378
|
+
const graph = relations.filter((r) => r.sourceEntityId === id || r.targetEntityId === id).sort((a, b) => String(b.createdAt ?? "").localeCompare(String(a.createdAt ?? ""))).slice(0, limit);
|
|
379
|
+
for (const r of graph) {
|
|
380
|
+
const outgoing = r.sourceEntityId === id;
|
|
381
|
+
const otherId = outgoing ? r.targetEntityId : r.sourceEntityId;
|
|
382
|
+
const other = entities.find((e) => e.id === otherId);
|
|
383
|
+
if (!other || !inLens(other)) continue;
|
|
384
|
+
connections.push({
|
|
385
|
+
entityId: otherId,
|
|
386
|
+
entity: { ...other, type: other.profileSlug ?? other.type ?? null, facetSlugs: other.facetSlugs ?? [] },
|
|
387
|
+
label: r.type,
|
|
388
|
+
direction: outgoing ? "outgoing" : "incoming",
|
|
389
|
+
source: "graph",
|
|
390
|
+
relationId: r.id,
|
|
391
|
+
relationType: r.type,
|
|
392
|
+
createdAt: r.createdAt ?? null
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
for (const s of sessions.filter((x) => x.subjectEntityId === id).slice(0, limit)) {
|
|
396
|
+
const row = sessionRow(s);
|
|
397
|
+
connections.push({
|
|
398
|
+
entityId: s.id,
|
|
399
|
+
entity: null,
|
|
400
|
+
label: row.title || row.goal,
|
|
401
|
+
direction: "incoming",
|
|
402
|
+
source: "focus_session",
|
|
403
|
+
focusSessionId: s.id,
|
|
404
|
+
focusSessionGoal: row.goal,
|
|
405
|
+
focusSessionStatus: row.status,
|
|
406
|
+
focusSessionWorkspaceId: row.workspaceId,
|
|
407
|
+
createdAt: row.createdAt
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
const n = (source) => connections.filter((c) => c.source === source).length;
|
|
411
|
+
return json(200, {
|
|
412
|
+
connections,
|
|
413
|
+
counts: { total: connections.length, graph: n("graph"), structural: n("property"), threads: n("thread"), contextChannels: n("context_channel"), focusSessions: n("focus_session") }
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
const entity = /^\/entities\/([^/]+)$/.exec(path);
|
|
417
|
+
if (entity) {
|
|
418
|
+
const found = entities.find((e) => e.id === decodeURIComponent(entity[1]));
|
|
419
|
+
return found ? json(200, found) : new Response(null, { status: 404 });
|
|
420
|
+
}
|
|
421
|
+
const doc = /^\/documents\/([^/]+)$/.exec(path);
|
|
422
|
+
if (doc) {
|
|
423
|
+
const format = query.get("format") ?? "raw";
|
|
424
|
+
if (format !== "raw" && format !== "readable") return json(400, { error: "format must be raw or readable" });
|
|
425
|
+
const d = documents.find((x) => x.id === decodeURIComponent(doc[1]));
|
|
426
|
+
if (!d) return json(404, { error: "Document not found" });
|
|
427
|
+
return json(200, {
|
|
428
|
+
document: {
|
|
429
|
+
id: d.id,
|
|
430
|
+
title: d.title,
|
|
431
|
+
type: d.type ?? "markdown",
|
|
432
|
+
language: d.language ?? null,
|
|
433
|
+
workspaceId: d.workspaceId ?? null,
|
|
434
|
+
format,
|
|
435
|
+
content: d.content,
|
|
436
|
+
revision: d.revision ?? 1,
|
|
437
|
+
version: d.version ?? 1,
|
|
438
|
+
sections: [],
|
|
439
|
+
diagnostics: [],
|
|
440
|
+
updatedAt: d.updatedAt ?? seededAt,
|
|
441
|
+
createdAt: d.createdAt ?? seededAt
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
if (path === "/focus-sessions") {
|
|
446
|
+
const ws = query.get("workspaceId");
|
|
447
|
+
const project = query.get("projectId");
|
|
448
|
+
if (!ws && !project) return json(400, { error: "workspaceId or projectId is required" });
|
|
449
|
+
const status = query.get("status") ?? "all";
|
|
450
|
+
const lens = query.get("lens") ?? "all";
|
|
451
|
+
const kind = query.get("kind") ?? "all";
|
|
452
|
+
const subject = query.get("subjectEntityId");
|
|
453
|
+
const limit = Math.min(Math.max(Number(query.get("limit") ?? 20) || 20, 1), 50);
|
|
454
|
+
const rows = sessions.map(sessionRow).filter((r) => (!ws || r.workspaceId === ws) && (!project || r.projectId === project)).filter((r) => status === "all" || r.status === status).filter((r) => {
|
|
455
|
+
const pending = r.triage?.pending === true;
|
|
456
|
+
return lens === "triage" ? pending : lens === "default" ? !pending : true;
|
|
457
|
+
}).filter((r) => kind === "all" || r.kind === kind).filter((r) => !subject || r.subjectEntityId === subject).sort((a, b) => String(b.startedAt).localeCompare(String(a.startedAt)));
|
|
458
|
+
return json(200, rows.slice(0, limit));
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
300
462
|
function hub(method, path, query, headers, body) {
|
|
301
463
|
const failure2 = options.failures?.[path];
|
|
302
464
|
if (failure2 === "unreachable") return "reject";
|
|
@@ -333,15 +495,36 @@ function createMockAuthServer(options = {}) {
|
|
|
333
495
|
const ws = query.get("workspaceId");
|
|
334
496
|
const limit = Math.min(Math.max(Number(query.get("limit") ?? 50) || 50, 1), 200);
|
|
335
497
|
const offset = Number(query.get("offset") ?? 0) || 0;
|
|
336
|
-
const
|
|
498
|
+
const idsRaw = query.getAll("proposalIds");
|
|
499
|
+
const ids = idsRaw.length > 0 ? new Set(idsRaw.flatMap((v) => v.split(",").map((x) => x.trim()).filter(Boolean))) : null;
|
|
500
|
+
const rows = proposals.filter((p) => p.workspaceId !== null && readable.has(p.workspaceId)).filter((p) => (status === "all" || p.status === status) && (!ws || p.workspaceId === ws)).filter((p) => !ids || ids.has(p.id)).reverse();
|
|
337
501
|
const page = rows.slice(offset, offset + limit);
|
|
338
502
|
return json(200, { proposals: page, limit, offset, total: rows.length, hasMore: offset + page.length < rows.length });
|
|
339
503
|
}
|
|
504
|
+
if (method === "GET") {
|
|
505
|
+
const read = readSeeded(path, query);
|
|
506
|
+
if (read) return read;
|
|
507
|
+
}
|
|
508
|
+
const approve = method === "POST" ? /^\/proposals\/([^/]+)\/approve$/.exec(path) : null;
|
|
509
|
+
if (approve) {
|
|
510
|
+
if (options.actsAs !== "person") {
|
|
511
|
+
return json(403, { error: "An agent credential cannot approve proposals \u2014 approve is human review. Approve from a human session." });
|
|
512
|
+
}
|
|
513
|
+
const p = proposals.find((x) => x.id === decodeURIComponent(approve[1]));
|
|
514
|
+
if (!p) return json(404, { error: "Proposal not found" });
|
|
515
|
+
if (!grant.some((g) => g.permission === "proposal.approve" && row.scope.includes(g.permission) && g.workspaceId === p.workspaceId)) {
|
|
516
|
+
return json(403, { error: "You may not approve changes here" });
|
|
517
|
+
}
|
|
518
|
+
if (p.status !== "pending") return json(409, { error: `The proposal is ${p.status}, not pending` });
|
|
519
|
+
p.status = "approved";
|
|
520
|
+
approvals.push(p.id);
|
|
521
|
+
return json(200, { success: true, proposalId: p.id, proposal: { ...p } });
|
|
522
|
+
}
|
|
340
523
|
if (method !== "GET") {
|
|
341
524
|
writes.push({ method, path, body });
|
|
342
525
|
const fields = body && typeof body === "object" ? body : {};
|
|
343
526
|
const workspaceId = typeof fields.workspaceId === "string" ? fields.workspaceId : null;
|
|
344
|
-
if (
|
|
527
|
+
if (writeMode === "proposed") {
|
|
345
528
|
const proposalId = `prop_mock_${++proposalSeq}`;
|
|
346
529
|
proposals.push({
|
|
347
530
|
id: proposalId,
|
|
@@ -416,6 +599,7 @@ function createMockAuthServer(options = {}) {
|
|
|
416
599
|
requests,
|
|
417
600
|
writes,
|
|
418
601
|
proposals,
|
|
602
|
+
approvals,
|
|
419
603
|
settleProposal(id, status) {
|
|
420
604
|
const p = proposals.find((x) => x.id === id);
|
|
421
605
|
if (p) p.status = status;
|
|
@@ -474,6 +658,9 @@ function createMockAuthServer(options = {}) {
|
|
|
474
658
|
for (const row of access.values()) row.revoked = true;
|
|
475
659
|
for (const row of refreshTokens.values()) row.revoked = true;
|
|
476
660
|
},
|
|
661
|
+
revokeAccessKeys() {
|
|
662
|
+
for (const row of access.values()) row.revoked = true;
|
|
663
|
+
},
|
|
477
664
|
liveRefreshTokens() {
|
|
478
665
|
return [...refreshTokens].filter(([, r]) => !r.used && !r.revoked).map(([t]) => t);
|
|
479
666
|
},
|
|
@@ -484,10 +671,43 @@ function createMockAuthServer(options = {}) {
|
|
|
484
671
|
};
|
|
485
672
|
}
|
|
486
673
|
|
|
674
|
+
// src/testing/seed.ts
|
|
675
|
+
var KEYS = ["entities", "sessions", "documents", "relations", "proposals", "spaces"];
|
|
676
|
+
var REQUIRED = {
|
|
677
|
+
entities: ["id"],
|
|
678
|
+
sessions: ["id"],
|
|
679
|
+
documents: ["id", "title", "content"],
|
|
680
|
+
relations: ["id", "sourceEntityId", "targetEntityId", "type"],
|
|
681
|
+
proposals: ["id"],
|
|
682
|
+
spaces: ["id", "name"]
|
|
683
|
+
};
|
|
684
|
+
function parseMockPodSeed(input) {
|
|
685
|
+
const value = typeof input === "string" ? JSON.parse(input) : input;
|
|
686
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("seed: expected an object");
|
|
687
|
+
const obj = value;
|
|
688
|
+
for (const key of Object.keys(obj)) {
|
|
689
|
+
if (!KEYS.includes(key)) throw new TypeError(`seed.${key}: unknown collection (expected ${KEYS.join(", ")})`);
|
|
690
|
+
}
|
|
691
|
+
for (const key of KEYS) {
|
|
692
|
+
const rows = obj[key];
|
|
693
|
+
if (rows === void 0) continue;
|
|
694
|
+
if (!Array.isArray(rows)) throw new TypeError(`seed.${key}: expected an array`);
|
|
695
|
+
rows.forEach((row, i) => {
|
|
696
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) throw new TypeError(`seed.${key}[${i}]: expected an object`);
|
|
697
|
+
for (const field of REQUIRED[key]) {
|
|
698
|
+
if (typeof row[field] !== "string") throw new TypeError(`seed.${key}[${i}].${field}: expected a string`);
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
return JSON.parse(JSON.stringify(obj));
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// src/connect/rules.ts
|
|
706
|
+
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
707
|
+
var CLOUD_STATE_RE = /^[A-Za-z0-9._~-]{16,256}$/;
|
|
708
|
+
|
|
487
709
|
// src/testing/cloud.ts
|
|
488
710
|
var MOCK_CLOUD_URL = "https://cp.mock-synap.test";
|
|
489
|
-
var STATE_RE = /^[A-Za-z0-9._~-]{16,256}$/;
|
|
490
|
-
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
491
711
|
function createMockCloud(options = {}) {
|
|
492
712
|
const base = (options.url ?? MOCK_CLOUD_URL).replace(/\/+$/, "");
|
|
493
713
|
const requests = [];
|
|
@@ -514,7 +734,7 @@ function createMockCloud(options = {}) {
|
|
|
514
734
|
const clientId = url.searchParams.get("client_id");
|
|
515
735
|
const state = url.searchParams.get("state");
|
|
516
736
|
if (!clientId || !cimdUrlAccepted(clientId)) throw new Error("Chooser refused: client_id must be an https CIMD URL");
|
|
517
|
-
if (!state || !
|
|
737
|
+
if (!state || !CLOUD_STATE_RE.test(state)) throw new Error("Chooser refused: state is missing or malformed");
|
|
518
738
|
if (clientId !== metadata.client_id) throw new Error("Chooser refused: the client metadata is not this client_id's");
|
|
519
739
|
return new URL(metadata.initiate_login_uri);
|
|
520
740
|
}
|
|
@@ -532,7 +752,7 @@ function createMockCloud(options = {}) {
|
|
|
532
752
|
|
|
533
753
|
// src/testing/index.ts
|
|
534
754
|
var MOCK_POD_URL = "https://mock.synap.invalid";
|
|
535
|
-
var MOCK_TOKENS = { form: "demo-form", share: "demo", site: "demo-site" };
|
|
755
|
+
var MOCK_TOKENS = { form: "demo-form", share: "demo", htmlShare: "demo-html", site: "demo-site" };
|
|
536
756
|
var MOCK_RETRY_AFTER_SEC = 30;
|
|
537
757
|
var MOCK_FAILURE_TOKENS = {
|
|
538
758
|
/** 429 with no `Retry-After` (what the pod's public doors send today). */
|
|
@@ -712,7 +932,7 @@ function invalidKeys(form, body) {
|
|
|
712
932
|
}
|
|
713
933
|
function createMockPod(options = {}) {
|
|
714
934
|
const forms = options.forms ?? { [MOCK_TOKENS.form]: MOCK_FORM };
|
|
715
|
-
const shares = options.shares ?? { [MOCK_TOKENS.share]: MOCK_SHARE };
|
|
935
|
+
const shares = options.shares ?? { [MOCK_TOKENS.share]: MOCK_SHARE, [MOCK_TOKENS.htmlShare]: MOCK_HTML_SHARE };
|
|
716
936
|
const sites = options.sites ?? { [MOCK_TOKENS.site]: MOCK_SITE };
|
|
717
937
|
const requests = [];
|
|
718
938
|
const submissions = [];
|
|
@@ -785,6 +1005,7 @@ function createMockPod(options = {}) {
|
|
|
785
1005
|
MOCK_FAILURE_TOKENS,
|
|
786
1006
|
MOCK_FORM,
|
|
787
1007
|
MOCK_GRANT,
|
|
1008
|
+
MOCK_HTML_SHARE,
|
|
788
1009
|
MOCK_POD_URL,
|
|
789
1010
|
MOCK_RETRY_AFTER_SEC,
|
|
790
1011
|
MOCK_SHARE,
|
|
@@ -793,6 +1014,7 @@ function createMockPod(options = {}) {
|
|
|
793
1014
|
MOCK_USER,
|
|
794
1015
|
createMockAuthServer,
|
|
795
1016
|
createMockCloud,
|
|
796
|
-
createMockPod
|
|
1017
|
+
createMockPod,
|
|
1018
|
+
parseMockPodSeed
|
|
797
1019
|
});
|
|
798
1020
|
//# sourceMappingURL=testing.cjs.map
|