@owox/backend 0.38.0 → 0.39.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.
Files changed (179) hide show
  1. package/dist/src/common/helpers/read-bounded-body.helper.d.ts +1 -0
  2. package/dist/src/common/helpers/read-bounded-body.helper.js +28 -0
  3. package/dist/src/common/scheduler/system-tasks/system-trigger-type.d.ts +3 -1
  4. package/dist/src/common/scheduler/system-tasks/system-trigger-type.js +2 -0
  5. package/dist/src/config/data-source-options.config.d.ts +4 -3
  6. package/dist/src/config/data-source-options.config.js +10 -3
  7. package/dist/src/config/plugin-collections-body-parser.config.js +3 -0
  8. package/dist/src/data-marts/credentials/credential.types.d.ts +26 -2
  9. package/dist/src/data-marts/credentials/credential.types.js +18 -6
  10. package/dist/src/data-marts/credentials/dto/credential-api.dto.d.ts +5 -1
  11. package/dist/src/data-marts/credentials/dto/credential-api.dto.js +21 -0
  12. package/dist/src/data-marts/credentials/dto/credential.dto.d.ts +2 -1
  13. package/dist/src/data-marts/credentials/entities/credential.entity.d.ts +2 -1
  14. package/dist/src/data-marts/credentials/entities/credential.entity.js +5 -0
  15. package/dist/src/data-marts/credentials/facades/credential-consumer-binding.facade.impl.js +6 -1
  16. package/dist/src/data-marts/credentials/mappers/credential.mapper.js +2 -0
  17. package/dist/src/data-marts/credentials/services/builtin-credential-definitions.js +8 -0
  18. package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.d.ts +4 -0
  19. package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.js +36 -17
  20. package/dist/src/data-marts/credentials/services/credential-fetch.service.d.ts +8 -0
  21. package/dist/src/data-marts/credentials/services/credential-fetch.service.js +115 -46
  22. package/dist/src/data-marts/credentials/services/credential-validation-probe.service.d.ts +3 -1
  23. package/dist/src/data-marts/credentials/services/credential-validation-probe.service.js +10 -2
  24. package/dist/src/data-marts/credentials/services/credential.service.d.ts +4 -0
  25. package/dist/src/data-marts/credentials/services/credential.service.js +36 -0
  26. package/dist/src/data-marts/credentials/services/google-service-account-key.d.ts +6 -0
  27. package/dist/src/data-marts/credentials/services/google-service-account-key.js +46 -0
  28. package/dist/src/data-marts/credentials/services/google-service-account-token.service.d.ts +25 -0
  29. package/dist/src/data-marts/credentials/services/google-service-account-token.service.js +177 -0
  30. package/dist/src/data-marts/credentials/use-cases/create-credential.service.d.ts +1 -0
  31. package/dist/src/data-marts/credentials/use-cases/create-credential.service.js +10 -2
  32. package/dist/src/data-marts/credentials/use-cases/update-credential.service.d.ts +1 -0
  33. package/dist/src/data-marts/credentials/use-cases/update-credential.service.js +28 -4
  34. package/dist/src/data-marts/credentials/use-cases/validate-credential.service.js +2 -5
  35. package/dist/src/data-marts/data-marts.module.js +4 -0
  36. package/dist/src/data-marts/data-storage-types/snowflake/adapters/snowflake-api.adapter.js +1 -0
  37. package/dist/src/data-marts/dto/presentation/run-data-mart-request-api.dto.js +4 -2
  38. package/dist/src/data-marts/services/connector/backfill-segment.d.ts +22 -0
  39. package/dist/src/data-marts/services/connector/backfill-segment.js +91 -0
  40. package/dist/src/data-marts/services/connector/connector-execution.service.d.ts +1 -0
  41. package/dist/src/data-marts/services/connector/connector-execution.service.js +3 -0
  42. package/dist/src/data-marts/services/connector/connector-executor.service.d.ts +4 -1
  43. package/dist/src/data-marts/services/connector/connector-executor.service.js +107 -23
  44. package/dist/src/data-marts/services/connector/connector-run.service.d.ts +3 -0
  45. package/dist/src/data-marts/services/connector/connector-run.service.js +98 -4
  46. package/dist/src/data-marts/services/data-mart-run.service.d.ts +1 -0
  47. package/dist/src/data-marts/services/data-mart-run.service.js +9 -0
  48. package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.d.ts +14 -0
  49. package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.js +45 -0
  50. package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.d.ts +4 -0
  51. package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.js +46 -1
  52. package/dist/src/data-marts/utils/manual-backfill-range.d.ts +52 -0
  53. package/dist/src/data-marts/utils/manual-backfill-range.js +110 -8
  54. package/dist/src/ee/mcp/instructions/mcp-system-instructions.d.ts +1 -1
  55. package/dist/src/ee/mcp/instructions/mcp-system-instructions.js +1 -0
  56. package/dist/src/idp/decorators/auth-context.decorator.js +1 -0
  57. package/dist/src/idp/guards/idp.guard.d.ts +3 -0
  58. package/dist/src/idp/guards/idp.guard.js +38 -8
  59. package/dist/src/idp/oauth/controllers/oauth-authorization.controller.js +8 -6
  60. package/dist/src/idp/oauth/mcp-client-integration.d.ts +1 -0
  61. package/dist/src/idp/oauth/mcp-client-integration.js +15 -0
  62. package/dist/src/idp/ports/plugin-runtime-authorizer.port.d.ts +6 -0
  63. package/dist/src/idp/types/auth.types.d.ts +1 -0
  64. package/dist/src/migrations/1790900000000-add-plugin-version-backend.d.ts +6 -0
  65. package/dist/src/migrations/1790900000000-add-plugin-version-backend.js +21 -0
  66. package/dist/src/migrations/1790900000001-create-plugin-action-execution.d.ts +6 -0
  67. package/dist/src/migrations/1790900000001-create-plugin-action-execution.js +77 -0
  68. package/dist/src/migrations/1791000000000-add-credential-public-metadata.d.ts +6 -0
  69. package/dist/src/migrations/1791000000000-add-credential-public-metadata.js +23 -0
  70. package/dist/src/plugin-host/collections/dto/domain/plugin-collection.types.d.ts +1 -0
  71. package/dist/src/plugin-host/collections/errors/plugin-collection.errors.d.ts +6 -0
  72. package/dist/src/plugin-host/collections/errors/plugin-collection.errors.js +19 -1
  73. package/dist/src/plugin-host/collections/services/plugin-collection-declaration.service.js +3 -3
  74. package/dist/src/plugin-host/collections/use-cases/put-plugin-collection-document.service.js +7 -0
  75. package/dist/src/plugin-host/constants/plugin-action-limits.d.ts +34 -0
  76. package/dist/src/plugin-host/constants/plugin-action-limits.js +51 -0
  77. package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.d.ts +20 -0
  78. package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.js +123 -0
  79. package/dist/src/plugin-host/controllers/plugin-credential-runtime.controller.js +11 -19
  80. package/dist/src/plugin-host/controllers/plugin-history.controller.d.ts +10 -0
  81. package/dist/src/plugin-host/controllers/plugin-history.controller.js +57 -0
  82. package/dist/src/plugin-host/controllers/plugin-release-check.controller.d.ts +10 -0
  83. package/dist/src/plugin-host/controllers/plugin-release-check.controller.js +58 -0
  84. package/dist/src/plugin-host/dto/domain/check-plugin-release.command.d.ts +22 -0
  85. package/dist/src/plugin-host/dto/domain/check-plugin-release.command.js +17 -0
  86. package/dist/src/plugin-host/dto/domain/list-plugin-history.command.d.ts +10 -0
  87. package/dist/src/plugin-host/dto/domain/list-plugin-history.command.js +18 -0
  88. package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.d.ts +23 -0
  89. package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.js +44 -0
  90. package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.d.ts +36 -0
  91. package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.js +3 -0
  92. package/dist/src/plugin-host/dto/domain/plugin-history.dto.d.ts +29 -0
  93. package/dist/src/plugin-host/dto/domain/plugin-history.dto.js +3 -0
  94. package/dist/src/plugin-host/dto/domain/plugin-view.dto.d.ts +1 -0
  95. package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.d.ts +44 -0
  96. package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.js +208 -0
  97. package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.d.ts +2 -0
  98. package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.js +7 -0
  99. package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.d.ts +29 -0
  100. package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.js +148 -0
  101. package/dist/src/plugin-host/dto/presentation/publication-api.dto.d.ts +17 -0
  102. package/dist/src/plugin-host/dto/presentation/publication-api.dto.js +95 -1
  103. package/dist/src/plugin-host/entities/plugin-action-execution.entity.d.ts +24 -0
  104. package/dist/src/plugin-host/entities/plugin-action-execution.entity.js +136 -0
  105. package/dist/src/plugin-host/entities/plugin-version.entity.d.ts +2 -1
  106. package/dist/src/plugin-host/entities/plugin-version.entity.js +5 -0
  107. package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.d.ts +9 -0
  108. package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.js +22 -0
  109. package/dist/src/plugin-host/enums/release-rejection-code.enum.d.ts +3 -0
  110. package/dist/src/plugin-host/enums/release-rejection-code.enum.js +6 -0
  111. package/dist/src/plugin-host/errors/plugin-action.errors.d.ts +45 -0
  112. package/dist/src/plugin-host/errors/plugin-action.errors.js +70 -0
  113. package/dist/src/plugin-host/errors/plugin-host.errors.d.ts +6 -0
  114. package/dist/src/plugin-host/errors/plugin-host.errors.js +10 -1
  115. package/dist/src/plugin-host/filters/plugin-host-exception.filter.js +2 -2
  116. package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.d.ts +3 -0
  117. package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.js +22 -0
  118. package/dist/src/plugin-host/mappers/plugin-presentation.mapper.d.ts +16 -1
  119. package/dist/src/plugin-host/mappers/plugin-presentation.mapper.js +80 -1
  120. package/dist/src/plugin-host/plugin-host.module.js +32 -0
  121. package/dist/src/plugin-host/services/action-input-validator.service.d.ts +23 -0
  122. package/dist/src/plugin-host/services/action-input-validator.service.js +277 -0
  123. package/dist/src/plugin-host/services/external-credential-definition-sync.service.d.ts +3 -0
  124. package/dist/src/plugin-host/services/external-credential-definition-sync.service.js +47 -15
  125. package/dist/src/plugin-host/services/plugin-action-dispatcher.service.d.ts +13 -0
  126. package/dist/src/plugin-host/services/plugin-action-dispatcher.service.js +140 -0
  127. package/dist/src/plugin-host/services/plugin-action-execution.service.d.ts +69 -0
  128. package/dist/src/plugin-host/services/plugin-action-execution.service.js +239 -0
  129. package/dist/src/plugin-host/services/plugin-action-starter.service.d.ts +22 -0
  130. package/dist/src/plugin-host/services/plugin-action-starter.service.js +81 -0
  131. package/dist/src/plugin-host/services/plugin-audit.service.d.ts +13 -0
  132. package/dist/src/plugin-host/services/plugin-audit.service.js +78 -0
  133. package/dist/src/plugin-host/services/plugin-publication.service.d.ts +2 -0
  134. package/dist/src/plugin-host/services/plugin-publication.service.js +18 -10
  135. package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.d.ts +5 -2
  136. package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.js +31 -3
  137. package/dist/src/plugin-host/services/plugin-version.service.d.ts +2 -1
  138. package/dist/src/plugin-host/services/release-candidate-rules.service.d.ts +51 -0
  139. package/dist/src/plugin-host/services/release-candidate-rules.service.js +198 -0
  140. package/dist/src/plugin-host/services/remote-url-validator.service.d.ts +7 -0
  141. package/dist/src/plugin-host/services/remote-url-validator.service.js +4 -0
  142. package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.d.ts +14 -0
  143. package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.js +50 -0
  144. package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.d.ts +8 -0
  145. package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.js +39 -0
  146. package/dist/src/plugin-host/use-cases/check-plugin-release.service.d.ts +22 -0
  147. package/dist/src/plugin-host/use-cases/check-plugin-release.service.js +152 -0
  148. package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.d.ts +14 -0
  149. package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.js +85 -0
  150. package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.d.ts +9 -0
  151. package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.js +67 -0
  152. package/dist/src/plugin-host/use-cases/get-plugin-installation-entry.service.js +2 -7
  153. package/dist/src/plugin-host/use-cases/install-plugin.service.js +4 -0
  154. package/dist/src/plugin-host/use-cases/list-plugin-history.service.d.ts +25 -0
  155. package/dist/src/plugin-host/use-cases/list-plugin-history.service.js +147 -0
  156. package/dist/src/plugin-host/use-cases/plugin-publisher-access.d.ts +5 -0
  157. package/dist/src/plugin-host/use-cases/plugin-publisher-access.js +28 -0
  158. package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.d.ts +12 -0
  159. package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.js +64 -0
  160. package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.d.ts +3 -5
  161. package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.js +15 -59
  162. package/dist/src/plugin-host/use-cases/uninstall-plugin.service.js +3 -1
  163. package/dist/src/plugin-host/use-cases/update-plugin.service.d.ts +0 -1
  164. package/dist/src/plugin-host/use-cases/update-plugin.service.js +3 -25
  165. package/dist/src/plugin-host/utils/action-input-schema.util.d.ts +14 -0
  166. package/dist/src/plugin-host/utils/action-input-schema.util.js +133 -0
  167. package/dist/src/plugin-host/utils/credential-handles.util.d.ts +3 -0
  168. package/dist/src/plugin-host/utils/credential-handles.util.js +13 -0
  169. package/dist/src/plugin-host/utils/execution-token.util.d.ts +5 -0
  170. package/dist/src/plugin-host/utils/execution-token.util.js +13 -0
  171. package/dist/src/plugin-host/utils/json-shape.util.d.ts +1 -0
  172. package/dist/src/plugin-host/utils/json-shape.util.js +21 -0
  173. package/dist/src/plugin-host/utils/plugin-action-outcome.util.d.ts +10 -0
  174. package/dist/src/plugin-host/utils/plugin-action-outcome.util.js +67 -0
  175. package/dist/src/plugin-host/utils/plugin-manifest.util.d.ts +121 -0
  176. package/dist/src/plugin-host/utils/plugin-manifest.util.js +111 -1
  177. package/dist/src/plugin-host/utils/request-abort-signal.util.d.ts +5 -0
  178. package/dist/src/plugin-host/utils/request-abort-signal.util.js +19 -0
  179. package/package.json +10 -8
