spectrum-ts 1.1.0 → 1.1.1
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/{chunk-XMAI2AAN.js → chunk-7D6FHYKT.js} +51 -36
- package/dist/{chunk-7Q7KJKGL.js → chunk-7VSE6V3Q.js} +1 -1
- package/dist/{chunk-LAGNM6I7.js → chunk-TY3RT4OB.js} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/providers/imessage/index.d.ts +1 -1
- package/dist/providers/imessage/index.js +990 -614
- package/dist/providers/terminal/index.d.ts +1 -1
- package/dist/providers/terminal/index.js +2 -2
- package/dist/providers/whatsapp-business/index.d.ts +1 -1
- package/dist/providers/whatsapp-business/index.js +1 -1
- package/dist/{types-DJQLFwWW.d.ts → types-BZhWdyLk.d.ts} +1 -0
- package/package.json +1 -1
|
@@ -903,8 +903,54 @@ function buildMessage(params) {
|
|
|
903
903
|
throw err;
|
|
904
904
|
}
|
|
905
905
|
};
|
|
906
|
+
const requireBuiltMessage = (action) => {
|
|
907
|
+
if (!self) {
|
|
908
|
+
throw new Error(
|
|
909
|
+
`${action}() called before message construction completed (internal bug)`
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
return self;
|
|
913
|
+
};
|
|
914
|
+
const dispatchReplyItem = async (item, target, replyToMessage) => {
|
|
915
|
+
let sendResult;
|
|
916
|
+
try {
|
|
917
|
+
sendResult = await replyToMessage({
|
|
918
|
+
space: spaceRef,
|
|
919
|
+
messageId: params.id,
|
|
920
|
+
target,
|
|
921
|
+
content: item,
|
|
922
|
+
client,
|
|
923
|
+
config
|
|
924
|
+
});
|
|
925
|
+
} catch (err) {
|
|
926
|
+
if (err instanceof UnsupportedError) {
|
|
927
|
+
warnUnsupported(err, definition.name);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
throw err;
|
|
931
|
+
}
|
|
932
|
+
if (!sendResult?.id) {
|
|
933
|
+
throw new Error(
|
|
934
|
+
`Platform "${definition.name}" reply did not return a message id`
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
return buildMessage({
|
|
938
|
+
id: sendResult.id,
|
|
939
|
+
content: item,
|
|
940
|
+
sender: sendResult.sender,
|
|
941
|
+
timestamp: sendResult.timestamp ?? /* @__PURE__ */ new Date(),
|
|
942
|
+
extras: {},
|
|
943
|
+
spaceRef,
|
|
944
|
+
space,
|
|
945
|
+
definition,
|
|
946
|
+
client,
|
|
947
|
+
config,
|
|
948
|
+
direction: "outbound"
|
|
949
|
+
});
|
|
950
|
+
};
|
|
906
951
|
async function reply(...content) {
|
|
907
|
-
|
|
952
|
+
const replyToMessage = definition.actions.replyToMessage;
|
|
953
|
+
if (!replyToMessage) {
|
|
908
954
|
warnUnsupported(
|
|
909
955
|
UnsupportedError.action("reply", definition.name),
|
|
910
956
|
definition.name
|
|
@@ -912,44 +958,13 @@ function buildMessage(params) {
|
|
|
912
958
|
return content.length === 1 ? void 0 : [];
|
|
913
959
|
}
|
|
914
960
|
const resolved = await resolveContents(content);
|
|
961
|
+
const target = requireBuiltMessage("reply");
|
|
915
962
|
const results = [];
|
|
916
963
|
for (const item of resolved) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
space: spaceRef,
|
|
921
|
-
messageId: params.id,
|
|
922
|
-
content: item,
|
|
923
|
-
client,
|
|
924
|
-
config
|
|
925
|
-
});
|
|
926
|
-
} catch (err) {
|
|
927
|
-
if (err instanceof UnsupportedError) {
|
|
928
|
-
warnUnsupported(err, definition.name);
|
|
929
|
-
continue;
|
|
930
|
-
}
|
|
931
|
-
throw err;
|
|
932
|
-
}
|
|
933
|
-
if (!sendResult?.id) {
|
|
934
|
-
throw new Error(
|
|
935
|
-
`Platform "${definition.name}" reply did not return a message id`
|
|
936
|
-
);
|
|
964
|
+
const sent = await dispatchReplyItem(item, target, replyToMessage);
|
|
965
|
+
if (sent) {
|
|
966
|
+
results.push(sent);
|
|
937
967
|
}
|
|
938
|
-
results.push(
|
|
939
|
-
buildMessage({
|
|
940
|
-
id: sendResult.id,
|
|
941
|
-
content: item,
|
|
942
|
-
sender: sendResult.sender,
|
|
943
|
-
timestamp: sendResult.timestamp ?? /* @__PURE__ */ new Date(),
|
|
944
|
-
extras: {},
|
|
945
|
-
spaceRef,
|
|
946
|
-
space,
|
|
947
|
-
definition,
|
|
948
|
-
client,
|
|
949
|
-
config,
|
|
950
|
-
direction: "outbound"
|
|
951
|
-
})
|
|
952
|
-
);
|
|
953
968
|
}
|
|
954
969
|
if (content.length === 1) {
|
|
955
970
|
return results[0];
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readSchema,
|
|
4
4
|
resolveContents,
|
|
5
5
|
streamSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7D6FHYKT.js";
|
|
7
7
|
|
|
8
8
|
// src/content/group.ts
|
|
9
9
|
import z from "zod";
|
|
@@ -162,7 +162,7 @@ function richlink(url) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
export {
|
|
165
|
-
|
|
165
|
+
groupSchema,
|
|
166
166
|
group,
|
|
167
167
|
asRichlink,
|
|
168
168
|
richlink
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ContentBuilder, U as User, M as Message, a as ContentInput, b as Content, P as ProviderMessage, c as PlatformDef, d as Platform, e as PlatformProviderConfig, S as SpectrumLike, f as CustomEventStreams, g as Space, I as InboundMessage, O as OutboundMessage } from './types-
|
|
2
|
-
export { A as AnyPlatformDef, E as EventProducer, h as PlatformInstance, i as PlatformMessage, j as PlatformSpace, k as PlatformUser, l as SchemaMessage } from './types-
|
|
1
|
+
import { C as ContentBuilder, U as User, M as Message, a as ContentInput, b as Content, P as ProviderMessage, c as PlatformDef, d as Platform, e as PlatformProviderConfig, S as SpectrumLike, f as CustomEventStreams, g as Space, I as InboundMessage, O as OutboundMessage } from './types-BZhWdyLk.js';
|
|
2
|
+
export { A as AnyPlatformDef, E as EventProducer, h as PlatformInstance, i as PlatformMessage, j as PlatformSpace, k as PlatformUser, l as SchemaMessage } from './types-BZhWdyLk.js';
|
|
3
3
|
import vCard from 'vcf';
|
|
4
4
|
import z__default from 'zod';
|
|
5
5
|
export { M as ManagedStream, m as mergeStreams, s as stream } from './stream-B55k7W8-.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
group,
|
|
3
3
|
richlink
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TY3RT4OB.js";
|
|
5
5
|
import {
|
|
6
6
|
voice
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7VSE6V3Q.js";
|
|
8
8
|
import {
|
|
9
9
|
SpectrumCloudError,
|
|
10
10
|
cloud,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
text,
|
|
27
27
|
toVCard,
|
|
28
28
|
wrapProviderMessage
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-7D6FHYKT.js";
|
|
30
30
|
|
|
31
31
|
// src/emoji/generated.ts
|
|
32
32
|
var GeneratedEmoji = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as ManagedStream } from '../../stream-B55k7W8-.js';
|
|
2
|
-
import { l as SchemaMessage, d as Platform, c as PlatformDef, P as ProviderMessage } from '../../types-
|
|
2
|
+
import { l as SchemaMessage, d as Platform, c as PlatformDef, P as ProviderMessage } from '../../types-BZhWdyLk.js';
|
|
3
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
4
4
|
import * as z from 'zod';
|
|
5
5
|
import z__default from 'zod';
|