@wayai/cli 0.3.342 → 0.3.343
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.js +1489 -824
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6339,6 +6339,25 @@ var init_chunk_63UWXV4T = __esm({
|
|
|
6339
6339
|
}
|
|
6340
6340
|
});
|
|
6341
6341
|
|
|
6342
|
+
// ../../packages/core/dist/chunk-TVUDMGWV.js
|
|
6343
|
+
var bootstrapQuery;
|
|
6344
|
+
var init_chunk_TVUDMGWV = __esm({
|
|
6345
|
+
"../../packages/core/dist/chunk-TVUDMGWV.js"() {
|
|
6346
|
+
"use strict";
|
|
6347
|
+
init_zod();
|
|
6348
|
+
bootstrapQuery = external_exports.object({
|
|
6349
|
+
active_hub_id: external_exports.string().uuid().optional(),
|
|
6350
|
+
active_conversation_id: external_exports.string().uuid().optional(),
|
|
6351
|
+
active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
|
|
6352
|
+
/**
|
|
6353
|
+
* The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
|
|
6354
|
+
* preloads it as `people.active_thread` when the viewer is a member.
|
|
6355
|
+
*/
|
|
6356
|
+
active_thread_id: external_exports.string().uuid().optional()
|
|
6357
|
+
});
|
|
6358
|
+
}
|
|
6359
|
+
});
|
|
6360
|
+
|
|
6342
6361
|
// ../../packages/core/dist/chunk-S4HVRNEQ.js
|
|
6343
6362
|
var PERMISSIONS;
|
|
6344
6363
|
var init_chunk_S4HVRNEQ = __esm({
|
|
@@ -6491,6 +6510,231 @@ var init_chunk_ZC6YGHNX = __esm({
|
|
|
6491
6510
|
}
|
|
6492
6511
|
});
|
|
6493
6512
|
|
|
6513
|
+
// ../../packages/core/dist/chunk-2YEGUQR7.js
|
|
6514
|
+
var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
|
|
6515
|
+
var init_chunk_2YEGUQR7 = __esm({
|
|
6516
|
+
"../../packages/core/dist/chunk-2YEGUQR7.js"() {
|
|
6517
|
+
"use strict";
|
|
6518
|
+
init_zod();
|
|
6519
|
+
PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
|
|
6520
|
+
CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
6521
|
+
PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
|
|
6522
|
+
userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
|
|
6523
|
+
personIdSchema = external_exports.string().refine(
|
|
6524
|
+
(value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
|
|
6525
|
+
{ message: PERSON_ID_FORM_MESSAGE }
|
|
6526
|
+
);
|
|
6527
|
+
}
|
|
6528
|
+
});
|
|
6529
|
+
|
|
6530
|
+
// ../../packages/core/dist/chunk-UAOHHCW5.js
|
|
6531
|
+
function normalizeContactPhone(raw) {
|
|
6532
|
+
const compact = raw.trim().replace(/[\s\-.()]/g, "");
|
|
6533
|
+
const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
|
|
6534
|
+
return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
|
|
6535
|
+
}
|
|
6536
|
+
function normalizeContactLabel(raw) {
|
|
6537
|
+
return raw.trim().replace(/\s+/g, " ").toLowerCase();
|
|
6538
|
+
}
|
|
6539
|
+
function importRowLabels(row, batchLabels) {
|
|
6540
|
+
return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
|
|
6541
|
+
}
|
|
6542
|
+
var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
|
|
6543
|
+
var init_chunk_UAOHHCW5 = __esm({
|
|
6544
|
+
"../../packages/core/dist/chunk-UAOHHCW5.js"() {
|
|
6545
|
+
"use strict";
|
|
6546
|
+
init_zod();
|
|
6547
|
+
CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
|
|
6548
|
+
CONTACT_NAME_MAX = 200;
|
|
6549
|
+
CONTACT_EMAIL_MAX = 320;
|
|
6550
|
+
CONTACT_PHONE_INPUT_MAX = 40;
|
|
6551
|
+
CONTACT_INSTAGRAM_SID_MAX = 64;
|
|
6552
|
+
CONTACT_METADATA_MAX_BYTES = 4096;
|
|
6553
|
+
CONTACT_LABEL_MAX = 64;
|
|
6554
|
+
CONTACT_LABELS_MAX = 20;
|
|
6555
|
+
CONTACT_SCOPE_TAGS_MAX = 20;
|
|
6556
|
+
CONTACT_PAGE_MAX = 100;
|
|
6557
|
+
CONTACT_IMPORT_BATCH_MAX = 500;
|
|
6558
|
+
CONTACT_SEARCH_MAX = 100;
|
|
6559
|
+
CONTACT_LIST_NAME_MAX = 64;
|
|
6560
|
+
CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
6561
|
+
CONTACT_LIST_DESCRIPTION_MAX = 1e3;
|
|
6562
|
+
CONTACT_LIST_FILTER_MAX = 20;
|
|
6563
|
+
CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
|
|
6564
|
+
SUPPRESSION_SCOPES = ["all", "marketing"];
|
|
6565
|
+
SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
|
|
6566
|
+
contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
|
|
6567
|
+
contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
|
|
6568
|
+
const phone = normalizeContactPhone(raw);
|
|
6569
|
+
if (phone === null) {
|
|
6570
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
|
|
6571
|
+
return external_exports.NEVER;
|
|
6572
|
+
}
|
|
6573
|
+
return phone;
|
|
6574
|
+
});
|
|
6575
|
+
contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
|
|
6576
|
+
contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
|
|
6577
|
+
contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label3) => label3.length > 0, "A label cannot be empty").refine((label3) => !label3.includes(","), "A label cannot contain a comma");
|
|
6578
|
+
contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
|
|
6579
|
+
contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
|
|
6580
|
+
try {
|
|
6581
|
+
return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
|
|
6582
|
+
} catch {
|
|
6583
|
+
return false;
|
|
6584
|
+
}
|
|
6585
|
+
}, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
|
|
6586
|
+
scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
|
|
6587
|
+
contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
|
|
6588
|
+
external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
|
|
6589
|
+
external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
|
|
6590
|
+
]);
|
|
6591
|
+
hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
|
|
6592
|
+
IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
|
|
6593
|
+
contactBookOrgQuery = external_exports.object({
|
|
6594
|
+
organization_id: external_exports.string().uuid()
|
|
6595
|
+
});
|
|
6596
|
+
contactBookContactParam = external_exports.object({
|
|
6597
|
+
contactId: external_exports.string().uuid()
|
|
6598
|
+
});
|
|
6599
|
+
contactBookListParam = external_exports.object({
|
|
6600
|
+
listId: external_exports.string().uuid()
|
|
6601
|
+
});
|
|
6602
|
+
contactBookHubParam = external_exports.object({
|
|
6603
|
+
hubId: external_exports.string().uuid()
|
|
6604
|
+
});
|
|
6605
|
+
contactBookPageQuery = external_exports.object({
|
|
6606
|
+
cursor: external_exports.string().max(2048).optional(),
|
|
6607
|
+
limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
|
|
6608
|
+
});
|
|
6609
|
+
listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
|
|
6610
|
+
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
|
|
6611
|
+
label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
|
|
6612
|
+
scope_tag_id: external_exports.string().uuid().optional()
|
|
6613
|
+
});
|
|
6614
|
+
listHubContactBookContactsQuery = contactBookPageQuery.extend({
|
|
6615
|
+
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
|
|
6616
|
+
});
|
|
6617
|
+
contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
|
|
6618
|
+
email: contactEmail
|
|
6619
|
+
});
|
|
6620
|
+
listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
6621
|
+
contactRowFields = {
|
|
6622
|
+
name: contactName,
|
|
6623
|
+
phone: contactPhone.nullish(),
|
|
6624
|
+
email: contactEmail.nullish(),
|
|
6625
|
+
instagram_sid: contactInstagramSid.nullish(),
|
|
6626
|
+
labels: contactLabels.optional(),
|
|
6627
|
+
metadata: contactMetadata.optional()
|
|
6628
|
+
};
|
|
6629
|
+
createContactBookContactBody = external_exports.object({
|
|
6630
|
+
organization_id: external_exports.string().uuid(),
|
|
6631
|
+
...contactRowFields,
|
|
6632
|
+
visibility: contactVisibilitySchema,
|
|
6633
|
+
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
6634
|
+
}).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
6635
|
+
updateContactBookContactBody = external_exports.object({
|
|
6636
|
+
name: contactName.optional(),
|
|
6637
|
+
phone: contactPhone.nullable().optional(),
|
|
6638
|
+
email: contactEmail.nullable().optional(),
|
|
6639
|
+
instagram_sid: contactInstagramSid.nullable().optional(),
|
|
6640
|
+
labels: contactLabels.optional(),
|
|
6641
|
+
metadata: contactMetadata.optional(),
|
|
6642
|
+
visibility: contactVisibilitySchema.optional(),
|
|
6643
|
+
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
6644
|
+
}).strict();
|
|
6645
|
+
contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
6646
|
+
importContactBookContactsBody = external_exports.object({
|
|
6647
|
+
organization_id: external_exports.string().uuid(),
|
|
6648
|
+
visibility: contactVisibilitySchema,
|
|
6649
|
+
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
|
|
6650
|
+
labels: contactLabels.optional(),
|
|
6651
|
+
rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
|
|
6652
|
+
}).strict().superRefine((batch, ctx) => {
|
|
6653
|
+
batch.rows.forEach((row, index) => {
|
|
6654
|
+
if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
|
|
6655
|
+
ctx.addIssue({
|
|
6656
|
+
code: external_exports.ZodIssueCode.custom,
|
|
6657
|
+
path: ["rows", index, "labels"],
|
|
6658
|
+
message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
|
|
6659
|
+
});
|
|
6660
|
+
}
|
|
6661
|
+
});
|
|
6662
|
+
});
|
|
6663
|
+
linkContactBookContactBody = external_exports.object({
|
|
6664
|
+
user_id: external_exports.string().min(1).max(128)
|
|
6665
|
+
}).strict();
|
|
6666
|
+
listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
|
|
6667
|
+
message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
|
|
6668
|
+
});
|
|
6669
|
+
contactListFilterSchema = external_exports.object({
|
|
6670
|
+
labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
|
|
6671
|
+
scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
|
|
6672
|
+
}).strict();
|
|
6673
|
+
createContactBookListBody = external_exports.object({
|
|
6674
|
+
organization_id: external_exports.string().uuid(),
|
|
6675
|
+
name: listName,
|
|
6676
|
+
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
|
|
6677
|
+
filter: contactListFilterSchema.optional()
|
|
6678
|
+
}).strict();
|
|
6679
|
+
updateContactBookListBody = external_exports.object({
|
|
6680
|
+
name: listName.optional(),
|
|
6681
|
+
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
|
|
6682
|
+
filter: contactListFilterSchema.optional()
|
|
6683
|
+
}).strict();
|
|
6684
|
+
updateContactBookListPinsBody = external_exports.object({
|
|
6685
|
+
add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
|
|
6686
|
+
remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
|
|
6687
|
+
}).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
|
|
6688
|
+
suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
|
|
6689
|
+
external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
|
|
6690
|
+
external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
|
|
6691
|
+
external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
|
|
6692
|
+
]);
|
|
6693
|
+
createContactBookSuppressionBody = external_exports.object({
|
|
6694
|
+
organization_id: external_exports.string().uuid(),
|
|
6695
|
+
identity: suppressionIdentitySchema,
|
|
6696
|
+
scope: external_exports.enum(SUPPRESSION_SCOPES)
|
|
6697
|
+
}).strict();
|
|
6698
|
+
contactBookSuppressionParam = external_exports.object({
|
|
6699
|
+
suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
|
|
6700
|
+
});
|
|
6701
|
+
listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
6702
|
+
contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
|
|
6703
|
+
contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
|
|
6704
|
+
orgListReferenceSchema = listName;
|
|
6705
|
+
}
|
|
6706
|
+
});
|
|
6707
|
+
|
|
6708
|
+
// ../../packages/core/dist/chunk-MGBAXT5Y.js
|
|
6709
|
+
var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
|
|
6710
|
+
var init_chunk_MGBAXT5Y = __esm({
|
|
6711
|
+
"../../packages/core/dist/chunk-MGBAXT5Y.js"() {
|
|
6712
|
+
"use strict";
|
|
6713
|
+
init_chunk_2YEGUQR7();
|
|
6714
|
+
init_chunk_UAOHHCW5();
|
|
6715
|
+
init_zod();
|
|
6716
|
+
PERSON_LINKS_MAX = 15;
|
|
6717
|
+
PERSON_DENY_PAGE_MAX = 100;
|
|
6718
|
+
personParam = external_exports.object({
|
|
6719
|
+
personId: userPersonIdSchema
|
|
6720
|
+
});
|
|
6721
|
+
personLinkParam = personParam.extend({
|
|
6722
|
+
targetId: personIdSchema
|
|
6723
|
+
});
|
|
6724
|
+
deniedPersonParam = external_exports.object({
|
|
6725
|
+
personId: personIdSchema
|
|
6726
|
+
});
|
|
6727
|
+
listDeniedPersonsQuery = contactBookOrgQuery.extend({
|
|
6728
|
+
cursor: personIdSchema.optional(),
|
|
6729
|
+
limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
|
|
6730
|
+
});
|
|
6731
|
+
conversationCustomerPersonParam = external_exports.object({
|
|
6732
|
+
hubId: external_exports.string().uuid(),
|
|
6733
|
+
conversationId: external_exports.string().uuid()
|
|
6734
|
+
});
|
|
6735
|
+
}
|
|
6736
|
+
});
|
|
6737
|
+
|
|
6494
6738
|
// ../../packages/core/dist/chunk-5DGHIY7L.js
|
|
6495
6739
|
var rekorBaseChangeMessageSchema;
|
|
6496
6740
|
var init_chunk_5DGHIY7L = __esm({
|
|
@@ -7449,22 +7693,41 @@ var init_chunk_PFGVH2CX = __esm({
|
|
|
7449
7693
|
}
|
|
7450
7694
|
});
|
|
7451
7695
|
|
|
7452
|
-
// ../../packages/core/dist/chunk-
|
|
7453
|
-
var
|
|
7454
|
-
var
|
|
7455
|
-
"../../packages/core/dist/chunk-
|
|
7696
|
+
// ../../packages/core/dist/chunk-FPSDNS2E.js
|
|
7697
|
+
var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
|
|
7698
|
+
var init_chunk_FPSDNS2E = __esm({
|
|
7699
|
+
"../../packages/core/dist/chunk-FPSDNS2E.js"() {
|
|
7456
7700
|
"use strict";
|
|
7457
7701
|
init_zod();
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7702
|
+
noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
|
|
7703
|
+
noticeStatusSchema = external_exports.enum(["active", "resolved"]);
|
|
7704
|
+
NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
|
|
7705
|
+
noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
|
|
7706
|
+
noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
|
|
7707
|
+
createNoticeBody = external_exports.object({
|
|
7708
|
+
severity: noticeSeveritySchema.default("info"),
|
|
7709
|
+
scope: noticeScopeSchema.default("global"),
|
|
7710
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
7711
|
+
body: external_exports.string().max(2e3).optional(),
|
|
7712
|
+
link: noticeLinkSchema.optional(),
|
|
7713
|
+
starts_at: external_exports.string().datetime().optional(),
|
|
7714
|
+
ends_at: external_exports.string().datetime().optional()
|
|
7715
|
+
});
|
|
7716
|
+
updateNoticeBody = external_exports.object({
|
|
7717
|
+
severity: noticeSeveritySchema.optional(),
|
|
7718
|
+
scope: noticeScopeSchema.optional(),
|
|
7719
|
+
title: external_exports.string().trim().min(1).max(200).optional(),
|
|
7720
|
+
body: external_exports.string().max(2e3).nullable().optional(),
|
|
7721
|
+
link: noticeLinkSchema.nullable().optional(),
|
|
7722
|
+
starts_at: external_exports.string().datetime().optional(),
|
|
7723
|
+
ends_at: external_exports.string().datetime().nullable().optional()
|
|
7724
|
+
}).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
|
|
7725
|
+
listNoticesQuery = external_exports.object({
|
|
7726
|
+
status: noticeStatusSchema.optional(),
|
|
7727
|
+
limit: external_exports.coerce.number().int().min(1).max(200).optional(),
|
|
7728
|
+
offset: external_exports.coerce.number().int().min(0).optional()
|
|
7467
7729
|
});
|
|
7730
|
+
noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
|
|
7468
7731
|
}
|
|
7469
7732
|
});
|
|
7470
7733
|
|
|
@@ -7974,231 +8237,6 @@ var init_chunk_Y7CFCYX4 = __esm({
|
|
|
7974
8237
|
}
|
|
7975
8238
|
});
|
|
7976
8239
|
|
|
7977
|
-
// ../../packages/core/dist/chunk-2YEGUQR7.js
|
|
7978
|
-
var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
|
|
7979
|
-
var init_chunk_2YEGUQR7 = __esm({
|
|
7980
|
-
"../../packages/core/dist/chunk-2YEGUQR7.js"() {
|
|
7981
|
-
"use strict";
|
|
7982
|
-
init_zod();
|
|
7983
|
-
PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
|
|
7984
|
-
CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
7985
|
-
PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
|
|
7986
|
-
userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
|
|
7987
|
-
personIdSchema = external_exports.string().refine(
|
|
7988
|
-
(value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
|
|
7989
|
-
{ message: PERSON_ID_FORM_MESSAGE }
|
|
7990
|
-
);
|
|
7991
|
-
}
|
|
7992
|
-
});
|
|
7993
|
-
|
|
7994
|
-
// ../../packages/core/dist/chunk-UAOHHCW5.js
|
|
7995
|
-
function normalizeContactPhone(raw) {
|
|
7996
|
-
const compact = raw.trim().replace(/[\s\-.()]/g, "");
|
|
7997
|
-
const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
|
|
7998
|
-
return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
|
|
7999
|
-
}
|
|
8000
|
-
function normalizeContactLabel(raw) {
|
|
8001
|
-
return raw.trim().replace(/\s+/g, " ").toLowerCase();
|
|
8002
|
-
}
|
|
8003
|
-
function importRowLabels(row, batchLabels) {
|
|
8004
|
-
return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
|
|
8005
|
-
}
|
|
8006
|
-
var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
|
|
8007
|
-
var init_chunk_UAOHHCW5 = __esm({
|
|
8008
|
-
"../../packages/core/dist/chunk-UAOHHCW5.js"() {
|
|
8009
|
-
"use strict";
|
|
8010
|
-
init_zod();
|
|
8011
|
-
CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
|
|
8012
|
-
CONTACT_NAME_MAX = 200;
|
|
8013
|
-
CONTACT_EMAIL_MAX = 320;
|
|
8014
|
-
CONTACT_PHONE_INPUT_MAX = 40;
|
|
8015
|
-
CONTACT_INSTAGRAM_SID_MAX = 64;
|
|
8016
|
-
CONTACT_METADATA_MAX_BYTES = 4096;
|
|
8017
|
-
CONTACT_LABEL_MAX = 64;
|
|
8018
|
-
CONTACT_LABELS_MAX = 20;
|
|
8019
|
-
CONTACT_SCOPE_TAGS_MAX = 20;
|
|
8020
|
-
CONTACT_PAGE_MAX = 100;
|
|
8021
|
-
CONTACT_IMPORT_BATCH_MAX = 500;
|
|
8022
|
-
CONTACT_SEARCH_MAX = 100;
|
|
8023
|
-
CONTACT_LIST_NAME_MAX = 64;
|
|
8024
|
-
CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
8025
|
-
CONTACT_LIST_DESCRIPTION_MAX = 1e3;
|
|
8026
|
-
CONTACT_LIST_FILTER_MAX = 20;
|
|
8027
|
-
CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
|
|
8028
|
-
SUPPRESSION_SCOPES = ["all", "marketing"];
|
|
8029
|
-
SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
|
|
8030
|
-
contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
|
|
8031
|
-
contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
|
|
8032
|
-
const phone = normalizeContactPhone(raw);
|
|
8033
|
-
if (phone === null) {
|
|
8034
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
|
|
8035
|
-
return external_exports.NEVER;
|
|
8036
|
-
}
|
|
8037
|
-
return phone;
|
|
8038
|
-
});
|
|
8039
|
-
contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
|
|
8040
|
-
contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
|
|
8041
|
-
contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label3) => label3.length > 0, "A label cannot be empty").refine((label3) => !label3.includes(","), "A label cannot contain a comma");
|
|
8042
|
-
contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
|
|
8043
|
-
contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
|
|
8044
|
-
try {
|
|
8045
|
-
return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
|
|
8046
|
-
} catch {
|
|
8047
|
-
return false;
|
|
8048
|
-
}
|
|
8049
|
-
}, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
|
|
8050
|
-
scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
|
|
8051
|
-
contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
|
|
8052
|
-
external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
|
|
8053
|
-
external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
|
|
8054
|
-
]);
|
|
8055
|
-
hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
|
|
8056
|
-
IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
|
|
8057
|
-
contactBookOrgQuery = external_exports.object({
|
|
8058
|
-
organization_id: external_exports.string().uuid()
|
|
8059
|
-
});
|
|
8060
|
-
contactBookContactParam = external_exports.object({
|
|
8061
|
-
contactId: external_exports.string().uuid()
|
|
8062
|
-
});
|
|
8063
|
-
contactBookListParam = external_exports.object({
|
|
8064
|
-
listId: external_exports.string().uuid()
|
|
8065
|
-
});
|
|
8066
|
-
contactBookHubParam = external_exports.object({
|
|
8067
|
-
hubId: external_exports.string().uuid()
|
|
8068
|
-
});
|
|
8069
|
-
contactBookPageQuery = external_exports.object({
|
|
8070
|
-
cursor: external_exports.string().max(2048).optional(),
|
|
8071
|
-
limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
|
|
8072
|
-
});
|
|
8073
|
-
listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
|
|
8074
|
-
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
|
|
8075
|
-
label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
|
|
8076
|
-
scope_tag_id: external_exports.string().uuid().optional()
|
|
8077
|
-
});
|
|
8078
|
-
listHubContactBookContactsQuery = contactBookPageQuery.extend({
|
|
8079
|
-
q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
|
|
8080
|
-
});
|
|
8081
|
-
contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
|
|
8082
|
-
email: contactEmail
|
|
8083
|
-
});
|
|
8084
|
-
listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
8085
|
-
contactRowFields = {
|
|
8086
|
-
name: contactName,
|
|
8087
|
-
phone: contactPhone.nullish(),
|
|
8088
|
-
email: contactEmail.nullish(),
|
|
8089
|
-
instagram_sid: contactInstagramSid.nullish(),
|
|
8090
|
-
labels: contactLabels.optional(),
|
|
8091
|
-
metadata: contactMetadata.optional()
|
|
8092
|
-
};
|
|
8093
|
-
createContactBookContactBody = external_exports.object({
|
|
8094
|
-
organization_id: external_exports.string().uuid(),
|
|
8095
|
-
...contactRowFields,
|
|
8096
|
-
visibility: contactVisibilitySchema,
|
|
8097
|
-
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
8098
|
-
}).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
8099
|
-
updateContactBookContactBody = external_exports.object({
|
|
8100
|
-
name: contactName.optional(),
|
|
8101
|
-
phone: contactPhone.nullable().optional(),
|
|
8102
|
-
email: contactEmail.nullable().optional(),
|
|
8103
|
-
instagram_sid: contactInstagramSid.nullable().optional(),
|
|
8104
|
-
labels: contactLabels.optional(),
|
|
8105
|
-
metadata: contactMetadata.optional(),
|
|
8106
|
-
visibility: contactVisibilitySchema.optional(),
|
|
8107
|
-
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
|
|
8108
|
-
}).strict();
|
|
8109
|
-
contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
|
|
8110
|
-
importContactBookContactsBody = external_exports.object({
|
|
8111
|
-
organization_id: external_exports.string().uuid(),
|
|
8112
|
-
visibility: contactVisibilitySchema,
|
|
8113
|
-
environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
|
|
8114
|
-
labels: contactLabels.optional(),
|
|
8115
|
-
rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
|
|
8116
|
-
}).strict().superRefine((batch, ctx) => {
|
|
8117
|
-
batch.rows.forEach((row, index) => {
|
|
8118
|
-
if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
|
|
8119
|
-
ctx.addIssue({
|
|
8120
|
-
code: external_exports.ZodIssueCode.custom,
|
|
8121
|
-
path: ["rows", index, "labels"],
|
|
8122
|
-
message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
|
|
8123
|
-
});
|
|
8124
|
-
}
|
|
8125
|
-
});
|
|
8126
|
-
});
|
|
8127
|
-
linkContactBookContactBody = external_exports.object({
|
|
8128
|
-
user_id: external_exports.string().min(1).max(128)
|
|
8129
|
-
}).strict();
|
|
8130
|
-
listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
|
|
8131
|
-
message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
|
|
8132
|
-
});
|
|
8133
|
-
contactListFilterSchema = external_exports.object({
|
|
8134
|
-
labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
|
|
8135
|
-
scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
|
|
8136
|
-
}).strict();
|
|
8137
|
-
createContactBookListBody = external_exports.object({
|
|
8138
|
-
organization_id: external_exports.string().uuid(),
|
|
8139
|
-
name: listName,
|
|
8140
|
-
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
|
|
8141
|
-
filter: contactListFilterSchema.optional()
|
|
8142
|
-
}).strict();
|
|
8143
|
-
updateContactBookListBody = external_exports.object({
|
|
8144
|
-
name: listName.optional(),
|
|
8145
|
-
description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
|
|
8146
|
-
filter: contactListFilterSchema.optional()
|
|
8147
|
-
}).strict();
|
|
8148
|
-
updateContactBookListPinsBody = external_exports.object({
|
|
8149
|
-
add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
|
|
8150
|
-
remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
|
|
8151
|
-
}).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
|
|
8152
|
-
suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
|
|
8153
|
-
external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
|
|
8154
|
-
external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
|
|
8155
|
-
external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
|
|
8156
|
-
]);
|
|
8157
|
-
createContactBookSuppressionBody = external_exports.object({
|
|
8158
|
-
organization_id: external_exports.string().uuid(),
|
|
8159
|
-
identity: suppressionIdentitySchema,
|
|
8160
|
-
scope: external_exports.enum(SUPPRESSION_SCOPES)
|
|
8161
|
-
}).strict();
|
|
8162
|
-
contactBookSuppressionParam = external_exports.object({
|
|
8163
|
-
suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
|
|
8164
|
-
});
|
|
8165
|
-
listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
|
|
8166
|
-
contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
|
|
8167
|
-
contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
|
|
8168
|
-
orgListReferenceSchema = listName;
|
|
8169
|
-
}
|
|
8170
|
-
});
|
|
8171
|
-
|
|
8172
|
-
// ../../packages/core/dist/chunk-MGBAXT5Y.js
|
|
8173
|
-
var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
|
|
8174
|
-
var init_chunk_MGBAXT5Y = __esm({
|
|
8175
|
-
"../../packages/core/dist/chunk-MGBAXT5Y.js"() {
|
|
8176
|
-
"use strict";
|
|
8177
|
-
init_chunk_2YEGUQR7();
|
|
8178
|
-
init_chunk_UAOHHCW5();
|
|
8179
|
-
init_zod();
|
|
8180
|
-
PERSON_LINKS_MAX = 15;
|
|
8181
|
-
PERSON_DENY_PAGE_MAX = 100;
|
|
8182
|
-
personParam = external_exports.object({
|
|
8183
|
-
personId: userPersonIdSchema
|
|
8184
|
-
});
|
|
8185
|
-
personLinkParam = personParam.extend({
|
|
8186
|
-
targetId: personIdSchema
|
|
8187
|
-
});
|
|
8188
|
-
deniedPersonParam = external_exports.object({
|
|
8189
|
-
personId: personIdSchema
|
|
8190
|
-
});
|
|
8191
|
-
listDeniedPersonsQuery = contactBookOrgQuery.extend({
|
|
8192
|
-
cursor: personIdSchema.optional(),
|
|
8193
|
-
limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
|
|
8194
|
-
});
|
|
8195
|
-
conversationCustomerPersonParam = external_exports.object({
|
|
8196
|
-
hubId: external_exports.string().uuid(),
|
|
8197
|
-
conversationId: external_exports.string().uuid()
|
|
8198
|
-
});
|
|
8199
|
-
}
|
|
8200
|
-
});
|
|
8201
|
-
|
|
8202
8240
|
// ../../packages/core/dist/chunk-YUZFHVB2.js
|
|
8203
8241
|
var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
|
|
8204
8242
|
var init_chunk_YUZFHVB2 = __esm({
|
|
@@ -8645,41 +8683,18 @@ var init_chunk_34LE6P7E = __esm({
|
|
|
8645
8683
|
}
|
|
8646
8684
|
});
|
|
8647
8685
|
|
|
8648
|
-
// ../../packages/core/dist/chunk-
|
|
8649
|
-
var
|
|
8650
|
-
var
|
|
8651
|
-
"../../packages/core/dist/chunk-
|
|
8686
|
+
// ../../packages/core/dist/chunk-IR2NOSI3.js
|
|
8687
|
+
var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
|
|
8688
|
+
var init_chunk_IR2NOSI3 = __esm({
|
|
8689
|
+
"../../packages/core/dist/chunk-IR2NOSI3.js"() {
|
|
8652
8690
|
"use strict";
|
|
8691
|
+
init_chunk_HZ6CADSY();
|
|
8653
8692
|
init_zod();
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
createNoticeBody = external_exports.object({
|
|
8660
|
-
severity: noticeSeveritySchema.default("info"),
|
|
8661
|
-
scope: noticeScopeSchema.default("global"),
|
|
8662
|
-
title: external_exports.string().trim().min(1).max(200),
|
|
8663
|
-
body: external_exports.string().max(2e3).optional(),
|
|
8664
|
-
link: noticeLinkSchema.optional(),
|
|
8665
|
-
starts_at: external_exports.string().datetime().optional(),
|
|
8666
|
-
ends_at: external_exports.string().datetime().optional()
|
|
8667
|
-
});
|
|
8668
|
-
updateNoticeBody = external_exports.object({
|
|
8669
|
-
severity: noticeSeveritySchema.optional(),
|
|
8670
|
-
scope: noticeScopeSchema.optional(),
|
|
8671
|
-
title: external_exports.string().trim().min(1).max(200).optional(),
|
|
8672
|
-
body: external_exports.string().max(2e3).nullable().optional(),
|
|
8673
|
-
link: noticeLinkSchema.nullable().optional(),
|
|
8674
|
-
starts_at: external_exports.string().datetime().optional(),
|
|
8675
|
-
ends_at: external_exports.string().datetime().nullable().optional()
|
|
8676
|
-
}).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
|
|
8677
|
-
listNoticesQuery = external_exports.object({
|
|
8678
|
-
status: noticeStatusSchema.optional(),
|
|
8679
|
-
limit: external_exports.coerce.number().int().min(1).max(200).optional(),
|
|
8680
|
-
offset: external_exports.coerce.number().int().min(0).optional()
|
|
8681
|
-
});
|
|
8682
|
-
noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
|
|
8693
|
+
adminSetGuideHubBody = external_exports.object({
|
|
8694
|
+
hub_id: uuidSchema,
|
|
8695
|
+
dry_run: external_exports.boolean().optional()
|
|
8696
|
+
}).strict();
|
|
8697
|
+
GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
|
|
8683
8698
|
}
|
|
8684
8699
|
});
|
|
8685
8700
|
|
|
@@ -9146,6 +9161,29 @@ var init_chunk_2ZZZHXZR = __esm({
|
|
|
9146
9161
|
}
|
|
9147
9162
|
});
|
|
9148
9163
|
|
|
9164
|
+
// ../../packages/core/dist/chunk-MH4O3YEX.js
|
|
9165
|
+
var stateOperationBody;
|
|
9166
|
+
var init_chunk_MH4O3YEX = __esm({
|
|
9167
|
+
"../../packages/core/dist/chunk-MH4O3YEX.js"() {
|
|
9168
|
+
"use strict";
|
|
9169
|
+
init_chunk_6TSQ5HXC();
|
|
9170
|
+
init_zod();
|
|
9171
|
+
stateOperationBody = external_exports.object({
|
|
9172
|
+
hub_id: external_exports.string().uuid(),
|
|
9173
|
+
operation: external_exports.enum(["get", "update", "set_path", "reset"]),
|
|
9174
|
+
state_slug: slugSchema,
|
|
9175
|
+
/**
|
|
9176
|
+
* Deprecated and ignored. Scope is derived from the hub's state definition.
|
|
9177
|
+
* Kept on the schema so legacy bodies still validate.
|
|
9178
|
+
*/
|
|
9179
|
+
state_scope: external_exports.enum(["conversation", "user"]).optional(),
|
|
9180
|
+
updates: external_exports.record(external_exports.unknown()).optional(),
|
|
9181
|
+
path: external_exports.array(external_exports.string()).optional(),
|
|
9182
|
+
value: external_exports.unknown().optional()
|
|
9183
|
+
});
|
|
9184
|
+
}
|
|
9185
|
+
});
|
|
9186
|
+
|
|
9149
9187
|
// ../../packages/core/dist/chunk-IBL7FANV.js
|
|
9150
9188
|
var SUMMARIZATION_THRESHOLD_MIN, SUMMARIZATION_THRESHOLD_MAX;
|
|
9151
9189
|
var init_chunk_IBL7FANV = __esm({
|
|
@@ -12731,21 +12769,6 @@ var init_chunk_C4HEZ7ZI = __esm({
|
|
|
12731
12769
|
}
|
|
12732
12770
|
});
|
|
12733
12771
|
|
|
12734
|
-
// ../../packages/core/dist/chunk-IR2NOSI3.js
|
|
12735
|
-
var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
|
|
12736
|
-
var init_chunk_IR2NOSI3 = __esm({
|
|
12737
|
-
"../../packages/core/dist/chunk-IR2NOSI3.js"() {
|
|
12738
|
-
"use strict";
|
|
12739
|
-
init_chunk_HZ6CADSY();
|
|
12740
|
-
init_zod();
|
|
12741
|
-
adminSetGuideHubBody = external_exports.object({
|
|
12742
|
-
hub_id: uuidSchema,
|
|
12743
|
-
dry_run: external_exports.boolean().optional()
|
|
12744
|
-
}).strict();
|
|
12745
|
-
GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
|
|
12746
|
-
}
|
|
12747
|
-
});
|
|
12748
|
-
|
|
12749
12772
|
// ../../packages/core/dist/chunk-YULHXJ5M.js
|
|
12750
12773
|
var COMMUNITY_LESSON_TREE_MAX_BYTES, COMMUNITY_LESSON_LINK_PROTOCOLS, COMMUNITY_LESSON_TREE_TOO_LARGE_REASON, COMMUNITY_LESSON_TREE_TOO_DEEP_REASON, COMMUNITY_LESSON_LINE_PREFIX_TOO_WIDE_REASON, LINK_SCHEME;
|
|
12751
12774
|
var init_chunk_YULHXJ5M = __esm({
|
|
@@ -12849,29 +12872,6 @@ var init_chunk_ACGAI25T = __esm({
|
|
|
12849
12872
|
}
|
|
12850
12873
|
});
|
|
12851
12874
|
|
|
12852
|
-
// ../../packages/core/dist/chunk-MH4O3YEX.js
|
|
12853
|
-
var stateOperationBody;
|
|
12854
|
-
var init_chunk_MH4O3YEX = __esm({
|
|
12855
|
-
"../../packages/core/dist/chunk-MH4O3YEX.js"() {
|
|
12856
|
-
"use strict";
|
|
12857
|
-
init_chunk_6TSQ5HXC();
|
|
12858
|
-
init_zod();
|
|
12859
|
-
stateOperationBody = external_exports.object({
|
|
12860
|
-
hub_id: external_exports.string().uuid(),
|
|
12861
|
-
operation: external_exports.enum(["get", "update", "set_path", "reset"]),
|
|
12862
|
-
state_slug: slugSchema,
|
|
12863
|
-
/**
|
|
12864
|
-
* Deprecated and ignored. Scope is derived from the hub's state definition.
|
|
12865
|
-
* Kept on the schema so legacy bodies still validate.
|
|
12866
|
-
*/
|
|
12867
|
-
state_scope: external_exports.enum(["conversation", "user"]).optional(),
|
|
12868
|
-
updates: external_exports.record(external_exports.unknown()).optional(),
|
|
12869
|
-
path: external_exports.array(external_exports.string()).optional(),
|
|
12870
|
-
value: external_exports.unknown().optional()
|
|
12871
|
-
});
|
|
12872
|
-
}
|
|
12873
|
-
});
|
|
12874
|
-
|
|
12875
12875
|
// ../../packages/core/dist/chunk-5Y2NNQHX.js
|
|
12876
12876
|
var CASE_SUBMISSION_ISSUED_KINDS, CASE_SUBMISSION_RENDER_STUCK_MS, CASE_SUBMISSION_MARK_ID_PATTERN, CASE_CORRECTION_REASON_MAX_LENGTH, submitCaseBody, correctCaseSubmissionBody, caseDeliveryQuery;
|
|
12877
12877
|
var init_chunk_5Y2NNQHX = __esm({
|
|
@@ -16608,6 +16608,25 @@ var init_chunk_M2IF4G6X = __esm({
|
|
|
16608
16608
|
}
|
|
16609
16609
|
});
|
|
16610
16610
|
|
|
16611
|
+
// ../../packages/core/dist/chunk-UOPCLXCU.js
|
|
16612
|
+
var CASE_CHANGE_TOPICS, caseChangedFrameSchema;
|
|
16613
|
+
var init_chunk_UOPCLXCU = __esm({
|
|
16614
|
+
"../../packages/core/dist/chunk-UOPCLXCU.js"() {
|
|
16615
|
+
"use strict";
|
|
16616
|
+
init_chunk_733K4J4G();
|
|
16617
|
+
init_chunk_HZ6CADSY();
|
|
16618
|
+
init_zod();
|
|
16619
|
+
CASE_CHANGE_TOPICS = ["submission", "agenda", "access"];
|
|
16620
|
+
caseChangedFrameSchema = external_exports.object({
|
|
16621
|
+
org_id: uuidSchema,
|
|
16622
|
+
space_id: uuidSchema,
|
|
16623
|
+
/** The case, by its code; null for an `access` change, which names none. */
|
|
16624
|
+
code: caseRecordParam.shape.code.nullable(),
|
|
16625
|
+
topic: external_exports.enum(CASE_CHANGE_TOPICS)
|
|
16626
|
+
}).strict();
|
|
16627
|
+
}
|
|
16628
|
+
});
|
|
16629
|
+
|
|
16611
16630
|
// ../../packages/core/dist/chunk-7CZSLDOE.js
|
|
16612
16631
|
var CASE_MEMBER_CASES_PAGE_MAX, caseMemberReachQuery;
|
|
16613
16632
|
var init_chunk_7CZSLDOE = __esm({
|
|
@@ -16976,237 +16995,6 @@ var init_chunk_WYCUCSD5 = __esm({
|
|
|
16976
16995
|
}
|
|
16977
16996
|
});
|
|
16978
16997
|
|
|
16979
|
-
// ../../packages/core/dist/chunk-H6V7NEWR.js
|
|
16980
|
-
function isCaseDueDate(value) {
|
|
16981
|
-
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
16982
|
-
if (!match) return false;
|
|
16983
|
-
const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
16984
|
-
if (year < CASE_DUE_DATE_MIN_YEAR || year > CASE_DUE_DATE_MAX_YEAR) return false;
|
|
16985
|
-
const date = new Date(Date.UTC(year, month - 1, day));
|
|
16986
|
-
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
16987
|
-
}
|
|
16988
|
-
function setCaseDeadlinesProblem(body) {
|
|
16989
|
-
const seen = /* @__PURE__ */ new Set();
|
|
16990
|
-
for (const [index, phase] of body.phases.entries()) {
|
|
16991
|
-
if (seen.has(phase.phase_id)) return { reason: "phase_repeated", at: `phases.${index}.phase_id` };
|
|
16992
|
-
seen.add(phase.phase_id);
|
|
16993
|
-
}
|
|
16994
|
-
return null;
|
|
16995
|
-
}
|
|
16996
|
-
var CASE_DUE_DATE_MIN_YEAR, CASE_DUE_DATE_MAX_YEAR, CASE_DEADLINES_PHASES_MAX, CASE_OVERDUE_CASES_MAX, caseDueDateSchema, setCaseDeadlinesShape, setCaseDeadlinesBody, setCaseTaskPlanBody, setCaseOwnerBody, caseOverdueQuery;
|
|
16997
|
-
var init_chunk_H6V7NEWR = __esm({
|
|
16998
|
-
"../../packages/core/dist/chunk-H6V7NEWR.js"() {
|
|
16999
|
-
"use strict";
|
|
17000
|
-
init_chunk_3T3D7LTE();
|
|
17001
|
-
init_chunk_HZ6CADSY();
|
|
17002
|
-
init_zod();
|
|
17003
|
-
CASE_DUE_DATE_MIN_YEAR = 2e3;
|
|
17004
|
-
CASE_DUE_DATE_MAX_YEAR = 2100;
|
|
17005
|
-
CASE_DEADLINES_PHASES_MAX = 50;
|
|
17006
|
-
CASE_OVERDUE_CASES_MAX = 50;
|
|
17007
|
-
caseDueDateSchema = external_exports.string().refine(isCaseDueDate, "Not a calendar date (YYYY-MM-DD)");
|
|
17008
|
-
setCaseDeadlinesShape = external_exports.object({
|
|
17009
|
-
phases: external_exports.array(external_exports.object({ phase_id: uuidSchema, due_on: caseDueDateSchema.nullable() }).strict()).min(1).max(CASE_DEADLINES_PHASES_MAX)
|
|
17010
|
-
}).strict();
|
|
17011
|
-
setCaseDeadlinesBody = setCaseDeadlinesShape.superRefine((body, ctx) => {
|
|
17012
|
-
const found = setCaseDeadlinesProblem(body);
|
|
17013
|
-
if (found) {
|
|
17014
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: found.reason, path: found.at.split("."), params: { case_deadlines_reason: found.reason } });
|
|
17015
|
-
}
|
|
17016
|
-
});
|
|
17017
|
-
setCaseTaskPlanBody = external_exports.object({
|
|
17018
|
-
owner_person_id: uuidSchema.nullable(),
|
|
17019
|
-
due_on: caseDueDateSchema.nullable()
|
|
17020
|
-
}).strict();
|
|
17021
|
-
setCaseOwnerBody = external_exports.object({ owner_person_id: uuidSchema.nullable() }).strict();
|
|
17022
|
-
caseOverdueQuery = casePageQuery.extend({
|
|
17023
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_OVERDUE_CASES_MAX).optional()
|
|
17024
|
-
});
|
|
17025
|
-
}
|
|
17026
|
-
});
|
|
17027
|
-
|
|
17028
|
-
// ../../packages/core/dist/chunk-ZVIMTUGZ.js
|
|
17029
|
-
var CASE_GUEST_EMAIL_MAX, CASE_GUEST_INVITATIONS_PAGE_MAX, CASE_GUEST_INVITE_TOKEN_LENGTH, caseGuestEmailSchema, caseGuestInviteTokenSchema, inviteCaseGuestBody, caseGuestInvitationParam, caseGuestInvitationsQuery, joinCaseSpaceBody, caseJoinSearchParams;
|
|
17030
|
-
var init_chunk_ZVIMTUGZ = __esm({
|
|
17031
|
-
"../../packages/core/dist/chunk-ZVIMTUGZ.js"() {
|
|
17032
|
-
"use strict";
|
|
17033
|
-
init_chunk_3T3D7LTE();
|
|
17034
|
-
init_chunk_HZ6CADSY();
|
|
17035
|
-
init_zod();
|
|
17036
|
-
CASE_GUEST_EMAIL_MAX = 320;
|
|
17037
|
-
CASE_GUEST_INVITATIONS_PAGE_MAX = 100;
|
|
17038
|
-
CASE_GUEST_INVITE_TOKEN_LENGTH = 43;
|
|
17039
|
-
caseGuestEmailSchema = external_exports.string().trim().toLowerCase().max(CASE_GUEST_EMAIL_MAX).email();
|
|
17040
|
-
caseGuestInviteTokenSchema = external_exports.string().regex(new RegExp(`^[A-Za-z0-9_-]{${CASE_GUEST_INVITE_TOKEN_LENGTH}}$`));
|
|
17041
|
-
inviteCaseGuestBody = external_exports.object({ email: caseGuestEmailSchema }).strict();
|
|
17042
|
-
caseGuestInvitationParam = caseSpaceParam.extend({ invitation_id: uuidSchema });
|
|
17043
|
-
caseGuestInvitationsQuery = casePageQuery.extend({
|
|
17044
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_GUEST_INVITATIONS_PAGE_MAX).optional()
|
|
17045
|
-
});
|
|
17046
|
-
joinCaseSpaceBody = external_exports.object({ invite: caseGuestInviteTokenSchema }).strict();
|
|
17047
|
-
caseJoinSearchParams = external_exports.object({ org: uuidSchema, space: uuidSchema, invite: caseGuestInviteTokenSchema });
|
|
17048
|
-
}
|
|
17049
|
-
});
|
|
17050
|
-
|
|
17051
|
-
// ../../packages/core/dist/chunk-BVQCYBU6.js
|
|
17052
|
-
var CASE_RELATION_TYPE_CODE_PATTERN, CASE_RELATION_TYPE_CODE_MAX_LENGTH, CASE_RELATION_TYPE_NAME_MAX_LENGTH, CASE_RELATION_TYPES_PER_SPACE_MAX, CASE_RELATION_DESCRIPTION_MAX_LENGTH, CASE_RELATION_SIDES, CASE_EXTERNAL_SYSTEM_PATTERN, CASE_EXTERNAL_NUMBER_MAX_LENGTH, CASE_EXTERNAL_URL_MAX_LENGTH, trimmedName2, relationTypeFields, createCaseRelationTypeBody, updateCaseRelationTypeBody, relateCasesBody, addCaseExternalReferenceBody, caseRelationTypeParam, caseRelationParam, caseExternalReferenceParam, caseRelationTypesQuery;
|
|
17053
|
-
var init_chunk_BVQCYBU6 = __esm({
|
|
17054
|
-
"../../packages/core/dist/chunk-BVQCYBU6.js"() {
|
|
17055
|
-
"use strict";
|
|
17056
|
-
init_chunk_733K4J4G();
|
|
17057
|
-
init_chunk_3T3D7LTE();
|
|
17058
|
-
init_chunk_HZ6CADSY();
|
|
17059
|
-
init_zod();
|
|
17060
|
-
CASE_RELATION_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
17061
|
-
CASE_RELATION_TYPE_CODE_MAX_LENGTH = 64;
|
|
17062
|
-
CASE_RELATION_TYPE_NAME_MAX_LENGTH = 200;
|
|
17063
|
-
CASE_RELATION_TYPES_PER_SPACE_MAX = 100;
|
|
17064
|
-
CASE_RELATION_DESCRIPTION_MAX_LENGTH = 500;
|
|
17065
|
-
CASE_RELATION_SIDES = ["origin", "destination"];
|
|
17066
|
-
CASE_EXTERNAL_SYSTEM_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ._-]{0,30}$/;
|
|
17067
|
-
CASE_EXTERNAL_NUMBER_MAX_LENGTH = 120;
|
|
17068
|
-
CASE_EXTERNAL_URL_MAX_LENGTH = 2048;
|
|
17069
|
-
trimmedName2 = external_exports.string().trim().min(1).max(CASE_RELATION_TYPE_NAME_MAX_LENGTH);
|
|
17070
|
-
relationTypeFields = { name: trimmedName2, inverse_name: trimmedName2, active: external_exports.boolean().default(true) };
|
|
17071
|
-
createCaseRelationTypeBody = external_exports.object({
|
|
17072
|
-
code: external_exports.string().trim().max(CASE_RELATION_TYPE_CODE_MAX_LENGTH).regex(CASE_RELATION_TYPE_CODE_PATTERN),
|
|
17073
|
-
...relationTypeFields
|
|
17074
|
-
}).strict();
|
|
17075
|
-
updateCaseRelationTypeBody = external_exports.object({ ...relationTypeFields, expected_updated_at: timestampSchema.optional() }).strict();
|
|
17076
|
-
relateCasesBody = external_exports.object({
|
|
17077
|
-
relation_type_id: uuidSchema,
|
|
17078
|
-
other_code: external_exports.string().max(CASE_RECORD_CODE_MAX_LENGTH).regex(CASE_RECORD_CODE_PATTERN),
|
|
17079
|
-
/** This case's side: `origin` reads the type's name ("continues"), `destination` its inverse. */
|
|
17080
|
-
side: external_exports.enum(CASE_RELATION_SIDES).default("origin"),
|
|
17081
|
-
description: external_exports.string().trim().min(1).max(CASE_RELATION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
17082
|
-
}).strict();
|
|
17083
|
-
addCaseExternalReferenceBody = external_exports.object({
|
|
17084
|
-
system: external_exports.string().trim().regex(CASE_EXTERNAL_SYSTEM_PATTERN),
|
|
17085
|
-
number: external_exports.string().trim().min(1).max(CASE_EXTERNAL_NUMBER_MAX_LENGTH),
|
|
17086
|
-
url: external_exports.string().trim().max(CASE_EXTERNAL_URL_MAX_LENGTH).url().refine((url) => url.startsWith("https://"), "An https link").nullable().default(null)
|
|
17087
|
-
}).strict();
|
|
17088
|
-
caseRelationTypeParam = caseSpaceParam.extend({ relation_type_id: uuidSchema });
|
|
17089
|
-
caseRelationParam = caseRecordParam.extend({ relation_id: uuidSchema });
|
|
17090
|
-
caseExternalReferenceParam = caseRecordParam.extend({ reference_id: uuidSchema });
|
|
17091
|
-
caseRelationTypesQuery = casePageQuery.extend({
|
|
17092
|
-
limit: external_exports.coerce.number().int().min(1).max(CASE_RELATION_TYPES_PER_SPACE_MAX).optional()
|
|
17093
|
-
});
|
|
17094
|
-
}
|
|
17095
|
-
});
|
|
17096
|
-
|
|
17097
|
-
// ../../packages/core/dist/chunk-UOPCLXCU.js
|
|
17098
|
-
var CASE_CHANGE_TOPICS, caseChangedFrameSchema;
|
|
17099
|
-
var init_chunk_UOPCLXCU = __esm({
|
|
17100
|
-
"../../packages/core/dist/chunk-UOPCLXCU.js"() {
|
|
17101
|
-
"use strict";
|
|
17102
|
-
init_chunk_733K4J4G();
|
|
17103
|
-
init_chunk_HZ6CADSY();
|
|
17104
|
-
init_zod();
|
|
17105
|
-
CASE_CHANGE_TOPICS = ["submission", "agenda", "access"];
|
|
17106
|
-
caseChangedFrameSchema = external_exports.object({
|
|
17107
|
-
org_id: uuidSchema,
|
|
17108
|
-
space_id: uuidSchema,
|
|
17109
|
-
/** The case, by its code; null for an `access` change, which names none. */
|
|
17110
|
-
code: caseRecordParam.shape.code.nullable(),
|
|
17111
|
-
topic: external_exports.enum(CASE_CHANGE_TOPICS)
|
|
17112
|
-
}).strict();
|
|
17113
|
-
}
|
|
17114
|
-
});
|
|
17115
|
-
|
|
17116
|
-
// ../../packages/core/dist/chunk-Z3SV3XTC.js
|
|
17117
|
-
var caseAccessQuery;
|
|
17118
|
-
var init_chunk_Z3SV3XTC = __esm({
|
|
17119
|
-
"../../packages/core/dist/chunk-Z3SV3XTC.js"() {
|
|
17120
|
-
"use strict";
|
|
17121
|
-
init_chunk_HZ6CADSY();
|
|
17122
|
-
init_zod();
|
|
17123
|
-
caseAccessQuery = external_exports.object({ with_team_id: uuidSchema.optional() }).strict();
|
|
17124
|
-
}
|
|
17125
|
-
});
|
|
17126
|
-
|
|
17127
|
-
// ../../packages/core/dist/chunk-NHC27NIE.js
|
|
17128
|
-
var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS, reason, activateCasePhaseBody, dispenseCaseBody, addCaseTaskBody, addCaseInputBody, caseOwnItemSchema, addCaseItemBody;
|
|
17129
|
-
var init_chunk_NHC27NIE = __esm({
|
|
17130
|
-
"../../packages/core/dist/chunk-NHC27NIE.js"() {
|
|
17131
|
-
"use strict";
|
|
17132
|
-
init_chunk_PFPADFUC();
|
|
17133
|
-
init_chunk_HZ6CADSY();
|
|
17134
|
-
init_zod();
|
|
17135
|
-
CASE_ADJUSTMENT_REASON_MAX_LENGTH = 2e3;
|
|
17136
|
-
CASE_ADJUSTMENT_DISPENSATION_KINDS = ["phase", "item", "output", "input"];
|
|
17137
|
-
reason = external_exports.string().trim().min(1).max(CASE_ADJUSTMENT_REASON_MAX_LENGTH);
|
|
17138
|
-
activateCasePhaseBody = external_exports.object({ phase_id: uuidSchema, reason }).strict();
|
|
17139
|
-
dispenseCaseBody = external_exports.object({ kind: external_exports.enum(CASE_ADJUSTMENT_DISPENSATION_KINDS), target_id: uuidSchema, reason }).strict();
|
|
17140
|
-
addCaseTaskBody = external_exports.object({
|
|
17141
|
-
phase_id: uuidSchema,
|
|
17142
|
-
name: external_exports.string().trim().min(1).max(CASE_TASK_NAME_MAX_LENGTH),
|
|
17143
|
-
required: external_exports.boolean().default(false),
|
|
17144
|
-
/** Tasks of the same phase it waits for. */
|
|
17145
|
-
depends_on: external_exports.array(uuidSchema).max(CASE_TASK_DEPENDENCIES_MAX).default([])
|
|
17146
|
-
}).strict();
|
|
17147
|
-
addCaseInputBody = external_exports.object({
|
|
17148
|
-
phase_id: uuidSchema,
|
|
17149
|
-
input: casePhaseInputSchema.extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) }),
|
|
17150
|
-
reason
|
|
17151
|
-
}).strict();
|
|
17152
|
-
caseOwnItemSchema = caseOutputItemSchema.omit({ waivable: true, template_mode: true, fixed_text: true }).extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) });
|
|
17153
|
-
addCaseItemBody = external_exports.object({
|
|
17154
|
-
phase_id: uuidSchema,
|
|
17155
|
-
/** The phase's output it goes in. */
|
|
17156
|
-
output_id: uuidSchema,
|
|
17157
|
-
item: caseOwnItemSchema,
|
|
17158
|
-
reason
|
|
17159
|
-
}).strict();
|
|
17160
|
-
}
|
|
17161
|
-
});
|
|
17162
|
-
|
|
17163
|
-
// ../../packages/core/dist/chunk-UMAPAGFH.js
|
|
17164
|
-
var CASE_AGENDA_VALUE_MAX_LENGTH, CASE_AGENDA_JUSTIFICATION_MAX_LENGTH, CASE_AGENDA_EVIDENCE_MAX_LENGTH, CASE_AGENDA_COMMENT_MAX_LENGTH, CASE_AGENDA_VERDICTS, comment, caseAgendaGroupParam, caseAgendaDecisionParam, caseAgendaQuery, caseApprovedDecisionsQuery, proposeCaseAgendaValueBody, decideCaseAgendaBody, dispenseCaseAgendaBody, addCaseDecisionBody;
|
|
17165
|
-
var init_chunk_UMAPAGFH = __esm({
|
|
17166
|
-
"../../packages/core/dist/chunk-UMAPAGFH.js"() {
|
|
17167
|
-
"use strict";
|
|
17168
|
-
init_chunk_733K4J4G();
|
|
17169
|
-
init_chunk_PFPADFUC();
|
|
17170
|
-
init_chunk_3T3D7LTE();
|
|
17171
|
-
init_chunk_M2T55BV6();
|
|
17172
|
-
init_chunk_HZ6CADSY();
|
|
17173
|
-
init_zod();
|
|
17174
|
-
CASE_AGENDA_VALUE_MAX_LENGTH = 2e3;
|
|
17175
|
-
CASE_AGENDA_JUSTIFICATION_MAX_LENGTH = 2e3;
|
|
17176
|
-
CASE_AGENDA_EVIDENCE_MAX_LENGTH = 500;
|
|
17177
|
-
CASE_AGENDA_COMMENT_MAX_LENGTH = 2e3;
|
|
17178
|
-
CASE_AGENDA_VERDICTS = ["approve", "return"];
|
|
17179
|
-
comment = external_exports.string().trim().min(1).max(CASE_AGENDA_COMMENT_MAX_LENGTH);
|
|
17180
|
-
caseAgendaGroupParam = caseRecordParam.extend({ group_id: uuidSchema });
|
|
17181
|
-
caseAgendaDecisionParam = caseRecordParam.extend({ decision_code: caseDecisionCodeSchema });
|
|
17182
|
-
caseAgendaQuery = external_exports.object({
|
|
17183
|
-
phase_id: uuidSchema,
|
|
17184
|
-
cursor: external_exports.string().min(1).max(CASE_PAGE_CURSOR_MAX_LENGTH).optional()
|
|
17185
|
-
});
|
|
17186
|
-
caseApprovedDecisionsQuery = external_exports.object({
|
|
17187
|
-
confidential: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
|
|
17188
|
-
});
|
|
17189
|
-
proposeCaseAgendaValueBody = external_exports.object({
|
|
17190
|
-
/** As written: a numeric type also takes a string of digits with a `.` or `,` decimal mark (Rito's). */
|
|
17191
|
-
value: external_exports.union([external_exports.number(), external_exports.boolean(), external_exports.string().max(CASE_AGENDA_VALUE_MAX_LENGTH)]),
|
|
17192
|
-
justification: external_exports.string().trim().min(1).max(CASE_AGENDA_JUSTIFICATION_MAX_LENGTH),
|
|
17193
|
-
evidence: external_exports.string().trim().max(CASE_AGENDA_EVIDENCE_MAX_LENGTH).nullable().default(null).transform((text5) => text5 || null),
|
|
17194
|
-
/** Required on an approved group: why it is revised. */
|
|
17195
|
-
reason: comment.nullable().default(null)
|
|
17196
|
-
}).strict();
|
|
17197
|
-
decideCaseAgendaBody = external_exports.object({
|
|
17198
|
-
decision: external_exports.enum(CASE_AGENDA_VERDICTS),
|
|
17199
|
-
/** The sending its decider read (`CaseAgendaGroupView.sending_id`). */
|
|
17200
|
-
sending_id: uuidSchema,
|
|
17201
|
-
comment: comment.nullable().default(null)
|
|
17202
|
-
}).strict().superRefine((body, ctx) => {
|
|
17203
|
-
if (body.decision === "return" && body.comment === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A return needs its comment", path: ["comment"] });
|
|
17204
|
-
});
|
|
17205
|
-
dispenseCaseAgendaBody = external_exports.object({ reason: comment }).strict();
|
|
17206
|
-
addCaseDecisionBody = external_exports.object({ decision: caseAgendaDecisionSchema, reason: comment }).strict();
|
|
17207
|
-
}
|
|
17208
|
-
});
|
|
17209
|
-
|
|
17210
16998
|
// ../../packages/core/dist/chunk-7TQYAKCB.js
|
|
17211
16999
|
function addCaseNoteProblem(note) {
|
|
17212
17000
|
return note.origin !== null && note.kind !== "contribution" ? { reason: "origin_not_contribution", at: "origin" } : null;
|
|
@@ -17292,7 +17080,7 @@ var init_chunk_S7UAXLHJ = __esm({
|
|
|
17292
17080
|
});
|
|
17293
17081
|
|
|
17294
17082
|
// ../../packages/core/dist/chunk-S4NDHW3Q.js
|
|
17295
|
-
var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason,
|
|
17083
|
+
var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason, reason, lineNumber2, recordCaseReferenceBody, CASE_PASSAGE_REVERSED_REASON, citeCasePassageBody, decideCaseVersionBody;
|
|
17296
17084
|
var init_chunk_S4NDHW3Q = __esm({
|
|
17297
17085
|
"../../packages/core/dist/chunk-S4NDHW3Q.js"() {
|
|
17298
17086
|
"use strict";
|
|
@@ -17302,7 +17090,7 @@ var init_chunk_S4NDHW3Q = __esm({
|
|
|
17302
17090
|
CASE_VERSION_DECISION_REASON_MAX_LENGTH = 2e3;
|
|
17303
17091
|
CASE_VERSION_DECISIONS = ["adopt", "keep"];
|
|
17304
17092
|
caseVersionDecisionReason = external_exports.string().trim().min(1).max(CASE_VERSION_DECISION_REASON_MAX_LENGTH);
|
|
17305
|
-
|
|
17093
|
+
reason = caseVersionDecisionReason;
|
|
17306
17094
|
lineNumber2 = casePassageLineSchema;
|
|
17307
17095
|
recordCaseReferenceBody = external_exports.object({
|
|
17308
17096
|
document_id: uuidSchema,
|
|
@@ -17322,7 +17110,7 @@ var init_chunk_S4NDHW3Q = __esm({
|
|
|
17322
17110
|
decision: external_exports.enum(CASE_VERSION_DECISIONS),
|
|
17323
17111
|
/** The newer version its decider read as current. */
|
|
17324
17112
|
expect_version_id: uuidSchema,
|
|
17325
|
-
reason:
|
|
17113
|
+
reason: reason.nullable().default(null)
|
|
17326
17114
|
}).strict().superRefine((body, ctx) => {
|
|
17327
17115
|
if (body.decision === "keep" && body.reason === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A version kept needs its reason", path: ["reason"] });
|
|
17328
17116
|
});
|
|
@@ -17360,6 +17148,329 @@ var init_chunk_UZ72OHQN = __esm({
|
|
|
17360
17148
|
}
|
|
17361
17149
|
});
|
|
17362
17150
|
|
|
17151
|
+
// ../../packages/core/dist/chunk-H6V7NEWR.js
|
|
17152
|
+
function isCaseDueDate(value) {
|
|
17153
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
17154
|
+
if (!match) return false;
|
|
17155
|
+
const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
17156
|
+
if (year < CASE_DUE_DATE_MIN_YEAR || year > CASE_DUE_DATE_MAX_YEAR) return false;
|
|
17157
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
17158
|
+
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
17159
|
+
}
|
|
17160
|
+
function setCaseDeadlinesProblem(body) {
|
|
17161
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17162
|
+
for (const [index, phase] of body.phases.entries()) {
|
|
17163
|
+
if (seen.has(phase.phase_id)) return { reason: "phase_repeated", at: `phases.${index}.phase_id` };
|
|
17164
|
+
seen.add(phase.phase_id);
|
|
17165
|
+
}
|
|
17166
|
+
return null;
|
|
17167
|
+
}
|
|
17168
|
+
var CASE_DUE_DATE_MIN_YEAR, CASE_DUE_DATE_MAX_YEAR, CASE_DEADLINES_PHASES_MAX, CASE_OVERDUE_CASES_MAX, caseDueDateSchema, setCaseDeadlinesShape, setCaseDeadlinesBody, setCaseTaskPlanBody, setCaseOwnerBody, caseOverdueQuery;
|
|
17169
|
+
var init_chunk_H6V7NEWR = __esm({
|
|
17170
|
+
"../../packages/core/dist/chunk-H6V7NEWR.js"() {
|
|
17171
|
+
"use strict";
|
|
17172
|
+
init_chunk_3T3D7LTE();
|
|
17173
|
+
init_chunk_HZ6CADSY();
|
|
17174
|
+
init_zod();
|
|
17175
|
+
CASE_DUE_DATE_MIN_YEAR = 2e3;
|
|
17176
|
+
CASE_DUE_DATE_MAX_YEAR = 2100;
|
|
17177
|
+
CASE_DEADLINES_PHASES_MAX = 50;
|
|
17178
|
+
CASE_OVERDUE_CASES_MAX = 50;
|
|
17179
|
+
caseDueDateSchema = external_exports.string().refine(isCaseDueDate, "Not a calendar date (YYYY-MM-DD)");
|
|
17180
|
+
setCaseDeadlinesShape = external_exports.object({
|
|
17181
|
+
phases: external_exports.array(external_exports.object({ phase_id: uuidSchema, due_on: caseDueDateSchema.nullable() }).strict()).min(1).max(CASE_DEADLINES_PHASES_MAX)
|
|
17182
|
+
}).strict();
|
|
17183
|
+
setCaseDeadlinesBody = setCaseDeadlinesShape.superRefine((body, ctx) => {
|
|
17184
|
+
const found = setCaseDeadlinesProblem(body);
|
|
17185
|
+
if (found) {
|
|
17186
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: found.reason, path: found.at.split("."), params: { case_deadlines_reason: found.reason } });
|
|
17187
|
+
}
|
|
17188
|
+
});
|
|
17189
|
+
setCaseTaskPlanBody = external_exports.object({
|
|
17190
|
+
owner_person_id: uuidSchema.nullable(),
|
|
17191
|
+
due_on: caseDueDateSchema.nullable()
|
|
17192
|
+
}).strict();
|
|
17193
|
+
setCaseOwnerBody = external_exports.object({ owner_person_id: uuidSchema.nullable() }).strict();
|
|
17194
|
+
caseOverdueQuery = casePageQuery.extend({
|
|
17195
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_OVERDUE_CASES_MAX).optional()
|
|
17196
|
+
});
|
|
17197
|
+
}
|
|
17198
|
+
});
|
|
17199
|
+
|
|
17200
|
+
// ../../packages/core/dist/chunk-ZVIMTUGZ.js
|
|
17201
|
+
var CASE_GUEST_EMAIL_MAX, CASE_GUEST_INVITATIONS_PAGE_MAX, CASE_GUEST_INVITE_TOKEN_LENGTH, caseGuestEmailSchema, caseGuestInviteTokenSchema, inviteCaseGuestBody, caseGuestInvitationParam, caseGuestInvitationsQuery, joinCaseSpaceBody, caseJoinSearchParams;
|
|
17202
|
+
var init_chunk_ZVIMTUGZ = __esm({
|
|
17203
|
+
"../../packages/core/dist/chunk-ZVIMTUGZ.js"() {
|
|
17204
|
+
"use strict";
|
|
17205
|
+
init_chunk_3T3D7LTE();
|
|
17206
|
+
init_chunk_HZ6CADSY();
|
|
17207
|
+
init_zod();
|
|
17208
|
+
CASE_GUEST_EMAIL_MAX = 320;
|
|
17209
|
+
CASE_GUEST_INVITATIONS_PAGE_MAX = 100;
|
|
17210
|
+
CASE_GUEST_INVITE_TOKEN_LENGTH = 43;
|
|
17211
|
+
caseGuestEmailSchema = external_exports.string().trim().toLowerCase().max(CASE_GUEST_EMAIL_MAX).email();
|
|
17212
|
+
caseGuestInviteTokenSchema = external_exports.string().regex(new RegExp(`^[A-Za-z0-9_-]{${CASE_GUEST_INVITE_TOKEN_LENGTH}}$`));
|
|
17213
|
+
inviteCaseGuestBody = external_exports.object({ email: caseGuestEmailSchema }).strict();
|
|
17214
|
+
caseGuestInvitationParam = caseSpaceParam.extend({ invitation_id: uuidSchema });
|
|
17215
|
+
caseGuestInvitationsQuery = casePageQuery.extend({
|
|
17216
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_GUEST_INVITATIONS_PAGE_MAX).optional()
|
|
17217
|
+
});
|
|
17218
|
+
joinCaseSpaceBody = external_exports.object({ invite: caseGuestInviteTokenSchema }).strict();
|
|
17219
|
+
caseJoinSearchParams = external_exports.object({ org: uuidSchema, space: uuidSchema, invite: caseGuestInviteTokenSchema });
|
|
17220
|
+
}
|
|
17221
|
+
});
|
|
17222
|
+
|
|
17223
|
+
// ../../packages/core/dist/chunk-BVQCYBU6.js
|
|
17224
|
+
var CASE_RELATION_TYPE_CODE_PATTERN, CASE_RELATION_TYPE_CODE_MAX_LENGTH, CASE_RELATION_TYPE_NAME_MAX_LENGTH, CASE_RELATION_TYPES_PER_SPACE_MAX, CASE_RELATION_DESCRIPTION_MAX_LENGTH, CASE_RELATION_SIDES, CASE_EXTERNAL_SYSTEM_PATTERN, CASE_EXTERNAL_NUMBER_MAX_LENGTH, CASE_EXTERNAL_URL_MAX_LENGTH, trimmedName2, relationTypeFields, createCaseRelationTypeBody, updateCaseRelationTypeBody, relateCasesBody, addCaseExternalReferenceBody, caseRelationTypeParam, caseRelationParam, caseExternalReferenceParam, caseRelationTypesQuery;
|
|
17225
|
+
var init_chunk_BVQCYBU6 = __esm({
|
|
17226
|
+
"../../packages/core/dist/chunk-BVQCYBU6.js"() {
|
|
17227
|
+
"use strict";
|
|
17228
|
+
init_chunk_733K4J4G();
|
|
17229
|
+
init_chunk_3T3D7LTE();
|
|
17230
|
+
init_chunk_HZ6CADSY();
|
|
17231
|
+
init_zod();
|
|
17232
|
+
CASE_RELATION_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
17233
|
+
CASE_RELATION_TYPE_CODE_MAX_LENGTH = 64;
|
|
17234
|
+
CASE_RELATION_TYPE_NAME_MAX_LENGTH = 200;
|
|
17235
|
+
CASE_RELATION_TYPES_PER_SPACE_MAX = 100;
|
|
17236
|
+
CASE_RELATION_DESCRIPTION_MAX_LENGTH = 500;
|
|
17237
|
+
CASE_RELATION_SIDES = ["origin", "destination"];
|
|
17238
|
+
CASE_EXTERNAL_SYSTEM_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ._-]{0,30}$/;
|
|
17239
|
+
CASE_EXTERNAL_NUMBER_MAX_LENGTH = 120;
|
|
17240
|
+
CASE_EXTERNAL_URL_MAX_LENGTH = 2048;
|
|
17241
|
+
trimmedName2 = external_exports.string().trim().min(1).max(CASE_RELATION_TYPE_NAME_MAX_LENGTH);
|
|
17242
|
+
relationTypeFields = { name: trimmedName2, inverse_name: trimmedName2, active: external_exports.boolean().default(true) };
|
|
17243
|
+
createCaseRelationTypeBody = external_exports.object({
|
|
17244
|
+
code: external_exports.string().trim().max(CASE_RELATION_TYPE_CODE_MAX_LENGTH).regex(CASE_RELATION_TYPE_CODE_PATTERN),
|
|
17245
|
+
...relationTypeFields
|
|
17246
|
+
}).strict();
|
|
17247
|
+
updateCaseRelationTypeBody = external_exports.object({ ...relationTypeFields, expected_updated_at: timestampSchema.optional() }).strict();
|
|
17248
|
+
relateCasesBody = external_exports.object({
|
|
17249
|
+
relation_type_id: uuidSchema,
|
|
17250
|
+
other_code: external_exports.string().max(CASE_RECORD_CODE_MAX_LENGTH).regex(CASE_RECORD_CODE_PATTERN),
|
|
17251
|
+
/** This case's side: `origin` reads the type's name ("continues"), `destination` its inverse. */
|
|
17252
|
+
side: external_exports.enum(CASE_RELATION_SIDES).default("origin"),
|
|
17253
|
+
description: external_exports.string().trim().min(1).max(CASE_RELATION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
|
|
17254
|
+
}).strict();
|
|
17255
|
+
addCaseExternalReferenceBody = external_exports.object({
|
|
17256
|
+
system: external_exports.string().trim().regex(CASE_EXTERNAL_SYSTEM_PATTERN),
|
|
17257
|
+
number: external_exports.string().trim().min(1).max(CASE_EXTERNAL_NUMBER_MAX_LENGTH),
|
|
17258
|
+
url: external_exports.string().trim().max(CASE_EXTERNAL_URL_MAX_LENGTH).url().refine((url) => url.startsWith("https://"), "An https link").nullable().default(null)
|
|
17259
|
+
}).strict();
|
|
17260
|
+
caseRelationTypeParam = caseSpaceParam.extend({ relation_type_id: uuidSchema });
|
|
17261
|
+
caseRelationParam = caseRecordParam.extend({ relation_id: uuidSchema });
|
|
17262
|
+
caseExternalReferenceParam = caseRecordParam.extend({ reference_id: uuidSchema });
|
|
17263
|
+
caseRelationTypesQuery = casePageQuery.extend({
|
|
17264
|
+
limit: external_exports.coerce.number().int().min(1).max(CASE_RELATION_TYPES_PER_SPACE_MAX).optional()
|
|
17265
|
+
});
|
|
17266
|
+
}
|
|
17267
|
+
});
|
|
17268
|
+
|
|
17269
|
+
// ../../packages/core/dist/chunk-Z3SV3XTC.js
|
|
17270
|
+
var caseAccessQuery;
|
|
17271
|
+
var init_chunk_Z3SV3XTC = __esm({
|
|
17272
|
+
"../../packages/core/dist/chunk-Z3SV3XTC.js"() {
|
|
17273
|
+
"use strict";
|
|
17274
|
+
init_chunk_HZ6CADSY();
|
|
17275
|
+
init_zod();
|
|
17276
|
+
caseAccessQuery = external_exports.object({ with_team_id: uuidSchema.optional() }).strict();
|
|
17277
|
+
}
|
|
17278
|
+
});
|
|
17279
|
+
|
|
17280
|
+
// ../../packages/core/dist/chunk-NHC27NIE.js
|
|
17281
|
+
var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS, reason2, activateCasePhaseBody, dispenseCaseBody, addCaseTaskBody, addCaseInputBody, caseOwnItemSchema, addCaseItemBody;
|
|
17282
|
+
var init_chunk_NHC27NIE = __esm({
|
|
17283
|
+
"../../packages/core/dist/chunk-NHC27NIE.js"() {
|
|
17284
|
+
"use strict";
|
|
17285
|
+
init_chunk_PFPADFUC();
|
|
17286
|
+
init_chunk_HZ6CADSY();
|
|
17287
|
+
init_zod();
|
|
17288
|
+
CASE_ADJUSTMENT_REASON_MAX_LENGTH = 2e3;
|
|
17289
|
+
CASE_ADJUSTMENT_DISPENSATION_KINDS = ["phase", "item", "output", "input"];
|
|
17290
|
+
reason2 = external_exports.string().trim().min(1).max(CASE_ADJUSTMENT_REASON_MAX_LENGTH);
|
|
17291
|
+
activateCasePhaseBody = external_exports.object({ phase_id: uuidSchema, reason: reason2 }).strict();
|
|
17292
|
+
dispenseCaseBody = external_exports.object({ kind: external_exports.enum(CASE_ADJUSTMENT_DISPENSATION_KINDS), target_id: uuidSchema, reason: reason2 }).strict();
|
|
17293
|
+
addCaseTaskBody = external_exports.object({
|
|
17294
|
+
phase_id: uuidSchema,
|
|
17295
|
+
name: external_exports.string().trim().min(1).max(CASE_TASK_NAME_MAX_LENGTH),
|
|
17296
|
+
required: external_exports.boolean().default(false),
|
|
17297
|
+
/** Tasks of the same phase it waits for. */
|
|
17298
|
+
depends_on: external_exports.array(uuidSchema).max(CASE_TASK_DEPENDENCIES_MAX).default([])
|
|
17299
|
+
}).strict();
|
|
17300
|
+
addCaseInputBody = external_exports.object({
|
|
17301
|
+
phase_id: uuidSchema,
|
|
17302
|
+
input: casePhaseInputSchema.extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) }),
|
|
17303
|
+
reason: reason2
|
|
17304
|
+
}).strict();
|
|
17305
|
+
caseOwnItemSchema = caseOutputItemSchema.omit({ waivable: true, template_mode: true, fixed_text: true }).extend({ agenda_group: caseAgendaGroupCodeSchema.nullable().default(null) });
|
|
17306
|
+
addCaseItemBody = external_exports.object({
|
|
17307
|
+
phase_id: uuidSchema,
|
|
17308
|
+
/** The phase's output it goes in. */
|
|
17309
|
+
output_id: uuidSchema,
|
|
17310
|
+
item: caseOwnItemSchema,
|
|
17311
|
+
reason: reason2
|
|
17312
|
+
}).strict();
|
|
17313
|
+
}
|
|
17314
|
+
});
|
|
17315
|
+
|
|
17316
|
+
// ../../packages/core/dist/chunk-UMAPAGFH.js
|
|
17317
|
+
var CASE_AGENDA_VALUE_MAX_LENGTH, CASE_AGENDA_JUSTIFICATION_MAX_LENGTH, CASE_AGENDA_EVIDENCE_MAX_LENGTH, CASE_AGENDA_COMMENT_MAX_LENGTH, CASE_AGENDA_VERDICTS, comment, caseAgendaGroupParam, caseAgendaDecisionParam, caseAgendaQuery, caseApprovedDecisionsQuery, proposeCaseAgendaValueBody, decideCaseAgendaBody, dispenseCaseAgendaBody, addCaseDecisionBody;
|
|
17318
|
+
var init_chunk_UMAPAGFH = __esm({
|
|
17319
|
+
"../../packages/core/dist/chunk-UMAPAGFH.js"() {
|
|
17320
|
+
"use strict";
|
|
17321
|
+
init_chunk_733K4J4G();
|
|
17322
|
+
init_chunk_PFPADFUC();
|
|
17323
|
+
init_chunk_3T3D7LTE();
|
|
17324
|
+
init_chunk_M2T55BV6();
|
|
17325
|
+
init_chunk_HZ6CADSY();
|
|
17326
|
+
init_zod();
|
|
17327
|
+
CASE_AGENDA_VALUE_MAX_LENGTH = 2e3;
|
|
17328
|
+
CASE_AGENDA_JUSTIFICATION_MAX_LENGTH = 2e3;
|
|
17329
|
+
CASE_AGENDA_EVIDENCE_MAX_LENGTH = 500;
|
|
17330
|
+
CASE_AGENDA_COMMENT_MAX_LENGTH = 2e3;
|
|
17331
|
+
CASE_AGENDA_VERDICTS = ["approve", "return"];
|
|
17332
|
+
comment = external_exports.string().trim().min(1).max(CASE_AGENDA_COMMENT_MAX_LENGTH);
|
|
17333
|
+
caseAgendaGroupParam = caseRecordParam.extend({ group_id: uuidSchema });
|
|
17334
|
+
caseAgendaDecisionParam = caseRecordParam.extend({ decision_code: caseDecisionCodeSchema });
|
|
17335
|
+
caseAgendaQuery = external_exports.object({
|
|
17336
|
+
phase_id: uuidSchema,
|
|
17337
|
+
cursor: external_exports.string().min(1).max(CASE_PAGE_CURSOR_MAX_LENGTH).optional()
|
|
17338
|
+
});
|
|
17339
|
+
caseApprovedDecisionsQuery = external_exports.object({
|
|
17340
|
+
confidential: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
|
|
17341
|
+
});
|
|
17342
|
+
proposeCaseAgendaValueBody = external_exports.object({
|
|
17343
|
+
/** As written: a numeric type also takes a string of digits with a `.` or `,` decimal mark (Rito's). */
|
|
17344
|
+
value: external_exports.union([external_exports.number(), external_exports.boolean(), external_exports.string().max(CASE_AGENDA_VALUE_MAX_LENGTH)]),
|
|
17345
|
+
justification: external_exports.string().trim().min(1).max(CASE_AGENDA_JUSTIFICATION_MAX_LENGTH),
|
|
17346
|
+
evidence: external_exports.string().trim().max(CASE_AGENDA_EVIDENCE_MAX_LENGTH).nullable().default(null).transform((text5) => text5 || null),
|
|
17347
|
+
/** Required on an approved group: why it is revised. */
|
|
17348
|
+
reason: comment.nullable().default(null)
|
|
17349
|
+
}).strict();
|
|
17350
|
+
decideCaseAgendaBody = external_exports.object({
|
|
17351
|
+
decision: external_exports.enum(CASE_AGENDA_VERDICTS),
|
|
17352
|
+
/** The sending its decider read (`CaseAgendaGroupView.sending_id`). */
|
|
17353
|
+
sending_id: uuidSchema,
|
|
17354
|
+
comment: comment.nullable().default(null)
|
|
17355
|
+
}).strict().superRefine((body, ctx) => {
|
|
17356
|
+
if (body.decision === "return" && body.comment === null) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A return needs its comment", path: ["comment"] });
|
|
17357
|
+
});
|
|
17358
|
+
dispenseCaseAgendaBody = external_exports.object({ reason: comment }).strict();
|
|
17359
|
+
addCaseDecisionBody = external_exports.object({ decision: caseAgendaDecisionSchema, reason: comment }).strict();
|
|
17360
|
+
}
|
|
17361
|
+
});
|
|
17362
|
+
|
|
17363
|
+
// ../../packages/core/dist/chunk-2PZIF56U.js
|
|
17364
|
+
var analyticsHubIdParam, analyticsVariableIdParam, updateVariablePinBody, updateAnalyticsViewBody, NUMERIC_FILTER_OPS, TEXT_FILTER_OPS, CATEGORICAL_FILTER_OPS, VARIABLE_FILTER_OPS, STRUCTURED_QUERY_OPS, STRUCTURED_QUERY_AGGREGATIONS, filterValueSchema, conversationsBody, analyticsConversationIdParam, messagesQuery, conversationDetailDataQuery, analyticsDataBody, structuredQueryBody, analyticsSqlBody, analyticsSqlTable, analyticsSqlSchemaQuery;
|
|
17365
|
+
var init_chunk_2PZIF56U = __esm({
|
|
17366
|
+
"../../packages/core/dist/chunk-2PZIF56U.js"() {
|
|
17367
|
+
"use strict";
|
|
17368
|
+
init_zod();
|
|
17369
|
+
analyticsHubIdParam = external_exports.object({
|
|
17370
|
+
hubId: external_exports.string().uuid()
|
|
17371
|
+
});
|
|
17372
|
+
analyticsVariableIdParam = external_exports.object({
|
|
17373
|
+
variableId: external_exports.string().uuid()
|
|
17374
|
+
});
|
|
17375
|
+
updateVariablePinBody = external_exports.object({
|
|
17376
|
+
pin: external_exports.union([external_exports.boolean(), external_exports.string()])
|
|
17377
|
+
});
|
|
17378
|
+
updateAnalyticsViewBody = external_exports.object({
|
|
17379
|
+
// 64 covers UUIDs (36) and the `sys:{name}` synthetic IDs for system variables.
|
|
17380
|
+
selected_variable_ids: external_exports.array(external_exports.string().min(1).max(64)).max(200)
|
|
17381
|
+
});
|
|
17382
|
+
NUMERIC_FILTER_OPS = ["eq", "neq", "gt", "gte", "lt", "lte"];
|
|
17383
|
+
TEXT_FILTER_OPS = ["equals", "not_equals", "contains", "not_contains", "starts_with", "ends_with"];
|
|
17384
|
+
CATEGORICAL_FILTER_OPS = ["is", "is_not", "in", "not_in"];
|
|
17385
|
+
VARIABLE_FILTER_OPS = [
|
|
17386
|
+
...NUMERIC_FILTER_OPS,
|
|
17387
|
+
...TEXT_FILTER_OPS,
|
|
17388
|
+
...CATEGORICAL_FILTER_OPS
|
|
17389
|
+
];
|
|
17390
|
+
STRUCTURED_QUERY_OPS = ["eq", "neq", "gt", "gte", "lt", "lte", "in", "not_in", "like"];
|
|
17391
|
+
STRUCTURED_QUERY_AGGREGATIONS = ["avg", "sum", "min", "max", "count", "quantile", "stddevPop", "corr", "uniq"];
|
|
17392
|
+
filterValueSchema = external_exports.object({
|
|
17393
|
+
variable_id: external_exports.string(),
|
|
17394
|
+
filter_type: external_exports.enum(VARIABLE_FILTER_OPS),
|
|
17395
|
+
filter_value: external_exports.union([external_exports.string(), external_exports.number()])
|
|
17396
|
+
});
|
|
17397
|
+
conversationsBody = external_exports.object({
|
|
17398
|
+
hub_id: external_exports.string().uuid(),
|
|
17399
|
+
time_interval: external_exports.object({
|
|
17400
|
+
start: external_exports.string().optional(),
|
|
17401
|
+
end: external_exports.string().optional()
|
|
17402
|
+
}).optional(),
|
|
17403
|
+
filters: external_exports.array(filterValueSchema).optional(),
|
|
17404
|
+
limit: external_exports.number().int().positive().max(500).default(50),
|
|
17405
|
+
offset: external_exports.number().int().min(0).default(0)
|
|
17406
|
+
});
|
|
17407
|
+
analyticsConversationIdParam = external_exports.object({
|
|
17408
|
+
conversationId: external_exports.string().uuid()
|
|
17409
|
+
});
|
|
17410
|
+
messagesQuery = external_exports.object({
|
|
17411
|
+
hub_id: external_exports.string().uuid(),
|
|
17412
|
+
limit: external_exports.string().regex(/^\d+$/).optional(),
|
|
17413
|
+
offset: external_exports.string().regex(/^\d+$/).optional()
|
|
17414
|
+
});
|
|
17415
|
+
conversationDetailDataQuery = external_exports.object({
|
|
17416
|
+
hub_id: external_exports.string().uuid()
|
|
17417
|
+
});
|
|
17418
|
+
analyticsDataBody = external_exports.object({
|
|
17419
|
+
hub_id: external_exports.string().uuid(),
|
|
17420
|
+
periodicity: external_exports.enum(["daily", "weekly", "monthly", "yearly"]),
|
|
17421
|
+
time_interval: external_exports.object({
|
|
17422
|
+
start: external_exports.string(),
|
|
17423
|
+
end: external_exports.string()
|
|
17424
|
+
}),
|
|
17425
|
+
trend_analysis: external_exports.boolean(),
|
|
17426
|
+
filters: external_exports.array(filterValueSchema).optional(),
|
|
17427
|
+
selected_variables: external_exports.array(external_exports.string()),
|
|
17428
|
+
include_summary: external_exports.boolean().optional(),
|
|
17429
|
+
include_variables: external_exports.boolean().optional(),
|
|
17430
|
+
variable_origin: external_exports.enum(["agent", "system", "annotation"]).optional(),
|
|
17431
|
+
variable_category: external_exports.string().optional(),
|
|
17432
|
+
variables_only: external_exports.boolean().optional()
|
|
17433
|
+
});
|
|
17434
|
+
structuredQueryBody = external_exports.object({
|
|
17435
|
+
hub_id: external_exports.string().uuid(),
|
|
17436
|
+
metrics: external_exports.array(external_exports.object({
|
|
17437
|
+
column: external_exports.string(),
|
|
17438
|
+
aggregation: external_exports.enum(STRUCTURED_QUERY_AGGREGATIONS),
|
|
17439
|
+
alias: external_exports.string().optional(),
|
|
17440
|
+
corr_with: external_exports.string().optional(),
|
|
17441
|
+
quantile_level: external_exports.number().min(0).max(1).optional()
|
|
17442
|
+
})).min(1),
|
|
17443
|
+
group_by: external_exports.array(external_exports.string()).optional(),
|
|
17444
|
+
order_by: external_exports.array(external_exports.object({
|
|
17445
|
+
column: external_exports.string(),
|
|
17446
|
+
direction: external_exports.enum(["asc", "desc"]).optional()
|
|
17447
|
+
})).optional(),
|
|
17448
|
+
filters: external_exports.array(external_exports.object({
|
|
17449
|
+
column: external_exports.string(),
|
|
17450
|
+
operator: external_exports.enum(STRUCTURED_QUERY_OPS),
|
|
17451
|
+
value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
|
|
17452
|
+
})).optional(),
|
|
17453
|
+
time_range: external_exports.object({
|
|
17454
|
+
start: external_exports.string(),
|
|
17455
|
+
end: external_exports.string()
|
|
17456
|
+
}).optional(),
|
|
17457
|
+
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
17458
|
+
});
|
|
17459
|
+
analyticsSqlBody = external_exports.object({
|
|
17460
|
+
hub_id: external_exports.string().uuid(),
|
|
17461
|
+
// Hard size cap before the validator runs — keeps lex/parse work bounded.
|
|
17462
|
+
sql: external_exports.string().min(1).max(8e3),
|
|
17463
|
+
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
17464
|
+
});
|
|
17465
|
+
analyticsSqlTable = external_exports.enum(["conversation", "message"]);
|
|
17466
|
+
analyticsSqlSchemaQuery = external_exports.object({
|
|
17467
|
+
hub_id: external_exports.string().uuid(),
|
|
17468
|
+
// Defaulted so a client that predates the message table keeps its old response.
|
|
17469
|
+
table: analyticsSqlTable.default("conversation")
|
|
17470
|
+
});
|
|
17471
|
+
}
|
|
17472
|
+
});
|
|
17473
|
+
|
|
17363
17474
|
// ../../packages/core/dist/chunk-UEJOG2Q7.js
|
|
17364
17475
|
var archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams;
|
|
17365
17476
|
var init_chunk_UEJOG2Q7 = __esm({
|
|
@@ -18265,117 +18376,6 @@ var init_chunk_Q5SZRRLP = __esm({
|
|
|
18265
18376
|
}
|
|
18266
18377
|
});
|
|
18267
18378
|
|
|
18268
|
-
// ../../packages/core/dist/chunk-2PZIF56U.js
|
|
18269
|
-
var analyticsHubIdParam, analyticsVariableIdParam, updateVariablePinBody, updateAnalyticsViewBody, NUMERIC_FILTER_OPS, TEXT_FILTER_OPS, CATEGORICAL_FILTER_OPS, VARIABLE_FILTER_OPS, STRUCTURED_QUERY_OPS, STRUCTURED_QUERY_AGGREGATIONS, filterValueSchema, conversationsBody, analyticsConversationIdParam, messagesQuery, conversationDetailDataQuery, analyticsDataBody, structuredQueryBody, analyticsSqlBody, analyticsSqlTable, analyticsSqlSchemaQuery;
|
|
18270
|
-
var init_chunk_2PZIF56U = __esm({
|
|
18271
|
-
"../../packages/core/dist/chunk-2PZIF56U.js"() {
|
|
18272
|
-
"use strict";
|
|
18273
|
-
init_zod();
|
|
18274
|
-
analyticsHubIdParam = external_exports.object({
|
|
18275
|
-
hubId: external_exports.string().uuid()
|
|
18276
|
-
});
|
|
18277
|
-
analyticsVariableIdParam = external_exports.object({
|
|
18278
|
-
variableId: external_exports.string().uuid()
|
|
18279
|
-
});
|
|
18280
|
-
updateVariablePinBody = external_exports.object({
|
|
18281
|
-
pin: external_exports.union([external_exports.boolean(), external_exports.string()])
|
|
18282
|
-
});
|
|
18283
|
-
updateAnalyticsViewBody = external_exports.object({
|
|
18284
|
-
// 64 covers UUIDs (36) and the `sys:{name}` synthetic IDs for system variables.
|
|
18285
|
-
selected_variable_ids: external_exports.array(external_exports.string().min(1).max(64)).max(200)
|
|
18286
|
-
});
|
|
18287
|
-
NUMERIC_FILTER_OPS = ["eq", "neq", "gt", "gte", "lt", "lte"];
|
|
18288
|
-
TEXT_FILTER_OPS = ["equals", "not_equals", "contains", "not_contains", "starts_with", "ends_with"];
|
|
18289
|
-
CATEGORICAL_FILTER_OPS = ["is", "is_not", "in", "not_in"];
|
|
18290
|
-
VARIABLE_FILTER_OPS = [
|
|
18291
|
-
...NUMERIC_FILTER_OPS,
|
|
18292
|
-
...TEXT_FILTER_OPS,
|
|
18293
|
-
...CATEGORICAL_FILTER_OPS
|
|
18294
|
-
];
|
|
18295
|
-
STRUCTURED_QUERY_OPS = ["eq", "neq", "gt", "gte", "lt", "lte", "in", "not_in", "like"];
|
|
18296
|
-
STRUCTURED_QUERY_AGGREGATIONS = ["avg", "sum", "min", "max", "count", "quantile", "stddevPop", "corr", "uniq"];
|
|
18297
|
-
filterValueSchema = external_exports.object({
|
|
18298
|
-
variable_id: external_exports.string(),
|
|
18299
|
-
filter_type: external_exports.enum(VARIABLE_FILTER_OPS),
|
|
18300
|
-
filter_value: external_exports.union([external_exports.string(), external_exports.number()])
|
|
18301
|
-
});
|
|
18302
|
-
conversationsBody = external_exports.object({
|
|
18303
|
-
hub_id: external_exports.string().uuid(),
|
|
18304
|
-
time_interval: external_exports.object({
|
|
18305
|
-
start: external_exports.string().optional(),
|
|
18306
|
-
end: external_exports.string().optional()
|
|
18307
|
-
}).optional(),
|
|
18308
|
-
filters: external_exports.array(filterValueSchema).optional(),
|
|
18309
|
-
limit: external_exports.number().int().positive().max(500).default(50),
|
|
18310
|
-
offset: external_exports.number().int().min(0).default(0)
|
|
18311
|
-
});
|
|
18312
|
-
analyticsConversationIdParam = external_exports.object({
|
|
18313
|
-
conversationId: external_exports.string().uuid()
|
|
18314
|
-
});
|
|
18315
|
-
messagesQuery = external_exports.object({
|
|
18316
|
-
hub_id: external_exports.string().uuid(),
|
|
18317
|
-
limit: external_exports.string().regex(/^\d+$/).optional(),
|
|
18318
|
-
offset: external_exports.string().regex(/^\d+$/).optional()
|
|
18319
|
-
});
|
|
18320
|
-
conversationDetailDataQuery = external_exports.object({
|
|
18321
|
-
hub_id: external_exports.string().uuid()
|
|
18322
|
-
});
|
|
18323
|
-
analyticsDataBody = external_exports.object({
|
|
18324
|
-
hub_id: external_exports.string().uuid(),
|
|
18325
|
-
periodicity: external_exports.enum(["daily", "weekly", "monthly", "yearly"]),
|
|
18326
|
-
time_interval: external_exports.object({
|
|
18327
|
-
start: external_exports.string(),
|
|
18328
|
-
end: external_exports.string()
|
|
18329
|
-
}),
|
|
18330
|
-
trend_analysis: external_exports.boolean(),
|
|
18331
|
-
filters: external_exports.array(filterValueSchema).optional(),
|
|
18332
|
-
selected_variables: external_exports.array(external_exports.string()),
|
|
18333
|
-
include_summary: external_exports.boolean().optional(),
|
|
18334
|
-
include_variables: external_exports.boolean().optional(),
|
|
18335
|
-
variable_origin: external_exports.enum(["agent", "system", "annotation"]).optional(),
|
|
18336
|
-
variable_category: external_exports.string().optional(),
|
|
18337
|
-
variables_only: external_exports.boolean().optional()
|
|
18338
|
-
});
|
|
18339
|
-
structuredQueryBody = external_exports.object({
|
|
18340
|
-
hub_id: external_exports.string().uuid(),
|
|
18341
|
-
metrics: external_exports.array(external_exports.object({
|
|
18342
|
-
column: external_exports.string(),
|
|
18343
|
-
aggregation: external_exports.enum(STRUCTURED_QUERY_AGGREGATIONS),
|
|
18344
|
-
alias: external_exports.string().optional(),
|
|
18345
|
-
corr_with: external_exports.string().optional(),
|
|
18346
|
-
quantile_level: external_exports.number().min(0).max(1).optional()
|
|
18347
|
-
})).min(1),
|
|
18348
|
-
group_by: external_exports.array(external_exports.string()).optional(),
|
|
18349
|
-
order_by: external_exports.array(external_exports.object({
|
|
18350
|
-
column: external_exports.string(),
|
|
18351
|
-
direction: external_exports.enum(["asc", "desc"]).optional()
|
|
18352
|
-
})).optional(),
|
|
18353
|
-
filters: external_exports.array(external_exports.object({
|
|
18354
|
-
column: external_exports.string(),
|
|
18355
|
-
operator: external_exports.enum(STRUCTURED_QUERY_OPS),
|
|
18356
|
-
value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
|
|
18357
|
-
})).optional(),
|
|
18358
|
-
time_range: external_exports.object({
|
|
18359
|
-
start: external_exports.string(),
|
|
18360
|
-
end: external_exports.string()
|
|
18361
|
-
}).optional(),
|
|
18362
|
-
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
18363
|
-
});
|
|
18364
|
-
analyticsSqlBody = external_exports.object({
|
|
18365
|
-
hub_id: external_exports.string().uuid(),
|
|
18366
|
-
// Hard size cap before the validator runs — keeps lex/parse work bounded.
|
|
18367
|
-
sql: external_exports.string().min(1).max(8e3),
|
|
18368
|
-
limit: external_exports.number().int().positive().max(1e4).optional()
|
|
18369
|
-
});
|
|
18370
|
-
analyticsSqlTable = external_exports.enum(["conversation", "message"]);
|
|
18371
|
-
analyticsSqlSchemaQuery = external_exports.object({
|
|
18372
|
-
hub_id: external_exports.string().uuid(),
|
|
18373
|
-
// Defaulted so a client that predates the message table keeps its old response.
|
|
18374
|
-
table: analyticsSqlTable.default("conversation")
|
|
18375
|
-
});
|
|
18376
|
-
}
|
|
18377
|
-
});
|
|
18378
|
-
|
|
18379
18379
|
// ../../packages/core/dist/chunk-ZRXP6OOJ.js
|
|
18380
18380
|
function capped(max, field) {
|
|
18381
18381
|
return (value, ctx) => {
|
|
@@ -18437,40 +18437,40 @@ var init_contracts = __esm({
|
|
|
18437
18437
|
init_chunk_C7UAGRXF();
|
|
18438
18438
|
init_chunk_IPXBFWUU();
|
|
18439
18439
|
init_chunk_63UWXV4T();
|
|
18440
|
+
init_chunk_TVUDMGWV();
|
|
18440
18441
|
init_chunk_WTIGECE5();
|
|
18441
18442
|
init_chunk_WDAXZDJO();
|
|
18442
18443
|
init_chunk_ZC6YGHNX();
|
|
18444
|
+
init_chunk_MGBAXT5Y();
|
|
18443
18445
|
init_chunk_5DGHIY7L();
|
|
18444
18446
|
init_chunk_TID3PAFF();
|
|
18445
18447
|
init_chunk_IPDOHAZ5();
|
|
18446
18448
|
init_chunk_PFGVH2CX();
|
|
18447
|
-
|
|
18449
|
+
init_chunk_FPSDNS2E();
|
|
18448
18450
|
init_chunk_TZH6DKKJ();
|
|
18449
18451
|
init_chunk_SSPK6ISL();
|
|
18450
18452
|
init_chunk_ZXK6N2HN();
|
|
18451
18453
|
init_chunk_Y7CFCYX4();
|
|
18452
|
-
init_chunk_MGBAXT5Y();
|
|
18453
18454
|
init_chunk_YUZFHVB2();
|
|
18454
18455
|
init_chunk_I3O2RACG();
|
|
18455
18456
|
init_chunk_CMRECH67();
|
|
18456
18457
|
init_chunk_34LE6P7E();
|
|
18457
|
-
|
|
18458
|
+
init_chunk_IR2NOSI3();
|
|
18458
18459
|
init_chunk_OPETF4GS();
|
|
18459
18460
|
init_chunk_SY6PLCPK();
|
|
18460
18461
|
init_chunk_2ZZZHXZR();
|
|
18462
|
+
init_chunk_MH4O3YEX();
|
|
18461
18463
|
init_chunk_QEEQN2NE();
|
|
18462
18464
|
init_chunk_KSTYTQ7I();
|
|
18463
18465
|
init_chunk_LKBSHANA();
|
|
18464
18466
|
init_chunk_LX3D5LCB();
|
|
18465
18467
|
init_chunk_C4HEZ7ZI();
|
|
18466
|
-
init_chunk_IR2NOSI3();
|
|
18467
18468
|
init_chunk_UCYWGWQT();
|
|
18468
18469
|
init_chunk_6AYIXGDT();
|
|
18469
18470
|
init_chunk_YULHXJ5M();
|
|
18470
18471
|
init_chunk_V4FRPRH5();
|
|
18471
18472
|
init_chunk_LWMLR2WI();
|
|
18472
18473
|
init_chunk_ACGAI25T();
|
|
18473
|
-
init_chunk_MH4O3YEX();
|
|
18474
18474
|
init_chunk_NNC2ZECG();
|
|
18475
18475
|
init_chunk_7CYHPF35();
|
|
18476
18476
|
init_chunk_NETRUHZF();
|
|
@@ -18485,22 +18485,24 @@ var init_contracts = __esm({
|
|
|
18485
18485
|
init_chunk_K3PD6AOF();
|
|
18486
18486
|
init_chunk_KVMROYDC();
|
|
18487
18487
|
init_chunk_M2IF4G6X();
|
|
18488
|
+
init_chunk_UOPCLXCU();
|
|
18488
18489
|
init_chunk_7CZSLDOE();
|
|
18489
18490
|
init_chunk_2YVCHUBL();
|
|
18490
18491
|
init_chunk_BT77VXJU();
|
|
18491
18492
|
init_chunk_WYCUCSD5();
|
|
18493
|
+
init_chunk_UZ72OHQN();
|
|
18494
|
+
init_chunk_6CHDJVQ6();
|
|
18495
|
+
init_chunk_U3X3BIQH();
|
|
18496
|
+
init_chunk_EYOBPUDN();
|
|
18492
18497
|
init_chunk_H6V7NEWR();
|
|
18493
18498
|
init_chunk_ZVIMTUGZ();
|
|
18494
18499
|
init_chunk_BVQCYBU6();
|
|
18495
|
-
|
|
18500
|
+
init_chunk_5PKKFSSF();
|
|
18496
18501
|
init_chunk_Z3SV3XTC();
|
|
18497
18502
|
init_chunk_NHC27NIE();
|
|
18498
18503
|
init_chunk_UMAPAGFH();
|
|
18499
|
-
init_chunk_UZ72OHQN();
|
|
18500
|
-
init_chunk_6CHDJVQ6();
|
|
18501
|
-
init_chunk_U3X3BIQH();
|
|
18502
|
-
init_chunk_EYOBPUDN();
|
|
18503
18504
|
init_chunk_S4NDHW3Q();
|
|
18505
|
+
init_chunk_2PZIF56U();
|
|
18504
18506
|
init_chunk_UEJOG2Q7();
|
|
18505
18507
|
init_chunk_KEN2DASI();
|
|
18506
18508
|
init_chunk_L5GC53VI();
|
|
@@ -18512,7 +18514,6 @@ var init_contracts = __esm({
|
|
|
18512
18514
|
init_chunk_PZPOUXJR();
|
|
18513
18515
|
init_chunk_LBDH7LCG();
|
|
18514
18516
|
init_chunk_4LXDRTO4();
|
|
18515
|
-
init_chunk_5PKKFSSF();
|
|
18516
18517
|
init_chunk_NVKU5PPQ();
|
|
18517
18518
|
init_chunk_Q5SZRRLP();
|
|
18518
18519
|
init_chunk_FECLIZTY();
|
|
@@ -18523,7 +18524,6 @@ var init_contracts = __esm({
|
|
|
18523
18524
|
init_chunk_D3EP4TDU();
|
|
18524
18525
|
init_chunk_PIZTARVG();
|
|
18525
18526
|
init_chunk_OMPT4ZHR();
|
|
18526
|
-
init_chunk_2PZIF56U();
|
|
18527
18527
|
init_chunk_6J742GLA();
|
|
18528
18528
|
init_chunk_ZRXP6OOJ();
|
|
18529
18529
|
init_chunk_BGNWWR6B();
|
|
@@ -27698,10 +27698,10 @@ function readModules(communityFolder, lessonsDir, raw, courseSlug, courseWhere,
|
|
|
27698
27698
|
}
|
|
27699
27699
|
function splitFrontmatter(text5) {
|
|
27700
27700
|
if (!text5.startsWith("---\n")) return null;
|
|
27701
|
-
const
|
|
27702
|
-
if (
|
|
27703
|
-
const rest = text5.slice(
|
|
27704
|
-
return { front: text5.slice(4,
|
|
27701
|
+
const close3 = text5.indexOf("\n---\n", 3);
|
|
27702
|
+
if (close3 === -1) return text5.endsWith("\n---") ? { front: text5.slice(4, -3), body: "" } : null;
|
|
27703
|
+
const rest = text5.slice(close3 + 5);
|
|
27704
|
+
return { front: text5.slice(4, close3 + 1), body: rest.endsWith("\n") ? rest.slice(0, -1) : rest };
|
|
27705
27705
|
}
|
|
27706
27706
|
function readLessonFile(communityFolder, lessonsDir, courseSlug, slug, problems2) {
|
|
27707
27707
|
const name = `${slug}${LESSON_FILE_EXT}`;
|
|
@@ -27946,7 +27946,7 @@ function readCommunitySynced(raw, problems2) {
|
|
|
27946
27946
|
function crossFileProblems(rooms, courses) {
|
|
27947
27947
|
const problems2 = [];
|
|
27948
27948
|
const seen = /* @__PURE__ */ new Map();
|
|
27949
|
-
const
|
|
27949
|
+
const once2 = (id, where) => {
|
|
27950
27950
|
if (id === void 0) return;
|
|
27951
27951
|
const first = seen.get(id);
|
|
27952
27952
|
if (first) problems2.push(`${where}: id ${id} is also ${first}'s \u2014 a copy keeps its original's id; remove the id (and its revs) to make a new one`);
|
|
@@ -27954,11 +27954,11 @@ function crossFileProblems(rooms, courses) {
|
|
|
27954
27954
|
};
|
|
27955
27955
|
const roomKeys = new Set(rooms.map((room) => room.key));
|
|
27956
27956
|
for (const course of courses) {
|
|
27957
|
-
|
|
27957
|
+
once2(course.id, `course ${course.slug}`);
|
|
27958
27958
|
for (const module of course.modules) {
|
|
27959
|
-
|
|
27959
|
+
once2(module.id, `module ${course.slug}/${module.key}`);
|
|
27960
27960
|
for (const lesson of module.lessons) {
|
|
27961
|
-
|
|
27961
|
+
once2(lesson.id, `lesson ${course.slug}/${lesson.slug}`);
|
|
27962
27962
|
if (lesson.room !== void 0 && !roomKeys.has(lesson.room)) {
|
|
27963
27963
|
problems2.push(`lesson ${course.slug}/${lesson.slug}: room ${lesson.room} is not a room key in ${COMMUNITY_FILE}`);
|
|
27964
27964
|
}
|
|
@@ -38989,14 +38989,121 @@ var init_case_types = __esm({
|
|
|
38989
38989
|
}
|
|
38990
38990
|
});
|
|
38991
38991
|
|
|
38992
|
-
// src/cases/case-
|
|
38992
|
+
// src/cases/case-local-files.ts
|
|
38993
38993
|
import * as fs30 from "fs";
|
|
38994
38994
|
import * as path42 from "path";
|
|
38995
|
+
function requireOwn(abs) {
|
|
38996
|
+
let st;
|
|
38997
|
+
try {
|
|
38998
|
+
st = fs30.lstatSync(abs);
|
|
38999
|
+
} catch {
|
|
39000
|
+
return;
|
|
39001
|
+
}
|
|
39002
|
+
const problem = ownProblem(st);
|
|
39003
|
+
if (problem) {
|
|
39004
|
+
throw expected(
|
|
39005
|
+
`Refused ${sanitizeTerminalText(abs)}: ${problem}. A case is read and written only in folders and files you own, never in one every user can write to.`
|
|
39006
|
+
);
|
|
39007
|
+
}
|
|
39008
|
+
}
|
|
39009
|
+
function caseLocalPathProblem(rel) {
|
|
39010
|
+
if (rel === "") return "it is empty";
|
|
39011
|
+
if (rel.includes("\0")) return "it holds a NUL";
|
|
39012
|
+
if (rel.includes("\\")) return "it holds a backslash";
|
|
39013
|
+
if (rel.startsWith("/") || /^[A-Za-z]:/.test(rel)) return "it is absolute";
|
|
39014
|
+
for (const segment2 of rel.split("/")) {
|
|
39015
|
+
if (segment2 === "") return "it has an empty segment";
|
|
39016
|
+
if (segment2 === "." || segment2 === "..") return `it has a "${segment2}" segment`;
|
|
39017
|
+
}
|
|
39018
|
+
return null;
|
|
39019
|
+
}
|
|
39020
|
+
function caseLocalRoot(dir) {
|
|
39021
|
+
let root;
|
|
39022
|
+
try {
|
|
39023
|
+
root = fs30.realpathSync(path42.resolve(dir));
|
|
39024
|
+
} catch {
|
|
39025
|
+
throw expected(`${sanitizeTerminalText(dir)} does not exist.`);
|
|
39026
|
+
}
|
|
39027
|
+
if (!fs30.statSync(root).isDirectory()) throw expected(`${sanitizeTerminalText(dir)} is not a folder.`);
|
|
39028
|
+
requireOwn(root);
|
|
39029
|
+
return root;
|
|
39030
|
+
}
|
|
39031
|
+
function writeCaseLocalFile(root, rel, data, opts = {}) {
|
|
39032
|
+
const problem = caseLocalPathProblem(rel);
|
|
39033
|
+
const shown3 = sanitizeTerminalText(rel);
|
|
39034
|
+
if (problem) throw expected(`Refused to write ${JSON.stringify(shown3)}: ${problem}.`);
|
|
39035
|
+
const target = path42.join(root, ...rel.split("/"));
|
|
39036
|
+
requireOwn(root);
|
|
39037
|
+
let folder = root;
|
|
39038
|
+
for (const segment2 of rel.split("/").slice(0, -1)) {
|
|
39039
|
+
folder = path42.join(folder, segment2);
|
|
39040
|
+
let st;
|
|
39041
|
+
try {
|
|
39042
|
+
st = fs30.lstatSync(folder);
|
|
39043
|
+
} catch {
|
|
39044
|
+
st = void 0;
|
|
39045
|
+
}
|
|
39046
|
+
if (!st) {
|
|
39047
|
+
try {
|
|
39048
|
+
fs30.mkdirSync(folder, { mode: CASE_FOLDER_MODE });
|
|
39049
|
+
} catch (err) {
|
|
39050
|
+
if (err.code !== "EEXIST") throw err;
|
|
39051
|
+
}
|
|
39052
|
+
st = fs30.lstatSync(folder);
|
|
39053
|
+
}
|
|
39054
|
+
if (!st.isDirectory()) {
|
|
39055
|
+
throw expected(`Refused to write ${shown3}: a folder on its way is a symlink or a file. The CLI never writes through a symlink.`);
|
|
39056
|
+
}
|
|
39057
|
+
requireOwn(folder);
|
|
39058
|
+
}
|
|
39059
|
+
if (!ensureRealSubdirNoSymlink(root, path42.dirname(target), true)) {
|
|
39060
|
+
throw expected(`Refused to write ${shown3}: a folder on its way is a symlink or a file. The CLI never writes through a symlink.`);
|
|
39061
|
+
}
|
|
39062
|
+
let existing;
|
|
39063
|
+
try {
|
|
39064
|
+
existing = fs30.lstatSync(target);
|
|
39065
|
+
} catch {
|
|
39066
|
+
existing = void 0;
|
|
39067
|
+
}
|
|
39068
|
+
if (existing && opts.create) return "exists";
|
|
39069
|
+
if (existing && !existing.isFile()) throw expected(`Refused to write ${shown3}: it is a symlink or not a file. The CLI never writes through a symlink.`);
|
|
39070
|
+
if (existing) requireOwn(target);
|
|
39071
|
+
if (existing && fileHasBytes(target, data)) return "unchanged";
|
|
39072
|
+
const flags = fs30.constants.O_WRONLY | fs30.constants.O_CREAT | (opts.create ? fs30.constants.O_EXCL : fs30.constants.O_TRUNC) | (fs30.constants.O_NOFOLLOW ?? 0);
|
|
39073
|
+
let fd;
|
|
39074
|
+
try {
|
|
39075
|
+
fd = fs30.openSync(target, flags, 420);
|
|
39076
|
+
} catch (err) {
|
|
39077
|
+
if (opts.create && err.code === "EEXIST") return "exists";
|
|
39078
|
+
if (err.code === "ELOOP") throw expected(`Refused to write ${shown3}: it is a symlink. The CLI never writes through a symlink.`);
|
|
39079
|
+
throw err;
|
|
39080
|
+
}
|
|
39081
|
+
try {
|
|
39082
|
+
fs30.writeFileSync(fd, data);
|
|
39083
|
+
} finally {
|
|
39084
|
+
fs30.closeSync(fd);
|
|
39085
|
+
}
|
|
39086
|
+
return "written";
|
|
39087
|
+
}
|
|
39088
|
+
var CASE_FOLDER_MODE;
|
|
39089
|
+
var init_case_local_files = __esm({
|
|
39090
|
+
"src/cases/case-local-files.ts"() {
|
|
39091
|
+
"use strict";
|
|
39092
|
+
init_fs_safety();
|
|
39093
|
+
init_expected();
|
|
39094
|
+
init_terminal_output();
|
|
39095
|
+
CASE_FOLDER_MODE = 493;
|
|
39096
|
+
}
|
|
39097
|
+
});
|
|
39098
|
+
|
|
39099
|
+
// src/cases/case-clone-record.ts
|
|
39100
|
+
import * as fs31 from "fs";
|
|
39101
|
+
import * as path43 from "path";
|
|
38995
39102
|
function isClonePath(rel) {
|
|
38996
39103
|
return isCasePath(rel, rel.split("/").filter((segment2) => CASE_PHASE_FOLDER_PATTERN.test(segment2)));
|
|
38997
39104
|
}
|
|
38998
39105
|
function assertClonePaths(root, record, phaseFolders) {
|
|
38999
|
-
if (!Object.keys(record.files).every((rel) => isCasePath(rel, phaseFolders))) throw notAMarker(
|
|
39106
|
+
if (!Object.keys(record.files).every((rel) => isCasePath(rel, phaseFolders))) throw notAMarker(path43.join(root, CASE_CLONE_RECORD_FILE));
|
|
39000
39107
|
}
|
|
39001
39108
|
function isCloneRecord(value) {
|
|
39002
39109
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -39009,15 +39116,15 @@ function isCloneRecord(value) {
|
|
|
39009
39116
|
});
|
|
39010
39117
|
}
|
|
39011
39118
|
function readCloneRecord(root) {
|
|
39012
|
-
const file =
|
|
39119
|
+
const file = path43.join(root, CASE_CLONE_RECORD_FILE);
|
|
39013
39120
|
let marker;
|
|
39014
39121
|
try {
|
|
39015
|
-
marker =
|
|
39122
|
+
marker = fs31.lstatSync(file);
|
|
39016
39123
|
} catch {
|
|
39017
39124
|
return null;
|
|
39018
39125
|
}
|
|
39019
39126
|
const markerProblem = ownProblem(marker);
|
|
39020
|
-
const folderProblem = markerProblem ? null : ownProblem(
|
|
39127
|
+
const folderProblem = markerProblem ? null : ownProblem(fs31.lstatSync(root));
|
|
39021
39128
|
if (markerProblem || folderProblem) {
|
|
39022
39129
|
throw expected(sanitizeTerminalText(
|
|
39023
39130
|
`Refused the case clone marker ${file}: ${markerProblem ?? `its folder: ${folderProblem}`}. A clone counts only in a folder you own that not every user can write to: remove it, or work in a clone of your own.`
|
|
@@ -39039,19 +39146,19 @@ function writeCloneRecord(root, record) {
|
|
|
39039
39146
|
for (const rel of Object.keys(record.files).sort()) files[rel] = { sha: record.files[rel].sha, confidential: record.files[rel].confidential };
|
|
39040
39147
|
const body = `${JSON.stringify({ org_id: record.org_id, space_id: record.space_id, code: record.code, files }, null, 2)}
|
|
39041
39148
|
`;
|
|
39042
|
-
const tmp =
|
|
39149
|
+
const tmp = path43.join(root, `${CASE_CLONE_RECORD_FILE}.tmp`);
|
|
39043
39150
|
if (!writeFileNoFollow(root, tmp, Buffer.from(body, "utf-8"))) throw symlinkRefusal(tmp, "file");
|
|
39044
|
-
|
|
39045
|
-
|
|
39151
|
+
fs31.chmodSync(tmp, 420);
|
|
39152
|
+
fs31.renameSync(tmp, path43.join(root, CASE_CLONE_RECORD_FILE));
|
|
39046
39153
|
}
|
|
39047
39154
|
function findCaseClone(from) {
|
|
39048
|
-
let dir =
|
|
39155
|
+
let dir = path43.resolve(from);
|
|
39049
39156
|
for (; ; ) {
|
|
39050
39157
|
try {
|
|
39051
|
-
dir =
|
|
39158
|
+
dir = fs31.realpathSync(dir);
|
|
39052
39159
|
break;
|
|
39053
39160
|
} catch {
|
|
39054
|
-
const parent =
|
|
39161
|
+
const parent = path43.dirname(dir);
|
|
39055
39162
|
if (parent === dir) return null;
|
|
39056
39163
|
dir = parent;
|
|
39057
39164
|
}
|
|
@@ -39059,11 +39166,24 @@ function findCaseClone(from) {
|
|
|
39059
39166
|
for (; ; ) {
|
|
39060
39167
|
const record = readCloneRecord(dir);
|
|
39061
39168
|
if (record) return { root: dir, record };
|
|
39062
|
-
const parent =
|
|
39169
|
+
const parent = path43.dirname(dir);
|
|
39063
39170
|
if (parent === dir) return null;
|
|
39064
39171
|
dir = parent;
|
|
39065
39172
|
}
|
|
39066
39173
|
}
|
|
39174
|
+
function cloneAt(dir) {
|
|
39175
|
+
if (dir !== void 0) {
|
|
39176
|
+
const root = caseLocalRoot(dir);
|
|
39177
|
+
const record = readCloneRecord(root);
|
|
39178
|
+
if (!record) {
|
|
39179
|
+
throw expected(`${sanitizeTerminalText(dir)} is not a case clone: it holds no ${CASE_CLONE_RECORD_FILE}. Clone the case with \`wayai cases clone\`.`);
|
|
39180
|
+
}
|
|
39181
|
+
return { root, record };
|
|
39182
|
+
}
|
|
39183
|
+
const clone = findCaseClone(process.cwd());
|
|
39184
|
+
if (!clone) throw expected("This folder is not inside a case clone. Run `wayai cases clone`, or name the clone with --dir.");
|
|
39185
|
+
return clone;
|
|
39186
|
+
}
|
|
39067
39187
|
var CASE_CLONE_RECORD_FILE, isCasePath, notAMarker, sameCase;
|
|
39068
39188
|
var init_case_clone_record = __esm({
|
|
39069
39189
|
"src/cases/case-clone-record.ts"() {
|
|
@@ -39074,6 +39194,7 @@ var init_case_clone_record = __esm({
|
|
|
39074
39194
|
init_case_files();
|
|
39075
39195
|
init_case_file_paths();
|
|
39076
39196
|
init_case_types();
|
|
39197
|
+
init_case_local_files();
|
|
39077
39198
|
CASE_CLONE_RECORD_FILE = ".wayai-case.json";
|
|
39078
39199
|
isCasePath = (rel, phaseFolders) => checkCaseFilePath({ path: rel, type: "file" }, phaseFolders).ok;
|
|
39079
39200
|
notAMarker = (file) => expected(`${sanitizeTerminalText(file)} is not a marker \`wayai cases clone\` wrote. Move it aside and clone the case again.`);
|
|
@@ -39082,12 +39203,12 @@ var init_case_clone_record = __esm({
|
|
|
39082
39203
|
});
|
|
39083
39204
|
|
|
39084
39205
|
// src/cases/case-tokens.ts
|
|
39085
|
-
import * as
|
|
39086
|
-
import * as
|
|
39206
|
+
import * as fs32 from "fs";
|
|
39207
|
+
import * as path44 from "path";
|
|
39087
39208
|
import * as os3 from "os";
|
|
39088
39209
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
39089
39210
|
function listPath() {
|
|
39090
|
-
return
|
|
39211
|
+
return path44.join(os3.homedir(), ".wayai", "case-connections.json");
|
|
39091
39212
|
}
|
|
39092
39213
|
function caseTokenAccount(ref) {
|
|
39093
39214
|
return `${ref.org_id}/${ref.space_id}/${ref.code}`;
|
|
@@ -39125,7 +39246,7 @@ function isConnection(value) {
|
|
|
39125
39246
|
function listCaseConnections() {
|
|
39126
39247
|
let parsed;
|
|
39127
39248
|
try {
|
|
39128
|
-
parsed = JSON.parse(
|
|
39249
|
+
parsed = JSON.parse(fs32.readFileSync(listPath(), "utf-8"));
|
|
39129
39250
|
} catch {
|
|
39130
39251
|
return [];
|
|
39131
39252
|
}
|
|
@@ -39133,8 +39254,8 @@ function listCaseConnections() {
|
|
|
39133
39254
|
return Array.isArray(connections) ? connections.filter(isConnection) : [];
|
|
39134
39255
|
}
|
|
39135
39256
|
function writeList(connections) {
|
|
39136
|
-
|
|
39137
|
-
|
|
39257
|
+
fs32.mkdirSync(path44.dirname(listPath()), { recursive: true });
|
|
39258
|
+
fs32.writeFileSync(listPath(), JSON.stringify({ connections }, null, 2) + "\n", { mode: 384 });
|
|
39138
39259
|
}
|
|
39139
39260
|
function findCaseConnection(ref) {
|
|
39140
39261
|
return listCaseConnections().find((c) => sameCase(c, ref));
|
|
@@ -39250,111 +39371,6 @@ var init_case_session = __esm({
|
|
|
39250
39371
|
}
|
|
39251
39372
|
});
|
|
39252
39373
|
|
|
39253
|
-
// src/cases/case-local-files.ts
|
|
39254
|
-
import * as fs32 from "fs";
|
|
39255
|
-
import * as path44 from "path";
|
|
39256
|
-
function requireOwn(abs) {
|
|
39257
|
-
let st;
|
|
39258
|
-
try {
|
|
39259
|
-
st = fs32.lstatSync(abs);
|
|
39260
|
-
} catch {
|
|
39261
|
-
return;
|
|
39262
|
-
}
|
|
39263
|
-
const problem = ownProblem(st);
|
|
39264
|
-
if (problem) {
|
|
39265
|
-
throw expected(
|
|
39266
|
-
`Refused ${sanitizeTerminalText(abs)}: ${problem}. A case is read and written only in folders and files you own, never in one every user can write to.`
|
|
39267
|
-
);
|
|
39268
|
-
}
|
|
39269
|
-
}
|
|
39270
|
-
function caseLocalPathProblem(rel) {
|
|
39271
|
-
if (rel === "") return "it is empty";
|
|
39272
|
-
if (rel.includes("\0")) return "it holds a NUL";
|
|
39273
|
-
if (rel.includes("\\")) return "it holds a backslash";
|
|
39274
|
-
if (rel.startsWith("/") || /^[A-Za-z]:/.test(rel)) return "it is absolute";
|
|
39275
|
-
for (const segment2 of rel.split("/")) {
|
|
39276
|
-
if (segment2 === "") return "it has an empty segment";
|
|
39277
|
-
if (segment2 === "." || segment2 === "..") return `it has a "${segment2}" segment`;
|
|
39278
|
-
}
|
|
39279
|
-
return null;
|
|
39280
|
-
}
|
|
39281
|
-
function caseLocalRoot(dir) {
|
|
39282
|
-
let root;
|
|
39283
|
-
try {
|
|
39284
|
-
root = fs32.realpathSync(path44.resolve(dir));
|
|
39285
|
-
} catch {
|
|
39286
|
-
throw expected(`${sanitizeTerminalText(dir)} does not exist.`);
|
|
39287
|
-
}
|
|
39288
|
-
if (!fs32.statSync(root).isDirectory()) throw expected(`${sanitizeTerminalText(dir)} is not a folder.`);
|
|
39289
|
-
requireOwn(root);
|
|
39290
|
-
return root;
|
|
39291
|
-
}
|
|
39292
|
-
function writeCaseLocalFile(root, rel, data) {
|
|
39293
|
-
const problem = caseLocalPathProblem(rel);
|
|
39294
|
-
const shown3 = sanitizeTerminalText(rel);
|
|
39295
|
-
if (problem) throw expected(`Refused to write ${JSON.stringify(shown3)}: ${problem}.`);
|
|
39296
|
-
const target = path44.join(root, ...rel.split("/"));
|
|
39297
|
-
requireOwn(root);
|
|
39298
|
-
let folder = root;
|
|
39299
|
-
for (const segment2 of rel.split("/").slice(0, -1)) {
|
|
39300
|
-
folder = path44.join(folder, segment2);
|
|
39301
|
-
let st;
|
|
39302
|
-
try {
|
|
39303
|
-
st = fs32.lstatSync(folder);
|
|
39304
|
-
} catch {
|
|
39305
|
-
st = void 0;
|
|
39306
|
-
}
|
|
39307
|
-
if (!st) {
|
|
39308
|
-
try {
|
|
39309
|
-
fs32.mkdirSync(folder, { mode: CASE_FOLDER_MODE });
|
|
39310
|
-
} catch (err) {
|
|
39311
|
-
if (err.code !== "EEXIST") throw err;
|
|
39312
|
-
}
|
|
39313
|
-
st = fs32.lstatSync(folder);
|
|
39314
|
-
}
|
|
39315
|
-
if (!st.isDirectory()) {
|
|
39316
|
-
throw expected(`Refused to write ${shown3}: a folder on its way is a symlink or a file. The CLI never writes through a symlink.`);
|
|
39317
|
-
}
|
|
39318
|
-
requireOwn(folder);
|
|
39319
|
-
}
|
|
39320
|
-
if (!ensureRealSubdirNoSymlink(root, path44.dirname(target), true)) {
|
|
39321
|
-
throw expected(`Refused to write ${shown3}: a folder on its way is a symlink or a file. The CLI never writes through a symlink.`);
|
|
39322
|
-
}
|
|
39323
|
-
let existing;
|
|
39324
|
-
try {
|
|
39325
|
-
existing = fs32.lstatSync(target);
|
|
39326
|
-
} catch {
|
|
39327
|
-
existing = void 0;
|
|
39328
|
-
}
|
|
39329
|
-
if (existing && !existing.isFile()) throw expected(`Refused to write ${shown3}: it is a symlink or not a file. The CLI never writes through a symlink.`);
|
|
39330
|
-
if (existing) requireOwn(target);
|
|
39331
|
-
if (existing && fileHasBytes(target, data)) return "unchanged";
|
|
39332
|
-
const flags = fs32.constants.O_WRONLY | fs32.constants.O_CREAT | fs32.constants.O_TRUNC | (fs32.constants.O_NOFOLLOW ?? 0);
|
|
39333
|
-
let fd;
|
|
39334
|
-
try {
|
|
39335
|
-
fd = fs32.openSync(target, flags, 420);
|
|
39336
|
-
} catch (err) {
|
|
39337
|
-
if (err.code === "ELOOP") throw expected(`Refused to write ${shown3}: it is a symlink. The CLI never writes through a symlink.`);
|
|
39338
|
-
throw err;
|
|
39339
|
-
}
|
|
39340
|
-
try {
|
|
39341
|
-
fs32.writeFileSync(fd, data);
|
|
39342
|
-
} finally {
|
|
39343
|
-
fs32.closeSync(fd);
|
|
39344
|
-
}
|
|
39345
|
-
return "written";
|
|
39346
|
-
}
|
|
39347
|
-
var CASE_FOLDER_MODE;
|
|
39348
|
-
var init_case_local_files = __esm({
|
|
39349
|
-
"src/cases/case-local-files.ts"() {
|
|
39350
|
-
"use strict";
|
|
39351
|
-
init_fs_safety();
|
|
39352
|
-
init_expected();
|
|
39353
|
-
init_terminal_output();
|
|
39354
|
-
CASE_FOLDER_MODE = 493;
|
|
39355
|
-
}
|
|
39356
|
-
});
|
|
39357
|
-
|
|
39358
39374
|
// ../../packages/core/dist/contracts/case-comments.js
|
|
39359
39375
|
var init_case_comments = __esm({
|
|
39360
39376
|
"../../packages/core/dist/contracts/case-comments.js"() {
|
|
@@ -39945,6 +39961,11 @@ async function readPackageDelivery(reads, root, mirror, confidential) {
|
|
|
39945
39961
|
changedHere
|
|
39946
39962
|
};
|
|
39947
39963
|
}
|
|
39964
|
+
function differenceOf(f, here) {
|
|
39965
|
+
if (f.status === "written" && here === null) return "missing";
|
|
39966
|
+
if (here !== null && (f.status !== "written" || here.sha !== f.sha)) return "changed";
|
|
39967
|
+
return null;
|
|
39968
|
+
}
|
|
39948
39969
|
function entriesUnder(dir) {
|
|
39949
39970
|
const out = [];
|
|
39950
39971
|
const walk = (abs, rel) => {
|
|
@@ -39976,9 +39997,8 @@ function checkPackageFolder(root, mirror) {
|
|
|
39976
39997
|
for (const f of manifest?.files ?? []) {
|
|
39977
39998
|
listed3.add(f.path);
|
|
39978
39999
|
if (f.confidential) continue;
|
|
39979
|
-
const
|
|
39980
|
-
if (
|
|
39981
|
-
else if (here !== null && (f.status !== "written" || here.sha !== f.sha)) differs.push({ path: f.path, tool: isTool(f.path), reason: "changed" });
|
|
40000
|
+
const reason3 = differenceOf(f, held(f.path));
|
|
40001
|
+
if (reason3) differs.push({ path: f.path, tool: isTool(f.path), reason: reason3 });
|
|
39982
40002
|
}
|
|
39983
40003
|
for (const rel of entriesUnder(path46.join(mirror, CASE_PACKAGE_DIR))) {
|
|
39984
40004
|
if (!listed3.has(rel)) differs.push({ path: rel, tool: isTool(rel), reason: "not_published" });
|
|
@@ -40010,6 +40030,23 @@ function packageCheckLines(check, mirrorName) {
|
|
|
40010
40030
|
...scope
|
|
40011
40031
|
];
|
|
40012
40032
|
}
|
|
40033
|
+
function deliveredPackage(root, mirror) {
|
|
40034
|
+
const manifest = readManifest(root, mirror);
|
|
40035
|
+
const held = heldReader(root, mirror);
|
|
40036
|
+
const listed3 = new Map((manifest?.files ?? []).map((f) => [f.path, f]));
|
|
40037
|
+
return {
|
|
40038
|
+
manifest,
|
|
40039
|
+
file: (rel) => {
|
|
40040
|
+
const f = listed3.get(rel);
|
|
40041
|
+
if (!f) return { state: "unlisted" };
|
|
40042
|
+
const here = held(rel);
|
|
40043
|
+
const reason3 = differenceOf(f, here);
|
|
40044
|
+
if (reason3) return { state: reason3, confidential: f.confidential };
|
|
40045
|
+
if (here === null) return { state: "not_delivered", confidential: f.confidential };
|
|
40046
|
+
return { state: "ok", bytes: here.bytes, confidential: f.confidential };
|
|
40047
|
+
}
|
|
40048
|
+
};
|
|
40049
|
+
}
|
|
40013
40050
|
var CASE_PACKAGE_DIR, PACKAGE_MANIFEST_FILE, PACKAGE_FILE_MODE, safe2, isTool, toolsFirst, STATUSES, isObject, PACKAGE_NOT_DELIVERED, PACKAGE_CHECK_SCOPE, packageDiffers;
|
|
40014
40051
|
var init_case_package = __esm({
|
|
40015
40052
|
"src/cases/case-package.ts"() {
|
|
@@ -40555,6 +40592,504 @@ exec wayai cases pull --mirror-only --dir "$(dirname "$0")/.."
|
|
|
40555
40592
|
}
|
|
40556
40593
|
});
|
|
40557
40594
|
|
|
40595
|
+
// ../../packages/core/dist/chunk-KAO33OFE.js
|
|
40596
|
+
function firstAtOrAfter(sorted, from) {
|
|
40597
|
+
let lo = 0;
|
|
40598
|
+
let hi = sorted.length;
|
|
40599
|
+
while (lo < hi) {
|
|
40600
|
+
const mid = lo + hi >> 1;
|
|
40601
|
+
if (sorted[mid] < from) lo = mid + 1;
|
|
40602
|
+
else hi = mid;
|
|
40603
|
+
}
|
|
40604
|
+
return lo < sorted.length ? sorted[lo] : -1;
|
|
40605
|
+
}
|
|
40606
|
+
function caseMarkdownSegments(text5) {
|
|
40607
|
+
const blankStarts = [];
|
|
40608
|
+
for (let i = text5.indexOf("\n"); i >= 0; i = text5.indexOf("\n", i + 1)) {
|
|
40609
|
+
BLANK_AFTER.lastIndex = i + 1;
|
|
40610
|
+
if (BLANK_AFTER.test(text5)) blankStarts.push(i);
|
|
40611
|
+
}
|
|
40612
|
+
const runs = /* @__PURE__ */ new Map();
|
|
40613
|
+
for (let i = 0; i < text5.length; ) {
|
|
40614
|
+
if (text5[i] !== "`") {
|
|
40615
|
+
i++;
|
|
40616
|
+
continue;
|
|
40617
|
+
}
|
|
40618
|
+
let j = i;
|
|
40619
|
+
while (text5[j] === "`") j++;
|
|
40620
|
+
const list2 = runs.get(j - i);
|
|
40621
|
+
if (list2) list2.push(i);
|
|
40622
|
+
else runs.set(j - i, [i]);
|
|
40623
|
+
i = j;
|
|
40624
|
+
}
|
|
40625
|
+
let commentNeverCloses = false;
|
|
40626
|
+
const fenceEnd = (i) => {
|
|
40627
|
+
FENCE_OPEN.lastIndex = i;
|
|
40628
|
+
const m = FENCE_OPEN.exec(text5);
|
|
40629
|
+
if (!m || m[1][0] === "`" && m[2].includes("`")) return null;
|
|
40630
|
+
const start = i + m[0].length;
|
|
40631
|
+
const close3 = new RegExp(`^ {0,3}${m[1][0]}{${m[1].length},}[ \\t]*\\r?$`, "gm");
|
|
40632
|
+
close3.lastIndex = start;
|
|
40633
|
+
const found = close3.exec(text5);
|
|
40634
|
+
if (!found) return text5.length;
|
|
40635
|
+
const end = found.index + found[0].length;
|
|
40636
|
+
return text5[end] === "\n" ? end + 1 : end;
|
|
40637
|
+
};
|
|
40638
|
+
const inlineCodeEnd = (i, size) => {
|
|
40639
|
+
const blank = firstAtOrAfter(blankStarts, i);
|
|
40640
|
+
const limit = blank < 0 ? text5.length : blank;
|
|
40641
|
+
const close3 = firstAtOrAfter(runs.get(size) ?? [], i + size);
|
|
40642
|
+
return close3 >= 0 && close3 < limit ? close3 + size : null;
|
|
40643
|
+
};
|
|
40644
|
+
const segments = [];
|
|
40645
|
+
let plainStart = 0;
|
|
40646
|
+
const keep = (kind, start, end) => {
|
|
40647
|
+
if (plainStart < start) segments.push({ kind: "text", content: text5.slice(plainStart, start) });
|
|
40648
|
+
segments.push({ kind, content: text5.slice(start, end) });
|
|
40649
|
+
plainStart = end;
|
|
40650
|
+
};
|
|
40651
|
+
for (let i = 0; i < text5.length; ) {
|
|
40652
|
+
if (i === 0 || text5[i - 1] === "\n") {
|
|
40653
|
+
const end = fenceEnd(i);
|
|
40654
|
+
if (end !== null) {
|
|
40655
|
+
keep("fence", i, end);
|
|
40656
|
+
i = end;
|
|
40657
|
+
continue;
|
|
40658
|
+
}
|
|
40659
|
+
}
|
|
40660
|
+
if (text5[i] === "\\") {
|
|
40661
|
+
i += 2;
|
|
40662
|
+
continue;
|
|
40663
|
+
}
|
|
40664
|
+
if (!commentNeverCloses && text5.startsWith("<!--", i)) {
|
|
40665
|
+
const end = text5.indexOf("-->", i + 4);
|
|
40666
|
+
if (end >= 0) {
|
|
40667
|
+
keep("comment", i, end + 3);
|
|
40668
|
+
i = end + 3;
|
|
40669
|
+
continue;
|
|
40670
|
+
}
|
|
40671
|
+
commentNeverCloses = true;
|
|
40672
|
+
}
|
|
40673
|
+
if (text5[i] === "`") {
|
|
40674
|
+
let j = i;
|
|
40675
|
+
while (text5[j] === "`") j++;
|
|
40676
|
+
const end = inlineCodeEnd(i, j - i);
|
|
40677
|
+
if (end !== null) {
|
|
40678
|
+
keep("code", i, end);
|
|
40679
|
+
i = end;
|
|
40680
|
+
continue;
|
|
40681
|
+
}
|
|
40682
|
+
i = j;
|
|
40683
|
+
continue;
|
|
40684
|
+
}
|
|
40685
|
+
i++;
|
|
40686
|
+
}
|
|
40687
|
+
if (plainStart < text5.length) segments.push({ kind: "text", content: text5.slice(plainStart) });
|
|
40688
|
+
return segments;
|
|
40689
|
+
}
|
|
40690
|
+
function trimTabsAndSpaces(text5) {
|
|
40691
|
+
let start = 0;
|
|
40692
|
+
let end = text5.length;
|
|
40693
|
+
while (start < end && isTabOrSpace(text5[start])) start++;
|
|
40694
|
+
while (end > start && isTabOrSpace(text5[end - 1])) end--;
|
|
40695
|
+
return text5.slice(start, end);
|
|
40696
|
+
}
|
|
40697
|
+
function readMarker(content, line) {
|
|
40698
|
+
const calculation = CALCULATION_MARKER.exec(content)?.groups;
|
|
40699
|
+
if (calculation) return { kind: "calculation", name: calculation.name, label: calculation.label.trim(), line };
|
|
40700
|
+
const decision = DECISION_MARKER.exec(content)?.groups;
|
|
40701
|
+
if (decision) return { kind: "decision", code: decision.code, label: decision.label.trim(), line };
|
|
40702
|
+
const piece = DOCUMENT_MARKER.exec(content)?.groups;
|
|
40703
|
+
if (piece) return { kind: "document", output: piece.output, item: piece.item ?? null, label: piece.label.trim(), line };
|
|
40704
|
+
const input = INPUT_MARKER.exec(content)?.groups;
|
|
40705
|
+
if (!input) return null;
|
|
40706
|
+
const start = input.start ? Number(input.start) : null;
|
|
40707
|
+
const end = input.end ? Number(input.end) : start;
|
|
40708
|
+
if (start !== null && end < start) return null;
|
|
40709
|
+
return { kind: "input", key: input.key, version: Number(input.version), cited: start === null ? null : { start, end }, label: input.label?.trim() || null, line };
|
|
40710
|
+
}
|
|
40711
|
+
function lineMarkers(line) {
|
|
40712
|
+
const found = [];
|
|
40713
|
+
for (const run of line.split(/[\r\u2028\u2029]/)) {
|
|
40714
|
+
let close3 = -2;
|
|
40715
|
+
for (let open = run.indexOf("[["); open >= 0; ) {
|
|
40716
|
+
if (close3 !== -1 && close3 < open + 2) close3 = run.indexOf("]]", open + 2);
|
|
40717
|
+
if (close3 < 0) {
|
|
40718
|
+
found.push({ raw: "[[", content: null });
|
|
40719
|
+
open = run.indexOf("[[", open + 2);
|
|
40720
|
+
continue;
|
|
40721
|
+
}
|
|
40722
|
+
found.push({ raw: run.slice(open, close3 + 2), content: run.slice(open + 2, close3) });
|
|
40723
|
+
open = run.indexOf("[[", close3 + 2);
|
|
40724
|
+
}
|
|
40725
|
+
}
|
|
40726
|
+
return found;
|
|
40727
|
+
}
|
|
40728
|
+
function lineImages(line) {
|
|
40729
|
+
const targets = [];
|
|
40730
|
+
const targetFrom = (from) => {
|
|
40731
|
+
let k = from;
|
|
40732
|
+
while (k < line.length && !isSpace(line[k]) && line[k] !== ")" && line[k] !== ">") k++;
|
|
40733
|
+
return line.slice(from, k);
|
|
40734
|
+
};
|
|
40735
|
+
let bracket = -2;
|
|
40736
|
+
let after = null;
|
|
40737
|
+
for (let open = line.indexOf("!["); open >= 0; ) {
|
|
40738
|
+
if (bracket !== -1 && bracket < open + 2) {
|
|
40739
|
+
bracket = line.indexOf("]", open + 2);
|
|
40740
|
+
after = null;
|
|
40741
|
+
if (bracket >= 0 && line[bracket + 1] === "(") {
|
|
40742
|
+
let j = bracket + 2;
|
|
40743
|
+
while (isSpace(line[j])) j++;
|
|
40744
|
+
const angled = line[j] === "<" ? targetFrom(j + 1) : "";
|
|
40745
|
+
const target = angled || targetFrom(j);
|
|
40746
|
+
if (target) after = { target, end: (angled ? j + 1 : j) + target.length };
|
|
40747
|
+
}
|
|
40748
|
+
}
|
|
40749
|
+
if (bracket < 0) break;
|
|
40750
|
+
if (after) targets.push(after.target);
|
|
40751
|
+
open = line.indexOf("![", after ? after.end : open + 1);
|
|
40752
|
+
}
|
|
40753
|
+
return targets;
|
|
40754
|
+
}
|
|
40755
|
+
function fillsOf(text5) {
|
|
40756
|
+
const fills = [];
|
|
40757
|
+
let close3 = -2;
|
|
40758
|
+
for (let open = text5.indexOf("{{"); open >= 0; ) {
|
|
40759
|
+
let j = open + 2;
|
|
40760
|
+
while (isSpace(text5[j])) j++;
|
|
40761
|
+
let next = open + 1;
|
|
40762
|
+
if (text5.startsWith("fill", j)) {
|
|
40763
|
+
j += 4;
|
|
40764
|
+
while (isSpace(text5[j])) j++;
|
|
40765
|
+
if (text5[j] === ":") {
|
|
40766
|
+
j++;
|
|
40767
|
+
if (close3 !== -1 && close3 < j) close3 = text5.indexOf("}}", j);
|
|
40768
|
+
if (close3 >= 0) {
|
|
40769
|
+
fills.push({ start: open, end: close3 + 2, text: text5.slice(j, close3).trim() });
|
|
40770
|
+
next = close3 + 2;
|
|
40771
|
+
}
|
|
40772
|
+
}
|
|
40773
|
+
}
|
|
40774
|
+
open = text5.indexOf("{{", next);
|
|
40775
|
+
}
|
|
40776
|
+
return fills;
|
|
40777
|
+
}
|
|
40778
|
+
function atxHeading(line) {
|
|
40779
|
+
let i = 0;
|
|
40780
|
+
while (i < 3 && line[i] === " ") i++;
|
|
40781
|
+
let j = i;
|
|
40782
|
+
while (line[j] === "#" && j - i < 7) j++;
|
|
40783
|
+
const level = j - i;
|
|
40784
|
+
if (level < 1 || level > 6 || j < line.length && !isTabOrSpace(line[j])) return null;
|
|
40785
|
+
const rest = line.slice(j);
|
|
40786
|
+
if (/[\r\u2028\u2029]/.test(rest)) return null;
|
|
40787
|
+
let text5 = trimTabsAndSpaces(rest);
|
|
40788
|
+
let hashes = text5.length;
|
|
40789
|
+
while (hashes > 0 && text5[hashes - 1] === "#") hashes--;
|
|
40790
|
+
if (hashes < text5.length && isTabOrSpace(text5[hashes - 1])) {
|
|
40791
|
+
while (hashes > 0 && isTabOrSpace(text5[hashes - 1])) hashes--;
|
|
40792
|
+
text5 = text5.slice(0, hashes);
|
|
40793
|
+
}
|
|
40794
|
+
return { level, text: text5 };
|
|
40795
|
+
}
|
|
40796
|
+
function anchorOf(text5) {
|
|
40797
|
+
let end = text5.length;
|
|
40798
|
+
while (end > 0 && isTabOrSpace(text5[end - 1])) end--;
|
|
40799
|
+
if (end < 2 || text5[end - 1] !== "}") return null;
|
|
40800
|
+
const open = text5.lastIndexOf("{", end - 2);
|
|
40801
|
+
if (open < 0) return null;
|
|
40802
|
+
const attributes = text5.slice(open + 1, end - 1);
|
|
40803
|
+
if (attributes.includes("}")) return null;
|
|
40804
|
+
for (let k = attributes.length - 1; k >= 0; k--) {
|
|
40805
|
+
if (attributes[k] !== "#" || k > 0 && !isTabOrSpace(attributes[k - 1])) continue;
|
|
40806
|
+
let stop = k + 1;
|
|
40807
|
+
while (stop < attributes.length && !isSpace(attributes[stop])) stop++;
|
|
40808
|
+
if (stop === k + 1) continue;
|
|
40809
|
+
let titleEnd = open;
|
|
40810
|
+
while (titleEnd > 0 && isTabOrSpace(text5[titleEnd - 1])) titleEnd--;
|
|
40811
|
+
return { code: attributes.slice(k + 1, stop), title: text5.slice(0, titleEnd) };
|
|
40812
|
+
}
|
|
40813
|
+
return null;
|
|
40814
|
+
}
|
|
40815
|
+
function tableEnd(lines, i) {
|
|
40816
|
+
let columns = COLUMNS.test(lines[i]) ? i : -1;
|
|
40817
|
+
if (columns < 0 && DASHES.test(lines[i])) {
|
|
40818
|
+
for (let n = i + 1; n < lines.length && lines[n].trim() !== ""; n++) {
|
|
40819
|
+
if (COLUMNS.test(lines[n])) {
|
|
40820
|
+
columns = n;
|
|
40821
|
+
break;
|
|
40822
|
+
}
|
|
40823
|
+
}
|
|
40824
|
+
}
|
|
40825
|
+
if (columns < 0) return -1;
|
|
40826
|
+
for (let n = columns + 1; n < lines.length; n++) {
|
|
40827
|
+
if (atxHeading(lines[n]) || FENCE.test(lines[n])) return -1;
|
|
40828
|
+
if (DASHES.test(lines[n]) || COLUMNS.test(lines[n])) return n;
|
|
40829
|
+
}
|
|
40830
|
+
return -1;
|
|
40831
|
+
}
|
|
40832
|
+
function readHeadings(lines) {
|
|
40833
|
+
const headings = [];
|
|
40834
|
+
let fence = null;
|
|
40835
|
+
let closedAt = -1;
|
|
40836
|
+
let tableUntil = -1;
|
|
40837
|
+
for (let i = 0; i < lines.length; i++) {
|
|
40838
|
+
if (i <= tableUntil) continue;
|
|
40839
|
+
const line = lines[i];
|
|
40840
|
+
const mark = FENCE.exec(line);
|
|
40841
|
+
if (fence !== null) {
|
|
40842
|
+
if (mark && mark[1][0] === fence[0] && mark[1].length >= fence.length && line.trim() === mark[1]) {
|
|
40843
|
+
fence = null;
|
|
40844
|
+
closedAt = i;
|
|
40845
|
+
}
|
|
40846
|
+
continue;
|
|
40847
|
+
}
|
|
40848
|
+
if (mark) {
|
|
40849
|
+
fence = mark[1];
|
|
40850
|
+
continue;
|
|
40851
|
+
}
|
|
40852
|
+
if (i === 0 || lines[i - 1].trim() === "") {
|
|
40853
|
+
const end = tableEnd(lines, i);
|
|
40854
|
+
if (end > i) {
|
|
40855
|
+
tableUntil = end;
|
|
40856
|
+
continue;
|
|
40857
|
+
}
|
|
40858
|
+
}
|
|
40859
|
+
const atx = atxHeading(line);
|
|
40860
|
+
if (atx) {
|
|
40861
|
+
headings.push({ start: i, end: i + 1, ...atx });
|
|
40862
|
+
continue;
|
|
40863
|
+
}
|
|
40864
|
+
const previous = lines[i - 1];
|
|
40865
|
+
if (i > 0 && SETEXT_UNDERLINE.test(line) && previous.trim() !== "" && closedAt !== i - 1 && (i === 1 || lines[i - 2].trim() === "") && headings.at(-1)?.end !== i) {
|
|
40866
|
+
headings.push({ start: i - 1, end: i + 1, level: line.includes("=") ? 1 : 2, text: previous.trim() });
|
|
40867
|
+
}
|
|
40868
|
+
}
|
|
40869
|
+
return headings.map((h) => {
|
|
40870
|
+
const anchor = anchorOf(h.text);
|
|
40871
|
+
return { ...h, code: anchor?.code ?? null, title: anchor?.title ?? h.text };
|
|
40872
|
+
});
|
|
40873
|
+
}
|
|
40874
|
+
function bodyWithLines(text5) {
|
|
40875
|
+
const original = withoutBom(text5).replace(/\r\n/g, "\n");
|
|
40876
|
+
const frontMatter = CASE_FRONT_MATTER.exec(original)?.[0] ?? "";
|
|
40877
|
+
let line = 1 + (frontMatter.match(/\n/g)?.length ?? 0);
|
|
40878
|
+
let body = "";
|
|
40879
|
+
const origin = [line];
|
|
40880
|
+
for (const segment2 of caseMarkdownSegments(original.slice(frontMatter.length))) {
|
|
40881
|
+
if (segment2.kind === "comment") {
|
|
40882
|
+
line += segment2.content.match(/\n/g)?.length ?? 0;
|
|
40883
|
+
continue;
|
|
40884
|
+
}
|
|
40885
|
+
for (const c of segment2.content) if (c === "\n") {
|
|
40886
|
+
line++;
|
|
40887
|
+
origin.push(line);
|
|
40888
|
+
}
|
|
40889
|
+
body += segment2.content;
|
|
40890
|
+
}
|
|
40891
|
+
return { body, frontMatter, origin };
|
|
40892
|
+
}
|
|
40893
|
+
function lastAtOrBefore(sorted, at) {
|
|
40894
|
+
let lo = 0;
|
|
40895
|
+
let hi = sorted.length - 1;
|
|
40896
|
+
while (lo < hi) {
|
|
40897
|
+
const mid = lo + hi + 1 >> 1;
|
|
40898
|
+
if (sorted[mid] <= at) lo = mid;
|
|
40899
|
+
else hi = mid - 1;
|
|
40900
|
+
}
|
|
40901
|
+
return lo;
|
|
40902
|
+
}
|
|
40903
|
+
function readCaseItems(text5) {
|
|
40904
|
+
const { body, frontMatter, origin } = bodyWithLines(text5);
|
|
40905
|
+
const lines = body.split("\n");
|
|
40906
|
+
const lastLine = Math.max(1, casePassageLines(text5).length);
|
|
40907
|
+
const headings = readHeadings(lines);
|
|
40908
|
+
const lineMarks = [];
|
|
40909
|
+
const malformed = [];
|
|
40910
|
+
lines.forEach((content, n) => {
|
|
40911
|
+
const marks = [];
|
|
40912
|
+
for (const { raw, content: inner } of lineMarkers(content)) {
|
|
40913
|
+
const marker = inner === null ? null : readMarker(inner, origin[n]);
|
|
40914
|
+
if (marker) marks.push(marker);
|
|
40915
|
+
else malformed.push({ marker: raw, line: origin[n] });
|
|
40916
|
+
}
|
|
40917
|
+
lineMarks.push(marks);
|
|
40918
|
+
});
|
|
40919
|
+
const ends = new Array(headings.length);
|
|
40920
|
+
let nextAnchor = lines.length;
|
|
40921
|
+
const nextAtLevel = new Array(7).fill(lines.length);
|
|
40922
|
+
for (let h = headings.length - 1; h >= 0; h--) {
|
|
40923
|
+
const heading = headings[h];
|
|
40924
|
+
let end = nextAnchor;
|
|
40925
|
+
for (let level = 1; level <= heading.level; level++) end = Math.min(end, nextAtLevel[level]);
|
|
40926
|
+
ends[h] = end;
|
|
40927
|
+
nextAtLevel[heading.level] = heading.start;
|
|
40928
|
+
if (heading.code !== null) nextAnchor = heading.start;
|
|
40929
|
+
}
|
|
40930
|
+
const headingLine = new Array(lines.length).fill(false);
|
|
40931
|
+
for (const heading of headings) for (let n = heading.start; n < heading.end; n++) headingLine[n] = true;
|
|
40932
|
+
const inItem = new Array(lines.length).fill(false);
|
|
40933
|
+
const items = [];
|
|
40934
|
+
headings.forEach((heading, h) => {
|
|
40935
|
+
if (heading.code === null) return;
|
|
40936
|
+
const end = ends[h];
|
|
40937
|
+
for (let n = heading.start; n < end; n++) inItem[n] = true;
|
|
40938
|
+
const markers2 = [];
|
|
40939
|
+
const images = [];
|
|
40940
|
+
for (let n = heading.end; n < end; n++) {
|
|
40941
|
+
for (const marker of lineMarks[n]) markers2.push(marker);
|
|
40942
|
+
for (const target of lineImages(lines[n])) images.push({ target, line: origin[n] });
|
|
40943
|
+
}
|
|
40944
|
+
const internal = [];
|
|
40945
|
+
for (let o = h + 1; o < headings.length && headings[o].start < end; o++) {
|
|
40946
|
+
const other = headings[o];
|
|
40947
|
+
if (other.start >= heading.end) internal.push({ level: other.level, text: other.title, line: origin[other.start] });
|
|
40948
|
+
}
|
|
40949
|
+
const prose = [];
|
|
40950
|
+
for (let n = heading.end; n < end; n++) if (!headingLine[n]) prose.push(lines[n]);
|
|
40951
|
+
const proseText = prose.join("\n");
|
|
40952
|
+
let withoutFills = "";
|
|
40953
|
+
let from = 0;
|
|
40954
|
+
for (const fill of fillsOf(proseText)) {
|
|
40955
|
+
withoutFills += proseText.slice(from, fill.start);
|
|
40956
|
+
from = fill.end;
|
|
40957
|
+
}
|
|
40958
|
+
withoutFills += proseText.slice(from);
|
|
40959
|
+
items.push({
|
|
40960
|
+
code: heading.code,
|
|
40961
|
+
title: heading.title,
|
|
40962
|
+
level: heading.level,
|
|
40963
|
+
lines: { start: origin[heading.start], end: Math.max(origin[heading.start], Math.min(origin[end - 1], lastLine)) },
|
|
40964
|
+
text: lines.slice(heading.end, end).join("\n"),
|
|
40965
|
+
has_text: withoutFills.trim() !== "",
|
|
40966
|
+
headings: internal,
|
|
40967
|
+
markers: markers2,
|
|
40968
|
+
inputs: once(markers2.flatMap((m) => m.kind === "input" ? [m.key] : [])),
|
|
40969
|
+
calculations: once(markers2.flatMap((m) => m.kind === "calculation" ? [m.name] : [])),
|
|
40970
|
+
decisions: once(markers2.flatMap((m) => m.kind === "decision" ? [m.code] : [])),
|
|
40971
|
+
images
|
|
40972
|
+
});
|
|
40973
|
+
});
|
|
40974
|
+
const lineStarts = [0];
|
|
40975
|
+
for (let i = body.indexOf("\n"); i >= 0; i = body.indexOf("\n", i + 1)) lineStarts.push(i + 1);
|
|
40976
|
+
const fills = fillsOf(body).map((fill) => ({ text: fill.text, line: origin[lastAtOrBefore(lineStarts, fill.start)] }));
|
|
40977
|
+
const markers = [];
|
|
40978
|
+
for (const marks of lineMarks) for (const marker of marks) markers.push(marker);
|
|
40979
|
+
return {
|
|
40980
|
+
items,
|
|
40981
|
+
markers,
|
|
40982
|
+
fills,
|
|
40983
|
+
outside: { front_matter: frontMatter, body: lines.filter((_, n) => !inItem[n]).join("\n") },
|
|
40984
|
+
malformed_markers: malformed
|
|
40985
|
+
};
|
|
40986
|
+
}
|
|
40987
|
+
var CASE_COMPOSED_COVER, CASE_ITEM_READER_MAX_CHARS, FENCE_OPEN, BLANK_AFTER, CASE_FRONT_MATTER, withoutBom, FENCE, SETEXT_UNDERLINE, DASHES, COLUMNS, patternBody, CALCULATION_MARKER, DECISION_MARKER, DOCUMENT_MARKER, INPUT_MARKER, isSpace, isTabOrSpace, once;
|
|
40988
|
+
var init_chunk_KAO33OFE = __esm({
|
|
40989
|
+
"../../packages/core/dist/chunk-KAO33OFE.js"() {
|
|
40990
|
+
"use strict";
|
|
40991
|
+
init_chunk_S7UAXLHJ();
|
|
40992
|
+
init_chunk_PFPADFUC();
|
|
40993
|
+
CASE_COMPOSED_COVER = "00-cover.md";
|
|
40994
|
+
CASE_ITEM_READER_MAX_CHARS = 4 * 1024 * 1024;
|
|
40995
|
+
FENCE_OPEN = / {0,3}(`{3,}|~{3,})([^\n]*)(?:\n|$)/y;
|
|
40996
|
+
BLANK_AFTER = /[ \t]*\r?\n/y;
|
|
40997
|
+
CASE_FRONT_MATTER = /^---\r?\n(?![ \t]*\r?\n)([\s\S]*?)\r?\n---/;
|
|
40998
|
+
withoutBom = (text5) => text5.replace(/^\uFEFF/, "");
|
|
40999
|
+
FENCE = /^ {0,3}(`{3,}|~{3,})/;
|
|
41000
|
+
SETEXT_UNDERLINE = /^ {0,3}(=+|-+)[ \t]*$/;
|
|
41001
|
+
DASHES = /^ {0,3}-{3,}[ \t]*$/;
|
|
41002
|
+
COLUMNS = /^ {0,3}-+(?:[ \t]+-+)+[ \t]*$/;
|
|
41003
|
+
patternBody = (pattern) => pattern.source.slice(1, -1);
|
|
41004
|
+
CALCULATION_MARKER = new RegExp(`^calc:(?<name>${patternBody(CASE_CALCULATION_CODE_PATTERN)})\\|(?<label>.*\\S.*)$`);
|
|
41005
|
+
DECISION_MARKER = new RegExp(`^decision:(?<code>${patternBody(CASE_DECISION_CODE_PATTERN)})\\|(?<label>.*\\S.*)$`);
|
|
41006
|
+
DOCUMENT_MARKER = new RegExp(`^doc:(?<output>${patternBody(CASE_CODE_PATTERN)})(?:#(?<item>[^\\s|#]+))?\\|(?<label>.*\\S.*)$`);
|
|
41007
|
+
INPUT_MARKER = new RegExp(
|
|
41008
|
+
`^(?<key>${patternBody(CASE_INPUT_KEY_PATTERN)})@v(?<version>[1-9]\\d*)(?:#L(?<start>[1-9]\\d*)(?:-L(?<end>[1-9]\\d*))?)?(?:\\|(?<label>.*))?$`
|
|
41009
|
+
);
|
|
41010
|
+
isSpace = (c) => c !== void 0 && /\s/.test(c);
|
|
41011
|
+
isTabOrSpace = (c) => c === " " || c === " ";
|
|
41012
|
+
once = (values) => [...new Set(values)];
|
|
41013
|
+
}
|
|
41014
|
+
});
|
|
41015
|
+
|
|
41016
|
+
// ../../packages/core/dist/case-item-reader.js
|
|
41017
|
+
var init_case_item_reader = __esm({
|
|
41018
|
+
"../../packages/core/dist/case-item-reader.js"() {
|
|
41019
|
+
"use strict";
|
|
41020
|
+
init_chunk_KAO33OFE();
|
|
41021
|
+
init_chunk_S7UAXLHJ();
|
|
41022
|
+
init_chunk_7TQYAKCB();
|
|
41023
|
+
init_chunk_VROZDNLV();
|
|
41024
|
+
init_chunk_733K4J4G();
|
|
41025
|
+
init_chunk_PFPADFUC();
|
|
41026
|
+
init_chunk_KWRHZBGU();
|
|
41027
|
+
init_chunk_3T3D7LTE();
|
|
41028
|
+
init_chunk_M2T55BV6();
|
|
41029
|
+
init_chunk_VYINA6YP();
|
|
41030
|
+
init_chunk_ZVXO3XL6();
|
|
41031
|
+
init_chunk_FBV7NLKO();
|
|
41032
|
+
init_chunk_WEXVYJ5H();
|
|
41033
|
+
init_chunk_HZ6CADSY();
|
|
41034
|
+
init_chunk_ICYO56QW();
|
|
41035
|
+
init_chunk_WFQDSQJK();
|
|
41036
|
+
init_chunk_ZTNFLGW5();
|
|
41037
|
+
}
|
|
41038
|
+
});
|
|
41039
|
+
|
|
41040
|
+
// src/cases/case-skeleton.ts
|
|
41041
|
+
function fillAttributes(text5, attributes, missing) {
|
|
41042
|
+
return text5.replace(MARK, (mark, name) => {
|
|
41043
|
+
if (name === FILL) return mark;
|
|
41044
|
+
const value = Object.hasOwn(attributes, name) ? attributes[name] : void 0;
|
|
41045
|
+
if (typeof value === "string" || typeof value === "number" && Number.isFinite(value)) return oneLine(String(value));
|
|
41046
|
+
missing.add(name);
|
|
41047
|
+
return `{{fill: ${name}}}`;
|
|
41048
|
+
});
|
|
41049
|
+
}
|
|
41050
|
+
function skeletonParts(input) {
|
|
41051
|
+
const title2 = oneLine(input.document_type);
|
|
41052
|
+
const cover = ["---", `case: ${oneLine(input.case_code)}`, `type: ${title2}`, `title: ${title2}`, "---", "", `# ${title2}`, ""];
|
|
41053
|
+
const sections = [];
|
|
41054
|
+
const missing = /* @__PURE__ */ new Set();
|
|
41055
|
+
let underGrouping = false;
|
|
41056
|
+
for (const item of input.items) {
|
|
41057
|
+
const nested = !item.grouping && underGrouping;
|
|
41058
|
+
const lines = [`${nested ? "###" : "##"} ${oneLine(item.title)} {#${item.code}}`, ""];
|
|
41059
|
+
if (item.grouping) underGrouping = true;
|
|
41060
|
+
const body = item.grouping ? null : item.template_mode === "fixed" && item.fixed_text !== null ? item.fixed_text.trim() : item.template !== null ? fillAttributes(item.template.trim(), input.attributes, missing) : `{{fill: ${oneLine(item.title)}}}`;
|
|
41061
|
+
if (body) lines.push(body, "");
|
|
41062
|
+
if (nested) sections[sections.length - 1].lines.push(...lines);
|
|
41063
|
+
else sections.push({ code: item.code, lines });
|
|
41064
|
+
}
|
|
41065
|
+
return { cover, sections, missing: [...missing].sort() };
|
|
41066
|
+
}
|
|
41067
|
+
function skeletonFiles(input, base) {
|
|
41068
|
+
const { cover, sections, missing } = skeletonParts(input);
|
|
41069
|
+
if (!base.endsWith("/")) return { files: [{ rel: base, text: close2([...cover, ...sections.flatMap((s) => s.lines)]) }], missing };
|
|
41070
|
+
const width = Math.max(2, String(sections.length).length);
|
|
41071
|
+
return {
|
|
41072
|
+
files: [
|
|
41073
|
+
{ rel: `${base}${CASE_COMPOSED_COVER}`, text: close2(cover) },
|
|
41074
|
+
...sections.map((s, i) => ({ rel: `${base}${String(i + 1).padStart(width, "0")}-${s.code}.md`, text: close2(s.lines) }))
|
|
41075
|
+
],
|
|
41076
|
+
missing
|
|
41077
|
+
};
|
|
41078
|
+
}
|
|
41079
|
+
var MARK, FILL, oneLine, close2, fillsIn;
|
|
41080
|
+
var init_case_skeleton = __esm({
|
|
41081
|
+
"src/cases/case-skeleton.ts"() {
|
|
41082
|
+
"use strict";
|
|
41083
|
+
init_case_item_reader();
|
|
41084
|
+
MARK = /\{\{\s*([^{}:]+?)\s*(?::[^{}]*)?\}\}/g;
|
|
41085
|
+
FILL = "fill";
|
|
41086
|
+
oneLine = (text5) => text5.replace(/\s*\r?\n\s*/g, " ").trim();
|
|
41087
|
+
close2 = (lines) => `${lines.join("\n").trimEnd()}
|
|
41088
|
+
`;
|
|
41089
|
+
fillsIn = (text5) => readCaseItems(text5).fills.length;
|
|
41090
|
+
}
|
|
41091
|
+
});
|
|
41092
|
+
|
|
40558
41093
|
// ../../packages/core/dist/contracts/case-notes.js
|
|
40559
41094
|
var init_case_notes = __esm({
|
|
40560
41095
|
"../../packages/core/dist/contracts/case-notes.js"() {
|
|
@@ -40919,7 +41454,117 @@ async function caseReceivedAdd(session, file, opts) {
|
|
|
40919
41454
|
console.log(`${one2(received.title)} registered in ${phase.folder}/received/ of ${session.connection.code}: ${received.received_id}`);
|
|
40920
41455
|
if (received.text_origin === "agent") console.log("Its text is marked as converted by an agent, for whoever reviews it.");
|
|
40921
41456
|
}
|
|
40922
|
-
|
|
41457
|
+
function documentHere(root, record, bound) {
|
|
41458
|
+
const folder = bound.endsWith("/");
|
|
41459
|
+
try {
|
|
41460
|
+
fs36.lstatSync(path48.join(root, ...(folder ? bound.slice(0, -1) : bound).split("/")));
|
|
41461
|
+
return true;
|
|
41462
|
+
} catch {
|
|
41463
|
+
}
|
|
41464
|
+
return Object.keys(record.files).some((rel) => folder ? rel.startsWith(bound) : rel === bound);
|
|
41465
|
+
}
|
|
41466
|
+
async function caseSkeleton(session, clone, opts) {
|
|
41467
|
+
const pull = `wayai cases pull --mirror-only${opts.confidential ? " --confidential" : ""}`;
|
|
41468
|
+
const undelivered = () => expected(`No package is delivered in this clone's mirror: run \`${pull}\`, then skeleton again.`);
|
|
41469
|
+
const detail = await loadCase(session);
|
|
41470
|
+
const can = detail.access.capabilities;
|
|
41471
|
+
if (!can.includes("view_work")) throw expected(`Your access to case ${detail.code} does not reach its work: no team of yours reads it.`);
|
|
41472
|
+
const holdsRight = can.includes("read_confidential");
|
|
41473
|
+
if (opts.confidential && !holdsRight) {
|
|
41474
|
+
throw expected(`This machine's authorization on case ${detail.code} does not hold the Confidential right, so --confidential reads nothing more. Run it without --confidential.`);
|
|
41475
|
+
}
|
|
41476
|
+
if (!opts.confidential && holdsRight) throw expected(SKELETON_CONFIDENTIAL_REQUIRED);
|
|
41477
|
+
const mirror = mirrorFolder(clone.root);
|
|
41478
|
+
if (!mirror) throw undelivered();
|
|
41479
|
+
const phaseFolders = detail.phases.map((p) => p.folder);
|
|
41480
|
+
assertClonePaths(clone.root, clone.record, phaseFolders);
|
|
41481
|
+
const phase = findPhase(detail, opts.phase);
|
|
41482
|
+
const work = (await call(session, () => session.api.getCasePhaseWork(session.connection, phase.phase_id))).data;
|
|
41483
|
+
const outputs = opts.output === void 0 ? work.outputs : work.outputs.filter((o) => o.code === opts.output);
|
|
41484
|
+
if (opts.output !== void 0 && outputs.length === 0) {
|
|
41485
|
+
throw expected(`Phase ${phase.folder} has no output ${JSON.stringify(sanitizeTerminalText(opts.output))}. Its outputs: ${work.outputs.map((o) => one2(o.code)).join(", ") || "none"}.`);
|
|
41486
|
+
}
|
|
41487
|
+
const plans = await withMirrorLock(clone.root, async () => {
|
|
41488
|
+
const pkg2 = deliveredPackage(clone.root, mirror);
|
|
41489
|
+
if (pkg2.manifest === void 0) throw undelivered();
|
|
41490
|
+
if (opts.confidential && pkg2.manifest !== null && !pkg2.manifest.confidential) {
|
|
41491
|
+
throw expected(`The mirror's package was written without --confidential, so it holds no confidential template: run \`${pull}\`, then skeleton again.`);
|
|
41492
|
+
}
|
|
41493
|
+
const problems2 = [];
|
|
41494
|
+
const casePath2 = (rel, twin) => {
|
|
41495
|
+
const checked = checkCaseFilePath({ path: rel, type: "file" }, [phase.folder]);
|
|
41496
|
+
return checked.ok && checked.area === "phase" && !checked.received && checked.confidential_path === twin;
|
|
41497
|
+
};
|
|
41498
|
+
if (!CASE_PHASE_FOLDER_PATTERN.test(phase.folder)) problems2.push(`the phase's folder ${JSON.stringify(sanitizeTerminalText(phase.folder))} is no phase folder`);
|
|
41499
|
+
const planned = outputs.map((output) => {
|
|
41500
|
+
const code2 = one2(output.code);
|
|
41501
|
+
const bad = output.file_paths.filter((p) => !casePath2(p.endsWith("/") ? `${p}${CASE_COMPOSED_COVER}` : p, false));
|
|
41502
|
+
for (const p of bad) problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(p))} is no path of this phase a document can be written at`);
|
|
41503
|
+
if (bad.length) return null;
|
|
41504
|
+
if (output.format === "file") return { code: code2, skipped: "a file piece, sent as it comes: it has no items to start from" };
|
|
41505
|
+
if (output.dispensation) return { code: code2, skipped: "dispensed" };
|
|
41506
|
+
const items = work.items.filter((i) => i.output_id === output.id && !i.dispensation);
|
|
41507
|
+
const malformed = items.filter((i) => !CASE_CODE_PATTERN.test(i.code));
|
|
41508
|
+
for (const i of malformed) problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(i.code))} is no item code`);
|
|
41509
|
+
if (malformed.length) return null;
|
|
41510
|
+
if (items.length === 0) return { code: code2, skipped: "no item to start from" };
|
|
41511
|
+
const bound = output.file_paths.find((p) => p.endsWith(".md") || p.endsWith("/"));
|
|
41512
|
+
if (bound === void 0) return { code: code2, skipped: "it binds no Markdown file or folder of chapters" };
|
|
41513
|
+
const held = output.file_paths.flatMap((p) => opts.confidential ? [p, `conf/${p}`] : [p]).find((p) => documentHere(clone.root, clone.record, p));
|
|
41514
|
+
if (held !== void 0) return { code: code2, skipped: `its document is already here, at ${sanitizeTerminalText(held)}` };
|
|
41515
|
+
const skeletonItems = items.map((item) => {
|
|
41516
|
+
let template = null;
|
|
41517
|
+
if (item.own === null && !item.grouping && item.template_mode !== "fixed") {
|
|
41518
|
+
const rel = `templates/${phase.folder}/${item.code}.md`;
|
|
41519
|
+
const file = pkg2.file(rel);
|
|
41520
|
+
if (file.state !== "unlisted" && file.confidential && !opts.confidential) {
|
|
41521
|
+
problems2.push(`item ${one2(item.code)} of output ${code2}: its template is confidential, used only with --confidential`);
|
|
41522
|
+
} else if (file.state === "ok") {
|
|
41523
|
+
template = file.bytes.toString("utf-8");
|
|
41524
|
+
} else if (file.state !== "unlisted") {
|
|
41525
|
+
const what = file.state === "changed" ? "changed here since the pull" : file.state === "missing" ? "missing here" : "not delivered by the last pull";
|
|
41526
|
+
problems2.push(`${CASE_MIRROR_DIR}/${CASE_PACKAGE_DIR}/${rel}: ${what}; a template that differs from the published manifest is never used`);
|
|
41527
|
+
}
|
|
41528
|
+
}
|
|
41529
|
+
return { ...item, template };
|
|
41530
|
+
});
|
|
41531
|
+
const input = { case_code: detail.code, document_type: output.document_type, items: skeletonItems, attributes: detail.attributes ?? {} };
|
|
41532
|
+
const base = opts.confidential ? `conf/${bound}` : bound;
|
|
41533
|
+
const made = skeletonFiles(input, base);
|
|
41534
|
+
for (const f of made.files.filter((f2) => !casePath2(f2.rel, opts.confidential))) {
|
|
41535
|
+
problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(f.rel))} is no path a document can be written at`);
|
|
41536
|
+
}
|
|
41537
|
+
return { code: code2, path: base, files: made.files, items: items.length, missing: made.missing };
|
|
41538
|
+
});
|
|
41539
|
+
if (problems2.length) {
|
|
41540
|
+
throw expected(`Nothing was written:
|
|
41541
|
+
${[...new Set(problems2)].join("\n ")}
|
|
41542
|
+
\`${pull}\` writes the published package again.`);
|
|
41543
|
+
}
|
|
41544
|
+
return planned.filter((p) => p !== null);
|
|
41545
|
+
});
|
|
41546
|
+
console.log(`Skeleton of ${phase.folder}${opts.output ? `, output ${one2(opts.output)}` : ""}:`);
|
|
41547
|
+
let wrote = false;
|
|
41548
|
+
for (const plan of plans) {
|
|
41549
|
+
if ("skipped" in plan) {
|
|
41550
|
+
console.log(` ${plan.code}: skipped, ${plan.skipped}.`);
|
|
41551
|
+
continue;
|
|
41552
|
+
}
|
|
41553
|
+
const written = plan.files.filter((f) => writeCaseLocalFile(clone.root, f.rel, Buffer.from(f.text, "utf-8"), { create: true }) === "written");
|
|
41554
|
+
if (written.length === 0) {
|
|
41555
|
+
console.log(` ${plan.code}: skipped, its document appeared at ${sanitizeTerminalText(plan.path)} while this ran.`);
|
|
41556
|
+
continue;
|
|
41557
|
+
}
|
|
41558
|
+
wrote = true;
|
|
41559
|
+
const fills = written.reduce((n, f) => n + fillsIn(f.text), 0);
|
|
41560
|
+
const chapters = plan.path.endsWith("/") ? `, in ${written.length - 1} chapter${written.length === 2 ? "" : "s"}` : "";
|
|
41561
|
+
console.log(` ${plan.code}: wrote ${sanitizeTerminalText(plan.path)}, ${plan.items} item${plan.items === 1 ? "" : "s"}${chapters}, ${fills} to fill.`);
|
|
41562
|
+
for (const f of plan.files.filter((f2) => !written.includes(f2))) console.log(` ${sanitizeTerminalText(f.rel)} appeared while this ran: left as it is.`);
|
|
41563
|
+
if (plan.missing.length) console.log(` Attributes the case holds no value for, left as {{fill: \u2026}}: ${plan.missing.map(one2).join(", ")}.`);
|
|
41564
|
+
}
|
|
41565
|
+
if (wrote) console.log("Replace each {{fill: \u2026}} with its text, then push.");
|
|
41566
|
+
}
|
|
41567
|
+
var NOTE_PAGES_READ, NOTES_PAGE, AGENDA_PAGES_READ2, one2, loadCase, loadState, phaseLabel, statusWords, CaseNames, AWAITING, readsWork, PHASES_VIEW_NOTE, noteLine, blockerKey, SKELETON_CONFIDENTIAL_REQUIRED;
|
|
40923
41568
|
var init_case_work = __esm({
|
|
40924
41569
|
"src/cases/case-work.ts"() {
|
|
40925
41570
|
"use strict";
|
|
@@ -40931,6 +41576,10 @@ var init_case_work = __esm({
|
|
|
40931
41576
|
init_case_clone_record();
|
|
40932
41577
|
init_case_mirror();
|
|
40933
41578
|
init_case_package();
|
|
41579
|
+
init_case_skeleton();
|
|
41580
|
+
init_case_item_reader();
|
|
41581
|
+
init_case_file_paths();
|
|
41582
|
+
init_case_types();
|
|
40934
41583
|
init_case_notes();
|
|
40935
41584
|
init_case_checks();
|
|
40936
41585
|
init_case_received_documents();
|
|
@@ -41014,6 +41663,7 @@ var init_case_work = __esm({
|
|
|
41014
41663
|
return "";
|
|
41015
41664
|
}
|
|
41016
41665
|
};
|
|
41666
|
+
SKELETON_CONFIDENTIAL_REQUIRED = "This machine's authorization holds the Confidential right, so the phase's items WayAI answers it may include confidential ones, which nothing marks: a document at an open path could carry them. Run skeleton with --confidential, which writes the documents under conf/.";
|
|
41017
41667
|
}
|
|
41018
41668
|
});
|
|
41019
41669
|
|
|
@@ -41638,7 +42288,7 @@ async function pullFiles(opts) {
|
|
|
41638
42288
|
}
|
|
41639
42289
|
removeLocal(dir, rel);
|
|
41640
42290
|
delete record.files[rel];
|
|
41641
|
-
changes.push(`${
|
|
42291
|
+
changes.push(`${MARK2.delete} ${safe4(rel)}`);
|
|
41642
42292
|
}
|
|
41643
42293
|
for (const w of plan.writes) {
|
|
41644
42294
|
const clash = diskClash(dir, w.rel);
|
|
@@ -41671,7 +42321,7 @@ async function pullFiles(opts) {
|
|
|
41671
42321
|
const hash2 = computeHash(bytes);
|
|
41672
42322
|
writeLocal(dir, w.rel, bytes);
|
|
41673
42323
|
record.files[w.rel] = { version, content_sha256: hash2 };
|
|
41674
|
-
changes.push(`${local.has(w.rel) ?
|
|
42324
|
+
changes.push(`${local.has(w.rel) ? MARK2.update : MARK2.create} ${safe4(w.rel)}`);
|
|
41675
42325
|
}
|
|
41676
42326
|
} finally {
|
|
41677
42327
|
writeRecord(dir, record);
|
|
@@ -41705,11 +42355,11 @@ async function describeSteps(client, t, dir, steps) {
|
|
|
41705
42355
|
for (const step of steps) {
|
|
41706
42356
|
const rel = safe4(step.rel);
|
|
41707
42357
|
if (step.op === "create") {
|
|
41708
|
-
lines.push(`${
|
|
42358
|
+
lines.push(`${MARK2.create} ${rel} (new, ${step.local.size} bytes)`);
|
|
41709
42359
|
} else if (step.op === "delete") {
|
|
41710
|
-
lines.push(`${
|
|
42360
|
+
lines.push(`${MARK2.delete} ${rel} (delete)`);
|
|
41711
42361
|
} else {
|
|
41712
|
-
lines.push(`${
|
|
42362
|
+
lines.push(`${MARK2.update} ${rel}`);
|
|
41713
42363
|
if (!isTextType(step.remote.content_type) || step.remote.size > MAX_DIFF_BYTES || step.local.size > MAX_DIFF_BYTES) {
|
|
41714
42364
|
lines.push(` (content changed: ${step.remote.size} \u2192 ${step.local.size} bytes)`);
|
|
41715
42365
|
continue;
|
|
@@ -41811,7 +42461,7 @@ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
|
|
|
41811
42461
|
};
|
|
41812
42462
|
}
|
|
41813
42463
|
pushed++;
|
|
41814
|
-
console.log(` ${
|
|
42464
|
+
console.log(` ${MARK2[step.op]} ${safe4(step.rel)}`);
|
|
41815
42465
|
} catch (err) {
|
|
41816
42466
|
if (step.op === "delete" && err instanceof ApiError && err.status === 404) {
|
|
41817
42467
|
delete record.files[step.rel];
|
|
@@ -41839,7 +42489,7 @@ function finishWithConflicts(t, dir, conflicts) {
|
|
|
41839
42489
|
`${count} conflict${count === 1 ? "" : "s"} not pushed \u2014 the base's copies of those files were left as they are. To settle them, ${remedy(conflicts, pullCommand2(t, dir, true))}, then push again.`
|
|
41840
42490
|
);
|
|
41841
42491
|
}
|
|
41842
|
-
var LIST_PAGE, MAX_LIST_PAGES, MAX_DIFF_BYTES,
|
|
42492
|
+
var LIST_PAGE, MAX_LIST_PAGES, MAX_DIFF_BYTES, MARK2, safe4, PULL_KEPT, PULL_CONFLICT, PUSH_CONFLICT;
|
|
41843
42493
|
var init_sync3 = __esm({
|
|
41844
42494
|
"src/data/files-sync/sync.ts"() {
|
|
41845
42495
|
"use strict";
|
|
@@ -41860,7 +42510,7 @@ var init_sync3 = __esm({
|
|
|
41860
42510
|
LIST_PAGE = 1e3;
|
|
41861
42511
|
MAX_LIST_PAGES = 1e3;
|
|
41862
42512
|
MAX_DIFF_BYTES = 256 * 1024;
|
|
41863
|
-
|
|
42513
|
+
MARK2 = { create: "+", update: "~", delete: "-" };
|
|
41864
42514
|
safe4 = (rel) => sanitizeTerminalText(rel);
|
|
41865
42515
|
PULL_KEPT = {
|
|
41866
42516
|
edited: "edited in your files, not pushed yet",
|
|
@@ -42056,7 +42706,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
42056
42706
|
conflicts.push({ rel, reason: "unresolved" });
|
|
42057
42707
|
} else if (matchesScan(root, rel, local.get(rel))) {
|
|
42058
42708
|
removeLocal(root, rel);
|
|
42059
|
-
changes.push(`${
|
|
42709
|
+
changes.push(`${MARK2.delete} ${safe5(rel)}`);
|
|
42060
42710
|
} else {
|
|
42061
42711
|
conflicts.push({ rel, reason: "edited_while_pulling" });
|
|
42062
42712
|
}
|
|
@@ -42068,7 +42718,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
42068
42718
|
}
|
|
42069
42719
|
removeLocal(root, rel);
|
|
42070
42720
|
delete next.files[rel];
|
|
42071
|
-
changes.push(`${
|
|
42721
|
+
changes.push(`${MARK2.delete} ${safe5(rel)}`);
|
|
42072
42722
|
}
|
|
42073
42723
|
for (const w of plan.writes) {
|
|
42074
42724
|
const clash = diskClash(root, w.rel);
|
|
@@ -42084,7 +42734,7 @@ async function pullInto(calls, detail, record, opts) {
|
|
|
42084
42734
|
}
|
|
42085
42735
|
writeCaseLocalFile(root, w.rel, Buffer.from(bytes));
|
|
42086
42736
|
next.files[w.rel] = recordedFile(listed3.get(w.rel));
|
|
42087
|
-
changes.push(`${local.has(w.rel) ?
|
|
42737
|
+
changes.push(`${local.has(w.rel) ? MARK2.update : MARK2.create} ${safe5(w.rel)}`);
|
|
42088
42738
|
}
|
|
42089
42739
|
for (const c of plan.conflicts) {
|
|
42090
42740
|
if (c.reason === "both_changed" || c.reason === "exists_locally") {
|
|
@@ -42129,17 +42779,6 @@ ${CONFIDENTIAL_NOTICE}`);
|
|
|
42129
42779
|
mode: opts.verb === "Cloned" ? "clone" : "pull"
|
|
42130
42780
|
}));
|
|
42131
42781
|
}
|
|
42132
|
-
function cloneAt(dir) {
|
|
42133
|
-
if (dir !== void 0) {
|
|
42134
|
-
const root = caseLocalRoot(dir);
|
|
42135
|
-
const record = readCloneRecord(root);
|
|
42136
|
-
if (!record) throw expected(`${safe5(dir)} is not a case clone: it holds no ${CASE_CLONE_RECORD_FILE}. Clone the case with \`wayai cases clone\`.`);
|
|
42137
|
-
return { root, record };
|
|
42138
|
-
}
|
|
42139
|
-
const clone = findCaseClone(process.cwd());
|
|
42140
|
-
if (!clone) throw expected("This folder is not inside a case clone. Run `wayai cases clone`, or name the clone with --dir.");
|
|
42141
|
-
return clone;
|
|
42142
|
-
}
|
|
42143
42782
|
async function cloneSession(root) {
|
|
42144
42783
|
return openCaseSession({}, Date.now(), root);
|
|
42145
42784
|
}
|
|
@@ -42309,7 +42948,7 @@ Nothing was pushed.`
|
|
|
42309
42948
|
const { synced: synced2, local: localIn, remote, listed: listed3 } = sidesOf(recordIn, local, files, opts.confidential);
|
|
42310
42949
|
const plan = planPush({ synced: synced2, local: localIn, remote, prune: opts.prune });
|
|
42311
42950
|
console.log(safe5(`Push ${root} \u2192 case ${record.code}`));
|
|
42312
|
-
const steps = plan.steps.map((s) => `${
|
|
42951
|
+
const steps = plan.steps.map((s) => `${MARK2[s.op]} ${safe5(s.rel)}${s.op === "create" ? ` (new, ${s.local.size} bytes)` : ""}`);
|
|
42313
42952
|
printSection("Changes:", steps);
|
|
42314
42953
|
printSection("Changed on the case since your last pull: left as is; pull to take it:", plan.changedOnBase.map(safe5));
|
|
42315
42954
|
printSection("Deleted on the case since your last pull, or no longer readable here: left as is; pull to remove your copy:", plan.deletedOnBase.map(safe5));
|
|
@@ -43189,6 +43828,16 @@ async function casesCommand(args2) {
|
|
|
43189
43828
|
const dir = values.dir ?? (clone && sameCase(clone.record, session.connection) ? clone.root : process.cwd());
|
|
43190
43829
|
return caseDecisions(session, { dir, confidential: values.confidential === true });
|
|
43191
43830
|
}
|
|
43831
|
+
case "skeleton": {
|
|
43832
|
+
takesNone();
|
|
43833
|
+
if (values.phase === void 0) throw usageError4("skeleton takes --phase <folder>.");
|
|
43834
|
+
const clone = cloneAt(values.dir);
|
|
43835
|
+
return caseSkeleton(await openCaseSession({}, Date.now(), clone.root), clone, {
|
|
43836
|
+
phase: values.phase,
|
|
43837
|
+
output: values.output,
|
|
43838
|
+
confidential: values.confidential === true
|
|
43839
|
+
});
|
|
43840
|
+
}
|
|
43192
43841
|
case "clone":
|
|
43193
43842
|
takesNone();
|
|
43194
43843
|
return caseClone(selector, { dir: values.dir, confidential: values.confidential === true });
|
|
@@ -43492,6 +44141,8 @@ Usage:
|
|
|
43492
44141
|
wayai cases explain [--phase <folder>] [--json]
|
|
43493
44142
|
wayai cases check [--phase <folder> [--output <code>]] [--json]
|
|
43494
44143
|
wayai cases decisions [--dir <folder>] [--confidential]
|
|
44144
|
+
wayai cases skeleton --phase <folder> [--output <code>] [--dir <clone>]
|
|
44145
|
+
[--confidential]
|
|
43495
44146
|
wayai cases note "<text>" [--kind observation|next_step|pending|contribution]
|
|
43496
44147
|
[--phase <folder>] [--task <task_id>] [--origin <who sent it>]
|
|
43497
44148
|
wayai cases note done <note_id>
|
|
@@ -43574,6 +44225,18 @@ decisions Write the approved decisions to analysis/decisions.csv under --dir
|
|
|
43574
44225
|
(default: the clone's root inside a clone of the case, else this
|
|
43575
44226
|
folder). With --confidential, a confidential group's
|
|
43576
44227
|
go to conf/analysis/decisions.csv, if the case lets you read them.
|
|
44228
|
+
skeleton Write the starting document of each of a phase's outputs into the
|
|
44229
|
+
clone (--dir, default the clone you are in), at the path its type
|
|
44230
|
+
binds: its items' headings and anchors, a fixed item's text, and
|
|
44231
|
+
each item's template from the case's package in the mirror, the
|
|
44232
|
+
case's attributes filled in; what is left to write is marked
|
|
44233
|
+
{{fill: \u2026}}. It never overwrites: an output whose document is
|
|
44234
|
+
already here is skipped. A template that differs from the
|
|
44235
|
+
published manifest refuses the run. --output names one output.
|
|
44236
|
+
An authorization holding the Confidential right needs
|
|
44237
|
+
--confidential, which writes the documents under conf/ with the
|
|
44238
|
+
confidential templates a \`pull --mirror-only --confidential\`
|
|
44239
|
+
delivered.
|
|
43577
44240
|
note Add a note (an observation unless --kind says otherwise). A
|
|
43578
44241
|
contribution names who sent it (--origin).
|
|
43579
44242
|
note done Mark a pending item or next step done.
|
|
@@ -43652,6 +44315,8 @@ need it.
|
|
|
43652
44315
|
explain: [...SELECT, "json", "phase"],
|
|
43653
44316
|
check: [...SELECT, "json", "phase", "output"],
|
|
43654
44317
|
decisions: [...SELECT, "dir", "confidential"],
|
|
44318
|
+
// A clone names its case, as for pull: skeleton writes into the clone (--dir), never a case.
|
|
44319
|
+
skeleton: ["dir", "phase", "output", "confidential"],
|
|
43655
44320
|
note: [...SELECT, "kind", "phase", "task", "origin"],
|
|
43656
44321
|
"note done": SELECT,
|
|
43657
44322
|
"received add": [...SELECT, "text", "phase", "type", "title", "confidential"],
|