@@ -69,16 +69,59 @@ export declare const PluginCredentialRequirementSchema: z.ZodUnion<[z.ZodString,
69
69
  id: z.ZodString;
70
70
  optional: z.ZodDefault<z.ZodBoolean>;
71
71
  models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
72
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
72
73
  }, "strip", z.ZodTypeAny, {
73
74
  id: string;
74
75
  optional: boolean;
76
+ scopes?: string[] | undefined;
75
77
  models?: string[] | undefined;
76
78
  }, {
77
79
  id: string;
80
+ scopes?: string[] | undefined;
78
81
  models?: string[] | undefined;
79
82
  optional?: boolean | undefined;
80
83
  }>]>;
81
84
  export type PluginCredentialRequirement = z.infer<typeof PluginCredentialRequirementSchema>;
85
+ export declare const PLUGIN_ACTION_NAME_PATTERN: RegExp;
86
+ export declare const PluginBackendSchema: z.ZodObject<{
87
+ url: z.ZodString;
88
+ actions: z.ZodEffects<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
89
+ timeoutSeconds: z.ZodDefault<z.ZodNumber>;
90
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ timeoutSeconds: number;
93
+ input?: Record<string, unknown> | undefined;
94
+ }, {
95
+ input?: Record<string, unknown> | undefined;
96
+ timeoutSeconds?: number | undefined;
97
+ }>>, Record<string, {
98
+ timeoutSeconds: number;
99
+ input?: Record<string, unknown> | undefined;
100
+ }>, Record<string, {
101
+ input?: Record<string, unknown> | undefined;
102
+ timeoutSeconds?: number | undefined;
103
+ }>>, Record<string, {
104
+ timeoutSeconds: number;
105
+ input?: Record<string, unknown> | undefined;
106
+ }>, Record<string, {
107
+ input?: Record<string, unknown> | undefined;
108
+ timeoutSeconds?: number | undefined;
109
+ }>>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ url: string;
112
+ actions: Record<string, {
113
+ timeoutSeconds: number;
114
+ input?: Record<string, unknown> | undefined;
115
+ }>;
116
+ }, {
117
+ url: string;
118
+ actions: Record<string, {
119
+ input?: Record<string, unknown> | undefined;
120
+ timeoutSeconds?: number | undefined;
121
+ }>;
122
+ }>;
123
+ export type PluginBackendDeclaration = z.infer<typeof PluginBackendSchema>;
124
+ export type PluginBackendActionDeclaration = PluginBackendDeclaration['actions'][string];
82
125
  export type PluginCollectionDeclaration = z.infer<typeof PluginCollectionDeclarationSchema>;
