spectrum-ts 1.2.1 → 1.4.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/{chunk-K3CTEGCZ.js → chunk-66GJ45ZZ.js} +1 -1
- package/dist/{chunk-I7EKZS5C.js → chunk-B4MHPWPZ.js} +1 -1
- package/dist/{chunk-UQPIWAHH.js → chunk-LH4YEBG3.js} +30 -17
- package/dist/index.d.ts +16 -12
- package/dist/index.js +79 -15
- package/dist/providers/imessage/index.d.ts +20 -3
- package/dist/providers/imessage/index.js +263 -156
- package/dist/providers/terminal/index.d.ts +89 -4
- package/dist/providers/terminal/index.js +30 -40
- package/dist/providers/whatsapp-business/index.d.ts +2 -1
- package/dist/providers/whatsapp-business/index.js +26 -36
- package/dist/{types-Dvp0I86h.d.ts → types-BcCLW2VO.d.ts} +58 -20
- package/package.json +1 -1
|
@@ -720,7 +720,8 @@ function wrapProviderMessage(raw, ctx, direction) {
|
|
|
720
720
|
space: ctx.space,
|
|
721
721
|
definition: ctx.definition,
|
|
722
722
|
client: ctx.client,
|
|
723
|
-
config: ctx.config
|
|
723
|
+
config: ctx.config,
|
|
724
|
+
store: ctx.store
|
|
724
725
|
};
|
|
725
726
|
if (direction === "inbound") {
|
|
726
727
|
if (!raw.sender) {
|
|
@@ -763,7 +764,7 @@ var isRawProviderRecord = (v) => {
|
|
|
763
764
|
return "id" in record && "content" in record && typeof record.react !== "function" && typeof record.reply !== "function";
|
|
764
765
|
};
|
|
765
766
|
function buildSpace(params) {
|
|
766
|
-
const { spaceRef, extras, typingCtx, definition, client, config } = params;
|
|
767
|
+
const { spaceRef, extras, typingCtx, definition, client, config, store } = params;
|
|
767
768
|
let space;
|
|
768
769
|
async function dispatchReaction(item) {
|
|
769
770
|
try {
|
|
@@ -775,7 +776,8 @@ function buildSpace(params) {
|
|
|
775
776
|
target: item.target,
|
|
776
777
|
reaction: item.emoji,
|
|
777
778
|
client,
|
|
778
|
-
config
|
|
779
|
+
config,
|
|
780
|
+
store
|
|
779
781
|
});
|
|
780
782
|
} catch (err) {
|
|
781
783
|
if (err instanceof UnsupportedError) {
|
|
@@ -813,7 +815,7 @@ function buildSpace(params) {
|
|
|
813
815
|
}
|
|
814
816
|
return wrapProviderMessage(
|
|
815
817
|
raw,
|
|
816
|
-
{ client, config, definition, space, spaceRef },
|
|
818
|
+
{ client, config, definition, space, spaceRef, store },
|
|
817
819
|
"outbound"
|
|
818
820
|
);
|
|
819
821
|
}
|
|
@@ -849,7 +851,8 @@ function buildSpace(params) {
|
|
|
849
851
|
space: spaceRef,
|
|
850
852
|
messageId: id,
|
|
851
853
|
client,
|
|
852
|
-
config
|
|
854
|
+
config,
|
|
855
|
+
store
|
|
853
856
|
});
|
|
854
857
|
} catch (err) {
|
|
855
858
|
if (err instanceof UnsupportedError) {
|
|
@@ -863,7 +866,7 @@ function buildSpace(params) {
|
|
|
863
866
|
}
|
|
864
867
|
return wrapProviderMessage(
|
|
865
868
|
raw,
|
|
866
|
-
{ client, config, definition, space, spaceRef },
|
|
869
|
+
{ client, config, definition, space, spaceRef, store },
|
|
867
870
|
"inbound"
|
|
868
871
|
);
|
|
869
872
|
}
|
|
@@ -894,7 +897,7 @@ function buildSpace(params) {
|
|
|
894
897
|
return space;
|
|
895
898
|
}
|
|
896
899
|
function buildMessage(params) {
|
|
897
|
-
const { definition, client, config, spaceRef, space } = params;
|
|
900
|
+
const { definition, client, config, spaceRef, space, store } = params;
|
|
898
901
|
let self;
|
|
899
902
|
const react = async (reaction2) => {
|
|
900
903
|
if (!definition.actions.reactToMessage) {
|
|
@@ -915,7 +918,8 @@ function buildMessage(params) {
|
|
|
915
918
|
target: self,
|
|
916
919
|
reaction: reaction2,
|
|
917
920
|
client,
|
|
918
|
-
config
|
|
921
|
+
config,
|
|
922
|
+
store
|
|
919
923
|
});
|
|
920
924
|
} catch (err) {
|
|
921
925
|
if (err instanceof UnsupportedError) {
|
|
@@ -949,7 +953,8 @@ function buildMessage(params) {
|
|
|
949
953
|
target,
|
|
950
954
|
content: item,
|
|
951
955
|
client,
|
|
952
|
-
config
|
|
956
|
+
config,
|
|
957
|
+
store
|
|
953
958
|
});
|
|
954
959
|
} catch (err) {
|
|
955
960
|
if (err instanceof UnsupportedError) {
|
|
@@ -965,7 +970,7 @@ function buildMessage(params) {
|
|
|
965
970
|
}
|
|
966
971
|
return wrapProviderMessage(
|
|
967
972
|
raw,
|
|
968
|
-
{ client, config, definition, space, spaceRef },
|
|
973
|
+
{ client, config, definition, space, spaceRef, store },
|
|
969
974
|
"outbound"
|
|
970
975
|
);
|
|
971
976
|
};
|
|
@@ -1028,7 +1033,8 @@ function buildMessage(params) {
|
|
|
1028
1033
|
messageId: params.id,
|
|
1029
1034
|
content: resolved,
|
|
1030
1035
|
client,
|
|
1031
|
-
config
|
|
1036
|
+
config,
|
|
1037
|
+
store
|
|
1032
1038
|
});
|
|
1033
1039
|
} catch (err) {
|
|
1034
1040
|
if (err instanceof UnsupportedError) {
|
|
@@ -1070,7 +1076,8 @@ function createPlatformInstance(def, runtime) {
|
|
|
1070
1076
|
const resolved = await def.user.resolve({
|
|
1071
1077
|
input: { userID },
|
|
1072
1078
|
client: runtime.client,
|
|
1073
|
-
config: runtime.config
|
|
1079
|
+
config: runtime.config,
|
|
1080
|
+
store: runtime.store
|
|
1074
1081
|
});
|
|
1075
1082
|
return {
|
|
1076
1083
|
...resolved,
|
|
@@ -1123,7 +1130,8 @@ function createPlatformInstance(def, runtime) {
|
|
|
1123
1130
|
const resolved = await def.user.resolve({
|
|
1124
1131
|
input: { userID },
|
|
1125
1132
|
client: runtime.client,
|
|
1126
|
-
config: runtime.config
|
|
1133
|
+
config: runtime.config,
|
|
1134
|
+
store: runtime.store
|
|
1127
1135
|
});
|
|
1128
1136
|
return {
|
|
1129
1137
|
...resolved,
|
|
@@ -1140,17 +1148,20 @@ function createPlatformInstance(def, runtime) {
|
|
|
1140
1148
|
const resolved = await def.space.resolve({
|
|
1141
1149
|
input: { users, params: parsedParams },
|
|
1142
1150
|
client: runtime.client,
|
|
1143
|
-
config: runtime.config
|
|
1151
|
+
config: runtime.config,
|
|
1152
|
+
store: runtime.store
|
|
1144
1153
|
});
|
|
1145
1154
|
const parsedSpace = def.space.schema ? def.space.schema.parse(resolved) : resolved;
|
|
1146
1155
|
const spaceRef = {
|
|
1156
|
+
...parsedSpace,
|
|
1147
1157
|
id: parsedSpace.id,
|
|
1148
1158
|
__platform: def.name
|
|
1149
1159
|
};
|
|
1150
1160
|
const typingCtx = {
|
|
1151
1161
|
space: spaceRef,
|
|
1152
1162
|
client: runtime.client,
|
|
1153
|
-
config: runtime.config
|
|
1163
|
+
config: runtime.config,
|
|
1164
|
+
store: runtime.store
|
|
1154
1165
|
};
|
|
1155
1166
|
return buildSpace({
|
|
1156
1167
|
spaceRef,
|
|
@@ -1158,7 +1169,8 @@ function createPlatformInstance(def, runtime) {
|
|
|
1158
1169
|
typingCtx,
|
|
1159
1170
|
definition: def,
|
|
1160
1171
|
client: runtime.client,
|
|
1161
|
-
config: runtime.config
|
|
1172
|
+
config: runtime.config,
|
|
1173
|
+
store: runtime.store
|
|
1162
1174
|
});
|
|
1163
1175
|
}
|
|
1164
1176
|
};
|
|
@@ -1171,7 +1183,8 @@ function createPlatformInstance(def, runtime) {
|
|
|
1171
1183
|
if (producer) {
|
|
1172
1184
|
eventProperties[eventName] = producer({
|
|
1173
1185
|
client: runtime.client,
|
|
1174
|
-
config: runtime.config
|
|
1186
|
+
config: runtime.config,
|
|
1187
|
+
store: runtime.store
|
|
1175
1188
|
});
|
|
1176
1189
|
}
|
|
1177
1190
|
}
|
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
|
|
2
|
-
export { A as AnyPlatformDef, B as Broadcaster,
|
|
1
|
+
import { C as ContentBuilder, U as User, M as Message, a as ContentInput, b as Content, P as ProviderMessage, E as EventProducer, c as CreateClientContext, S as Store, d as PlatformDef, e as Platform, f as PlatformProviderConfig, g as SpectrumLike, h as CustomEventStreams, i as Space, I as InboundMessage, O as OutboundMessage } from './types-BcCLW2VO.js';
|
|
2
|
+
export { A as AnyPlatformDef, B as Broadcaster, j as InboundPlatformMessage, k as ManagedStream, l as PlatformInstance, m as PlatformMessage, n as PlatformRuntime, o as PlatformSpace, p as PlatformUser, q as SchemaMessage, r as broadcast, s as mergeStreams, t as stream } from './types-BcCLW2VO.js';
|
|
3
3
|
import vCard from 'vcf';
|
|
4
4
|
import z__default from 'zod';
|
|
5
5
|
import 'hotscript';
|
|
@@ -2148,21 +2148,24 @@ declare const Emoji: {
|
|
|
2148
2148
|
};
|
|
2149
2149
|
type EmojiKey = keyof typeof Emoji;
|
|
2150
2150
|
|
|
2151
|
+
type NoInferValue<T> = [T][T extends unknown ? 0 : never];
|
|
2151
2152
|
declare function definePlatform<_Name extends string, _ConfigSchema extends z__default.ZodType<object>, _UserSchema extends z__default.ZodType<object> | undefined, _SpaceSchema extends z__default.ZodType<object> | undefined, _SpaceParamsSchema extends z__default.ZodType<object> | undefined, _Client, _ResolvedUser extends {
|
|
2152
2153
|
id: string;
|
|
2153
2154
|
}, _ResolvedSpace extends {
|
|
2154
2155
|
id: string;
|
|
2155
2156
|
}, _MessageSchema extends z__default.ZodType<object> | undefined = undefined, _MessageType extends ProviderMessage<_ResolvedUser, _ResolvedSpace, _MessageSchema extends z__default.ZodType<object> ? z__default.infer<_MessageSchema> : Record<never, never>> = ProviderMessage<_ResolvedUser, _ResolvedSpace, _MessageSchema extends z__default.ZodType<object> ? z__default.infer<_MessageSchema> : Record<never, never>>, _Events extends {
|
|
2156
|
-
messages:
|
|
2157
|
-
client: _Client;
|
|
2158
|
-
config: z__default.infer<_ConfigSchema>;
|
|
2159
|
-
}) => AsyncIterable<_MessageType>;
|
|
2157
|
+
messages: EventProducer<_MessageType, _Client, z__default.infer<_ConfigSchema>>;
|
|
2160
2158
|
} = {
|
|
2161
|
-
messages:
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2159
|
+
messages: EventProducer<_MessageType, _Client, z__default.infer<_ConfigSchema>>;
|
|
2160
|
+
}, _Static extends Record<string, unknown> = Record<never, never>>(name: _Name, def: {
|
|
2161
|
+
lifecycle: {
|
|
2162
|
+
createClient: (ctx: CreateClientContext<_ConfigSchema>) => Promise<_Client>;
|
|
2163
|
+
destroyClient?: (ctx: {
|
|
2164
|
+
client: NoInferValue<_Client>;
|
|
2165
|
+
store: Store;
|
|
2166
|
+
}) => Promise<void>;
|
|
2167
|
+
};
|
|
2168
|
+
} & Omit<PlatformDef<_Name, _ConfigSchema, _UserSchema, _SpaceSchema, _SpaceParamsSchema, _Client, _ResolvedUser, _ResolvedSpace, _MessageSchema, _MessageType, _Events>, "lifecycle" | "name"> & {
|
|
2166
2169
|
static?: _Static;
|
|
2167
2170
|
}): Platform<PlatformDef<_Name, _ConfigSchema, _UserSchema, _SpaceSchema, _SpaceParamsSchema, _Client, _ResolvedUser, _ResolvedSpace, _MessageSchema, _MessageType, _Events>> & Readonly<_Static>;
|
|
2168
2171
|
|
|
@@ -2215,6 +2218,7 @@ interface SharedTokenData {
|
|
|
2215
2218
|
interface DedicatedTokenData {
|
|
2216
2219
|
auth: Record<string, string>;
|
|
2217
2220
|
expiresIn: number;
|
|
2221
|
+
numbers: Record<string, string | null>;
|
|
2218
2222
|
type: "dedicated";
|
|
2219
2223
|
}
|
|
2220
2224
|
type TokenData = SharedTokenData | DedicatedTokenData;
|
|
@@ -2268,4 +2272,4 @@ declare class UnsupportedError extends Error {
|
|
|
2268
2272
|
declare const fromVCard: (vcf: string) => ContactInput;
|
|
2269
2273
|
declare const toVCard: (contact: Contact) => Promise<string>;
|
|
2270
2274
|
|
|
2271
|
-
export { type CloudPlatform, type Contact, type ContactAddress, type ContactDetails, type ContactEmail, type ContactInput, type ContactName, type ContactOrg, type ContactPhone, Content, ContentBuilder, ContentInput, type DedicatedTokenData, Emoji, type EmojiKey, type Group, type ImessageInfoData, Message, Platform, PlatformDef, PlatformProviderConfig, type PlatformStatus, type PlatformsData, type Poll, type PollChoice, type PollChoiceInput, type PollOption, type Reaction, type Richlink, type SharedTokenData, Space, Spectrum, SpectrumCloudError, type SpectrumInstance, type SubscriptionData, type SubscriptionStatus, type TokenData, UnsupportedError, type UnsupportedKind, User, type Voice, attachment, cloud, contact, custom, definePlatform, fromVCard, group, option, poll, reaction, resolveContents, richlink, text, toVCard, voice };
|
|
2275
|
+
export { type CloudPlatform, type Contact, type ContactAddress, type ContactDetails, type ContactEmail, type ContactInput, type ContactName, type ContactOrg, type ContactPhone, Content, ContentBuilder, ContentInput, type DedicatedTokenData, Emoji, type EmojiKey, EventProducer, type Group, type ImessageInfoData, Message, Platform, PlatformDef, PlatformProviderConfig, type PlatformStatus, type PlatformsData, type Poll, type PollChoice, type PollChoiceInput, type PollOption, type Reaction, type Richlink, type SharedTokenData, Space, Spectrum, SpectrumCloudError, type SpectrumInstance, type SubscriptionData, type SubscriptionStatus, type TokenData, UnsupportedError, type UnsupportedKind, User, type Voice, attachment, cloud, contact, custom, definePlatform, fromVCard, group, option, poll, reaction, resolveContents, richlink, text, toVCard, voice };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
group,
|
|
3
3
|
richlink
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-66GJ45ZZ.js";
|
|
5
5
|
import {
|
|
6
6
|
voice
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-B4MHPWPZ.js";
|
|
8
8
|
import {
|
|
9
9
|
SpectrumCloudError,
|
|
10
10
|
broadcast,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
text,
|
|
28
28
|
toVCard,
|
|
29
29
|
wrapProviderMessage
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LH4YEBG3.js";
|
|
31
31
|
|
|
32
32
|
// src/emoji/generated.ts
|
|
33
33
|
var GeneratedEmoji = {
|
|
@@ -1960,6 +1960,63 @@ var Emoji = { ...GeneratedEmoji, ...aliases };
|
|
|
1960
1960
|
|
|
1961
1961
|
// src/spectrum.ts
|
|
1962
1962
|
import z from "zod";
|
|
1963
|
+
|
|
1964
|
+
// src/utils/store.ts
|
|
1965
|
+
var isRecordObject = (value) => {
|
|
1966
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1967
|
+
return false;
|
|
1968
|
+
}
|
|
1969
|
+
const prototype = Object.getPrototypeOf(value);
|
|
1970
|
+
return prototype === Object.prototype || prototype === null;
|
|
1971
|
+
};
|
|
1972
|
+
function createStore() {
|
|
1973
|
+
const data = /* @__PURE__ */ new Map();
|
|
1974
|
+
return {
|
|
1975
|
+
set(key, value) {
|
|
1976
|
+
data.set(key, value);
|
|
1977
|
+
},
|
|
1978
|
+
get(key) {
|
|
1979
|
+
return data.get(key);
|
|
1980
|
+
},
|
|
1981
|
+
has(key) {
|
|
1982
|
+
return data.has(key);
|
|
1983
|
+
},
|
|
1984
|
+
delete(key) {
|
|
1985
|
+
return data.delete(key);
|
|
1986
|
+
},
|
|
1987
|
+
clear() {
|
|
1988
|
+
data.clear();
|
|
1989
|
+
},
|
|
1990
|
+
keys() {
|
|
1991
|
+
return Array.from(data.keys());
|
|
1992
|
+
},
|
|
1993
|
+
string(key) {
|
|
1994
|
+
const v = data.get(key);
|
|
1995
|
+
return typeof v === "string" ? v : void 0;
|
|
1996
|
+
},
|
|
1997
|
+
number(key) {
|
|
1998
|
+
const v = data.get(key);
|
|
1999
|
+
return typeof v === "number" ? v : void 0;
|
|
2000
|
+
},
|
|
2001
|
+
bool(key) {
|
|
2002
|
+
const v = data.get(key);
|
|
2003
|
+
return typeof v === "boolean" ? v : void 0;
|
|
2004
|
+
},
|
|
2005
|
+
object(key) {
|
|
2006
|
+
const v = data.get(key);
|
|
2007
|
+
if (!isRecordObject(v)) {
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
return v;
|
|
2011
|
+
},
|
|
2012
|
+
array(key) {
|
|
2013
|
+
const v = data.get(key);
|
|
2014
|
+
return Array.isArray(v) ? v : void 0;
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
// src/spectrum.ts
|
|
1963
2020
|
var spectrumOptionsSchema = z.object({
|
|
1964
2021
|
flattenGroups: z.boolean().optional()
|
|
1965
2022
|
}).optional();
|
|
@@ -2012,10 +2069,11 @@ async function Spectrum(options) {
|
|
|
2012
2069
|
});
|
|
2013
2070
|
};
|
|
2014
2071
|
const createProviderMessagesStream = (state) => {
|
|
2015
|
-
const { client, config, definition } = state;
|
|
2072
|
+
const { client, config, definition, store } = state;
|
|
2016
2073
|
const raw = definition.events.messages({
|
|
2017
2074
|
client,
|
|
2018
|
-
config
|
|
2075
|
+
config,
|
|
2076
|
+
store
|
|
2019
2077
|
});
|
|
2020
2078
|
const bindSend = async function* () {
|
|
2021
2079
|
for await (const msg of raw) {
|
|
@@ -2023,14 +2081,15 @@ async function Spectrum(options) {
|
|
|
2023
2081
|
...msg.space,
|
|
2024
2082
|
__platform: definition.name
|
|
2025
2083
|
};
|
|
2026
|
-
const typingCtx = { space: spaceRef, client, config };
|
|
2084
|
+
const typingCtx = { space: spaceRef, client, config, store };
|
|
2027
2085
|
const space = buildSpace({
|
|
2028
2086
|
spaceRef,
|
|
2029
2087
|
extras: {},
|
|
2030
2088
|
typingCtx,
|
|
2031
2089
|
definition,
|
|
2032
2090
|
client,
|
|
2033
|
-
config
|
|
2091
|
+
config,
|
|
2092
|
+
store
|
|
2034
2093
|
});
|
|
2035
2094
|
const normalizedMessage = wrapProviderMessage(
|
|
2036
2095
|
msg,
|
|
@@ -2039,7 +2098,8 @@ async function Spectrum(options) {
|
|
|
2039
2098
|
config,
|
|
2040
2099
|
definition,
|
|
2041
2100
|
space,
|
|
2042
|
-
spaceRef
|
|
2101
|
+
spaceRef,
|
|
2102
|
+
store
|
|
2043
2103
|
},
|
|
2044
2104
|
"inbound"
|
|
2045
2105
|
);
|
|
@@ -2072,15 +2132,18 @@ async function Spectrum(options) {
|
|
|
2072
2132
|
const providerConfig = provider;
|
|
2073
2133
|
const def = providerConfig.__definition;
|
|
2074
2134
|
const userConfig = def.config.parse(providerConfig.config);
|
|
2135
|
+
const store = createStore();
|
|
2075
2136
|
const client = await def.lifecycle.createClient({
|
|
2076
2137
|
config: userConfig,
|
|
2077
2138
|
projectId,
|
|
2078
|
-
projectSecret
|
|
2139
|
+
projectSecret,
|
|
2140
|
+
store
|
|
2079
2141
|
});
|
|
2080
2142
|
const state = {
|
|
2081
2143
|
client,
|
|
2082
2144
|
config: userConfig,
|
|
2083
|
-
definition: def
|
|
2145
|
+
definition: def,
|
|
2146
|
+
store
|
|
2084
2147
|
};
|
|
2085
2148
|
platformStates.set(def.name, {
|
|
2086
2149
|
...state,
|
|
@@ -2114,12 +2177,12 @@ async function Spectrum(options) {
|
|
|
2114
2177
|
const createCustomEventStream = (eventName) => {
|
|
2115
2178
|
return stream((emit, end) => {
|
|
2116
2179
|
const providerStreams = Array.from(platformStates.values(), (state) => {
|
|
2117
|
-
const { client, config, definition } = state;
|
|
2180
|
+
const { client, config, definition, store } = state;
|
|
2118
2181
|
const producer = definition.events[eventName];
|
|
2119
2182
|
if (!producer) {
|
|
2120
2183
|
return void 0;
|
|
2121
2184
|
}
|
|
2122
|
-
const providerEvents = producer({ client, config });
|
|
2185
|
+
const providerEvents = producer({ client, config, store });
|
|
2123
2186
|
const annotatePlatform = async function* () {
|
|
2124
2187
|
for await (const value of providerEvents) {
|
|
2125
2188
|
yield { ...value, platform: definition.name };
|
|
@@ -2168,10 +2231,11 @@ async function Spectrum(options) {
|
|
|
2168
2231
|
await Promise.allSettled(streamShutdowns);
|
|
2169
2232
|
const clientShutdowns = Array.from(
|
|
2170
2233
|
platformStates.values(),
|
|
2171
|
-
(state) => state.definition.lifecycle.destroyClient({
|
|
2172
|
-
client: state.client
|
|
2234
|
+
(state) => state.definition.lifecycle.destroyClient?.({
|
|
2235
|
+
client: state.client,
|
|
2236
|
+
store: state.store
|
|
2173
2237
|
})
|
|
2174
|
-
);
|
|
2238
|
+
).filter((shutdown) => shutdown !== void 0);
|
|
2175
2239
|
await Promise.allSettled(clientShutdowns);
|
|
2176
2240
|
customEventStreams.clear();
|
|
2177
2241
|
messageBroadcasters.clear();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ContentInput, C as ContentBuilder,
|
|
1
|
+
import { a as ContentInput, C as ContentBuilder, q as SchemaMessage, e as Platform, d as PlatformDef, P as ProviderMessage, S as Store, k as ManagedStream } from '../../types-BcCLW2VO.js';
|
|
2
2
|
import * as zod_v4_core from 'zod/v4/core';
|
|
3
3
|
import * as z from 'zod';
|
|
4
4
|
import z__default from 'zod';
|
|
@@ -9,7 +9,11 @@ import 'hotscript';
|
|
|
9
9
|
type IMessageMessageEffect = MessageEffect;
|
|
10
10
|
declare function effect(input: ContentInput, messageEffect: IMessageMessageEffect): ContentBuilder;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface RemoteClient {
|
|
13
|
+
client: AdvancedIMessage;
|
|
14
|
+
phone: string;
|
|
15
|
+
}
|
|
16
|
+
type IMessageClient = IMessageSDK | RemoteClient[];
|
|
13
17
|
declare const userSchema: z__default.ZodObject<{}, z__default.core.$strip>;
|
|
14
18
|
declare const spaceSchema: z__default.ZodObject<{
|
|
15
19
|
id: z__default.ZodString;
|
|
@@ -17,6 +21,7 @@ declare const spaceSchema: z__default.ZodObject<{
|
|
|
17
21
|
dm: "dm";
|
|
18
22
|
group: "group";
|
|
19
23
|
}>;
|
|
24
|
+
phone: z__default.ZodString;
|
|
20
25
|
}, z__default.core.$strip>;
|
|
21
26
|
type IMessageMessage = SchemaMessage<typeof userSchema, typeof spaceSchema> & {
|
|
22
27
|
partIndex?: number;
|
|
@@ -30,9 +35,11 @@ declare const imessage: Platform<PlatformDef<"iMessage", z.ZodUnion<readonly [z.
|
|
|
30
35
|
clients: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
31
36
|
address: z.ZodString;
|
|
32
37
|
token: z.ZodString;
|
|
38
|
+
phone: z.ZodString;
|
|
33
39
|
}, zod_v4_core.$strip>, z.ZodArray<z.ZodObject<{
|
|
34
40
|
address: z.ZodString;
|
|
35
41
|
token: z.ZodString;
|
|
42
|
+
phone: z.ZodString;
|
|
36
43
|
}, zod_v4_core.$strip>>]>>;
|
|
37
44
|
}, zod_v4_core.$strip>]>, z.ZodType<object, unknown, zod_v4_core.$ZodTypeInternals<object, unknown>> | undefined, z.ZodObject<{
|
|
38
45
|
id: z.ZodString;
|
|
@@ -40,14 +47,19 @@ declare const imessage: Platform<PlatformDef<"iMessage", z.ZodUnion<readonly [z.
|
|
|
40
47
|
dm: "dm";
|
|
41
48
|
group: "group";
|
|
42
49
|
}>;
|
|
43
|
-
|
|
50
|
+
phone: z.ZodString;
|
|
51
|
+
}, zod_v4_core.$strip>, z.ZodObject<{
|
|
52
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, zod_v4_core.$strip>, IMessageClient, {
|
|
44
54
|
id: string;
|
|
45
55
|
}, {
|
|
46
56
|
id: string;
|
|
47
57
|
type: "dm";
|
|
58
|
+
phone: string;
|
|
48
59
|
} | {
|
|
49
60
|
id: string;
|
|
50
61
|
type: "group";
|
|
62
|
+
phone: string;
|
|
51
63
|
}, z.ZodObject<{
|
|
52
64
|
partIndex: z.ZodOptional<z.ZodNumber>;
|
|
53
65
|
parentId: z.ZodOptional<z.ZodString>;
|
|
@@ -56,9 +68,11 @@ declare const imessage: Platform<PlatformDef<"iMessage", z.ZodUnion<readonly [z.
|
|
|
56
68
|
}, {
|
|
57
69
|
id: string;
|
|
58
70
|
type: "dm";
|
|
71
|
+
phone: string;
|
|
59
72
|
} | {
|
|
60
73
|
id: string;
|
|
61
74
|
type: "group";
|
|
75
|
+
phone: string;
|
|
62
76
|
}, {
|
|
63
77
|
partIndex?: number | undefined;
|
|
64
78
|
parentId?: string | undefined;
|
|
@@ -72,11 +86,14 @@ declare const imessage: Platform<PlatformDef<"iMessage", z.ZodUnion<readonly [z.
|
|
|
72
86
|
clients?: {
|
|
73
87
|
address: string;
|
|
74
88
|
token: string;
|
|
89
|
+
phone: string;
|
|
75
90
|
} | {
|
|
76
91
|
address: string;
|
|
77
92
|
token: string;
|
|
93
|
+
phone: string;
|
|
78
94
|
}[] | undefined;
|
|
79
95
|
};
|
|
96
|
+
store: Store;
|
|
80
97
|
}) => ManagedStream<IMessageMessage>;
|
|
81
98
|
}>> & Readonly<{
|
|
82
99
|
effect: {
|