@webiny/api-core 6.4.0-beta.3 → 6.4.0-beta.5
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/features/ai/AnthropicSdkFactory.js +8 -44
- package/features/ai/AnthropicSdkFactory.js.map +1 -1
- package/features/ai/OpenAiSdkFactory.js +4 -168
- package/features/ai/OpenAiSdkFactory.js.map +1 -1
- package/features/encryption/EncryptionService.d.ts +2 -2
- package/features/encryption/EncryptionService.js +2 -2
- package/features/encryption/EncryptionService.js.map +1 -1
- package/features/encryption/abstractions.d.ts +2 -2
- package/features/encryption/abstractions.js.map +1 -1
- package/features/webhooks/Webhook/abstractions/WebhookFactory.d.ts +1 -0
- package/features/webhooks/Webhook/abstractions/WebhookFactory.js.map +1 -1
- package/package.json +23 -22
|
@@ -2,64 +2,28 @@ import { createImplementation } from "@webiny/feature/api";
|
|
|
2
2
|
import { AiSdkFactory } from "./abstractions.js";
|
|
3
3
|
const ANTHROPIC_MODELS = [
|
|
4
4
|
{
|
|
5
|
-
id: "claude-
|
|
6
|
-
name: "Claude
|
|
5
|
+
id: "claude-opus-4-7",
|
|
6
|
+
name: "Claude Opus 4.7"
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
|
-
id: "claude-
|
|
10
|
-
name: "Claude
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: "claude-haiku-4-5",
|
|
14
|
-
name: "Claude Haiku 4.5"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: "claude-opus-4-0",
|
|
18
|
-
name: "Claude Opus 4"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "claude-opus-4-20250514",
|
|
22
|
-
name: "Claude Opus 4"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "claude-opus-4-1-20250805",
|
|
26
|
-
name: "Claude Opus 4.1"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "claude-opus-4-1",
|
|
30
|
-
name: "Claude Opus 4.1"
|
|
9
|
+
id: "claude-opus-4-6",
|
|
10
|
+
name: "Claude Opus 4.6"
|
|
31
11
|
},
|
|
32
12
|
{
|
|
33
13
|
id: "claude-opus-4-5",
|
|
34
14
|
name: "Claude Opus 4.5"
|
|
35
15
|
},
|
|
36
16
|
{
|
|
37
|
-
id: "claude-
|
|
38
|
-
name: "Claude
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "claude-sonnet-4-0",
|
|
42
|
-
name: "Claude Sonnet 4"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: "claude-sonnet-4-20250514",
|
|
46
|
-
name: "Claude Sonnet 4"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: "claude-sonnet-4-5-20250929",
|
|
50
|
-
name: "Claude Sonnet 4.5"
|
|
17
|
+
id: "claude-sonnet-4-6",
|
|
18
|
+
name: "Claude Sonnet 4.6"
|
|
51
19
|
},
|
|
52
20
|
{
|
|
53
21
|
id: "claude-sonnet-4-5",
|
|
54
22
|
name: "Claude Sonnet 4.5"
|
|
55
23
|
},
|
|
56
24
|
{
|
|
57
|
-
id: "claude-
|
|
58
|
-
name: "Claude
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: "claude-opus-4-6",
|
|
62
|
-
name: "Claude Opus 4.6"
|
|
25
|
+
id: "claude-haiku-4-5",
|
|
26
|
+
name: "Claude Haiku 4.5"
|
|
63
27
|
}
|
|
64
28
|
];
|
|
65
29
|
class AnthropicSdkFactoryImpl {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/ai/AnthropicSdkFactory.js","sources":["../../../src/features/ai/AnthropicSdkFactory.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { AiSdkFactory as AiSdkFactoryAbstraction } from \"./abstractions.js\";\nimport type { IAiSdk, IAiSdkModel } from \"./abstractions.js\";\n\nconst ANTHROPIC_MODELS: IAiSdkModel[] = [\n { id: \"claude-
|
|
1
|
+
{"version":3,"file":"features/ai/AnthropicSdkFactory.js","sources":["../../../src/features/ai/AnthropicSdkFactory.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { AiSdkFactory as AiSdkFactoryAbstraction } from \"./abstractions.js\";\nimport type { IAiSdk, IAiSdkModel } from \"./abstractions.js\";\n\nconst ANTHROPIC_MODELS: IAiSdkModel[] = [\n { id: \"claude-opus-4-7\", name: \"Claude Opus 4.7\" },\n { id: \"claude-opus-4-6\", name: \"Claude Opus 4.6\" },\n { id: \"claude-opus-4-5\", name: \"Claude Opus 4.5\" },\n { id: \"claude-sonnet-4-6\", name: \"Claude Sonnet 4.6\" },\n { id: \"claude-sonnet-4-5\", name: \"Claude Sonnet 4.5\" },\n { id: \"claude-haiku-4-5\", name: \"Claude Haiku 4.5\" }\n];\n\nclass AnthropicSdkFactoryImpl implements AiSdkFactoryAbstraction.Interface {\n readonly id = \"anthropic\";\n readonly name = \"Anthropic\";\n readonly models = ANTHROPIC_MODELS;\n\n async execute(apiKey?: string): Promise<IAiSdk> {\n const { createAnthropic } = await import(\"@ai-sdk/anthropic\");\n const provider = createAnthropic({\n apiKey: apiKey ?? process.env.WEBINY_API_ANTHROPIC_API_KEY\n });\n return {\n languageModel: modelId => provider.chat(modelId)\n };\n }\n}\n\nexport const AnthropicSdkFactory = createImplementation({\n abstraction: AiSdkFactoryAbstraction,\n implementation: AnthropicSdkFactoryImpl,\n dependencies: []\n});\n"],"names":["ANTHROPIC_MODELS","AnthropicSdkFactoryImpl","apiKey","createAnthropic","provider","process","modelId","AnthropicSdkFactory","createImplementation","AiSdkFactoryAbstraction"],"mappings":";;AAIA,MAAMA,mBAAkC;IACpC;QAAE,IAAI;QAAmB,MAAM;IAAkB;IACjD;QAAE,IAAI;QAAmB,MAAM;IAAkB;IACjD;QAAE,IAAI;QAAmB,MAAM;IAAkB;IACjD;QAAE,IAAI;QAAqB,MAAM;IAAoB;IACrD;QAAE,IAAI;QAAqB,MAAM;IAAoB;IACrD;QAAE,IAAI;QAAoB,MAAM;IAAmB;CACtD;AAED,MAAMC;IAKF,MAAM,QAAQC,MAAe,EAAmB;QAC5C,MAAM,EAAEC,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC;QACzC,MAAMC,WAAWD,gBAAgB;YAC7B,QAAQD,UAAUG,QAAQ,GAAG,CAAC,4BAA4B;QAC9D;QACA,OAAO;YACH,eAAeC,CAAAA,UAAWF,SAAS,IAAI,CAACE;QAC5C;IACJ;;aAZS,EAAE,GAAG;aACL,IAAI,GAAG;aACP,MAAM,GAAGN;;AAWtB;AAEO,MAAMO,sBAAsBC,qBAAqB;IACpD,aAAaC;IACb,gBAAgBR;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,217 +1,53 @@
|
|
|
1
1
|
import { createImplementation } from "@webiny/feature/api";
|
|
2
2
|
import { AiSdkFactory } from "./abstractions.js";
|
|
3
3
|
const OPENAI_MODELS = [
|
|
4
|
-
{
|
|
5
|
-
id: "gpt-5",
|
|
6
|
-
name: "GPT-5"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
id: "gpt-5-2025-08-07",
|
|
10
|
-
name: "GPT-5"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: "gpt-5-chat-latest",
|
|
14
|
-
name: "GPT-5"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: "gpt-5-mini",
|
|
18
|
-
name: "GPT-5 Mini"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "gpt-5-mini-2025-08-07",
|
|
22
|
-
name: "GPT-5 Mini"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "gpt-5-nano",
|
|
26
|
-
name: "GPT-5 Nano"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "gpt-5-nano-2025-08-07",
|
|
30
|
-
name: "GPT-5 Nano"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: "gpt-5.1",
|
|
34
|
-
name: "GPT-5.1"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: "gpt-5.1-2025-11-13",
|
|
38
|
-
name: "GPT-5.1"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "gpt-5.1-chat-latest",
|
|
42
|
-
name: "GPT-5.1"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: "gpt-5.2",
|
|
46
|
-
name: "GPT-5.2"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: "gpt-5.2-2025-12-11",
|
|
50
|
-
name: "GPT-5.2"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: "gpt-5.2-chat-latest",
|
|
54
|
-
name: "GPT-5.2"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: "gpt-5.2-pro",
|
|
58
|
-
name: "GPT-5.2 Pro"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: "gpt-5.2-pro-2025-12-11",
|
|
62
|
-
name: "GPT-5.2 Pro"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "gpt-5.3-chat-latest",
|
|
66
|
-
name: "GPT-5.3"
|
|
67
|
-
},
|
|
68
4
|
{
|
|
69
5
|
id: "gpt-5.4",
|
|
70
6
|
name: "GPT-5.4"
|
|
71
7
|
},
|
|
72
|
-
{
|
|
73
|
-
id: "gpt-5.4-2026-03-05",
|
|
74
|
-
name: "GPT-5.4"
|
|
75
|
-
},
|
|
76
8
|
{
|
|
77
9
|
id: "gpt-5.4-mini",
|
|
78
10
|
name: "GPT-5.4 Mini"
|
|
79
11
|
},
|
|
80
|
-
{
|
|
81
|
-
id: "gpt-5.4-mini-2026-03-17",
|
|
82
|
-
name: "GPT-5.4 Mini"
|
|
83
|
-
},
|
|
84
12
|
{
|
|
85
13
|
id: "gpt-5.4-nano",
|
|
86
14
|
name: "GPT-5.4 Nano"
|
|
87
15
|
},
|
|
88
|
-
{
|
|
89
|
-
id: "gpt-5.4-nano-2026-03-17",
|
|
90
|
-
name: "GPT-5.4 Nano"
|
|
91
|
-
},
|
|
92
16
|
{
|
|
93
17
|
id: "gpt-5.4-pro",
|
|
94
18
|
name: "GPT-5.4 Pro"
|
|
95
19
|
},
|
|
96
20
|
{
|
|
97
|
-
id: "gpt-5.
|
|
98
|
-
name: "GPT-5.
|
|
21
|
+
id: "gpt-5.3-chat-latest",
|
|
22
|
+
name: "GPT-5.3 Chat"
|
|
99
23
|
},
|
|
100
24
|
{
|
|
101
25
|
id: "gpt-4.1",
|
|
102
26
|
name: "GPT-4.1"
|
|
103
27
|
},
|
|
104
|
-
{
|
|
105
|
-
id: "gpt-4.1-2025-04-14",
|
|
106
|
-
name: "GPT-4.1"
|
|
107
|
-
},
|
|
108
28
|
{
|
|
109
29
|
id: "gpt-4.1-mini",
|
|
110
30
|
name: "GPT-4.1 Mini"
|
|
111
31
|
},
|
|
112
|
-
{
|
|
113
|
-
id: "gpt-4.1-mini-2025-04-14",
|
|
114
|
-
name: "GPT-4.1 Mini"
|
|
115
|
-
},
|
|
116
32
|
{
|
|
117
33
|
id: "gpt-4.1-nano",
|
|
118
34
|
name: "GPT-4.1 Nano"
|
|
119
35
|
},
|
|
120
|
-
{
|
|
121
|
-
id: "gpt-4.1-nano-2025-04-14",
|
|
122
|
-
name: "GPT-4.1 Nano"
|
|
123
|
-
},
|
|
124
36
|
{
|
|
125
37
|
id: "gpt-4o",
|
|
126
38
|
name: "GPT-4o"
|
|
127
39
|
},
|
|
128
|
-
{
|
|
129
|
-
id: "gpt-4o-2024-05-13",
|
|
130
|
-
name: "GPT-4o"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: "gpt-4o-2024-08-06",
|
|
134
|
-
name: "GPT-4o"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: "gpt-4o-2024-11-20",
|
|
138
|
-
name: "GPT-4o"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
id: "gpt-4o-audio-preview",
|
|
142
|
-
name: "GPT-4o Audio Preview"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
id: "gpt-4o-audio-preview-2024-12-17",
|
|
146
|
-
name: "GPT-4o Audio Preview"
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
id: "gpt-4o-search-preview",
|
|
150
|
-
name: "GPT-4o Search Preview"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
id: "gpt-4o-search-preview-2025-03-11",
|
|
154
|
-
name: "GPT-4o Search Preview"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
id: "gpt-4o-mini-search-preview",
|
|
158
|
-
name: "GPT-4o Mini Search Preview"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: "gpt-4o-mini-search-preview-2025-03-11",
|
|
162
|
-
name: "GPT-4o Mini Search Preview"
|
|
163
|
-
},
|
|
164
40
|
{
|
|
165
41
|
id: "gpt-4o-mini",
|
|
166
42
|
name: "GPT-4o Mini"
|
|
167
43
|
},
|
|
168
|
-
{
|
|
169
|
-
id: "gpt-4o-mini-2024-07-18",
|
|
170
|
-
name: "GPT-4o Mini"
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
id: "gpt-3.5-turbo-0125",
|
|
174
|
-
name: "GPT-3.5 Turbo"
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
id: "gpt-3.5-turbo",
|
|
178
|
-
name: "GPT-3.5 Turbo"
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
id: "gpt-3.5-turbo-1106",
|
|
182
|
-
name: "GPT-3.5 Turbo"
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
id: "o1",
|
|
186
|
-
name: "o1"
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
id: "o1-2024-12-17",
|
|
190
|
-
name: "o1"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
id: "o3",
|
|
194
|
-
name: "o3"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
id: "o3-2025-04-16",
|
|
198
|
-
name: "o3"
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
id: "o3-mini",
|
|
202
|
-
name: "o3 Mini"
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
id: "o3-mini-2025-01-31",
|
|
206
|
-
name: "o3 Mini"
|
|
207
|
-
},
|
|
208
44
|
{
|
|
209
45
|
id: "o4-mini",
|
|
210
46
|
name: "o4 Mini"
|
|
211
47
|
},
|
|
212
48
|
{
|
|
213
|
-
id: "
|
|
214
|
-
name: "
|
|
49
|
+
id: "o3",
|
|
50
|
+
name: "o3"
|
|
215
51
|
}
|
|
216
52
|
];
|
|
217
53
|
class OpenAiSdkFactoryImpl {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/ai/OpenAiSdkFactory.js","sources":["../../../src/features/ai/OpenAiSdkFactory.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { AiSdkFactory as AiSdkFactoryAbstraction } from \"./abstractions.js\";\nimport type { IAiSdk, IAiSdkModel } from \"./abstractions.js\";\n\
|
|
1
|
+
{"version":3,"file":"features/ai/OpenAiSdkFactory.js","sources":["../../../src/features/ai/OpenAiSdkFactory.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { AiSdkFactory as AiSdkFactoryAbstraction } from \"./abstractions.js\";\nimport type { IAiSdk, IAiSdkModel } from \"./abstractions.js\";\n\nconst OPENAI_MODELS: IAiSdkModel[] = [\n { id: \"gpt-5.4\", name: \"GPT-5.4\" },\n { id: \"gpt-5.4-mini\", name: \"GPT-5.4 Mini\" },\n { id: \"gpt-5.4-nano\", name: \"GPT-5.4 Nano\" },\n { id: \"gpt-5.4-pro\", name: \"GPT-5.4 Pro\" },\n { id: \"gpt-5.3-chat-latest\", name: \"GPT-5.3 Chat\" },\n { id: \"gpt-4.1\", name: \"GPT-4.1\" },\n { id: \"gpt-4.1-mini\", name: \"GPT-4.1 Mini\" },\n { id: \"gpt-4.1-nano\", name: \"GPT-4.1 Nano\" },\n { id: \"gpt-4o\", name: \"GPT-4o\" },\n { id: \"gpt-4o-mini\", name: \"GPT-4o Mini\" },\n { id: \"o4-mini\", name: \"o4 Mini\" },\n { id: \"o3\", name: \"o3\" }\n];\n\nclass OpenAiSdkFactoryImpl implements AiSdkFactoryAbstraction.Interface {\n readonly id = \"openai\";\n readonly name = \"OpenAI\";\n readonly models = OPENAI_MODELS;\n\n async execute(apiKey?: string): Promise<IAiSdk> {\n const { createOpenAI } = await import(\"@ai-sdk/openai\");\n const provider = createOpenAI({\n apiKey: apiKey ?? process.env.WEBINY_API_OPENAI_API_KEY\n });\n return {\n languageModel: modelId => provider.chat(modelId)\n };\n }\n}\n\nexport const OpenAiSdkFactory = createImplementation({\n abstraction: AiSdkFactoryAbstraction,\n implementation: OpenAiSdkFactoryImpl,\n dependencies: []\n});\n"],"names":["OPENAI_MODELS","OpenAiSdkFactoryImpl","apiKey","createOpenAI","provider","process","modelId","OpenAiSdkFactory","createImplementation","AiSdkFactoryAbstraction"],"mappings":";;AAIA,MAAMA,gBAA+B;IACjC;QAAE,IAAI;QAAW,MAAM;IAAU;IACjC;QAAE,IAAI;QAAgB,MAAM;IAAe;IAC3C;QAAE,IAAI;QAAgB,MAAM;IAAe;IAC3C;QAAE,IAAI;QAAe,MAAM;IAAc;IACzC;QAAE,IAAI;QAAuB,MAAM;IAAe;IAClD;QAAE,IAAI;QAAW,MAAM;IAAU;IACjC;QAAE,IAAI;QAAgB,MAAM;IAAe;IAC3C;QAAE,IAAI;QAAgB,MAAM;IAAe;IAC3C;QAAE,IAAI;QAAU,MAAM;IAAS;IAC/B;QAAE,IAAI;QAAe,MAAM;IAAc;IACzC;QAAE,IAAI;QAAW,MAAM;IAAU;IACjC;QAAE,IAAI;QAAM,MAAM;IAAK;CAC1B;AAED,MAAMC;IAKF,MAAM,QAAQC,MAAe,EAAmB;QAC5C,MAAM,EAAEC,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC;QACtC,MAAMC,WAAWD,aAAa;YAC1B,QAAQD,UAAUG,QAAQ,GAAG,CAAC,yBAAyB;QAC3D;QACA,OAAO;YACH,eAAeC,CAAAA,UAAWF,SAAS,IAAI,CAACE;QAC5C;IACJ;;aAZS,EAAE,GAAG;aACL,IAAI,GAAG;aACP,MAAM,GAAGN;;AAWtB;AAEO,MAAMO,mBAAmBC,qBAAqB;IACjD,aAAaC;IACb,gBAAgBR;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -4,7 +4,7 @@ export declare class EncryptionImpl implements EncryptionAbstraction.Interface {
|
|
|
4
4
|
private key;
|
|
5
5
|
private algorithm;
|
|
6
6
|
constructor(buildParams: BuildParams.Interface);
|
|
7
|
-
encrypt(value: string): string
|
|
8
|
-
decrypt(value: string): string
|
|
7
|
+
encrypt(value: string): Promise<string>;
|
|
8
|
+
decrypt(value: string): Promise<string>;
|
|
9
9
|
}
|
|
10
10
|
export declare const Encryption: import("@webiny/di").Implementation<typeof EncryptionImpl>;
|
|
@@ -21,7 +21,7 @@ class EncryptionImpl {
|
|
|
21
21
|
this.algorithm = DEFAULT_ALGORITHM;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
encrypt(value) {
|
|
24
|
+
async encrypt(value) {
|
|
25
25
|
if (!this.key) return value;
|
|
26
26
|
const iv = node_crypto.randomBytes(12);
|
|
27
27
|
const cipher = node_crypto.createCipheriv(this.algorithm, this.key, iv);
|
|
@@ -36,7 +36,7 @@ class EncryptionImpl {
|
|
|
36
36
|
encrypted
|
|
37
37
|
]).toString("base64");
|
|
38
38
|
}
|
|
39
|
-
decrypt(value) {
|
|
39
|
+
async decrypt(value) {
|
|
40
40
|
if (!this.key) return value;
|
|
41
41
|
const data = Buffer.from(value, "base64");
|
|
42
42
|
const iv = data.subarray(0, 12);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/encryption/EncryptionService.js","sources":["../../../src/features/encryption/EncryptionService.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Encryption as EncryptionAbstraction } from \"./abstractions.js\";\nimport { BuildParams } from \"../buildParams/abstractions.js\";\n\nconst DEFAULT_ALGORITHM = \"aes-256-gcm\";\n\nfunction keyLengthForAlgorithm(algorithm: string): number {\n // Parse key size in bits from algorithm name (e.g. \"aes-256-gcm\" → 32 bytes).\n const bits = parseInt(algorithm.split(\"-\")[1]);\n if (isNaN(bits)) {\n throw new Error(`Cannot determine key length from algorithm \"${algorithm}\".`);\n }\n return bits / 8;\n}\n\nexport class EncryptionImpl implements EncryptionAbstraction.Interface {\n private key: Buffer | null;\n private algorithm: string;\n\n constructor(buildParams: BuildParams.Interface) {\n const passphrase = buildParams.get<string>(\"EncryptionPassphrase\");\n\n if (passphrase) {\n // Salt is optional. It ensures two projects using the same passphrase derive different keys,\n // but since passphrases should be unique per project anyway, it's extra insurance rather than a necessity.\n const salt = buildParams.get<string>(\"EncryptionSalt\") ?? \"\";\n this.algorithm = buildParams.get<string>(\"EncryptionAlgorithm\") ?? DEFAULT_ALGORITHM;\n const keyLength = keyLengthForAlgorithm(this.algorithm);\n this.key = crypto.scryptSync(passphrase, salt, keyLength);\n } else {\n this.key = null;\n this.algorithm = DEFAULT_ALGORITHM;\n }\n }\n\n encrypt(value: string): string {\n if (!this.key) {\n return value;\n }\n const iv = crypto.randomBytes(12);\n const cipher = crypto.createCipheriv(this.algorithm, this.key, iv);\n const encrypted = Buffer.concat([cipher.update(value, \"utf8\"), cipher.final()]);\n const authTag = (cipher as crypto.CipherGCM).getAuthTag();\n return Buffer.concat([iv, authTag, encrypted]).toString(\"base64\");\n }\n\n decrypt(value: string): string {\n if (!this.key) {\n return value;\n }\n const data = Buffer.from(value, \"base64\");\n const iv = data.subarray(0, 12);\n const authTag = data.subarray(12, 28);\n const ciphertext = data.subarray(28);\n const decipher = crypto.createDecipheriv(this.algorithm, this.key, iv);\n (decipher as crypto.DecipherGCM).setAuthTag(authTag);\n return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString(\"utf8\");\n }\n}\n\nexport const Encryption = createImplementation({\n abstraction: EncryptionAbstraction,\n implementation: EncryptionImpl,\n dependencies: [BuildParams]\n});\n"],"names":["DEFAULT_ALGORITHM","keyLengthForAlgorithm","algorithm","bits","parseInt","isNaN","Error","EncryptionImpl","buildParams","passphrase","salt","keyLength","crypto","value","iv","cipher","encrypted","Buffer","authTag","data","ciphertext","decipher","Encryption","createImplementation","EncryptionAbstraction","BuildParams"],"mappings":";;;;AAKA,MAAMA,oBAAoB;AAE1B,SAASC,sBAAsBC,SAAiB;IAE5C,MAAMC,OAAOC,SAASF,UAAU,KAAK,CAAC,IAAI,CAAC,EAAE;IAC7C,IAAIG,MAAMF,OACN,MAAM,IAAIG,MAAM,CAAC,4CAA4C,EAAEJ,UAAU,EAAE,CAAC;IAEhF,OAAOC,OAAO;AAClB;AAEO,MAAMI;IAIT,YAAYC,WAAkC,CAAE;QAC5C,MAAMC,aAAaD,YAAY,GAAG,CAAS;QAE3C,IAAIC,YAAY;YAGZ,MAAMC,OAAOF,YAAY,GAAG,CAAS,qBAAqB;YAC1D,IAAI,CAAC,SAAS,GAAGA,YAAY,GAAG,CAAS,0BAA0BR;YACnE,MAAMW,YAAYV,sBAAsB,IAAI,CAAC,SAAS;YACtD,IAAI,CAAC,GAAG,GAAGW,YAAAA,UAAiB,CAACH,YAAYC,MAAMC;QACnD,OAAO;YACH,IAAI,CAAC,GAAG,GAAG;YACX,IAAI,CAAC,SAAS,GAAGX;QACrB;IACJ;IAEA,QAAQa,KAAa,
|
|
1
|
+
{"version":3,"file":"features/encryption/EncryptionService.js","sources":["../../../src/features/encryption/EncryptionService.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Encryption as EncryptionAbstraction } from \"./abstractions.js\";\nimport { BuildParams } from \"../buildParams/abstractions.js\";\n\nconst DEFAULT_ALGORITHM = \"aes-256-gcm\";\n\nfunction keyLengthForAlgorithm(algorithm: string): number {\n // Parse key size in bits from algorithm name (e.g. \"aes-256-gcm\" → 32 bytes).\n const bits = parseInt(algorithm.split(\"-\")[1]);\n if (isNaN(bits)) {\n throw new Error(`Cannot determine key length from algorithm \"${algorithm}\".`);\n }\n return bits / 8;\n}\n\nexport class EncryptionImpl implements EncryptionAbstraction.Interface {\n private key: Buffer | null;\n private algorithm: string;\n\n constructor(buildParams: BuildParams.Interface) {\n const passphrase = buildParams.get<string>(\"EncryptionPassphrase\");\n\n if (passphrase) {\n // Salt is optional. It ensures two projects using the same passphrase derive different keys,\n // but since passphrases should be unique per project anyway, it's extra insurance rather than a necessity.\n const salt = buildParams.get<string>(\"EncryptionSalt\") ?? \"\";\n this.algorithm = buildParams.get<string>(\"EncryptionAlgorithm\") ?? DEFAULT_ALGORITHM;\n const keyLength = keyLengthForAlgorithm(this.algorithm);\n this.key = crypto.scryptSync(passphrase, salt, keyLength);\n } else {\n this.key = null;\n this.algorithm = DEFAULT_ALGORITHM;\n }\n }\n\n async encrypt(value: string): Promise<string> {\n if (!this.key) {\n return value;\n }\n const iv = crypto.randomBytes(12);\n const cipher = crypto.createCipheriv(this.algorithm, this.key, iv);\n const encrypted = Buffer.concat([cipher.update(value, \"utf8\"), cipher.final()]);\n const authTag = (cipher as crypto.CipherGCM).getAuthTag();\n return Buffer.concat([iv, authTag, encrypted]).toString(\"base64\");\n }\n\n async decrypt(value: string): Promise<string> {\n if (!this.key) {\n return value;\n }\n const data = Buffer.from(value, \"base64\");\n const iv = data.subarray(0, 12);\n const authTag = data.subarray(12, 28);\n const ciphertext = data.subarray(28);\n const decipher = crypto.createDecipheriv(this.algorithm, this.key, iv);\n (decipher as crypto.DecipherGCM).setAuthTag(authTag);\n return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString(\"utf8\");\n }\n}\n\nexport const Encryption = createImplementation({\n abstraction: EncryptionAbstraction,\n implementation: EncryptionImpl,\n dependencies: [BuildParams]\n});\n"],"names":["DEFAULT_ALGORITHM","keyLengthForAlgorithm","algorithm","bits","parseInt","isNaN","Error","EncryptionImpl","buildParams","passphrase","salt","keyLength","crypto","value","iv","cipher","encrypted","Buffer","authTag","data","ciphertext","decipher","Encryption","createImplementation","EncryptionAbstraction","BuildParams"],"mappings":";;;;AAKA,MAAMA,oBAAoB;AAE1B,SAASC,sBAAsBC,SAAiB;IAE5C,MAAMC,OAAOC,SAASF,UAAU,KAAK,CAAC,IAAI,CAAC,EAAE;IAC7C,IAAIG,MAAMF,OACN,MAAM,IAAIG,MAAM,CAAC,4CAA4C,EAAEJ,UAAU,EAAE,CAAC;IAEhF,OAAOC,OAAO;AAClB;AAEO,MAAMI;IAIT,YAAYC,WAAkC,CAAE;QAC5C,MAAMC,aAAaD,YAAY,GAAG,CAAS;QAE3C,IAAIC,YAAY;YAGZ,MAAMC,OAAOF,YAAY,GAAG,CAAS,qBAAqB;YAC1D,IAAI,CAAC,SAAS,GAAGA,YAAY,GAAG,CAAS,0BAA0BR;YACnE,MAAMW,YAAYV,sBAAsB,IAAI,CAAC,SAAS;YACtD,IAAI,CAAC,GAAG,GAAGW,YAAAA,UAAiB,CAACH,YAAYC,MAAMC;QACnD,OAAO;YACH,IAAI,CAAC,GAAG,GAAG;YACX,IAAI,CAAC,SAAS,GAAGX;QACrB;IACJ;IAEA,MAAM,QAAQa,KAAa,EAAmB;QAC1C,IAAI,CAAC,IAAI,CAAC,GAAG,EACT,OAAOA;QAEX,MAAMC,KAAKF,YAAAA,WAAkB,CAAC;QAC9B,MAAMG,SAASH,YAAAA,cAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAEE;QAC/D,MAAME,YAAYC,OAAO,MAAM,CAAC;YAACF,OAAO,MAAM,CAACF,OAAO;YAASE,OAAO,KAAK;SAAG;QAC9E,MAAMG,UAAWH,OAA4B,UAAU;QACvD,OAAOE,OAAO,MAAM,CAAC;YAACH;YAAII;YAASF;SAAU,EAAE,QAAQ,CAAC;IAC5D;IAEA,MAAM,QAAQH,KAAa,EAAmB;QAC1C,IAAI,CAAC,IAAI,CAAC,GAAG,EACT,OAAOA;QAEX,MAAMM,OAAOF,OAAO,IAAI,CAACJ,OAAO;QAChC,MAAMC,KAAKK,KAAK,QAAQ,CAAC,GAAG;QAC5B,MAAMD,UAAUC,KAAK,QAAQ,CAAC,IAAI;QAClC,MAAMC,aAAaD,KAAK,QAAQ,CAAC;QACjC,MAAME,WAAWT,YAAAA,gBAAuB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAEE;QAClEO,SAAgC,UAAU,CAACH;QAC5C,OAAOD,OAAO,MAAM,CAAC;YAACI,SAAS,MAAM,CAACD;YAAaC,SAAS,KAAK;SAAG,EAAE,QAAQ,CAAC;IACnF;AACJ;AAEO,MAAMC,+BAAaC,qBAAqB;IAC3C,aAAaC;IACb,gBAAgBjB;IAChB,cAAc;QAACkB;KAAY;AAC/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface IEncryption {
|
|
2
|
-
encrypt(value: string): string
|
|
3
|
-
decrypt(value: string): string
|
|
2
|
+
encrypt(value: string): Promise<string>;
|
|
3
|
+
decrypt(value: string): Promise<string>;
|
|
4
4
|
}
|
|
5
5
|
/** Symmetric encryption and decryption using a configured secret key. */
|
|
6
6
|
export declare const Encryption: import("@webiny/di").Abstraction<IEncryption>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/encryption/abstractions.js","sources":["../../../src/features/encryption/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IEncryption {\n encrypt(value: string): string
|
|
1
|
+
{"version":3,"file":"features/encryption/abstractions.js","sources":["../../../src/features/encryption/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IEncryption {\n encrypt(value: string): Promise<string>;\n decrypt(value: string): Promise<string>;\n}\n\n/** Symmetric encryption and decryption using a configured secret key. */\nexport const Encryption = createAbstraction<IEncryption>(\"Encryption\");\n\nexport namespace Encryption {\n export type Interface = IEncryption;\n}\n"],"names":["Encryption","createAbstraction"],"mappings":";AAQO,MAAMA,aAAaC,kBAA+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/webhooks/Webhook/abstractions/WebhookFactory.js","sources":["../../../../../src/features/webhooks/Webhook/abstractions/WebhookFactory.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IWebhookFactoryDefinition {\n app: string;\n appLabel: string;\n entity: string;\n eventName: string;\n label: string;\n}\n\nexport interface IWebhookFactory {\n execute(): Promise<IWebhookFactoryDefinition[]>;\n}\n\nexport const WebhookFactory = createAbstraction<IWebhookFactory>(\"Webhooks/WebhookFactory\");\n\nexport namespace WebhookFactory {\n export type Interface = IWebhookFactory;\n export type Definition = IWebhookFactoryDefinition;\n}\n"],"names":["WebhookFactory","createAbstraction"],"mappings":";
|
|
1
|
+
{"version":3,"file":"features/webhooks/Webhook/abstractions/WebhookFactory.js","sources":["../../../../../src/features/webhooks/Webhook/abstractions/WebhookFactory.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IWebhookFactoryDefinition {\n app: string;\n appLabel: string;\n entity: string;\n entityLabel: string;\n eventName: string;\n label: string;\n}\n\nexport interface IWebhookFactory {\n execute(): Promise<IWebhookFactoryDefinition[]>;\n}\n\nexport const WebhookFactory = createAbstraction<IWebhookFactory>(\"Webhooks/WebhookFactory\");\n\nexport namespace WebhookFactory {\n export type Interface = IWebhookFactory;\n export type Definition = IWebhookFactoryDefinition;\n}\n"],"names":["WebhookFactory","createAbstraction"],"mappings":";AAeO,MAAMA,iBAAiBC,kBAAmC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-core",
|
|
3
|
-
"version": "6.4.0-beta.
|
|
3
|
+
"version": "6.4.0-beta.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"./*": "./*"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ai-sdk/anthropic": "3.0.
|
|
18
|
-
"@ai-sdk/openai": "3.0.
|
|
19
|
-
"@webiny/api": "6.4.0-beta.
|
|
17
|
+
"@ai-sdk/anthropic": "3.0.79",
|
|
18
|
+
"@ai-sdk/openai": "3.0.65",
|
|
19
|
+
"@webiny/api": "6.4.0-beta.5",
|
|
20
20
|
"@webiny/di": "1.0.1",
|
|
21
|
-
"@webiny/error": "6.4.0-beta.
|
|
22
|
-
"@webiny/feature": "6.4.0-beta.
|
|
23
|
-
"@webiny/feature-flags": "6.4.0-beta.
|
|
24
|
-
"@webiny/handler": "6.4.0-beta.
|
|
25
|
-
"@webiny/handler-db": "6.4.0-beta.
|
|
26
|
-
"@webiny/handler-graphql": "6.4.0-beta.
|
|
27
|
-
"@webiny/plugins": "6.4.0-beta.
|
|
28
|
-
"@webiny/utils": "6.4.0-beta.
|
|
29
|
-
"@webiny/wcp": "6.4.0-beta.
|
|
30
|
-
"ai": "6.0.
|
|
21
|
+
"@webiny/error": "6.4.0-beta.5",
|
|
22
|
+
"@webiny/feature": "6.4.0-beta.5",
|
|
23
|
+
"@webiny/feature-flags": "6.4.0-beta.5",
|
|
24
|
+
"@webiny/handler": "6.4.0-beta.5",
|
|
25
|
+
"@webiny/handler-db": "6.4.0-beta.5",
|
|
26
|
+
"@webiny/handler-graphql": "6.4.0-beta.5",
|
|
27
|
+
"@webiny/plugins": "6.4.0-beta.5",
|
|
28
|
+
"@webiny/utils": "6.4.0-beta.5",
|
|
29
|
+
"@webiny/wcp": "6.4.0-beta.5",
|
|
30
|
+
"ai": "6.0.191",
|
|
31
31
|
"dataloader": "2.2.3",
|
|
32
32
|
"jose": "6.2.3",
|
|
33
33
|
"jsonwebtoken": "9.0.3",
|
|
@@ -39,18 +39,19 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/jsonwebtoken": "9.0.10",
|
|
42
|
-
"@webiny/build-tools": "6.4.0-beta.
|
|
43
|
-
"@webiny/db-dynamodb": "6.4.0-beta.
|
|
44
|
-
"@webiny/handler-aws": "6.4.0-beta.
|
|
45
|
-
"@webiny/project-utils": "6.4.0-beta.
|
|
42
|
+
"@webiny/build-tools": "6.4.0-beta.5",
|
|
43
|
+
"@webiny/db-dynamodb": "6.4.0-beta.5",
|
|
44
|
+
"@webiny/handler-aws": "6.4.0-beta.5",
|
|
45
|
+
"@webiny/project-utils": "6.4.0-beta.5",
|
|
46
46
|
"jest-dynalite": "3.6.1",
|
|
47
47
|
"rimraf": "6.1.3",
|
|
48
48
|
"typescript": "6.0.3",
|
|
49
|
-
"vitest": "4.1.
|
|
49
|
+
"vitest": "4.1.7"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
|
-
"access": "public"
|
|
53
|
-
"directory": "dist"
|
|
52
|
+
"access": "public"
|
|
54
53
|
},
|
|
55
|
-
"
|
|
54
|
+
"webiny": {
|
|
55
|
+
"publishFrom": "dist"
|
|
56
|
+
}
|
|
56
57
|
}
|