sst 3.0.23 → 3.0.24

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.
Files changed (59) hide show
  1. package/package.json +1 -1
  2. package/dist/auth/adapter/adapter.d.ts +0 -24
  3. package/dist/auth/adapter/adapter.js +0 -4
  4. package/dist/auth/adapter/apple.d.ts +0 -5
  5. package/dist/auth/adapter/apple.js +0 -22
  6. package/dist/auth/adapter/code.d.ts +0 -8
  7. package/dist/auth/adapter/code.js +0 -47
  8. package/dist/auth/adapter/facebook.d.ts +0 -5
  9. package/dist/auth/adapter/facebook.js +0 -27
  10. package/dist/auth/adapter/github.d.ts +0 -12
  11. package/dist/auth/adapter/github.js +0 -23
  12. package/dist/auth/adapter/google.d.ts +0 -17
  13. package/dist/auth/adapter/google.js +0 -22
  14. package/dist/auth/adapter/index.d.ts +0 -11
  15. package/dist/auth/adapter/index.js +0 -10
  16. package/dist/auth/adapter/link.d.ts +0 -6
  17. package/dist/auth/adapter/link.js +0 -27
  18. package/dist/auth/adapter/microsoft.d.ts +0 -11
  19. package/dist/auth/adapter/microsoft.js +0 -16
  20. package/dist/auth/adapter/oauth.d.ts +0 -33
  21. package/dist/auth/adapter/oauth.js +0 -79
  22. package/dist/auth/adapter/oidc.d.ts +0 -19
  23. package/dist/auth/adapter/oidc.js +0 -45
  24. package/dist/auth/adapter/spotify.d.ts +0 -12
  25. package/dist/auth/adapter/spotify.js +0 -22
  26. package/dist/auth/example/bun.d.ts +0 -2
  27. package/dist/auth/example/bun.js +0 -46
  28. package/dist/auth/handler.d.ts +0 -58
  29. package/dist/auth/handler.js +0 -207
  30. package/dist/auth/index.d.ts +0 -10
  31. package/dist/auth/index.js +0 -10
  32. package/dist/auth/session.d.ts +0 -25
  33. package/dist/auth/session.js +0 -28
  34. package/dist/aws/bus.d.ts +0 -24
  35. package/dist/aws/bus.js +0 -57
  36. package/dist/aws/client.d.ts +0 -3
  37. package/dist/aws/client.js +0 -7
  38. package/dist/aws/realtime.d.ts +0 -61
  39. package/dist/aws/realtime.js +0 -76
  40. package/dist/event/bus.d.ts +0 -20
  41. package/dist/event/bus.js +0 -57
  42. package/dist/event/destination.d.ts +0 -19
  43. package/dist/event/destination.js +0 -6
  44. package/dist/event/event.d.ts +0 -75
  45. package/dist/event/event.js +0 -43
  46. package/dist/event/index.d.ts +0 -75
  47. package/dist/event/index.js +0 -43
  48. package/dist/index.d.ts +0 -3
  49. package/dist/index.js +0 -3
  50. package/dist/realtime/index.d.ts +0 -25
  51. package/dist/realtime/index.js +0 -24
  52. package/dist/resource.d.ts +0 -9
  53. package/dist/resource.js +0 -50
  54. package/dist/util/prettify.d.ts +0 -3
  55. package/dist/util/prettify.js +0 -1
  56. package/dist/vector/index.d.ts +0 -193
  57. package/dist/vector/index.js +0 -62
  58. package/dist/vector-client.d.ts +0 -186
  59. package/dist/vector-client.js +0 -41
