@spectrum-ts/core 9.3.1 → 11.0.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/README.md +5 -4
- package/dist/{attachment-ChqzKngn.d.ts → attachment-Cpg2VUkY.d.ts} +221 -217
- package/dist/authoring.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ The fastest way to ship is with **Spectrum Cloud** — hosted infrastructure for
|
|
|
27
27
|
|
|
28
28
|
1. Sign up at **[app.photon.codes](https://app.photon.codes)** to get your project ID and secret.
|
|
29
29
|
2. Install the SDK (`spectrum-ts` is batteries-included — the runtime plus
|
|
30
|
-
|
|
30
|
+
the standard provider set):
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
bun add spectrum-ts
|
|
@@ -42,7 +42,7 @@ The fastest way to ship is with **Spectrum Cloud** — hosted infrastructure for
|
|
|
42
42
|
const app = await Spectrum({
|
|
43
43
|
projectId: process.env.PROJECT_ID,
|
|
44
44
|
projectSecret: process.env.PROJECT_SECRET,
|
|
45
|
-
|
|
45
|
+
platforms: [imessage.config()],
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
for await (const [space, message] of app.messages) {
|
|
@@ -52,7 +52,7 @@ The fastest way to ship is with **Spectrum Cloud** — hosted infrastructure for
|
|
|
52
52
|
}
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Spectrum also runs fully standalone — you can connect to a local iMessage database, bring your own gRPC endpoints, or build your own platform provider. See the [docs](https://docs.photon.codes) for self-hosted setups.
|
|
55
|
+
Spectrum also runs fully standalone — you can connect to a local iMessage database with the separate [`@spectrum-ts/imessage-local`](https://npmjs.com/package/@spectrum-ts/imessage-local) package, bring your own gRPC endpoints, or build your own platform provider. See the [docs](https://docs.photon.codes) for self-hosted setups.
|
|
56
56
|
|
|
57
57
|
## Documentation
|
|
58
58
|
|
|
@@ -63,13 +63,14 @@ Visit **[docs.photon.codes](https://docs.photon.codes)** to view the full docume
|
|
|
63
63
|
| Platform | Package |
|
|
64
64
|
|----------|---------|
|
|
65
65
|
| iMessage | [`@spectrum-ts/imessage`](https://npmjs.com/package/@spectrum-ts/imessage) |
|
|
66
|
+
| Local iMessage | [`@spectrum-ts/imessage-local`](https://npmjs.com/package/@spectrum-ts/imessage-local) (explicit install only) |
|
|
66
67
|
| WhatsApp Business | [`@spectrum-ts/whatsapp-business`](https://npmjs.com/package/@spectrum-ts/whatsapp-business) |
|
|
67
68
|
| Telegram | [`@spectrum-ts/telegram`](https://npmjs.com/package/@spectrum-ts/telegram) |
|
|
68
69
|
| Slack | [`@spectrum-ts/slack`](https://npmjs.com/package/@spectrum-ts/slack) |
|
|
69
70
|
| Terminal | [`@spectrum-ts/terminal`](https://npmjs.com/package/@spectrum-ts/terminal) |
|
|
70
71
|
| Custom | `definePlatform` from `spectrum-ts` |
|
|
71
72
|
|
|
72
|
-
`bun add spectrum-ts` is batteries-included (
|
|
73
|
+
`bun add spectrum-ts` is batteries-included (the standard provider set; local iMessage is an explicit install). For a smaller install, depend on the runtime plus only the providers you use — `bun add @spectrum-ts/core @spectrum-ts/telegram` — and import from the scoped packages directly. Either way the `spectrum-ts/providers/<platform>` import paths work as long as the matching provider package is installed; if it isn't, the import fails at build/startup naming the exact package to add.
|
|
73
74
|
|
|
74
75
|
## Issues
|
|
75
76
|
|
|
@@ -592,9 +592,6 @@ interface Message<TPlatform extends string = string, TSender extends User = User
|
|
|
592
592
|
declare const editSchema: z.ZodObject<{
|
|
593
593
|
type: z.ZodLiteral<"edit">;
|
|
594
594
|
content: z.ZodCustom<{
|
|
595
|
-
type: "custom";
|
|
596
|
-
raw: unknown;
|
|
597
|
-
} | {
|
|
598
595
|
type: "contact";
|
|
599
596
|
user?: {
|
|
600
597
|
__platform: string;
|
|
@@ -645,12 +642,38 @@ declare const editSchema: z.ZodObject<{
|
|
|
645
642
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
646
643
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
647
644
|
size?: number | undefined;
|
|
645
|
+
} | {
|
|
646
|
+
type: "poll";
|
|
647
|
+
title: string;
|
|
648
|
+
options: {
|
|
649
|
+
title: string;
|
|
650
|
+
}[];
|
|
651
|
+
} | {
|
|
652
|
+
type: "poll_option";
|
|
653
|
+
option: {
|
|
654
|
+
title: string;
|
|
655
|
+
};
|
|
656
|
+
poll: {
|
|
657
|
+
type: "poll";
|
|
658
|
+
title: string;
|
|
659
|
+
options: {
|
|
660
|
+
title: string;
|
|
661
|
+
}[];
|
|
662
|
+
};
|
|
663
|
+
selected: boolean;
|
|
664
|
+
title: string;
|
|
665
|
+
} | {
|
|
666
|
+
type: "custom";
|
|
667
|
+
raw: unknown;
|
|
648
668
|
} | {
|
|
649
669
|
type: "text";
|
|
650
670
|
text: string;
|
|
651
671
|
} | {
|
|
652
672
|
type: "markdown";
|
|
653
673
|
markdown: string;
|
|
674
|
+
} | {
|
|
675
|
+
type: "group";
|
|
676
|
+
items: Message<string, User, Space<unknown>>[];
|
|
654
677
|
} | {
|
|
655
678
|
type: "streamText";
|
|
656
679
|
stream: () => AsyncIterable<string>;
|
|
@@ -684,29 +707,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
684
707
|
type: "reaction";
|
|
685
708
|
emoji: string;
|
|
686
709
|
target: Message<string, User, Space<unknown>>;
|
|
687
|
-
} | {
|
|
688
|
-
type: "group";
|
|
689
|
-
items: Message<string, User, Space<unknown>>[];
|
|
690
|
-
} | {
|
|
691
|
-
type: "poll";
|
|
692
|
-
title: string;
|
|
693
|
-
options: {
|
|
694
|
-
title: string;
|
|
695
|
-
}[];
|
|
696
|
-
} | {
|
|
697
|
-
type: "poll_option";
|
|
698
|
-
option: {
|
|
699
|
-
title: string;
|
|
700
|
-
};
|
|
701
|
-
poll: {
|
|
702
|
-
type: "poll";
|
|
703
|
-
title: string;
|
|
704
|
-
options: {
|
|
705
|
-
title: string;
|
|
706
|
-
}[];
|
|
707
|
-
};
|
|
708
|
-
selected: boolean;
|
|
709
|
-
title: string;
|
|
710
710
|
} | {
|
|
711
711
|
type: "effect";
|
|
712
712
|
content: {
|
|
@@ -749,9 +749,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
749
749
|
} | {
|
|
750
750
|
type: "leaveSpace";
|
|
751
751
|
}, {
|
|
752
|
-
type: "custom";
|
|
753
|
-
raw: unknown;
|
|
754
|
-
} | {
|
|
755
752
|
type: "contact";
|
|
756
753
|
user?: {
|
|
757
754
|
__platform: string;
|
|
@@ -802,12 +799,38 @@ declare const editSchema: z.ZodObject<{
|
|
|
802
799
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
803
800
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
804
801
|
size?: number | undefined;
|
|
802
|
+
} | {
|
|
803
|
+
type: "poll";
|
|
804
|
+
title: string;
|
|
805
|
+
options: {
|
|
806
|
+
title: string;
|
|
807
|
+
}[];
|
|
808
|
+
} | {
|
|
809
|
+
type: "poll_option";
|
|
810
|
+
option: {
|
|
811
|
+
title: string;
|
|
812
|
+
};
|
|
813
|
+
poll: {
|
|
814
|
+
type: "poll";
|
|
815
|
+
title: string;
|
|
816
|
+
options: {
|
|
817
|
+
title: string;
|
|
818
|
+
}[];
|
|
819
|
+
};
|
|
820
|
+
selected: boolean;
|
|
821
|
+
title: string;
|
|
822
|
+
} | {
|
|
823
|
+
type: "custom";
|
|
824
|
+
raw: unknown;
|
|
805
825
|
} | {
|
|
806
826
|
type: "text";
|
|
807
827
|
text: string;
|
|
808
828
|
} | {
|
|
809
829
|
type: "markdown";
|
|
810
830
|
markdown: string;
|
|
831
|
+
} | {
|
|
832
|
+
type: "group";
|
|
833
|
+
items: Message<string, User, Space<unknown>>[];
|
|
811
834
|
} | {
|
|
812
835
|
type: "streamText";
|
|
813
836
|
stream: () => AsyncIterable<string>;
|
|
@@ -841,29 +864,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
841
864
|
type: "reaction";
|
|
842
865
|
emoji: string;
|
|
843
866
|
target: Message<string, User, Space<unknown>>;
|
|
844
|
-
} | {
|
|
845
|
-
type: "group";
|
|
846
|
-
items: Message<string, User, Space<unknown>>[];
|
|
847
|
-
} | {
|
|
848
|
-
type: "poll";
|
|
849
|
-
title: string;
|
|
850
|
-
options: {
|
|
851
|
-
title: string;
|
|
852
|
-
}[];
|
|
853
|
-
} | {
|
|
854
|
-
type: "poll_option";
|
|
855
|
-
option: {
|
|
856
|
-
title: string;
|
|
857
|
-
};
|
|
858
|
-
poll: {
|
|
859
|
-
type: "poll";
|
|
860
|
-
title: string;
|
|
861
|
-
options: {
|
|
862
|
-
title: string;
|
|
863
|
-
}[];
|
|
864
|
-
};
|
|
865
|
-
selected: boolean;
|
|
866
|
-
title: string;
|
|
867
867
|
} | {
|
|
868
868
|
type: "effect";
|
|
869
869
|
content: {
|
|
@@ -1136,9 +1136,6 @@ declare function rename(displayName: string): ContentBuilder;
|
|
|
1136
1136
|
declare const replySchema: z.ZodObject<{
|
|
1137
1137
|
type: z.ZodLiteral<"reply">;
|
|
1138
1138
|
content: z.ZodCustom<{
|
|
1139
|
-
type: "custom";
|
|
1140
|
-
raw: unknown;
|
|
1141
|
-
} | {
|
|
1142
1139
|
type: "contact";
|
|
1143
1140
|
user?: {
|
|
1144
1141
|
__platform: string;
|
|
@@ -1189,12 +1186,38 @@ declare const replySchema: z.ZodObject<{
|
|
|
1189
1186
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1190
1187
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
1191
1188
|
size?: number | undefined;
|
|
1189
|
+
} | {
|
|
1190
|
+
type: "poll";
|
|
1191
|
+
title: string;
|
|
1192
|
+
options: {
|
|
1193
|
+
title: string;
|
|
1194
|
+
}[];
|
|
1195
|
+
} | {
|
|
1196
|
+
type: "poll_option";
|
|
1197
|
+
option: {
|
|
1198
|
+
title: string;
|
|
1199
|
+
};
|
|
1200
|
+
poll: {
|
|
1201
|
+
type: "poll";
|
|
1202
|
+
title: string;
|
|
1203
|
+
options: {
|
|
1204
|
+
title: string;
|
|
1205
|
+
}[];
|
|
1206
|
+
};
|
|
1207
|
+
selected: boolean;
|
|
1208
|
+
title: string;
|
|
1209
|
+
} | {
|
|
1210
|
+
type: "custom";
|
|
1211
|
+
raw: unknown;
|
|
1192
1212
|
} | {
|
|
1193
1213
|
type: "text";
|
|
1194
1214
|
text: string;
|
|
1195
1215
|
} | {
|
|
1196
1216
|
type: "markdown";
|
|
1197
1217
|
markdown: string;
|
|
1218
|
+
} | {
|
|
1219
|
+
type: "group";
|
|
1220
|
+
items: Message<string, User, Space<unknown>>[];
|
|
1198
1221
|
} | {
|
|
1199
1222
|
type: "streamText";
|
|
1200
1223
|
stream: () => AsyncIterable<string>;
|
|
@@ -1228,29 +1251,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1228
1251
|
type: "reaction";
|
|
1229
1252
|
emoji: string;
|
|
1230
1253
|
target: Message<string, User, Space<unknown>>;
|
|
1231
|
-
} | {
|
|
1232
|
-
type: "group";
|
|
1233
|
-
items: Message<string, User, Space<unknown>>[];
|
|
1234
|
-
} | {
|
|
1235
|
-
type: "poll";
|
|
1236
|
-
title: string;
|
|
1237
|
-
options: {
|
|
1238
|
-
title: string;
|
|
1239
|
-
}[];
|
|
1240
|
-
} | {
|
|
1241
|
-
type: "poll_option";
|
|
1242
|
-
option: {
|
|
1243
|
-
title: string;
|
|
1244
|
-
};
|
|
1245
|
-
poll: {
|
|
1246
|
-
type: "poll";
|
|
1247
|
-
title: string;
|
|
1248
|
-
options: {
|
|
1249
|
-
title: string;
|
|
1250
|
-
}[];
|
|
1251
|
-
};
|
|
1252
|
-
selected: boolean;
|
|
1253
|
-
title: string;
|
|
1254
1254
|
} | {
|
|
1255
1255
|
type: "effect";
|
|
1256
1256
|
content: {
|
|
@@ -1293,9 +1293,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1293
1293
|
} | {
|
|
1294
1294
|
type: "leaveSpace";
|
|
1295
1295
|
}, {
|
|
1296
|
-
type: "custom";
|
|
1297
|
-
raw: unknown;
|
|
1298
|
-
} | {
|
|
1299
1296
|
type: "contact";
|
|
1300
1297
|
user?: {
|
|
1301
1298
|
__platform: string;
|
|
@@ -1346,12 +1343,38 @@ declare const replySchema: z.ZodObject<{
|
|
|
1346
1343
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1347
1344
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
1348
1345
|
size?: number | undefined;
|
|
1346
|
+
} | {
|
|
1347
|
+
type: "poll";
|
|
1348
|
+
title: string;
|
|
1349
|
+
options: {
|
|
1350
|
+
title: string;
|
|
1351
|
+
}[];
|
|
1352
|
+
} | {
|
|
1353
|
+
type: "poll_option";
|
|
1354
|
+
option: {
|
|
1355
|
+
title: string;
|
|
1356
|
+
};
|
|
1357
|
+
poll: {
|
|
1358
|
+
type: "poll";
|
|
1359
|
+
title: string;
|
|
1360
|
+
options: {
|
|
1361
|
+
title: string;
|
|
1362
|
+
}[];
|
|
1363
|
+
};
|
|
1364
|
+
selected: boolean;
|
|
1365
|
+
title: string;
|
|
1366
|
+
} | {
|
|
1367
|
+
type: "custom";
|
|
1368
|
+
raw: unknown;
|
|
1349
1369
|
} | {
|
|
1350
1370
|
type: "text";
|
|
1351
1371
|
text: string;
|
|
1352
1372
|
} | {
|
|
1353
1373
|
type: "markdown";
|
|
1354
1374
|
markdown: string;
|
|
1375
|
+
} | {
|
|
1376
|
+
type: "group";
|
|
1377
|
+
items: Message<string, User, Space<unknown>>[];
|
|
1355
1378
|
} | {
|
|
1356
1379
|
type: "streamText";
|
|
1357
1380
|
stream: () => AsyncIterable<string>;
|
|
@@ -1385,29 +1408,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1385
1408
|
type: "reaction";
|
|
1386
1409
|
emoji: string;
|
|
1387
1410
|
target: Message<string, User, Space<unknown>>;
|
|
1388
|
-
} | {
|
|
1389
|
-
type: "group";
|
|
1390
|
-
items: Message<string, User, Space<unknown>>[];
|
|
1391
|
-
} | {
|
|
1392
|
-
type: "poll";
|
|
1393
|
-
title: string;
|
|
1394
|
-
options: {
|
|
1395
|
-
title: string;
|
|
1396
|
-
}[];
|
|
1397
|
-
} | {
|
|
1398
|
-
type: "poll_option";
|
|
1399
|
-
option: {
|
|
1400
|
-
title: string;
|
|
1401
|
-
};
|
|
1402
|
-
poll: {
|
|
1403
|
-
type: "poll";
|
|
1404
|
-
title: string;
|
|
1405
|
-
options: {
|
|
1406
|
-
title: string;
|
|
1407
|
-
}[];
|
|
1408
|
-
};
|
|
1409
|
-
selected: boolean;
|
|
1410
|
-
title: string;
|
|
1411
1411
|
} | {
|
|
1412
1412
|
type: "effect";
|
|
1413
1413
|
content: {
|
|
@@ -6872,24 +6872,28 @@ interface SpectrumOptions {
|
|
|
6872
6872
|
*/
|
|
6873
6873
|
logLevel?: LogLevel;
|
|
6874
6874
|
}
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6875
|
+
type PlatformSelection<Providers extends PlatformProviderConfig[]> = {
|
|
6876
|
+
platforms: [...Providers];
|
|
6877
|
+
providers?: never;
|
|
6878
|
+
} | {
|
|
6879
|
+
platforms?: never;
|
|
6878
6880
|
providers: [...Providers];
|
|
6881
|
+
};
|
|
6882
|
+
type SpectrumFactoryOptions<Providers extends PlatformProviderConfig[]> = PlatformSelection<Providers> & {
|
|
6879
6883
|
options?: SpectrumOptions;
|
|
6880
6884
|
telemetry?: boolean;
|
|
6881
6885
|
webhookSecret?: string;
|
|
6882
|
-
}
|
|
6886
|
+
};
|
|
6887
|
+
declare function Spectrum<const Providers extends PlatformProviderConfig[]>(options: {
|
|
6888
|
+
projectId: string;
|
|
6889
|
+
projectSecret: string;
|
|
6890
|
+
} & SpectrumFactoryOptions<Providers>): Promise<SpectrumInstance<Providers> & {
|
|
6883
6891
|
readonly config: ProjectData;
|
|
6884
6892
|
}>;
|
|
6885
6893
|
declare function Spectrum<const Providers extends PlatformProviderConfig[]>(options: {
|
|
6886
6894
|
projectId?: never;
|
|
6887
6895
|
projectSecret?: never;
|
|
6888
|
-
|
|
6889
|
-
options?: SpectrumOptions;
|
|
6890
|
-
telemetry?: boolean;
|
|
6891
|
-
webhookSecret?: string;
|
|
6892
|
-
}): Promise<SpectrumInstance<Providers>>;
|
|
6896
|
+
} & SpectrumFactoryOptions<Providers>): Promise<SpectrumInstance<Providers>>;
|
|
6893
6897
|
//#endregion
|
|
6894
6898
|
//#region src/utils/errors.d.ts
|
|
6895
6899
|
type UnsupportedKind = "content" | "action";
|
|
@@ -7274,9 +7278,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7274
7278
|
}, z.core.$strip>, z.ZodObject<{
|
|
7275
7279
|
type: z.ZodLiteral<"reply">;
|
|
7276
7280
|
content: z.ZodCustom<{
|
|
7277
|
-
type: "custom";
|
|
7278
|
-
raw: unknown;
|
|
7279
|
-
} | {
|
|
7280
7281
|
type: "contact";
|
|
7281
7282
|
user?: {
|
|
7282
7283
|
__platform: string;
|
|
@@ -7327,12 +7328,38 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7327
7328
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7328
7329
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7329
7330
|
size?: number | undefined;
|
|
7331
|
+
} | {
|
|
7332
|
+
type: "poll";
|
|
7333
|
+
title: string;
|
|
7334
|
+
options: {
|
|
7335
|
+
title: string;
|
|
7336
|
+
}[];
|
|
7337
|
+
} | {
|
|
7338
|
+
type: "poll_option";
|
|
7339
|
+
option: {
|
|
7340
|
+
title: string;
|
|
7341
|
+
};
|
|
7342
|
+
poll: {
|
|
7343
|
+
type: "poll";
|
|
7344
|
+
title: string;
|
|
7345
|
+
options: {
|
|
7346
|
+
title: string;
|
|
7347
|
+
}[];
|
|
7348
|
+
};
|
|
7349
|
+
selected: boolean;
|
|
7350
|
+
title: string;
|
|
7351
|
+
} | {
|
|
7352
|
+
type: "custom";
|
|
7353
|
+
raw: unknown;
|
|
7330
7354
|
} | {
|
|
7331
7355
|
type: "text";
|
|
7332
7356
|
text: string;
|
|
7333
7357
|
} | {
|
|
7334
7358
|
type: "markdown";
|
|
7335
7359
|
markdown: string;
|
|
7360
|
+
} | {
|
|
7361
|
+
type: "group";
|
|
7362
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7336
7363
|
} | {
|
|
7337
7364
|
type: "streamText";
|
|
7338
7365
|
stream: () => AsyncIterable<string>;
|
|
@@ -7366,29 +7393,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7366
7393
|
type: "reaction";
|
|
7367
7394
|
emoji: string;
|
|
7368
7395
|
target: Message<string, User, Space<unknown>>;
|
|
7369
|
-
} | {
|
|
7370
|
-
type: "group";
|
|
7371
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7372
|
-
} | {
|
|
7373
|
-
type: "poll";
|
|
7374
|
-
title: string;
|
|
7375
|
-
options: {
|
|
7376
|
-
title: string;
|
|
7377
|
-
}[];
|
|
7378
|
-
} | {
|
|
7379
|
-
type: "poll_option";
|
|
7380
|
-
option: {
|
|
7381
|
-
title: string;
|
|
7382
|
-
};
|
|
7383
|
-
poll: {
|
|
7384
|
-
type: "poll";
|
|
7385
|
-
title: string;
|
|
7386
|
-
options: {
|
|
7387
|
-
title: string;
|
|
7388
|
-
}[];
|
|
7389
|
-
};
|
|
7390
|
-
selected: boolean;
|
|
7391
|
-
title: string;
|
|
7392
7396
|
} | {
|
|
7393
7397
|
type: "effect";
|
|
7394
7398
|
content: {
|
|
@@ -7431,9 +7435,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7431
7435
|
} | {
|
|
7432
7436
|
type: "leaveSpace";
|
|
7433
7437
|
}, {
|
|
7434
|
-
type: "custom";
|
|
7435
|
-
raw: unknown;
|
|
7436
|
-
} | {
|
|
7437
7438
|
type: "contact";
|
|
7438
7439
|
user?: {
|
|
7439
7440
|
__platform: string;
|
|
@@ -7484,12 +7485,38 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7484
7485
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7485
7486
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7486
7487
|
size?: number | undefined;
|
|
7488
|
+
} | {
|
|
7489
|
+
type: "poll";
|
|
7490
|
+
title: string;
|
|
7491
|
+
options: {
|
|
7492
|
+
title: string;
|
|
7493
|
+
}[];
|
|
7494
|
+
} | {
|
|
7495
|
+
type: "poll_option";
|
|
7496
|
+
option: {
|
|
7497
|
+
title: string;
|
|
7498
|
+
};
|
|
7499
|
+
poll: {
|
|
7500
|
+
type: "poll";
|
|
7501
|
+
title: string;
|
|
7502
|
+
options: {
|
|
7503
|
+
title: string;
|
|
7504
|
+
}[];
|
|
7505
|
+
};
|
|
7506
|
+
selected: boolean;
|
|
7507
|
+
title: string;
|
|
7508
|
+
} | {
|
|
7509
|
+
type: "custom";
|
|
7510
|
+
raw: unknown;
|
|
7487
7511
|
} | {
|
|
7488
7512
|
type: "text";
|
|
7489
7513
|
text: string;
|
|
7490
7514
|
} | {
|
|
7491
7515
|
type: "markdown";
|
|
7492
7516
|
markdown: string;
|
|
7517
|
+
} | {
|
|
7518
|
+
type: "group";
|
|
7519
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7493
7520
|
} | {
|
|
7494
7521
|
type: "streamText";
|
|
7495
7522
|
stream: () => AsyncIterable<string>;
|
|
@@ -7523,29 +7550,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7523
7550
|
type: "reaction";
|
|
7524
7551
|
emoji: string;
|
|
7525
7552
|
target: Message<string, User, Space<unknown>>;
|
|
7526
|
-
} | {
|
|
7527
|
-
type: "group";
|
|
7528
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7529
|
-
} | {
|
|
7530
|
-
type: "poll";
|
|
7531
|
-
title: string;
|
|
7532
|
-
options: {
|
|
7533
|
-
title: string;
|
|
7534
|
-
}[];
|
|
7535
|
-
} | {
|
|
7536
|
-
type: "poll_option";
|
|
7537
|
-
option: {
|
|
7538
|
-
title: string;
|
|
7539
|
-
};
|
|
7540
|
-
poll: {
|
|
7541
|
-
type: "poll";
|
|
7542
|
-
title: string;
|
|
7543
|
-
options: {
|
|
7544
|
-
title: string;
|
|
7545
|
-
}[];
|
|
7546
|
-
};
|
|
7547
|
-
selected: boolean;
|
|
7548
|
-
title: string;
|
|
7549
7553
|
} | {
|
|
7550
7554
|
type: "effect";
|
|
7551
7555
|
content: {
|
|
@@ -7592,9 +7596,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7592
7596
|
}, z.core.$strip>, z.ZodObject<{
|
|
7593
7597
|
type: z.ZodLiteral<"edit">;
|
|
7594
7598
|
content: z.ZodCustom<{
|
|
7595
|
-
type: "custom";
|
|
7596
|
-
raw: unknown;
|
|
7597
|
-
} | {
|
|
7598
7599
|
type: "contact";
|
|
7599
7600
|
user?: {
|
|
7600
7601
|
__platform: string;
|
|
@@ -7645,12 +7646,38 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7645
7646
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7646
7647
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7647
7648
|
size?: number | undefined;
|
|
7649
|
+
} | {
|
|
7650
|
+
type: "poll";
|
|
7651
|
+
title: string;
|
|
7652
|
+
options: {
|
|
7653
|
+
title: string;
|
|
7654
|
+
}[];
|
|
7655
|
+
} | {
|
|
7656
|
+
type: "poll_option";
|
|
7657
|
+
option: {
|
|
7658
|
+
title: string;
|
|
7659
|
+
};
|
|
7660
|
+
poll: {
|
|
7661
|
+
type: "poll";
|
|
7662
|
+
title: string;
|
|
7663
|
+
options: {
|
|
7664
|
+
title: string;
|
|
7665
|
+
}[];
|
|
7666
|
+
};
|
|
7667
|
+
selected: boolean;
|
|
7668
|
+
title: string;
|
|
7669
|
+
} | {
|
|
7670
|
+
type: "custom";
|
|
7671
|
+
raw: unknown;
|
|
7648
7672
|
} | {
|
|
7649
7673
|
type: "text";
|
|
7650
7674
|
text: string;
|
|
7651
7675
|
} | {
|
|
7652
7676
|
type: "markdown";
|
|
7653
7677
|
markdown: string;
|
|
7678
|
+
} | {
|
|
7679
|
+
type: "group";
|
|
7680
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7654
7681
|
} | {
|
|
7655
7682
|
type: "streamText";
|
|
7656
7683
|
stream: () => AsyncIterable<string>;
|
|
@@ -7684,29 +7711,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7684
7711
|
type: "reaction";
|
|
7685
7712
|
emoji: string;
|
|
7686
7713
|
target: Message<string, User, Space<unknown>>;
|
|
7687
|
-
} | {
|
|
7688
|
-
type: "group";
|
|
7689
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7690
|
-
} | {
|
|
7691
|
-
type: "poll";
|
|
7692
|
-
title: string;
|
|
7693
|
-
options: {
|
|
7694
|
-
title: string;
|
|
7695
|
-
}[];
|
|
7696
|
-
} | {
|
|
7697
|
-
type: "poll_option";
|
|
7698
|
-
option: {
|
|
7699
|
-
title: string;
|
|
7700
|
-
};
|
|
7701
|
-
poll: {
|
|
7702
|
-
type: "poll";
|
|
7703
|
-
title: string;
|
|
7704
|
-
options: {
|
|
7705
|
-
title: string;
|
|
7706
|
-
}[];
|
|
7707
|
-
};
|
|
7708
|
-
selected: boolean;
|
|
7709
|
-
title: string;
|
|
7710
7714
|
} | {
|
|
7711
7715
|
type: "effect";
|
|
7712
7716
|
content: {
|
|
@@ -7749,9 +7753,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7749
7753
|
} | {
|
|
7750
7754
|
type: "leaveSpace";
|
|
7751
7755
|
}, {
|
|
7752
|
-
type: "custom";
|
|
7753
|
-
raw: unknown;
|
|
7754
|
-
} | {
|
|
7755
7756
|
type: "contact";
|
|
7756
7757
|
user?: {
|
|
7757
7758
|
__platform: string;
|
|
@@ -7802,12 +7803,38 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7802
7803
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7803
7804
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7804
7805
|
size?: number | undefined;
|
|
7806
|
+
} | {
|
|
7807
|
+
type: "poll";
|
|
7808
|
+
title: string;
|
|
7809
|
+
options: {
|
|
7810
|
+
title: string;
|
|
7811
|
+
}[];
|
|
7812
|
+
} | {
|
|
7813
|
+
type: "poll_option";
|
|
7814
|
+
option: {
|
|
7815
|
+
title: string;
|
|
7816
|
+
};
|
|
7817
|
+
poll: {
|
|
7818
|
+
type: "poll";
|
|
7819
|
+
title: string;
|
|
7820
|
+
options: {
|
|
7821
|
+
title: string;
|
|
7822
|
+
}[];
|
|
7823
|
+
};
|
|
7824
|
+
selected: boolean;
|
|
7825
|
+
title: string;
|
|
7826
|
+
} | {
|
|
7827
|
+
type: "custom";
|
|
7828
|
+
raw: unknown;
|
|
7805
7829
|
} | {
|
|
7806
7830
|
type: "text";
|
|
7807
7831
|
text: string;
|
|
7808
7832
|
} | {
|
|
7809
7833
|
type: "markdown";
|
|
7810
7834
|
markdown: string;
|
|
7835
|
+
} | {
|
|
7836
|
+
type: "group";
|
|
7837
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7811
7838
|
} | {
|
|
7812
7839
|
type: "streamText";
|
|
7813
7840
|
stream: () => AsyncIterable<string>;
|
|
@@ -7841,29 +7868,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7841
7868
|
type: "reaction";
|
|
7842
7869
|
emoji: string;
|
|
7843
7870
|
target: Message<string, User, Space<unknown>>;
|
|
7844
|
-
} | {
|
|
7845
|
-
type: "group";
|
|
7846
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7847
|
-
} | {
|
|
7848
|
-
type: "poll";
|
|
7849
|
-
title: string;
|
|
7850
|
-
options: {
|
|
7851
|
-
title: string;
|
|
7852
|
-
}[];
|
|
7853
|
-
} | {
|
|
7854
|
-
type: "poll_option";
|
|
7855
|
-
option: {
|
|
7856
|
-
title: string;
|
|
7857
|
-
};
|
|
7858
|
-
poll: {
|
|
7859
|
-
type: "poll";
|
|
7860
|
-
title: string;
|
|
7861
|
-
options: {
|
|
7862
|
-
title: string;
|
|
7863
|
-
}[];
|
|
7864
|
-
};
|
|
7865
|
-
selected: boolean;
|
|
7866
|
-
title: string;
|
|
7867
7871
|
} | {
|
|
7868
7872
|
type: "effect";
|
|
7869
7873
|
content: {
|
package/dist/authoring.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as asReply, Cn as asCustom, Ct as asText, Et as asRichlink, Ft as renameSchema, H as ProviderMessageRecord, Hn as PhotoInput, Jt as asMarkdown, Lt as asRead, Mt as replySchema, Nn as asContact, Sn as reactionSchema, U as ProviderUserRecord, Un as buildPhotoAction, Ut as asPoll, Vn as avatarSchema, Wn as photoActionSchema, Wt as asPollOption, _n as removeMemberSchema, _t as asVoice, bn as asReaction, hn as leaveSpaceSchema, pn as addMemberSchema, q as ManagedStream, r as asAttachment, rn as groupSchema, tn as asGroup } from "./attachment-
|
|
1
|
+
import { At as asReply, Cn as asCustom, Ct as asText, Et as asRichlink, Ft as renameSchema, H as ProviderMessageRecord, Hn as PhotoInput, Jt as asMarkdown, Lt as asRead, Mt as replySchema, Nn as asContact, Sn as reactionSchema, U as ProviderUserRecord, Un as buildPhotoAction, Ut as asPoll, Vn as avatarSchema, Wn as photoActionSchema, Wt as asPollOption, _n as removeMemberSchema, _t as asVoice, bn as asReaction, hn as leaveSpaceSchema, pn as addMemberSchema, q as ManagedStream, r as asAttachment, rn as groupSchema, tn as asGroup } from "./attachment-Cpg2VUkY.js";
|
|
2
2
|
import z from "zod";
|
|
3
3
|
import { FetchSpanOptions, LogAttrs, LogAttrs as LogAttrs$1, LogLevel, PhotonLogger, SanitizeUrlOptions, createLogger, sanitizeEmail, sanitizeErrorMessage, sanitizePhone, sanitizeUrl, setLogLevel } from "@photon-ai/otel";
|
|
4
4
|
import { Token } from "marked";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as DedicatedTokenData, $t as TextStreamOptions, A as isFusorEvent, An as ContactName, B as PlatformUser, Bn as avatar, Bt as PollChoice, C as FusorVerify, D as WebhookRawResult, Dn as ContactDetails, Dt as richlink, E as WebhookRawRequest, En as ContactAddress, F as PlatformInstance, Fn as AgentSender, G as SpaceNamespace, Gn as App, Gt as option, Ht as PollOption, I as PlatformMessage, In as User, It as Read, J as broadcast, Jn as AppUrl, K as Broadcaster, Kn as AppLayout, Kt as poll, L as PlatformProviderConfig, Ln as Avatar, M as EventProducer, Mn as ContactPhone, N as Platform, Nt as Rename, O as FusorEvent, On as ContactEmail, Ot as resolveContents, P as PlatformDef, Pn as contact, Pt as rename, Q as CloudPlatform, Qt as StreamTextSource, R as PlatformRuntime, Rn as AvatarData, Rt as read, S as FusorRespond, St as typing, T as WebhookHandler, Tn as Contact, Tt as Richlink, V as ProviderMessage, Vt as PollChoiceInput, W as SchemaMessage, X as stream, Xn as appLayoutSchema, Xt as DeltaExtractor, Y as mergeStreams, Yn as app, Yt as markdown, Z as Store, Zt as StreamText, _ as FusorClient, a as Content, an as edit, at as ProjectProfile, b as FusorMessagesReturn, bt as unsend, c as fromVCard, cn as AddMember, ct as SlackTokenData, d as UnsupportedKind, dn as RemoveMember, dt as SubscriptionStatus, en as Group, et as FusorTokenData, f as Spectrum, fn as addMember, ft as TokenData, g as isFusorClient, gn as removeMember, gt as Voice, h as fusor, ht as EmojiKey, i as attachment, in as Edit, it as ProjectData, j as AnyPlatformDef, jn as ContactOrg, jt as reply, k as fusorEvent, kn as ContactInput, kt as Reply, l as toVCard, ln as LeaveSpace, lt as SpectrumCloudError, m as definePlatform, mn as leaveSpace, mt as Emoji, n as AttachmentInput, nn as group, nt as PlatformStatus, o as ContentBuilder, on as Message, ot as SharedTokenData, p as SpectrumInstance, pt as cloud, q as ManagedStream, qn as AppOptions, qt as Markdown, rt as PlatformsData, s as ContentInput, sn as Space, st as SlackTeamMeta, t as Attachment, tt as ImessageInfoData, u as UnsupportedError, un as MemberInput, ut as SubscriptionData, v as FusorMessages, vn as Reaction, vt as voice, w as FusorVerifyRequest, wn as custom, wt as text, x as FusorReply, xn as reaction, xt as Typing, y as FusorMessagesCtx, yn as ReactionBuilder, yt as Unsend, z as PlatformSpace, zn as AvatarInput, zt as Poll } from "./attachment-
|
|
1
|
+
import { $ as DedicatedTokenData, $t as TextStreamOptions, A as isFusorEvent, An as ContactName, B as PlatformUser, Bn as avatar, Bt as PollChoice, C as FusorVerify, D as WebhookRawResult, Dn as ContactDetails, Dt as richlink, E as WebhookRawRequest, En as ContactAddress, F as PlatformInstance, Fn as AgentSender, G as SpaceNamespace, Gn as App, Gt as option, Ht as PollOption, I as PlatformMessage, In as User, It as Read, J as broadcast, Jn as AppUrl, K as Broadcaster, Kn as AppLayout, Kt as poll, L as PlatformProviderConfig, Ln as Avatar, M as EventProducer, Mn as ContactPhone, N as Platform, Nt as Rename, O as FusorEvent, On as ContactEmail, Ot as resolveContents, P as PlatformDef, Pn as contact, Pt as rename, Q as CloudPlatform, Qt as StreamTextSource, R as PlatformRuntime, Rn as AvatarData, Rt as read, S as FusorRespond, St as typing, T as WebhookHandler, Tn as Contact, Tt as Richlink, V as ProviderMessage, Vt as PollChoiceInput, W as SchemaMessage, X as stream, Xn as appLayoutSchema, Xt as DeltaExtractor, Y as mergeStreams, Yn as app, Yt as markdown, Z as Store, Zt as StreamText, _ as FusorClient, a as Content, an as edit, at as ProjectProfile, b as FusorMessagesReturn, bt as unsend, c as fromVCard, cn as AddMember, ct as SlackTokenData, d as UnsupportedKind, dn as RemoveMember, dt as SubscriptionStatus, en as Group, et as FusorTokenData, f as Spectrum, fn as addMember, ft as TokenData, g as isFusorClient, gn as removeMember, gt as Voice, h as fusor, ht as EmojiKey, i as attachment, in as Edit, it as ProjectData, j as AnyPlatformDef, jn as ContactOrg, jt as reply, k as fusorEvent, kn as ContactInput, kt as Reply, l as toVCard, ln as LeaveSpace, lt as SpectrumCloudError, m as definePlatform, mn as leaveSpace, mt as Emoji, n as AttachmentInput, nn as group, nt as PlatformStatus, o as ContentBuilder, on as Message, ot as SharedTokenData, p as SpectrumInstance, pt as cloud, q as ManagedStream, qn as AppOptions, qt as Markdown, rt as PlatformsData, s as ContentInput, sn as Space, st as SlackTeamMeta, t as Attachment, tt as ImessageInfoData, u as UnsupportedError, un as MemberInput, ut as SubscriptionData, v as FusorMessages, vn as Reaction, vt as voice, w as FusorVerifyRequest, wn as custom, wt as text, x as FusorReply, xn as reaction, xt as Typing, y as FusorMessagesCtx, yn as ReactionBuilder, yt as Unsend, z as PlatformSpace, zn as AvatarInput, zt as Poll } from "./attachment-Cpg2VUkY.js";
|
|
2
2
|
export { type AddMember, type AgentSender, type AnyPlatformDef, type App, type AppLayout, type AppOptions, type AppUrl, type Attachment, type AttachmentInput, type Avatar, type AvatarData, type AvatarInput, type Broadcaster, type CloudPlatform, type Contact, type ContactAddress, type ContactDetails, type ContactEmail, type ContactInput, type ContactName, type ContactOrg, type ContactPhone, type Content, type ContentBuilder, type ContentInput, type DedicatedTokenData, type DeltaExtractor, type Edit, Emoji, type EmojiKey, type EventProducer, type FusorClient, type FusorEvent, type FusorMessages, type FusorMessagesCtx, type FusorMessagesReturn, type FusorReply, type FusorRespond, type FusorTokenData, type FusorVerify, type FusorVerifyRequest, type Group, type ImessageInfoData, type LeaveSpace, type ManagedStream, type Markdown, type MemberInput, type Message, type Platform, type PlatformDef, type PlatformInstance, type PlatformMessage, type PlatformProviderConfig, type PlatformRuntime, type PlatformSpace, type PlatformStatus, type PlatformUser, type PlatformsData, type Poll, type PollChoice, type PollChoiceInput, type PollOption, type ProjectData, type ProjectProfile, type ProviderMessage, type Reaction, type ReactionBuilder, type Read, type RemoveMember, type Rename, type Reply, type Richlink, type SchemaMessage, type SharedTokenData, type SlackTeamMeta, type SlackTokenData, type Space, type SpaceNamespace, Spectrum, SpectrumCloudError, type SpectrumInstance, type Store, type StreamText, type StreamTextSource, type SubscriptionData, type SubscriptionStatus, type TextStreamOptions, type TokenData, type Typing, type Unsend, UnsupportedError, type UnsupportedKind, type User, type Voice, type WebhookHandler, type WebhookRawRequest, type WebhookRawResult, addMember, app, appLayoutSchema, attachment, avatar, broadcast, cloud, contact, custom, definePlatform, edit, fromVCard, fusor, fusorEvent, group, isFusorClient, isFusorEvent, leaveSpace, markdown, mergeStreams, option, poll, reaction, read, removeMember, rename, reply, resolveContents, richlink, stream, text, toVCard, typing, unsend, voice };
|
package/dist/index.js
CHANGED
|
@@ -3051,7 +3051,7 @@ function definePlatform(name, rawDef) {
|
|
|
3051
3051
|
}
|
|
3052
3052
|
//#endregion
|
|
3053
3053
|
//#region src/build-env.ts
|
|
3054
|
-
const SPECTRUM_SDK_VERSION = "
|
|
3054
|
+
const SPECTRUM_SDK_VERSION = "11.0.0";
|
|
3055
3055
|
//#endregion
|
|
3056
3056
|
//#region src/utils/provider-packages.ts
|
|
3057
3057
|
const OFFICIAL_PROVIDER_PACKAGES = {
|
|
@@ -3073,7 +3073,7 @@ const installCommand = (pkg) => process.versions.bun ? `bun add ${pkg}` : `npm i
|
|
|
3073
3073
|
const officialProviderInstallHint = (platform) => {
|
|
3074
3074
|
const pkg = officialProviderPackage(platform);
|
|
3075
3075
|
if (!pkg) return;
|
|
3076
|
-
return `the "${platform}" platform is provided by the optional package ${pkg} — install it (\`${installCommand(pkg)}\`) and pass it to Spectrum({
|
|
3076
|
+
return `the "${platform}" platform is provided by the optional package ${pkg} — install it (\`${installCommand(pkg)}\`) and pass it to Spectrum({ platforms: [...] })`;
|
|
3077
3077
|
};
|
|
3078
3078
|
//#endregion
|
|
3079
3079
|
//#region src/utils/cloud.ts
|
|
@@ -4058,18 +4058,20 @@ const spectrumOptionsSchema = z.object({
|
|
|
4058
4058
|
const spectrumConfigSchema = z.union([z.object({
|
|
4059
4059
|
projectId: z.string().min(1),
|
|
4060
4060
|
projectSecret: z.string().min(1),
|
|
4061
|
-
providers: z.array(z.custom()),
|
|
4061
|
+
providers: z.array(z.custom()).optional(),
|
|
4062
|
+
platforms: z.array(z.custom()).optional(),
|
|
4062
4063
|
options: spectrumOptionsSchema,
|
|
4063
4064
|
telemetry: z.boolean().optional(),
|
|
4064
4065
|
webhookSecret: z.string().min(1).optional()
|
|
4065
4066
|
}), z.object({
|
|
4066
4067
|
projectId: z.undefined().optional(),
|
|
4067
4068
|
projectSecret: z.undefined().optional(),
|
|
4068
|
-
providers: z.array(z.custom()),
|
|
4069
|
+
providers: z.array(z.custom()).optional(),
|
|
4070
|
+
platforms: z.array(z.custom()).optional(),
|
|
4069
4071
|
options: spectrumOptionsSchema,
|
|
4070
4072
|
telemetry: z.boolean().optional(),
|
|
4071
4073
|
webhookSecret: z.string().min(1).optional()
|
|
4072
|
-
})]);
|
|
4074
|
+
})]).refine((config) => config.providers === void 0 !== (config.platforms === void 0), "Spectrum requires exactly one of platforms or providers");
|
|
4073
4075
|
function bootstrapTelemetry(opts) {
|
|
4074
4076
|
const headers = {};
|
|
4075
4077
|
if (opts.projectId && opts.projectSecret) {
|
|
@@ -4101,6 +4103,11 @@ function resolveProjectCredentials(options) {
|
|
|
4101
4103
|
projectSecret: options.projectSecret ?? envValue(envFor("PROJECT", "SECRET"))
|
|
4102
4104
|
};
|
|
4103
4105
|
}
|
|
4106
|
+
const resolveConfiguredProviders = (options) => {
|
|
4107
|
+
const configuredProviders = options.platforms ?? options.providers;
|
|
4108
|
+
if (!configuredProviders) throw new Error("Spectrum requires platforms or providers");
|
|
4109
|
+
return configuredProviders;
|
|
4110
|
+
};
|
|
4104
4111
|
async function Spectrum(options) {
|
|
4105
4112
|
const { projectId, projectSecret } = resolveProjectCredentials(options);
|
|
4106
4113
|
spectrumConfigSchema.parse({
|
|
@@ -4108,7 +4115,8 @@ async function Spectrum(options) {
|
|
|
4108
4115
|
projectId,
|
|
4109
4116
|
projectSecret
|
|
4110
4117
|
});
|
|
4111
|
-
const
|
|
4118
|
+
const providers = resolveConfiguredProviders(options);
|
|
4119
|
+
const { options: runtimeOptions, telemetry, webhookSecret } = options;
|
|
4112
4120
|
const flattenGroups = runtimeOptions?.flattenGroups ?? false;
|
|
4113
4121
|
applyLogLevel(runtimeOptions?.logLevel);
|
|
4114
4122
|
const resolvedWebhookSecret = webhookSecret ?? process.env[envFor("WEBHOOK", "SECRET")];
|