83
126
  export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
84
127
  name: z.ZodString;
@@ -160,21 +203,62 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
160
203
  id: z.ZodString;
161
204
  optional: z.ZodDefault<z.ZodBoolean>;
162
205
  models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
206
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
163
207
  }, "strip", z.ZodTypeAny, {
164
208
  id: string;
165
209
  optional: boolean;
210
+ scopes?: string[] | undefined;
166
211
  models?: string[] | undefined;
167
212
  }, {
168
213
  id: string;
214
+ scopes?: string[] | undefined;
169
215
  models?: string[] | undefined;
170
216
  optional?: boolean | undefined;
171
217
  }>]>, "many">>;
218
+ backend: z.ZodOptional<z.ZodObject<{
219
+ url: z.ZodString;
220
+ actions: z.ZodEffects<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
221
+ timeoutSeconds: z.ZodDefault<z.ZodNumber>;
222
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
223
+ }, "strip", z.ZodTypeAny, {
224
+ timeoutSeconds: number;
225
+ input?: Record<string, unknown> | undefined;
226
+ }, {
227
+ input?: Record<string, unknown> | undefined;
228
+ timeoutSeconds?: number | undefined;
229
+ }>>, Record<string, {
230
+ timeoutSeconds: number;
231
+ input?: Record<string, unknown> | undefined;
232
+ }>, Record<string, {
233
+ input?: Record<string, unknown> | undefined;
234
+ timeoutSeconds?: number | undefined;
235
+ }>>, Record<string, {
236
+ timeoutSeconds: number;
237
+ input?: Record<string, unknown> | undefined;
238
+ }>, Record<string, {
239
+ input?: Record<string, unknown> | undefined;
240
+ timeoutSeconds?: number | undefined;
241
+ }>>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ url: string;
244
+ actions: Record<string, {
245
+ timeoutSeconds: number;
246
+ input?: Record<string, unknown> | undefined;
247
+ }>;
248
+ }, {
249
+ url: string;
250
+ actions: Record<string, {
251
+ input?: Record<string, unknown> | undefined;
252
+ timeoutSeconds?: number | undefined;
253
+ }>;
254
+ }>>;
172
255
  }, "strip", z.ZodTypeAny, {
173
256
  name: string;
174
257
  description: string;
175
258
  credentials: (string | {
176
259
  id: string;
177
260
  optional: boolean;
261
+ scopes?: string[] | undefined;
178
262
  models?: string[] | undefined;
179
263
  })[];
180
264
  delivery: {
@@ -194,6 +278,13 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
194
278
  };
195
279
  } | undefined;
