@open-wa/schema 5.9.7 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/index.cjs +1 -1
- package/dist/generated/index.d.cts +141 -581
- package/dist/generated/index.d.cts.map +1 -1
- package/dist/generated/index.d.mts +141 -581
- package/dist/generated/index.d.mts.map +1 -1
- package/dist/generated/index.mjs +1 -1
- package/dist/{index-BR61SSKs.d.cts → index-BETdayaV.d.cts} +51 -231
- package/dist/index-BETdayaV.d.cts.map +1 -0
- package/dist/{index-j2GMQzWY.d.mts → index-DH0WRSA7.d.mts} +51 -231
- package/dist/index-DH0WRSA7.d.mts.map +1 -0
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{interactive-DxUwKpzK.d.cts → interactive-BE_M4nur.d.cts} +14 -6
- package/dist/interactive-BE_M4nur.d.cts.map +1 -0
- package/dist/{interactive-DxUwKpzK.d.mts → interactive-BE_M4nur.d.mts} +14 -6
- package/dist/interactive-BE_M4nur.d.mts.map +1 -0
- package/dist/interactive-ClvvgmVP.cjs +630 -0
- package/dist/interactive-ClvvgmVP.cjs.map +1 -0
- package/dist/interactive-Dec4HB2U.mjs +475 -0
- package/dist/interactive-Dec4HB2U.mjs.map +1 -0
- package/dist/interactive.cjs +26 -304
- package/dist/interactive.d.cts +2 -2
- package/dist/interactive.d.mts +2 -2
- package/dist/interactive.mjs +2 -283
- package/dist/methods/index.cjs +1 -1
- package/dist/methods/index.d.cts +1 -1
- package/dist/methods/index.d.mts +1 -1
- package/dist/methods/index.mjs +1 -1
- package/dist/{methods-D4XLSUxh.cjs → methods-9kRJiEdZ.cjs} +12 -77
- package/dist/methods-9kRJiEdZ.cjs.map +1 -0
- package/dist/{methods-CpeSpB2P.mjs → methods-NixIgGkq.mjs} +4 -63
- package/dist/methods-NixIgGkq.mjs.map +1 -0
- package/package.json +3 -3
- package/src/__tests__/booking-time.contract.test.ts +88 -0
- package/src/booking-time.ts +39 -0
- package/src/common-types.ts +1 -1
- package/src/effect-projection.ts +90 -47
- package/src/generated/asyncapi.json +191 -89
- package/src/generated/openapi.json +1675 -1307
- package/src/interactive.ts +12 -1
- package/src/methods/calls.ts +2 -2
- package/dist/index-BR61SSKs.d.cts.map +0 -1
- package/dist/index-j2GMQzWY.d.mts.map +0 -1
- package/dist/interactive-DxUwKpzK.d.cts.map +0 -1
- package/dist/interactive-DxUwKpzK.d.mts.map +0 -1
- package/dist/interactive.cjs.map +0 -1
- package/dist/interactive.mjs.map +0 -1
- package/dist/methods-CpeSpB2P.mjs.map +0 -1
- package/dist/methods-D4XLSUxh.cjs.map +0 -1
|
@@ -1,67 +1,8 @@
|
|
|
1
1
|
import { d as parameterRegistry, o as defineMethodV2 } from "./registry-BIddXpin.mjs";
|
|
2
|
-
import { InteractiveContentSchema, JsonObjectSchema } from "./interactive.mjs";
|
|
2
|
+
import { E as projectEffectSchema, f as InteractiveContentSchema, h as JsonObjectSchema } from "./interactive-Dec4HB2U.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { Schema } from "effect";
|
|
5
5
|
import { assertFile, getDUrl } from "@open-wa/utils";
|
|
6
|
-
//#region src/effect-projection.ts
|
|
7
|
-
/** Project Effect contracts into the serving method and listener registry. */
|
|
8
|
-
function projectEffectSchema(schema) {
|
|
9
|
-
if ("fields" in schema) {
|
|
10
|
-
const fields = schema.fields;
|
|
11
|
-
const shape = Object.fromEntries(Object.entries(fields).map(([name, field]) => {
|
|
12
|
-
const optional = field.ast.context?.isOptional === true;
|
|
13
|
-
const hasUndefined = field.ast._tag === "Union" && field.ast.types.some((member) => member._tag === "Undefined");
|
|
14
|
-
const value = projectEffectSchema(!optional ? field : hasUndefined ? Schema.required(field) : Schema.requiredKey(field));
|
|
15
|
-
return [name, optional ? value.optional() : value];
|
|
16
|
-
}));
|
|
17
|
-
return z.object(shape);
|
|
18
|
-
}
|
|
19
|
-
const document = Schema.toJsonSchemaDocument(schema);
|
|
20
|
-
const project = (node) => {
|
|
21
|
-
if (node.$ref) {
|
|
22
|
-
const key = node.$ref.split("/").at(-1);
|
|
23
|
-
return project(document.definitions[key]);
|
|
24
|
-
}
|
|
25
|
-
if ("const" in node) return z.literal(node.const);
|
|
26
|
-
if (node.enum) return z.union(node.enum.map((value) => z.literal(value)));
|
|
27
|
-
const members = node.anyOf ?? node.oneOf;
|
|
28
|
-
if (members) return z.union(members.map(project));
|
|
29
|
-
switch (node.type) {
|
|
30
|
-
case "string": {
|
|
31
|
-
let value = z.string();
|
|
32
|
-
if (node.minLength !== void 0) value = value.min(node.minLength);
|
|
33
|
-
if (node.maxLength !== void 0) value = value.max(node.maxLength);
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
case "number":
|
|
37
|
-
case "integer": {
|
|
38
|
-
let value = node.type === "integer" ? z.number().int() : z.number();
|
|
39
|
-
if (node.minimum !== void 0) value = value.min(node.minimum);
|
|
40
|
-
if (node.maximum !== void 0) value = value.max(node.maximum);
|
|
41
|
-
if (node.exclusiveMinimum !== void 0) value = value.gt(node.exclusiveMinimum);
|
|
42
|
-
if (node.exclusiveMaximum !== void 0) value = value.lt(node.exclusiveMaximum);
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
case "boolean": return z.boolean();
|
|
46
|
-
case "null": return z.null();
|
|
47
|
-
case "array": return z.array(project(node.items ?? {}));
|
|
48
|
-
case "object": {
|
|
49
|
-
const properties = node.properties ?? {};
|
|
50
|
-
const values = typeof node.additionalProperties === "object" ? project(node.additionalProperties) : node.additionalProperties ? z.unknown() : void 0;
|
|
51
|
-
if (!Object.keys(properties).length && values) return z.record(z.string(), values);
|
|
52
|
-
const required = new Set(node.required ?? []);
|
|
53
|
-
const object = z.object(Object.fromEntries(Object.entries(properties).map(([key, value]) => {
|
|
54
|
-
const field = project(value);
|
|
55
|
-
return [key, required.has(key) ? field : field.optional()];
|
|
56
|
-
})));
|
|
57
|
-
return values ? object.catchall(values) : object;
|
|
58
|
-
}
|
|
59
|
-
default: return z.unknown();
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
return project(document.schema);
|
|
63
|
-
}
|
|
64
|
-
//#endregion
|
|
65
6
|
//#region src/whatsapp-events.ts
|
|
66
7
|
const id = Schema.String.check(Schema.isMinLength(1));
|
|
67
8
|
const seconds = Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(2147483647));
|
|
@@ -392,7 +333,7 @@ const ContactSchema = z.object({
|
|
|
392
333
|
msgs: z.array(z.unknown()).nullable().optional(),
|
|
393
334
|
profilePicThumbObj: z.object({
|
|
394
335
|
eurl: z.string().optional(),
|
|
395
|
-
id:
|
|
336
|
+
id: ContactIdSchema$1.optional().describe("Serialized contact ID returned by the profile-picture serializer"),
|
|
396
337
|
img: z.string().optional(),
|
|
397
338
|
imgFull: z.string().optional(),
|
|
398
339
|
tag: z.string().optional()
|
|
@@ -3626,6 +3567,6 @@ const respondToEvent = defineMethodV2("respondToEvent", {
|
|
|
3626
3567
|
output: z.boolean()
|
|
3627
3568
|
});
|
|
3628
3569
|
//#endregion
|
|
3629
|
-
export { getBusinessProfile as $, StorySchema as $i, sendSeen as $n, UnixSecondsToDateSchema as $r, archiveChat as $t, sendInteractive as A, validateEventInput as Aa, BusinessProfileSchema as Ai, getUnsentMessages as An, nameParam as Ar, joinGroupViaLink as At, getLoadedMessageCount as B, GroupCreationResultSchema as Bi, sendContact as Bn, Base64ToDataUrlSchema as Br, setGroupToAdminsOnly as Bt, CallMediaOptionsSchema as C, WhatsAppEventSchema as Ca, AutoMediaSendOptionsSchema as Ci, getAllMessages as Cn, latitudeParam as Cr, getAllGroups as Ct, RawAudioFormatSchema as D, deserializeWhatsAppEvent as Da, MediaSendOptionsSchema as Di, getMyLastMessage as Dn, messageIdParam as Dr, getGroupMembers as Dt, MediaDescriptorSchema as E, deserializeEventResponse as Ea, ImageSendOptionsSchema as Ei, getMessagesForLLM as En, mentionedJidListParam as Er, getGroupInviteLink as Et, getConnectionState as F, CommunityMetadataSchema as Fi, sendAdvancedButtons as Fn, toParam as Fr, revokeGroupInviteLink as Ft, getWAVersion as G, LicenseTypeSchema as Gi, sendListMessage as Gn, FileToDataUrlSchema as Gr, getBlockedIds as Gt, getProcessStats as H, HostAccountSchema as Hi, sendFileFromUrl as Hn, ChatIdSchema as Hr, checkNumberStatus as Ht, getFeatures as I, CommunityParticipantIdsSchema as Ii, sendAlbum as In, userAgentParam as Ir, setGroupDescription as It, setMyName as J, NumberCheckSchema as Ji, sendMultipleContacts as Jn, HexColorSchema as Jr, getNumberProfile as Jt, healthCheck as K, MessageInfoSchema as Ki, sendLocation as Kn, GroupIdCodecSchema as Kr, getCommonGroups as Kt, getHostNumber as L, CommunityParticipantsSchema as Li, sendAudio as Ln, videoDataParam as Lr, setGroupEditToAdminsOnly as Lt, decryptMedia as M,
|
|
3570
|
+
export { getBusinessProfile as $, StorySchema as $i, sendSeen as $n, UnixSecondsToDateSchema as $r, archiveChat as $t, sendInteractive as A, validateEventInput as Aa, BusinessProfileSchema as Ai, getUnsentMessages as An, nameParam as Ar, joinGroupViaLink as At, getLoadedMessageCount as B, GroupCreationResultSchema as Bi, sendContact as Bn, Base64ToDataUrlSchema as Br, setGroupToAdminsOnly as Bt, CallMediaOptionsSchema as C, WhatsAppEventSchema as Ca, AutoMediaSendOptionsSchema as Ci, getAllMessages as Cn, latitudeParam as Cr, getAllGroups as Ct, RawAudioFormatSchema as D, deserializeWhatsAppEvent as Da, MediaSendOptionsSchema as Di, getMyLastMessage as Dn, messageIdParam as Dr, getGroupMembers as Dt, MediaDescriptorSchema as E, deserializeEventResponse as Ea, ImageSendOptionsSchema as Ei, getMessagesForLLM as En, mentionedJidListParam as Er, getGroupInviteLink as Et, getConnectionState as F, CommunityMetadataSchema as Fi, sendAdvancedButtons as Fn, toParam as Fr, revokeGroupInviteLink as Ft, getWAVersion as G, LicenseTypeSchema as Gi, sendListMessage as Gn, FileToDataUrlSchema as Gr, getBlockedIds as Gt, getProcessStats as H, HostAccountSchema as Hi, sendFileFromUrl as Hn, ChatIdSchema as Hr, checkNumberStatus as Ht, getFeatures as I, CommunityParticipantIdsSchema as Ii, sendAlbum as In, userAgentParam as Ir, setGroupDescription as It, setMyName as J, NumberCheckSchema as Ji, sendMultipleContacts as Jn, HexColorSchema as Jr, getNumberProfile as Jt, healthCheck as K, MessageInfoSchema as Ki, sendLocation as Kn, GroupIdCodecSchema as Kr, getCommonGroups as Kt, getHostNumber as L, CommunityParticipantsSchema as Li, sendAudio as Ln, videoDataParam as Lr, setGroupEditToAdminsOnly as Lt, decryptMedia as M, CommonGroupSchema as Mi, loadEarlierMessages as Mn, skipMyMessagesParam as Mr, promoteParticipant as Mt, downloadMedia as N, CommunityAdminIdsSchema as Ni, pinMessage as Nn, statusTextParam as Nr, rejectGroupJoinRequest as Nt, SendInteractiveInputSchema as O, serializeEventResponse as Oa, VideoSendOptionsSchema as Oi, getPollResults as On, messageIdsParam as Or, getGroupMembersId as Ot, getBatteryLevel as P, CommunityAdminsSchema as Pi, react as Pn, stickerDataParam as Pr, removeParticipant as Pt, getBusinessProducts as Q, ProductSchema as Qi, sendReplyWithMentions as Qn, UnixMillisToDateSchema as Qr, unblockContact as Qt, getLicenseFeatures as R, ContactStatusSchema as Ri, sendBanner as Rn, waitForIdParam as Rr, setGroupIcon as Rt, CallIdentitySchema as S, EventUpdateSchema as Sa, AudioSendOptionsSchema as Si, getAlbumMessages as Sn, includeNotificationsParam as Sr, demoteParticipant as St, CallSnapshotSchema as T, decodeWhatsAppEvent as Ta, GifSendOptionsSchema as Ti, getMessageInfo as Tn, longitudeParam as Tr, getGroupInfo as Tt, getSnapshot as U, LLMMessageSchema as Ui, sendImage as Un, ContactIdCodecSchema as Ur, checkReadReceipts as Ut, getMe as V, HealthCheckSchema as Vi, sendFile as Vn, ChatIdCodecSchema as Vr, blockContact as Vt, getUserAgent as W, LabelSchema as Wi, sendLinkWithAutoPreview as Wn, ContactIdSchema as Wr, getAllContacts as Wt, setProfilePicture as X, OrderSchema as Xi, sendPoll as Xn, MessageIdCodecSchema as Xr, requestPhoneNumber as Xt, setMyStatus as Y, NumberProfileSchema as Yi, sendPaymentRequest as Yn, IsoDatetimeToDateSchema as Yr, getProfilePicture as Yt, LicenseFeaturesSchema as Z, ProcessStatsSchema as Zi, sendPtt as Zn, MessageIdSchema as Zr, sharePhoneNumber as Zt, startCall as _, EventInputSchema as _a, PinDurationSchema as _i, SendTextResultSchema as _n, fileDataParam as _r, getCommunityParticipants as _t, getEvents as a, GroupIdSchema$1 as aa, fileToBufferCodec as ai, getChatWithNonContacts as an, sendYouTubeLink as ar, deleteAllStatus as at, CallCapabilitiesSchema as b, EventResponseSchema as ba, PollVoteSchema as bi, editMessage as bn, imageDataParam as br, approveGroupJoinRequest as bt, acceptCall as c, LocationSchema as ca, fileToTempPathCodec as ci, markAsUnread as cn, unstarMessage as cr, getStories as ct, getActiveCall as d, MessageSchema as da, isoDatetimeToDate as di, setChatEphemeral as dn, captionParam as dr, postVideoStatus as dt, ChatSchema as ea, base64ToDataUrlCodec as ei, clearChat as en, sendSticker as er, getOrder as et, getCallCapabilities as f, MessageTypes as fa, jsonStringCodec as fi, unarchiveChat as fn, chatIdParam as fr, getAllCommunities as ft, setCallMedia as g, WhatsAppEventRegistrySchema as ga, urlToDataUrlCodec as gi, AlbumSendResultSchema as gn, documentDataParam as gr, getCommunityParticipantIds as gt, rejectCall as h, EventResponseRegistrySchema as ha, unixSecondsToDate as hi, AlbumMediaSchema as hn, contentParam as hr, getCommunityInfo as ht, getEventResponses as i, GroupChatIdSchema as ia, fileToBase64Codec as ii, getChat as in, sendVideoAsGif as ir, removeLabel as it, sendRawMessage as j, validateEventUpdate as ja, CartItemSchema as ji, getVCards as jn, onlyLocalParam as jr, leaveGroup as jt, SendRawMessageInputSchema as k, serializeWhatsAppEvent as ka, VoiceNoteOptionsSchema as ki, getStarredMessages as kn, messageOptionsParam as kr, getKickedGroups as kt, clearCallAudio as l, MessageAck as la, groupIdCodec as li, muteChat as ln, voteOnPoll as lr, postImageStatus as lt, observeCallAudio as m, SimpleListener as ma, unixMillisToDate as mi, unpinChat as mn, contactIdParam as mr, getCommunityAdmins as mt, editEvent as n, ContactSchema as na, contactIdCodec as ni, getAllChatIds as nn, sendTextWithMentions as nr, getAllLabels as nt, respondToEvent as o, GroupMetadataSchema as oa, fileToDataUrlCodec as oi, isChatOnline as on, starMessage as or, deleteStatus as ot, muteCall as p, SerializedMessageIdSchema as pa, messageIdCodec as pi, unmuteChat as pn, communityIdParam as pr, getCommunityAdminIds as pt, isPlugged as q, MessageInteractionSchema as qi, sendMessageWithThumb as qn, GroupIdSchema as qr, getContact as qt, getEvent as r, DataURLSchema as ra, createFileCodec as ri, getAllChats as rn, sendVCard as rr, getChatsByLabel as rt, sendEvent as s, IdSchema as sa, fileToStreamCodec as si, markAsRead as sn, unpinMessage as sr, getStatus as st, cancelEvent as t, ContactIdSchema$1 as ta, chatIdCodec as ti, deleteChat as tn, sendText as tr, addLabel as tt, endCall as u, MessageIdReturnSchema as ua, hexColorCodec as ui, pinChat as un, audioDataParam as ur, postTextStatus as ut, stopCallAudioObserver as v, EventListOptionsSchema as va, PollResultsSchema as vi, StickerJobSchema as vn, filenameParam as vr, GroupInfoSchema as vt, CallReasonSchema as w, decodeEventResponse as wa, DocumentSendOptionsSchema as wi, getMessageById as wn, locationNameParam as wr, getGroupAdmins as wt, CallEndReasonSchema as x, EventResponseTypeSchema as xa, AudioAttachmentOptionsSchema as xi, forwardMessages as xn, includeMeParam as xr, createGroup as xt, CallActionResultSchema as y, EventPageSchema as ya, PollSendOptionsSchema as yi, deleteMessage as yn, groupIdParam as yr, addParticipant as yt, getLicenseType as z, FeatureFlagsSchema as zi, sendButtons as zn, withNewMessagesOnlyParam as zr, setGroupTitle as zt };
|
|
3630
3571
|
|
|
3631
|
-
//# sourceMappingURL=methods-
|
|
3572
|
+
//# sourceMappingURL=methods-NixIgGkq.mjs.map
|