@spectrum-ts/core 9.3.0 → 10.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-BpPKbxT1.d.ts → attachment-CxF8ejPo.d.ts} +173 -169
- 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,11 +592,8 @@ 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: "
|
|
596
|
-
|
|
597
|
-
} | {
|
|
598
|
-
type: "markdown";
|
|
599
|
-
markdown: string;
|
|
595
|
+
type: "custom";
|
|
596
|
+
raw: unknown;
|
|
600
597
|
} | {
|
|
601
598
|
type: "attachment";
|
|
602
599
|
id: string;
|
|
@@ -649,8 +646,18 @@ declare const editSchema: z.ZodObject<{
|
|
|
649
646
|
} | undefined;
|
|
650
647
|
raw?: unknown;
|
|
651
648
|
} | {
|
|
652
|
-
type: "
|
|
653
|
-
|
|
649
|
+
type: "text";
|
|
650
|
+
text: string;
|
|
651
|
+
} | {
|
|
652
|
+
type: "markdown";
|
|
653
|
+
markdown: string;
|
|
654
|
+
} | {
|
|
655
|
+
type: "group";
|
|
656
|
+
items: Message<string, User, Space<unknown>>[];
|
|
657
|
+
} | {
|
|
658
|
+
type: "reaction";
|
|
659
|
+
emoji: string;
|
|
660
|
+
target: Message<string, User, Space<unknown>>;
|
|
654
661
|
} | {
|
|
655
662
|
type: "poll";
|
|
656
663
|
title: string;
|
|
@@ -671,13 +678,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
671
678
|
};
|
|
672
679
|
selected: boolean;
|
|
673
680
|
title: string;
|
|
674
|
-
} | {
|
|
675
|
-
type: "group";
|
|
676
|
-
items: Message<string, User, Space<unknown>>[];
|
|
677
|
-
} | {
|
|
678
|
-
type: "reaction";
|
|
679
|
-
emoji: string;
|
|
680
|
-
target: Message<string, User, Space<unknown>>;
|
|
681
681
|
} | {
|
|
682
682
|
type: "streamText";
|
|
683
683
|
stream: () => AsyncIterable<string>;
|
|
@@ -710,12 +710,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
710
710
|
} | {
|
|
711
711
|
type: "effect";
|
|
712
712
|
content: {
|
|
713
|
-
type: "text";
|
|
714
|
-
text: string;
|
|
715
|
-
} | {
|
|
716
|
-
type: "markdown";
|
|
717
|
-
markdown: string;
|
|
718
|
-
} | {
|
|
719
713
|
type: "attachment";
|
|
720
714
|
id: string;
|
|
721
715
|
name: string;
|
|
@@ -723,6 +717,12 @@ declare const editSchema: z.ZodObject<{
|
|
|
723
717
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
724
718
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
725
719
|
size?: number | undefined;
|
|
720
|
+
} | {
|
|
721
|
+
type: "text";
|
|
722
|
+
text: string;
|
|
723
|
+
} | {
|
|
724
|
+
type: "markdown";
|
|
725
|
+
markdown: string;
|
|
726
726
|
};
|
|
727
727
|
effect: string;
|
|
728
728
|
} | {
|
|
@@ -749,11 +749,8 @@ declare const editSchema: z.ZodObject<{
|
|
|
749
749
|
} | {
|
|
750
750
|
type: "leaveSpace";
|
|
751
751
|
}, {
|
|
752
|
-
type: "
|
|
753
|
-
|
|
754
|
-
} | {
|
|
755
|
-
type: "markdown";
|
|
756
|
-
markdown: string;
|
|
752
|
+
type: "custom";
|
|
753
|
+
raw: unknown;
|
|
757
754
|
} | {
|
|
758
755
|
type: "attachment";
|
|
759
756
|
id: string;
|
|
@@ -806,8 +803,18 @@ declare const editSchema: z.ZodObject<{
|
|
|
806
803
|
} | undefined;
|
|
807
804
|
raw?: unknown;
|
|
808
805
|
} | {
|
|
809
|
-
type: "
|
|
810
|
-
|
|
806
|
+
type: "text";
|
|
807
|
+
text: string;
|
|
808
|
+
} | {
|
|
809
|
+
type: "markdown";
|
|
810
|
+
markdown: string;
|
|
811
|
+
} | {
|
|
812
|
+
type: "group";
|
|
813
|
+
items: Message<string, User, Space<unknown>>[];
|
|
814
|
+
} | {
|
|
815
|
+
type: "reaction";
|
|
816
|
+
emoji: string;
|
|
817
|
+
target: Message<string, User, Space<unknown>>;
|
|
811
818
|
} | {
|
|
812
819
|
type: "poll";
|
|
813
820
|
title: string;
|
|
@@ -828,13 +835,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
828
835
|
};
|
|
829
836
|
selected: boolean;
|
|
830
837
|
title: string;
|
|
831
|
-
} | {
|
|
832
|
-
type: "group";
|
|
833
|
-
items: Message<string, User, Space<unknown>>[];
|
|
834
|
-
} | {
|
|
835
|
-
type: "reaction";
|
|
836
|
-
emoji: string;
|
|
837
|
-
target: Message<string, User, Space<unknown>>;
|
|
838
838
|
} | {
|
|
839
839
|
type: "streamText";
|
|
840
840
|
stream: () => AsyncIterable<string>;
|
|
@@ -867,12 +867,6 @@ declare const editSchema: z.ZodObject<{
|
|
|
867
867
|
} | {
|
|
868
868
|
type: "effect";
|
|
869
869
|
content: {
|
|
870
|
-
type: "text";
|
|
871
|
-
text: string;
|
|
872
|
-
} | {
|
|
873
|
-
type: "markdown";
|
|
874
|
-
markdown: string;
|
|
875
|
-
} | {
|
|
876
870
|
type: "attachment";
|
|
877
871
|
id: string;
|
|
878
872
|
name: string;
|
|
@@ -880,6 +874,12 @@ declare const editSchema: z.ZodObject<{
|
|
|
880
874
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
881
875
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
882
876
|
size?: number | undefined;
|
|
877
|
+
} | {
|
|
878
|
+
type: "text";
|
|
879
|
+
text: string;
|
|
880
|
+
} | {
|
|
881
|
+
type: "markdown";
|
|
882
|
+
markdown: string;
|
|
883
883
|
};
|
|
884
884
|
effect: string;
|
|
885
885
|
} | {
|
|
@@ -1136,11 +1136,8 @@ 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: "
|
|
1140
|
-
|
|
1141
|
-
} | {
|
|
1142
|
-
type: "markdown";
|
|
1143
|
-
markdown: string;
|
|
1139
|
+
type: "custom";
|
|
1140
|
+
raw: unknown;
|
|
1144
1141
|
} | {
|
|
1145
1142
|
type: "attachment";
|
|
1146
1143
|
id: string;
|
|
@@ -1193,8 +1190,18 @@ declare const replySchema: z.ZodObject<{
|
|
|
1193
1190
|
} | undefined;
|
|
1194
1191
|
raw?: unknown;
|
|
1195
1192
|
} | {
|
|
1196
|
-
type: "
|
|
1197
|
-
|
|
1193
|
+
type: "text";
|
|
1194
|
+
text: string;
|
|
1195
|
+
} | {
|
|
1196
|
+
type: "markdown";
|
|
1197
|
+
markdown: string;
|
|
1198
|
+
} | {
|
|
1199
|
+
type: "group";
|
|
1200
|
+
items: Message<string, User, Space<unknown>>[];
|
|
1201
|
+
} | {
|
|
1202
|
+
type: "reaction";
|
|
1203
|
+
emoji: string;
|
|
1204
|
+
target: Message<string, User, Space<unknown>>;
|
|
1198
1205
|
} | {
|
|
1199
1206
|
type: "poll";
|
|
1200
1207
|
title: string;
|
|
@@ -1215,13 +1222,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1215
1222
|
};
|
|
1216
1223
|
selected: boolean;
|
|
1217
1224
|
title: string;
|
|
1218
|
-
} | {
|
|
1219
|
-
type: "group";
|
|
1220
|
-
items: Message<string, User, Space<unknown>>[];
|
|
1221
|
-
} | {
|
|
1222
|
-
type: "reaction";
|
|
1223
|
-
emoji: string;
|
|
1224
|
-
target: Message<string, User, Space<unknown>>;
|
|
1225
1225
|
} | {
|
|
1226
1226
|
type: "streamText";
|
|
1227
1227
|
stream: () => AsyncIterable<string>;
|
|
@@ -1254,12 +1254,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1254
1254
|
} | {
|
|
1255
1255
|
type: "effect";
|
|
1256
1256
|
content: {
|
|
1257
|
-
type: "text";
|
|
1258
|
-
text: string;
|
|
1259
|
-
} | {
|
|
1260
|
-
type: "markdown";
|
|
1261
|
-
markdown: string;
|
|
1262
|
-
} | {
|
|
1263
1257
|
type: "attachment";
|
|
1264
1258
|
id: string;
|
|
1265
1259
|
name: string;
|
|
@@ -1267,6 +1261,12 @@ declare const replySchema: z.ZodObject<{
|
|
|
1267
1261
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1268
1262
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
1269
1263
|
size?: number | undefined;
|
|
1264
|
+
} | {
|
|
1265
|
+
type: "text";
|
|
1266
|
+
text: string;
|
|
1267
|
+
} | {
|
|
1268
|
+
type: "markdown";
|
|
1269
|
+
markdown: string;
|
|
1270
1270
|
};
|
|
1271
1271
|
effect: string;
|
|
1272
1272
|
} | {
|
|
@@ -1293,11 +1293,8 @@ declare const replySchema: z.ZodObject<{
|
|
|
1293
1293
|
} | {
|
|
1294
1294
|
type: "leaveSpace";
|
|
1295
1295
|
}, {
|
|
1296
|
-
type: "
|
|
1297
|
-
|
|
1298
|
-
} | {
|
|
1299
|
-
type: "markdown";
|
|
1300
|
-
markdown: string;
|
|
1296
|
+
type: "custom";
|
|
1297
|
+
raw: unknown;
|
|
1301
1298
|
} | {
|
|
1302
1299
|
type: "attachment";
|
|
1303
1300
|
id: string;
|
|
@@ -1350,8 +1347,18 @@ declare const replySchema: z.ZodObject<{
|
|
|
1350
1347
|
} | undefined;
|
|
1351
1348
|
raw?: unknown;
|
|
1352
1349
|
} | {
|
|
1353
|
-
type: "
|
|
1354
|
-
|
|
1350
|
+
type: "text";
|
|
1351
|
+
text: string;
|
|
1352
|
+
} | {
|
|
1353
|
+
type: "markdown";
|
|
1354
|
+
markdown: string;
|
|
1355
|
+
} | {
|
|
1356
|
+
type: "group";
|
|
1357
|
+
items: Message<string, User, Space<unknown>>[];
|
|
1358
|
+
} | {
|
|
1359
|
+
type: "reaction";
|
|
1360
|
+
emoji: string;
|
|
1361
|
+
target: Message<string, User, Space<unknown>>;
|
|
1355
1362
|
} | {
|
|
1356
1363
|
type: "poll";
|
|
1357
1364
|
title: string;
|
|
@@ -1372,13 +1379,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1372
1379
|
};
|
|
1373
1380
|
selected: boolean;
|
|
1374
1381
|
title: string;
|
|
1375
|
-
} | {
|
|
1376
|
-
type: "group";
|
|
1377
|
-
items: Message<string, User, Space<unknown>>[];
|
|
1378
|
-
} | {
|
|
1379
|
-
type: "reaction";
|
|
1380
|
-
emoji: string;
|
|
1381
|
-
target: Message<string, User, Space<unknown>>;
|
|
1382
1382
|
} | {
|
|
1383
1383
|
type: "streamText";
|
|
1384
1384
|
stream: () => AsyncIterable<string>;
|
|
@@ -1411,12 +1411,6 @@ declare const replySchema: z.ZodObject<{
|
|
|
1411
1411
|
} | {
|
|
1412
1412
|
type: "effect";
|
|
1413
1413
|
content: {
|
|
1414
|
-
type: "text";
|
|
1415
|
-
text: string;
|
|
1416
|
-
} | {
|
|
1417
|
-
type: "markdown";
|
|
1418
|
-
markdown: string;
|
|
1419
|
-
} | {
|
|
1420
1414
|
type: "attachment";
|
|
1421
1415
|
id: string;
|
|
1422
1416
|
name: string;
|
|
@@ -1424,6 +1418,12 @@ declare const replySchema: z.ZodObject<{
|
|
|
1424
1418
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
1425
1419
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
1426
1420
|
size?: number | undefined;
|
|
1421
|
+
} | {
|
|
1422
|
+
type: "text";
|
|
1423
|
+
text: string;
|
|
1424
|
+
} | {
|
|
1425
|
+
type: "markdown";
|
|
1426
|
+
markdown: string;
|
|
1427
1427
|
};
|
|
1428
1428
|
effect: string;
|
|
1429
1429
|
} | {
|
|
@@ -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,11 +7278,8 @@ 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: "
|
|
7278
|
-
|
|
7279
|
-
} | {
|
|
7280
|
-
type: "markdown";
|
|
7281
|
-
markdown: string;
|
|
7281
|
+
type: "custom";
|
|
7282
|
+
raw: unknown;
|
|
7282
7283
|
} | {
|
|
7283
7284
|
type: "attachment";
|
|
7284
7285
|
id: string;
|
|
@@ -7331,8 +7332,18 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7331
7332
|
} | undefined;
|
|
7332
7333
|
raw?: unknown;
|
|
7333
7334
|
} | {
|
|
7334
|
-
type: "
|
|
7335
|
-
|
|
7335
|
+
type: "text";
|
|
7336
|
+
text: string;
|
|
7337
|
+
} | {
|
|
7338
|
+
type: "markdown";
|
|
7339
|
+
markdown: string;
|
|
7340
|
+
} | {
|
|
7341
|
+
type: "group";
|
|
7342
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7343
|
+
} | {
|
|
7344
|
+
type: "reaction";
|
|
7345
|
+
emoji: string;
|
|
7346
|
+
target: Message<string, User, Space<unknown>>;
|
|
7336
7347
|
} | {
|
|
7337
7348
|
type: "poll";
|
|
7338
7349
|
title: string;
|
|
@@ -7353,13 +7364,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7353
7364
|
};
|
|
7354
7365
|
selected: boolean;
|
|
7355
7366
|
title: string;
|
|
7356
|
-
} | {
|
|
7357
|
-
type: "group";
|
|
7358
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7359
|
-
} | {
|
|
7360
|
-
type: "reaction";
|
|
7361
|
-
emoji: string;
|
|
7362
|
-
target: Message<string, User, Space<unknown>>;
|
|
7363
7367
|
} | {
|
|
7364
7368
|
type: "streamText";
|
|
7365
7369
|
stream: () => AsyncIterable<string>;
|
|
@@ -7392,12 +7396,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7392
7396
|
} | {
|
|
7393
7397
|
type: "effect";
|
|
7394
7398
|
content: {
|
|
7395
|
-
type: "text";
|
|
7396
|
-
text: string;
|
|
7397
|
-
} | {
|
|
7398
|
-
type: "markdown";
|
|
7399
|
-
markdown: string;
|
|
7400
|
-
} | {
|
|
7401
7399
|
type: "attachment";
|
|
7402
7400
|
id: string;
|
|
7403
7401
|
name: string;
|
|
@@ -7405,6 +7403,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7405
7403
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7406
7404
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7407
7405
|
size?: number | undefined;
|
|
7406
|
+
} | {
|
|
7407
|
+
type: "text";
|
|
7408
|
+
text: string;
|
|
7409
|
+
} | {
|
|
7410
|
+
type: "markdown";
|
|
7411
|
+
markdown: string;
|
|
7408
7412
|
};
|
|
7409
7413
|
effect: string;
|
|
7410
7414
|
} | {
|
|
@@ -7431,11 +7435,8 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7431
7435
|
} | {
|
|
7432
7436
|
type: "leaveSpace";
|
|
7433
7437
|
}, {
|
|
7434
|
-
type: "
|
|
7435
|
-
|
|
7436
|
-
} | {
|
|
7437
|
-
type: "markdown";
|
|
7438
|
-
markdown: string;
|
|
7438
|
+
type: "custom";
|
|
7439
|
+
raw: unknown;
|
|
7439
7440
|
} | {
|
|
7440
7441
|
type: "attachment";
|
|
7441
7442
|
id: string;
|
|
@@ -7488,8 +7489,18 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7488
7489
|
} | undefined;
|
|
7489
7490
|
raw?: unknown;
|
|
7490
7491
|
} | {
|
|
7491
|
-
type: "
|
|
7492
|
-
|
|
7492
|
+
type: "text";
|
|
7493
|
+
text: string;
|
|
7494
|
+
} | {
|
|
7495
|
+
type: "markdown";
|
|
7496
|
+
markdown: string;
|
|
7497
|
+
} | {
|
|
7498
|
+
type: "group";
|
|
7499
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7500
|
+
} | {
|
|
7501
|
+
type: "reaction";
|
|
7502
|
+
emoji: string;
|
|
7503
|
+
target: Message<string, User, Space<unknown>>;
|
|
7493
7504
|
} | {
|
|
7494
7505
|
type: "poll";
|
|
7495
7506
|
title: string;
|
|
@@ -7510,13 +7521,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7510
7521
|
};
|
|
7511
7522
|
selected: boolean;
|
|
7512
7523
|
title: string;
|
|
7513
|
-
} | {
|
|
7514
|
-
type: "group";
|
|
7515
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7516
|
-
} | {
|
|
7517
|
-
type: "reaction";
|
|
7518
|
-
emoji: string;
|
|
7519
|
-
target: Message<string, User, Space<unknown>>;
|
|
7520
7524
|
} | {
|
|
7521
7525
|
type: "streamText";
|
|
7522
7526
|
stream: () => AsyncIterable<string>;
|
|
@@ -7549,12 +7553,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7549
7553
|
} | {
|
|
7550
7554
|
type: "effect";
|
|
7551
7555
|
content: {
|
|
7552
|
-
type: "text";
|
|
7553
|
-
text: string;
|
|
7554
|
-
} | {
|
|
7555
|
-
type: "markdown";
|
|
7556
|
-
markdown: string;
|
|
7557
|
-
} | {
|
|
7558
7556
|
type: "attachment";
|
|
7559
7557
|
id: string;
|
|
7560
7558
|
name: string;
|
|
@@ -7562,6 +7560,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7562
7560
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7563
7561
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7564
7562
|
size?: number | undefined;
|
|
7563
|
+
} | {
|
|
7564
|
+
type: "text";
|
|
7565
|
+
text: string;
|
|
7566
|
+
} | {
|
|
7567
|
+
type: "markdown";
|
|
7568
|
+
markdown: string;
|
|
7565
7569
|
};
|
|
7566
7570
|
effect: string;
|
|
7567
7571
|
} | {
|
|
@@ -7592,11 +7596,8 @@ 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: "
|
|
7596
|
-
|
|
7597
|
-
} | {
|
|
7598
|
-
type: "markdown";
|
|
7599
|
-
markdown: string;
|
|
7599
|
+
type: "custom";
|
|
7600
|
+
raw: unknown;
|
|
7600
7601
|
} | {
|
|
7601
7602
|
type: "attachment";
|
|
7602
7603
|
id: string;
|
|
@@ -7649,8 +7650,18 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7649
7650
|
} | undefined;
|
|
7650
7651
|
raw?: unknown;
|
|
7651
7652
|
} | {
|
|
7652
|
-
type: "
|
|
7653
|
-
|
|
7653
|
+
type: "text";
|
|
7654
|
+
text: string;
|
|
7655
|
+
} | {
|
|
7656
|
+
type: "markdown";
|
|
7657
|
+
markdown: string;
|
|
7658
|
+
} | {
|
|
7659
|
+
type: "group";
|
|
7660
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7661
|
+
} | {
|
|
7662
|
+
type: "reaction";
|
|
7663
|
+
emoji: string;
|
|
7664
|
+
target: Message<string, User, Space<unknown>>;
|
|
7654
7665
|
} | {
|
|
7655
7666
|
type: "poll";
|
|
7656
7667
|
title: string;
|
|
@@ -7671,13 +7682,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7671
7682
|
};
|
|
7672
7683
|
selected: boolean;
|
|
7673
7684
|
title: string;
|
|
7674
|
-
} | {
|
|
7675
|
-
type: "group";
|
|
7676
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7677
|
-
} | {
|
|
7678
|
-
type: "reaction";
|
|
7679
|
-
emoji: string;
|
|
7680
|
-
target: Message<string, User, Space<unknown>>;
|
|
7681
7685
|
} | {
|
|
7682
7686
|
type: "streamText";
|
|
7683
7687
|
stream: () => AsyncIterable<string>;
|
|
@@ -7710,12 +7714,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7710
7714
|
} | {
|
|
7711
7715
|
type: "effect";
|
|
7712
7716
|
content: {
|
|
7713
|
-
type: "text";
|
|
7714
|
-
text: string;
|
|
7715
|
-
} | {
|
|
7716
|
-
type: "markdown";
|
|
7717
|
-
markdown: string;
|
|
7718
|
-
} | {
|
|
7719
7717
|
type: "attachment";
|
|
7720
7718
|
id: string;
|
|
7721
7719
|
name: string;
|
|
@@ -7723,6 +7721,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7723
7721
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7724
7722
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7725
7723
|
size?: number | undefined;
|
|
7724
|
+
} | {
|
|
7725
|
+
type: "text";
|
|
7726
|
+
text: string;
|
|
7727
|
+
} | {
|
|
7728
|
+
type: "markdown";
|
|
7729
|
+
markdown: string;
|
|
7726
7730
|
};
|
|
7727
7731
|
effect: string;
|
|
7728
7732
|
} | {
|
|
@@ -7749,11 +7753,8 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7749
7753
|
} | {
|
|
7750
7754
|
type: "leaveSpace";
|
|
7751
7755
|
}, {
|
|
7752
|
-
type: "
|
|
7753
|
-
|
|
7754
|
-
} | {
|
|
7755
|
-
type: "markdown";
|
|
7756
|
-
markdown: string;
|
|
7756
|
+
type: "custom";
|
|
7757
|
+
raw: unknown;
|
|
7757
7758
|
} | {
|
|
7758
7759
|
type: "attachment";
|
|
7759
7760
|
id: string;
|
|
@@ -7806,8 +7807,18 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7806
7807
|
} | undefined;
|
|
7807
7808
|
raw?: unknown;
|
|
7808
7809
|
} | {
|
|
7809
|
-
type: "
|
|
7810
|
-
|
|
7810
|
+
type: "text";
|
|
7811
|
+
text: string;
|
|
7812
|
+
} | {
|
|
7813
|
+
type: "markdown";
|
|
7814
|
+
markdown: string;
|
|
7815
|
+
} | {
|
|
7816
|
+
type: "group";
|
|
7817
|
+
items: Message<string, User, Space<unknown>>[];
|
|
7818
|
+
} | {
|
|
7819
|
+
type: "reaction";
|
|
7820
|
+
emoji: string;
|
|
7821
|
+
target: Message<string, User, Space<unknown>>;
|
|
7811
7822
|
} | {
|
|
7812
7823
|
type: "poll";
|
|
7813
7824
|
title: string;
|
|
@@ -7828,13 +7839,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7828
7839
|
};
|
|
7829
7840
|
selected: boolean;
|
|
7830
7841
|
title: string;
|
|
7831
|
-
} | {
|
|
7832
|
-
type: "group";
|
|
7833
|
-
items: Message<string, User, Space<unknown>>[];
|
|
7834
|
-
} | {
|
|
7835
|
-
type: "reaction";
|
|
7836
|
-
emoji: string;
|
|
7837
|
-
target: Message<string, User, Space<unknown>>;
|
|
7838
7842
|
} | {
|
|
7839
7843
|
type: "streamText";
|
|
7840
7844
|
stream: () => AsyncIterable<string>;
|
|
@@ -7867,12 +7871,6 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7867
7871
|
} | {
|
|
7868
7872
|
type: "effect";
|
|
7869
7873
|
content: {
|
|
7870
|
-
type: "text";
|
|
7871
|
-
text: string;
|
|
7872
|
-
} | {
|
|
7873
|
-
type: "markdown";
|
|
7874
|
-
markdown: string;
|
|
7875
|
-
} | {
|
|
7876
7874
|
type: "attachment";
|
|
7877
7875
|
id: string;
|
|
7878
7876
|
name: string;
|
|
@@ -7880,6 +7878,12 @@ declare const contentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7880
7878
|
read: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
7881
7879
|
stream: z.core.$InferOuterFunctionType<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
7882
7880
|
size?: number | undefined;
|
|
7881
|
+
} | {
|
|
7882
|
+
type: "text";
|
|
7883
|
+
text: string;
|
|
7884
|
+
} | {
|
|
7885
|
+
type: "markdown";
|
|
7886
|
+
markdown: string;
|
|
7883
7887
|
};
|
|
7884
7888
|
effect: string;
|
|
7885
7889
|
} | {
|
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-CxF8ejPo.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-CxF8ejPo.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 = "10.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")];
|