196
280
  }[];
281
+ backend?: {
282
+ url: string;
283
+ actions: Record<string, {
284
+ timeoutSeconds: number;
285
+ input?: Record<string, unknown> | undefined;
286
+ }>;
287
+ } | undefined;
197
288
  }, {
198
289
  name: string;
199
290
  description: string;
@@ -203,6 +294,7 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
203
294
  };
204
295
  credentials?: (string | {
205
296
  id: string;
297
+ scopes?: string[] | undefined;
206
298
  models?: string[] | undefined;
207
299
  optional?: boolean | undefined;
208
300
  })[] | undefined;
@@ -219,12 +311,20 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
219
311
  };
220
312
  } | undefined;
221
313
  }[] | undefined;
314
+ backend?: {
315
+ url: string;
316
+ actions: Record<string, {
317
+ input?: Record<string, unknown> | undefined;
318
+ timeoutSeconds?: number | undefined;
319
+ }>;
320
+ } | undefined;
222
321
  }>, {
223
322
  name: string;
224
323
  description: string;
225
324
  credentials: (string | {
226
325
  id: string;
227
326
  optional: boolean;
327
+ scopes?: string[] | undefined;
228
328
  models?: string[] | undefined;
229
329
  })[];
230
330
  delivery: {
@@ -244,6 +344,13 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
244
344
  };
245
345
  } | undefined;