@@ -1,186 +0,0 @@
1
- import { Resource } from "./resource.js";
2
- export type IngestEvent = {
3
- /**
4
- * The text used to generate the embedding vector.
5
- * At least one of `text` or `image` must be provided.
6
- * @example
7
- * ```js
8
- * {
9
- * text: "This is an example text.",
10
- * }
11
- * ```
12
- */
13
- text?: string;
14
- /**
15
- * The base64 representation of the image used to generate the embedding vector.
16
- * At least one of `text` or `image` must be provided.
17
- * @example
18
- * ```js
19
- * {
20
- * image: await fs.readFile("./file.jpg").toString("base64"),
21
- * }
22
- * ```
23
- */
24
- image?: string;
25
- /**
26
- * Metadata for the event in JSON format.
27
- * This metadata will be used to filter when retrieving and removing embeddings.
28
- * @example
29
- * ```js
30
- * {
31
- * metadata: {
32
- * type: "movie",
33
- * id: "movie-123",
34
- * name: "Spiderman",
35
- * }
36
- * }
37
- * ```
38
- */
39
- metadata: Record<string, any>;
40
- };
41
- export type RetrieveEvent = {
42
- /**
43
- * The text prompt used to retrieve embeddings.
44
- * At least one of `text` or `image` must be provided.
45
- * @example
46
- * ```js
47
- * {
48
- * text: "This is an example text.",
49
- * }
50
- * ```
51
- */
52
- text?: string;
53
- /**
54
- * The base64 representation of the image prompt used to retrive embeddings.
55
- * At least one of `text` or `image` must be provided.
56
- * @example
57
- * ```js
58
- * {
59
- * image: await fs.readFile("./file.jpg").toString("base64"),
60
- * }
61
- * ```
62
- */
63
- image?: string;
64
- /**
65
- * The metadata used to filter the retrieval of embeddings.
66
- * Only embeddings with metadata that match the provided fields will be returned.
67
- * @example
68
- * ```js
69
- * {
70
- * include: {
71
- * type: "movie",
72
- * release: "2001",
73
- * }
74
- * }
75
- * ```
76
- * This will match the embedding with metadata:
77
- * {
78
- * type: "movie",
79
- * name: "Spiderman",
80
- * release: "2001",
81
- * }
82
- *
83
- * But not the embedding with metadata:
84
- * {
85
- * type: "book",
86
- * name: "Spiderman",
87
- * release: "2001",
88
- * }
89
- */
90
- include: Record<string, any>;
91
- /**
92
- * Exclude embeddings with metadata that match the provided fields.
93
- * @example
94
- * ```js
95
- * {
96
- * include: {
97
- * type: "movie",
98
- * release: "2001",
99
- * },
100
- * exclude: {
101
- * name: "Spiderman",
102
- * }
103
- * }
104
- * ```
105
- * This will match the embedding with metadata:
106
- * {
107
- * type: "movie",
108
- * name: "A Beautiful Mind",
109
- * release: "2001",
110
- * }
111
- *
112
- * But not the embedding with metadata:
113
- * {
114
- * type: "book",
115
- * name: "Spiderman",
116
- * release: "2001",
117
- * }
118
- */
119
- exclude?: Record<string, any>;
120
- /**
121
- * The threshold of similarity between the prompt and the retrieved embeddings.
122
- * Only embeddings with a similarity score higher than the threshold will be returned.
123
- * Expected value is between 0 and 1.
124
- * - 0 means the prompt and the retrieved embeddings are completely different.
125
- * - 1 means the prompt and the retrieved embeddings are identical.
126
- * @default `0`
127
- * @example
128
- * ```js
129
- * {
130
- * threshold: 0.5,
131
- * }
132
- * ```
133
- */
134
- threshold?: number;
135
- /**
136
- * The number of results to return.
137
- * @default `10`
138
- * @example
139
- * ```js
140
- * {
141
- * count: 10,
142
- * }
143
- * ```
144
- */
145
- count?: number;
146
- };
147
- export type RemoveEvent = {
148
- /**
149
- * The metadata used to filter the removal of embeddings.
150
- * Only embeddings with metadata that match the provided fields will be removed.
151
- * @example
152
- * To remove embeddings for movie with id "movie-123":
153
- * ```js
154
- * {
155
- * include: {
156
- * id: "movie-123",
157
- * }
158
- * }
159
- * ```
160
- * To remove embeddings for all movies:
161
- * {
162
- * include: {
163
- * type: "movie",
164
- * }
165
- * }
166
- */
167
- include: Record<string, any>;
168
- };
169
- type RetriveResponse = {
170
- /**
171
- * Metadata for the event in JSON format that was provided when ingesting the embedding.
172
- */
173
- metadata: Record<string, any>;
174
- /**
175
- * The similarity score between the prompt and the retrieved embedding.
176
- */
177
- score: number;
178
- };
179
- export declare function VectorClient<T extends keyof {
180
- [key in keyof Resource as "sst.aws.Vector" extends Resource[key]["type"] ? string extends key ? never : key : never]: Resource[key];
181
- }>(name: T): {
182
- ingest: (event: IngestEvent) => Promise<void>;
183
- retrieve: (event: RetrieveEvent) => Promise<RetriveResponse>;
184
- remove: (event: RemoveEvent) => Promise<void>;
185
- };
186
- export {};
@@ -1,41 +0,0 @@
1
- import { LambdaClient, InvokeCommand, } from "@aws-sdk/client-lambda";
2
- import { Resource } from "./resource.js";
3
- const lambda = new LambdaClient();
4
- export function VectorClient(name) {
5
- return {
6
- ingest: async (event) => {
7
- const ret = await lambda.send(new InvokeCommand({
8
- // @ts-expect-error
9
- FunctionName: Resource[name].ingestor,
10
- Payload: JSON.stringify(event),
11
- }));
12
- parsePayload(ret, "Failed to ingest into the vector db");
13
- },
14
- retrieve: async (event) => {
15
- const ret = await lambda.send(new InvokeCommand({
16
- // @ts-expect-error
17
- FunctionName: Resource[name].retriever,
18
- Payload: JSON.stringify(event),
19
- }));
20
- return parsePayload(ret, "Failed to retrieve from the vector db");
21
- },
22
- remove: async (event) => {
23
- const ret = await lambda.send(new InvokeCommand({
24
- // @ts-expect-error
25
- FunctionName: Resource[name].remover,
26
- Payload: JSON.stringify(event),
27
- }));
28
- parsePayload(ret, "Failed to remove from the vector db");
29
- },
30
- };
31
- }
32
- function parsePayload(output, message) {
33
- const payload = JSON.parse(Buffer.from(output.Payload).toString());
34
- // Set cause to the payload so that it can be logged in CloudWatch
35
- if (output.FunctionError) {
36
- const e = new Error(message);
37
- e.cause = payload;
38
- throw e;
39
- }
40
- return payload;
41
- }