246
346
  }[];
347
+ backend?: {
348
+ url: string;
349
+ actions: Record<string, {
350
+ timeoutSeconds: number;
351
+ input?: Record<string, unknown> | undefined;
352
+ }>;
353
+ } | undefined;
247
354
  }, {
248
355
  name: string;
249
356
  description: string;
@@ -253,6 +360,7 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
253
360
  };
254
361
  credentials?: (string | {
255
362
  id: string;
363
+ scopes?: string[] | undefined;
256
364
  models?: string[] | undefined;
257
365
  optional?: boolean | undefined;
258
366
  })[] | undefined;
@@ -269,6 +377,13 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
269
377
  };
270
378
  } | undefined;
271
379
  }[] | undefined;
380
+ backend?: {
381
+ url: string;
382
+ actions: Record<string, {
383
+ input?: Record<string, unknown> | undefined;
384
+ timeoutSeconds?: number | undefined;
385
+ }>;
386
+ } | undefined;
272
387
  }>;
273
388
  export type PluginManifest = z.infer<typeof PluginManifestSchema>;
274
389
  export type ManifestParseResult = {
@@ -279,6 +394,12 @@ export type ManifestParseResult = {
279
394
  readonly code: ReleaseRejectionCode;
280
395
  readonly detail: string;
281
396
  };
397
+ export declare function listActionInputSchemas(backend: PluginBackendDeclaration | null | undefined): {
398
+ readonly path: string;
399
+ readonly schema: Record<string, unknown>;
400
+ }[];
282
401
  export declare function parsePluginManifest(rawFileContent: string | null): ManifestParseResult;
283
402
  export declare function findIncompatibleCollectionChange(current: readonly PluginCollectionDeclaration[], candidate: readonly PluginCollectionDeclaration[]): string | null;
403
+ export declare function resolveBackendUrl(backend: PluginBackendDeclaration, deliveryUrl: string): string;
404
+ export declare function findIncompatibleActionChange(current: PluginBackendDeclaration | null | undefined, candidate: PluginBackendDeclaration | null | undefined): string | null;
284
405
  export {};
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluginManifestSchema = exports.PluginCredentialRequirementSchema = exports.PluginCollectionActionSchema = exports.PluginCollectionEntityTypeSchema = void 0;
3
+ exports.PluginManifestSchema = exports.PluginBackendSchema = exports.PLUGIN_ACTION_NAME_PATTERN = exports.PluginCredentialRequirementSchema = exports.PluginCollectionActionSchema = exports.PluginCollectionEntityTypeSchema = void 0;
4
+ exports.listActionInputSchemas = listActionInputSchemas;
4
5
  exports.parsePluginManifest = parsePluginManifest;
5
6
  exports.findIncompatibleCollectionChange = findIncompatibleCollectionChange;
7
+ exports.resolveBackendUrl = resolveBackendUrl;
8
+ exports.findIncompatibleActionChange = findIncompatibleActionChange;
9
+ const internal_helpers_1 = require("@owox/internal-helpers");
6
10
  const zod_1 = require("zod");
7
11
  const builtin_credential_definitions_1 = require("../../data-marts/credentials/services/builtin-credential-definitions");
12
+ const plugin_action_limits_1 = require("../constants/plugin-action-limits");
8
13
  const release_rejection_code_enum_1 = require("../enums/release-rejection-code.enum");
14
+ const action_input_schema_util_1 = require("./action-input-schema.util");
9
15
  exports.PluginCollectionEntityTypeSchema = zod_1.z.enum([
10
16
  'data-mart',
11
17
  'storage',
@@ -49,8 +55,22 @@ exports.PluginCredentialRequirementSchema = zod_1.z.union([
49
55
  id: zod_1.z.string().trim().min(1).max(255),
50
56
  optional: zod_1.z.boolean().default(false),
51
57
  models: zod_1.z.array(zod_1.z.string().trim().min(1).max(255)).max(20).optional(),
58
+ scopes: zod_1.z.array(zod_1.z.string().min(1).max(200).regex(/^\S+$/)).min(1).max(20).optional(),
52
59
  }),
53
60
  ]);
61
+ exports.PLUGIN_ACTION_NAME_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
62
+ exports.PluginBackendSchema = zod_1.z.object({
63
+ url: zod_1.z.string().min(1).max(2048),
64
+ actions: zod_1.z
65
+ .record(zod_1.z
66
+ .string()
67
+ .regex(exports.PLUGIN_ACTION_NAME_PATTERN, 'action names are lower-case letters, digits and hyphens, start with a letter, and have at most 64 characters'), zod_1.z.object({
68
+ timeoutSeconds: zod_1.z.number().int().min(1).max(300).default(30),
69
+ input: zod_1.z.record(zod_1.z.unknown()).optional(),
70
+ }))
71
+ .refine(actions => Object.keys(actions).length >= 1, 'declare at least one action')
72
+ .refine(actions => Object.keys(actions).length <= plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxActions, `at most ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxActions} actions`),
73
+ });
54
74
  const ENTITY_ACTIONS = {
55
75
  'data-mart': new Set([
56
76
  'SEE',
@@ -91,6 +111,7 @@ exports.PluginManifestSchema = zod_1.z
91
111
  }),
92
112
  collections: zod_1.z.array(PluginCollectionDeclarationSchema).max(50).default([]),
93
113
  credentials: zod_1.z.array(exports.PluginCredentialRequirementSchema).max(50).default([]),
114
+ backend: exports.PluginBackendSchema.optional(),
94
115
  })
95
116
  .superRefine((manifest, context) => {
96
117
  const names = new Set();
@@ -164,11 +185,84 @@ exports.PluginManifestSchema = zod_1.z
164
185
  message: 'models are supported only for the logical ai requirement',
165
186
  });
166
187
  }
188
+ const scopes = typeof requirement === 'string' ? undefined : requirement.scopes;
189
+ if (key === 'google-service-account' && !scopes) {
190
+ context.addIssue({
191
+ code: zod_1.z.ZodIssueCode.custom,
192
+ path: ['credentials', index],
193
+ message: 'google-service-account requires scopes',
194
+ });
195
+ }
196
+ if (key !== 'google-service-account' && scopes) {
197
+ context.addIssue({
198
+ code: zod_1.z.ZodIssueCode.custom,
199
+ path: ['credentials', index, 'scopes'],
200
+ message: 'scopes are supported only for google-service-account',
201
+ });
202
+ }
203
+ if (scopes && new Set(scopes).size !== scopes.length) {
204
+ context.addIssue({
205
+ code: zod_1.z.ZodIssueCode.custom,
206
+ path: ['credentials', index, 'scopes'],
207
+ message: 'scopes must be unique',
208
+ });
209
+ }
210
+ }
211
+ if (manifest.backend) {
212
+ const problem = findBackendUrlProblem(manifest.backend.url, manifest.delivery.url);
213
+ if (problem) {
214
+ context.addIssue({
215
+ code: zod_1.z.ZodIssueCode.custom,
216
+ path: ['backend', 'url'],
217
+ message: problem,
218
+ });
219
+ }
167
220
  }
168
221
  });
169
222
  function isRecord(value) {
170
223
  return typeof value === 'object' && value !== null && !Array.isArray(value);
171
224
  }
225
+ function parseUrl(value, base) {
226
+ try {
227
+ return new URL(value, base);
228
+ }
229
+ catch {
230
+ return null;
231
+ }
232
+ }
233
+ function findBackendUrlProblem(url, deliveryUrl) {
234
+ const absolute = /^[a-z][a-z0-9+.-]*:/i.test(url);
235
+ if (absolute && !(url.startsWith('https://') && parseUrl(url))) {
236
+ return 'an absolute URL must use https';
237
+ }
238
+ const delivery = parseUrl(deliveryUrl);
239
+ if (!delivery)
240
+ return null;
241
+ const resolved = parseUrl(url, deliveryUrl);
242
+ if (!absolute && resolved?.origin !== delivery.origin) {
243
+ return 'a relative URL must stay on the delivery.url origin';
244
+ }
245
+ return resolved?.username || resolved?.password
246
+ ? 'the URL must not contain a user name or password'
247
+ : null;
248
+ }
249
+ function listActionInputSchemas(backend) {
250
+ return Object.entries(backend?.actions ?? {}).flatMap(([name, action]) => action.input ? [{ path: `backend.actions.${name}.input`, schema: action.input }] : []);
251
+ }
252
+ function findUnsupportedActionInput(backend) {
253
+ for (const { path, schema } of listActionInputSchemas(backend)) {
254
+ try {
255
+ if (Buffer.byteLength(JSON.stringify(schema)) > plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxInputSchemaBytes) {
256
+ return `${path}: exceeds ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxInputSchemaBytes / 1024} KiB`;
257
+ }
258
+ (0, action_input_schema_util_1.assertBoundedSchema)(schema);
259
+ }
260
+ catch (error) {
261
+ return `${path}: ${(0, internal_helpers_1.castError)(error).message}`;
262
+ }
263
+ }
264
+ return null;
265
+ }
172
266
  function parsePluginManifest(rawFileContent) {
173
267
  if (rawFileContent === null) {
174
268
  return {
@@ -213,6 +307,14 @@ function parsePluginManifest(rawFileContent) {
213
307
  .join('; '),
214
308
  };
215
309
  }
310
+ const unsupportedInput = findUnsupportedActionInput(result.data.backend);
311
+ if (unsupportedInput) {
312
+ return {
313
+ ok: false,
314
+ code: release_rejection_code_enum_1.ReleaseRejectionCode.ACTION_INPUT_UNSUPPORTED,
315
+ detail: unsupportedInput,
316
+ };
317
+ }
216
318
  return { ok: true, manifest: result.data };
217
319
  }
218
320
  function findIncompatibleCollectionChange(current, candidate) {
@@ -233,4 +335,12 @@ function findIncompatibleCollectionChange(current, candidate) {
233
335
  }
234
336
  return null;
235
337
  }
338
+ function resolveBackendUrl(backend, deliveryUrl) {
339
+ return new URL(backend.url, deliveryUrl).toString();
340
+ }
341
+ function findIncompatibleActionChange(current, candidate) {
342
+ const next = candidate?.actions ?? {};
343
+ const removed = Object.keys(current?.actions ?? {}).find(name => !Object.hasOwn(next, name));
344
+ return removed === undefined ? null : `Action "${removed}" cannot be removed`;
345
+ }
236
346
  //# sourceMappingURL=plugin-manifest.util.js.map
@@ -0,0 +1,5 @@
1
+ import type { Request } from 'express';
2
+ export declare function requestAbortSignal(request: Request): {
3
+ readonly signal: AbortSignal;
4
+ dispose(): void;
5
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestAbortSignal = requestAbortSignal;
4
+ function requestAbortSignal(request) {
5
+ const controller = new AbortController();
6
+ const abort = () => controller.abort();
7
+ request.once('aborted', abort);
8
+ request.res?.once('close', abort);
9
+ request.res?.once('error', abort);
10
+ return {
11
+ signal: controller.signal,
12
+ dispose: () => {
13
+ request.off('aborted', abort);
14
+ request.res?.off('close', abort);
15
+ request.res?.off('error', abort);
16
+ },
17
+ };
18
+ }
19
+ //# sourceMappingURL=request-abort-signal.util.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owox/backend",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "OWOX Data Marts Backend - Full-stack data orchestration platform",
5
5
  "author": "OWOX",
6
6
  "license": "ELv2",
@@ -77,7 +77,7 @@
77
77
  "@google-cloud/opentelemetry-cloud-trace-exporter": "^3.0.0",
78
78
  "@google-cloud/pubsub": "^4.0.7",
79
79
  "@google-cloud/storage": "^7.21.0",
80
- "@huggingface/transformers": "^3.0.0",
80
+ "@huggingface/transformers": "^4.3.1",
81
81
  "@modelcontextprotocol/node": "^2.0.0",
82
82
  "@modelcontextprotocol/server": "^2.0.0",
83
83
  "@nestjs/common": "^11.0.1",
@@ -92,17 +92,19 @@
92
92
  "@opentelemetry/exporter-trace-otlp-http": "^0.220.0",
93
93
  "@opentelemetry/sdk-trace-base": "^2.9.0",
94
94
  "@opentelemetry/sdk-trace-node": "^2.9.0",
95
- "@owox/connectors": "0.38.0",
96
- "@owox/idp-protocol": "0.38.0",
97
- "@owox/internal-helpers": "0.38.0",
95
+ "@owox/connectors": "0.39.0",
96
+ "@owox/idp-protocol": "0.39.0",
97
+ "@owox/internal-helpers": "0.39.0",
98
+ "ajv": "^8.20.0",
98
99
  "better-sqlite3": "^12.2.0",
99
100
  "class-transformer": "^0.5.1",
100
101
  "class-validator": "^0.14.2",
101
- "compression": "^1.8.1",
102
+ "compression": "^1.8.2",
102
103
  "cross-spawn": "^7.0.6",
103
104
  "env-paths": "^3.0.0",
105
+ "google-auth-library": "^10.9.1",
104
106
  "googleapis": "^150.0.1",
105
- "handlebars": "^4.7.9",
107
+ "handlebars": "^4.7.10",
106
108
  "hono": "^4.11.4",
107
109
  "ipaddr.js": "^1.9.1",
108
110
  "jsonwebtoken": "^9.0.0",
@@ -119,7 +121,7 @@
119
121
  "remark-parse": "^11.0.0",
120
122
  "remark-rehype": "^11.1.2",
121
123
  "rxjs": "^7.8.1",
122
- "snowflake-sdk": "^2.3.3",
124
+ "snowflake-sdk": "^3.4.0",
123
125
  "swagger-ui-express": "^5.0.1",
124
126
  "typeorm": "^0.3.31",
125
127
  "typeorm-transactional": "^0.5.0",