@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
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PluginActionExecution = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const plugin_action_execution_status_enum_1 = require("../enums/plugin-action-execution-status.enum");
15
+ const JSON_TEXT = {
16
+ to: (value) => (value === undefined || value === null ? value : JSON.stringify(value)),
17
+ from: (text) => text === null || text === undefined ? null : JSON.parse(String(text)),
18
+ };
19
+ let PluginActionExecution = class PluginActionExecution {
20
+ id;
21
+ pluginId;
22
+ pluginVersionId;
23
+ installationId;
24
+ projectId;
25
+ userId;
26
+ action;
27
+ input;
28
+ trigger;
29
+ status;
30
+ role;
31
+ tokenHash;
32
+ deadlineAt;
33
+ createdAt;
34
+ startedAt;
35
+ finishedAt;
36
+ errorCode;
37
+ errorMessage;
38
+ result;
39
+ payloadsClearedAt;
40
+ payloadBytes;
41
+ };
42
+ exports.PluginActionExecution = PluginActionExecution;
43
+ __decorate([
44
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
45
+ __metadata("design:type", String)
46
+ ], PluginActionExecution.prototype, "id", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: 'varchar', length: 36 }),
49
+ __metadata("design:type", String)
50
+ ], PluginActionExecution.prototype, "pluginId", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'varchar', length: 36 }),
53
+ __metadata("design:type", String)
54
+ ], PluginActionExecution.prototype, "pluginVersionId", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: 'varchar', length: 36 }),
57
+ __metadata("design:type", String)
58
+ ], PluginActionExecution.prototype, "installationId", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
61
+ __metadata("design:type", String)
62
+ ], PluginActionExecution.prototype, "projectId", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
65
+ __metadata("design:type", String)
66
+ ], PluginActionExecution.prototype, "userId", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'varchar', length: 64 }),
69
+ __metadata("design:type", String)
70
+ ], PluginActionExecution.prototype, "action", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ type: 'text', nullable: true, transformer: JSON_TEXT }),
73
+ __metadata("design:type", Object)
74
+ ], PluginActionExecution.prototype, "input", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'varchar', length: 16 }),
77
+ __metadata("design:type", String)
78
+ ], PluginActionExecution.prototype, "trigger", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'varchar', length: 16 }),
81
+ __metadata("design:type", String)
82
+ ], PluginActionExecution.prototype, "status", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: 'varchar', length: 16 }),
85
+ __metadata("design:type", String)
86
+ ], PluginActionExecution.prototype, "role", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ type: 'varchar', length: 64, nullable: true }),
89
+ __metadata("design:type", Object)
90
+ ], PluginActionExecution.prototype, "tokenHash", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ type: 'datetime', nullable: true }),
93
+ __metadata("design:type", Object)
94
+ ], PluginActionExecution.prototype, "deadlineAt", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.CreateDateColumn)(),
97
+ __metadata("design:type", Date)
98
+ ], PluginActionExecution.prototype, "createdAt", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.Column)({ type: 'datetime', nullable: true }),
101
+ __metadata("design:type", Object)
102
+ ], PluginActionExecution.prototype, "startedAt", void 0);
103
+ __decorate([
104
+ (0, typeorm_1.Column)({ type: 'datetime', nullable: true }),
105
+ __metadata("design:type", Object)
106
+ ], PluginActionExecution.prototype, "finishedAt", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.Column)({ type: 'varchar', length: 64, nullable: true }),
109
+ __metadata("design:type", Object)
110
+ ], PluginActionExecution.prototype, "errorCode", void 0);
111
+ __decorate([
112
+ (0, typeorm_1.Column)({ type: 'varchar', length: 1000, nullable: true }),
113
+ __metadata("design:type", Object)
114
+ ], PluginActionExecution.prototype, "errorMessage", void 0);
115
+ __decorate([
116
+ (0, typeorm_1.Column)({ type: 'text', nullable: true, transformer: JSON_TEXT }),
117
+ __metadata("design:type", Object)
118
+ ], PluginActionExecution.prototype, "result", void 0);
119
+ __decorate([
120
+ (0, typeorm_1.Column)({ type: 'datetime', nullable: true }),
121
+ __metadata("design:type", Object)
122
+ ], PluginActionExecution.prototype, "payloadsClearedAt", void 0);
123
+ __decorate([
124
+ (0, typeorm_1.Column)({ type: 'int', default: 0 }),
125
+ __metadata("design:type", Number)
126
+ ], PluginActionExecution.prototype, "payloadBytes", void 0);
127
+ exports.PluginActionExecution = PluginActionExecution = __decorate([
128
+ (0, typeorm_1.Entity)('plugin_action_execution'),
129
+ (0, typeorm_1.Index)('UQ_plugin_action_execution_token', ['tokenHash'], { unique: true }),
130
+ (0, typeorm_1.Index)('idx_plugin_action_execution_running', ['installationId', 'status']),
131
+ (0, typeorm_1.Index)('idx_plugin_action_execution_deadline', ['status', 'deadlineAt']),
132
+ (0, typeorm_1.Index)('idx_plugin_action_execution_starts', ['installationId', 'startedAt', 'payloadBytes']),
133
+ (0, typeorm_1.Index)('idx_plugin_action_execution_finished', ['finishedAt']),
134
+ (0, typeorm_1.Index)('idx_plugin_action_execution_payloads', ['payloadsClearedAt', 'finishedAt'])
135
+ ], PluginActionExecution);
136
+ //# sourceMappingURL=plugin-action-execution.entity.js.map
@@ -1,4 +1,4 @@
1
- import type { PluginCollectionDeclaration } from '../utils/plugin-manifest.util';
1
+ import type { PluginBackendDeclaration, PluginCollectionDeclaration } from '../utils/plugin-manifest.util';
2
2
  import type { StoredCredentialRequirement } from '../../data-marts/credentials/credential.types';
3
3
  export declare class PluginVersion {
4
4
  id: string;
@@ -13,6 +13,7 @@ export declare class PluginVersion {
13
13
  deliveryUrl: string;
14
14
  collections: PluginCollectionDeclaration[] | null;
15
15
  credentialRequirements: StoredCredentialRequirement[] | null;
16
+ backend: PluginBackendDeclaration | null;
16
17
  releasePublishedAt: Date | null;
17
18
  createdAt: Date;
18
19
  }
@@ -24,6 +24,7 @@ let PluginVersion = class PluginVersion {
24
24
  deliveryUrl;
25
25
  collections;
26
26
  credentialRequirements;
27
+ backend;
27
28
  releasePublishedAt;
28
29
  createdAt;
29
30
  };
@@ -76,6 +77,10 @@ __decorate([
76
77
  (0, typeorm_1.Column)({ type: 'json', nullable: true }),
77
78
  __metadata("design:type", Object)
78
79
  ], PluginVersion.prototype, "credentialRequirements", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
82
+ __metadata("design:type", Object)
83
+ ], PluginVersion.prototype, "backend", void 0);
79
84
  __decorate([
80
85
  (0, typeorm_1.Column)({ type: 'datetime', nullable: true }),
81
86
  __metadata("design:type", Object)
@@ -0,0 +1,9 @@
1
+ export declare enum PluginActionExecutionStatus {
2
+ RUNNING = "RUNNING",
3
+ SUCCEEDED = "SUCCEEDED",
4
+ FAILED = "FAILED",
5
+ CANCELLED = "CANCELLED",
6
+ TIMED_OUT = "TIMED_OUT"
7
+ }
8
+ export type PluginActionTrigger = 'frontend';
9
+ export declare function isFinalPluginActionStatus(status: string): boolean;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginActionExecutionStatus = void 0;
4
+ exports.isFinalPluginActionStatus = isFinalPluginActionStatus;
5
+ var PluginActionExecutionStatus;
6
+ (function (PluginActionExecutionStatus) {
7
+ PluginActionExecutionStatus["RUNNING"] = "RUNNING";
8
+ PluginActionExecutionStatus["SUCCEEDED"] = "SUCCEEDED";
9
+ PluginActionExecutionStatus["FAILED"] = "FAILED";
10
+ PluginActionExecutionStatus["CANCELLED"] = "CANCELLED";
11
+ PluginActionExecutionStatus["TIMED_OUT"] = "TIMED_OUT";
12
+ })(PluginActionExecutionStatus || (exports.PluginActionExecutionStatus = PluginActionExecutionStatus = {}));
13
+ const FINAL_STATUSES = new Set([
14
+ PluginActionExecutionStatus.SUCCEEDED,
15
+ PluginActionExecutionStatus.FAILED,
16
+ PluginActionExecutionStatus.CANCELLED,
17
+ PluginActionExecutionStatus.TIMED_OUT,
18
+ ]);
19
+ function isFinalPluginActionStatus(status) {
20
+ return FINAL_STATUSES.has(status);
21
+ }
22
+ //# sourceMappingURL=plugin-action-execution-status.enum.js.map
@@ -9,6 +9,9 @@ export declare enum ReleaseRejectionCode {
9
9
  MANIFEST_INVALID_JSON = "MANIFEST_INVALID_JSON",
10
10
  MANIFEST_SCHEMA = "MANIFEST_SCHEMA",
11
11
  COLLECTIONS_INCOMPATIBLE = "COLLECTIONS_INCOMPATIBLE",
12
+ ACTION_INPUT_UNSUPPORTED = "ACTION_INPUT_UNSUPPORTED",
13
+ ACTIONS_INCOMPATIBLE = "ACTIONS_INCOMPATIBLE",
14
+ BACKEND_ORIGIN_CHANGED = "BACKEND_ORIGIN_CHANGED",
12
15
  DELIVERY_UNSUPPORTED = "DELIVERY_UNSUPPORTED",
13
16
  URL_NOT_HTTPS = "URL_NOT_HTTPS",
14
17
  URL_PRIVATE_NETWORK = "URL_PRIVATE_NETWORK",
@@ -13,6 +13,9 @@ var ReleaseRejectionCode;
13
13
  ReleaseRejectionCode["MANIFEST_INVALID_JSON"] = "MANIFEST_INVALID_JSON";
14
14
  ReleaseRejectionCode["MANIFEST_SCHEMA"] = "MANIFEST_SCHEMA";
15
15
  ReleaseRejectionCode["COLLECTIONS_INCOMPATIBLE"] = "COLLECTIONS_INCOMPATIBLE";
16
+ ReleaseRejectionCode["ACTION_INPUT_UNSUPPORTED"] = "ACTION_INPUT_UNSUPPORTED";
17
+ ReleaseRejectionCode["ACTIONS_INCOMPATIBLE"] = "ACTIONS_INCOMPATIBLE";
18
+ ReleaseRejectionCode["BACKEND_ORIGIN_CHANGED"] = "BACKEND_ORIGIN_CHANGED";
16
19
  ReleaseRejectionCode["DELIVERY_UNSUPPORTED"] = "DELIVERY_UNSUPPORTED";
17
20
  ReleaseRejectionCode["URL_NOT_HTTPS"] = "URL_NOT_HTTPS";
18
21
  ReleaseRejectionCode["URL_PRIVATE_NETWORK"] = "URL_PRIVATE_NETWORK";
@@ -31,6 +34,9 @@ const REJECTION_IS_PUBLISHER_ACTIONABLE = {
31
34
  [ReleaseRejectionCode.MANIFEST_INVALID_JSON]: true,
32
35
  [ReleaseRejectionCode.MANIFEST_SCHEMA]: true,
33
36
  [ReleaseRejectionCode.COLLECTIONS_INCOMPATIBLE]: true,
37
+ [ReleaseRejectionCode.ACTION_INPUT_UNSUPPORTED]: true,
38
+ [ReleaseRejectionCode.ACTIONS_INCOMPATIBLE]: true,
39
+ [ReleaseRejectionCode.BACKEND_ORIGIN_CHANGED]: true,
34
40
  [ReleaseRejectionCode.DELIVERY_UNSUPPORTED]: true,
35
41
  [ReleaseRejectionCode.URL_NOT_HTTPS]: true,
36
42
  [ReleaseRejectionCode.URL_PRIVATE_NETWORK]: true,
@@ -0,0 +1,45 @@
1
+ import { HttpStatus } from '@nestjs/common';
2
+ import { PluginHostError } from './plugin-host.errors';
3
+ export interface ActionInputError {
4
+ readonly instancePath: string;
5
+ readonly message: string;
6
+ }
7
+ export declare class ActionNotDeclaredError extends PluginHostError {
8
+ readonly memberVisible = true;
9
+ readonly httpStatus = HttpStatus.NOT_FOUND;
10
+ constructor(action: string);
11
+ }
12
+ export declare class ActionInputTooLargeError extends PluginHostError {
13
+ readonly memberVisible = true;
14
+ readonly httpStatus = HttpStatus.PAYLOAD_TOO_LARGE;
15
+ constructor();
16
+ }
17
+ export declare class ActionInputInvalidError extends PluginHostError {
18
+ readonly memberVisible = true;
19
+ constructor(errors: readonly ActionInputError[]);
20
+ }
21
+ export declare class TooManyExecutionsError extends PluginHostError {
22
+ readonly memberVisible = true;
23
+ readonly httpStatus = HttpStatus.TOO_MANY_REQUESTS;
24
+ constructor(message?: string);
25
+ }
26
+ export declare class ExecutionTokenNotAllowedError extends PluginHostError {
27
+ readonly memberVisible = true;
28
+ readonly httpStatus = HttpStatus.FORBIDDEN;
29
+ constructor(message?: string);
30
+ }
31
+ export declare class ExecutionTokenRequiredError extends PluginHostError {
32
+ readonly memberVisible = true;
33
+ readonly httpStatus = HttpStatus.FORBIDDEN;
34
+ constructor();
35
+ }
36
+ export declare class ExecutionNotFoundError extends PluginHostError {
37
+ readonly memberVisible = true;
38
+ readonly httpStatus = HttpStatus.NOT_FOUND;
39
+ constructor();
40
+ }
41
+ export declare class InstallationInactiveError extends PluginHostError {
42
+ readonly memberVisible = true;
43
+ readonly httpStatus = HttpStatus.FORBIDDEN;
44
+ constructor();
45
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InstallationInactiveError = exports.ExecutionNotFoundError = exports.ExecutionTokenRequiredError = exports.ExecutionTokenNotAllowedError = exports.TooManyExecutionsError = exports.ActionInputInvalidError = exports.ActionInputTooLargeError = exports.ActionNotDeclaredError = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const plugin_action_limits_1 = require("../constants/plugin-action-limits");
6
+ const plugin_host_errors_1 = require("./plugin-host.errors");
7
+ class ActionNotDeclaredError extends plugin_host_errors_1.PluginHostError {
8
+ memberVisible = true;
9
+ httpStatus = common_1.HttpStatus.NOT_FOUND;
10
+ constructor(action) {
11
+ super('ACTION_NOT_DECLARED', `Action "${action}" is not declared in the current version of this plugin`);
12
+ }
13
+ }
14
+ exports.ActionNotDeclaredError = ActionNotDeclaredError;
15
+ class ActionInputTooLargeError extends plugin_host_errors_1.PluginHostError {
16
+ memberVisible = true;
17
+ httpStatus = common_1.HttpStatus.PAYLOAD_TOO_LARGE;
18
+ constructor() {
19
+ super('INPUT_TOO_LARGE', `Action input is larger than ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxInputBytes / 1024} KiB`);
20
+ }
21
+ }
22
+ exports.ActionInputTooLargeError = ActionInputTooLargeError;
23
+ class ActionInputInvalidError extends plugin_host_errors_1.PluginHostError {
24
+ memberVisible = true;
25
+ constructor(errors) {
26
+ super('INVALID_INPUT', 'Action input does not match the action schema', { errors });
27
+ }
28
+ }
29
+ exports.ActionInputInvalidError = ActionInputInvalidError;
30
+ class TooManyExecutionsError extends plugin_host_errors_1.PluginHostError {
31
+ memberVisible = true;
32
+ httpStatus = common_1.HttpStatus.TOO_MANY_REQUESTS;
33
+ constructor(message = `This installation already has ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxRunningPerInstallation} running executions`) {
34
+ super('TOO_MANY_EXECUTIONS', message);
35
+ }
36
+ }
37
+ exports.TooManyExecutionsError = TooManyExecutionsError;
38
+ class ExecutionTokenNotAllowedError extends plugin_host_errors_1.PluginHostError {
39
+ memberVisible = true;
40
+ httpStatus = common_1.HttpStatus.FORBIDDEN;
41
+ constructor(message = 'A backend action cannot start another action') {
42
+ super('EXECUTION_TOKEN_NOT_ALLOWED', message);
43
+ }
44
+ }
45
+ exports.ExecutionTokenNotAllowedError = ExecutionTokenNotAllowedError;
46
+ class ExecutionTokenRequiredError extends plugin_host_errors_1.PluginHostError {
47
+ memberVisible = true;
48
+ httpStatus = common_1.HttpStatus.FORBIDDEN;
49
+ constructor() {
50
+ super('EXECUTION_TOKEN_REQUIRED', 'Only a backend action can read its own execution');
51
+ }
52
+ }
53
+ exports.ExecutionTokenRequiredError = ExecutionTokenRequiredError;
54
+ class ExecutionNotFoundError extends plugin_host_errors_1.PluginHostError {
55
+ memberVisible = true;
56
+ httpStatus = common_1.HttpStatus.NOT_FOUND;
57
+ constructor() {
58
+ super('EXECUTION_NOT_FOUND', 'Execution was not found');
59
+ }
60
+ }
61
+ exports.ExecutionNotFoundError = ExecutionNotFoundError;
62
+ class InstallationInactiveError extends plugin_host_errors_1.PluginHostError {
63
+ memberVisible = true;
64
+ httpStatus = common_1.HttpStatus.FORBIDDEN;
65
+ constructor() {
66
+ super('INSTALLATION_INACTIVE', 'The plugin installation is no longer active');
67
+ }
68
+ }
69
+ exports.InstallationInactiveError = InstallationInactiveError;
70
+ //# sourceMappingURL=plugin-action.errors.js.map
@@ -1,6 +1,8 @@
1
+ import { HttpStatus } from '@nestjs/common';
1
2
  import { BusinessViolationException } from '../../common/exceptions/business-violation.exception';
2
3
  export declare abstract class PluginHostError extends BusinessViolationException {
3
4
  abstract readonly memberVisible: boolean;
5
+ readonly httpStatus: HttpStatus;
4
6
  protected constructor(code: string, message: string, errorDetails?: Record<string, unknown>);
5
7
  }
6
8
  export declare class InvalidRepoLocatorError extends PluginHostError {
@@ -31,6 +33,10 @@ export declare class PluginSyncRateLimitedError extends PluginHostError {
31
33
  readonly memberVisible = true;
32
34
  constructor(retryAfterSeconds: number);
33
35
  }
36
+ export declare class PluginCheckRateLimitedError extends PluginHostError {
37
+ readonly memberVisible = true;
38
+ constructor(retryAfterSeconds: number);
39
+ }
34
40
  export declare class PluginSyncInProgressError extends PluginHostError {
35
41
  readonly memberVisible = true;
36
42
  constructor();
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluginVersionConflictError = exports.NoEligiblePluginVersionError = exports.PluginNotPublishedError = exports.StaleVersionConfirmationError = exports.PluginSuspendedError = exports.AudienceFormConflictError = exports.PublicationAuthorizationError = exports.PluginSyncLeaseLostError = exports.PluginSyncInProgressError = exports.PluginSyncRateLimitedError = exports.GithubApiError = exports.GithubRateLimitedError = exports.GithubAuthConfigError = exports.GithubRepoNotAccessibleError = exports.GithubRepoNotFoundError = exports.InvalidRepoLocatorError = exports.PluginHostError = void 0;
3
+ exports.PluginVersionConflictError = exports.NoEligiblePluginVersionError = exports.PluginNotPublishedError = exports.StaleVersionConfirmationError = exports.PluginSuspendedError = exports.AudienceFormConflictError = exports.PublicationAuthorizationError = exports.PluginSyncLeaseLostError = exports.PluginSyncInProgressError = exports.PluginCheckRateLimitedError = exports.PluginSyncRateLimitedError = exports.GithubApiError = exports.GithubRateLimitedError = exports.GithubAuthConfigError = exports.GithubRepoNotAccessibleError = exports.GithubRepoNotFoundError = exports.InvalidRepoLocatorError = exports.PluginHostError = void 0;
4
+ const common_1 = require("@nestjs/common");
4
5
  const business_violation_exception_1 = require("../../common/exceptions/business-violation.exception");
5
6
  class PluginHostError extends business_violation_exception_1.BusinessViolationException {
7
+ httpStatus = common_1.HttpStatus.BAD_REQUEST;
6
8
  constructor(code, message, errorDetails) {
7
9
  super(message, errorDetails, code);
8
10
  }
@@ -63,6 +65,13 @@ class PluginSyncRateLimitedError extends PluginHostError {
63
65
  }
64
66
  }
65
67
  exports.PluginSyncRateLimitedError = PluginSyncRateLimitedError;
68
+ class PluginCheckRateLimitedError extends PluginHostError {
69
+ memberVisible = true;
70
+ constructor(retryAfterSeconds) {
71
+ super('PLUGIN_CHECK_RATE_LIMITED', `This plugin was checked very recently. Try again in ${retryAfterSeconds} seconds.`, { retryAfterSeconds });
72
+ }
73
+ }
74
+ exports.PluginCheckRateLimitedError = PluginCheckRateLimitedError;
66
75
  class PluginSyncInProgressError extends PluginHostError {
67
76
  memberVisible = true;
68
77
  constructor() {
@@ -19,8 +19,8 @@ let PluginHostExceptionFilter = PluginHostExceptionFilter_1 = class PluginHostEx
19
19
  if (!exception.memberVisible) {
20
20
  this.logger.warn(`Withheld ${exception.code} detail from a member-facing response: ${exception.message}`, exception.errorDetails);
21
21
  }
22
- response.status(common_1.HttpStatus.BAD_REQUEST).json({
23
- statusCode: common_1.HttpStatus.BAD_REQUEST,
22
+ response.status(exception.httpStatus).json({
23
+ statusCode: exception.httpStatus,
24
24
  timestamp: new Date().toISOString(),
25
25
  path: request.url,
26
26
  code: exception.code,
@@ -0,0 +1,3 @@
1
+ import type { PluginActionExecutionView } from '../dto/domain/plugin-action-execution.dto';
2
+ import type { PluginActionExecutionSummary } from '../services/plugin-action-execution.service';
3
+ export declare function toPluginActionExecutionView(execution: PluginActionExecutionSummary): PluginActionExecutionView;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toPluginActionExecutionView = toPluginActionExecutionView;
4
+ const plugin_action_execution_status_enum_1 = require("../enums/plugin-action-execution-status.enum");
5
+ function toPluginActionExecutionView(execution) {
6
+ const failed = (0, plugin_action_execution_status_enum_1.isFinalPluginActionStatus)(execution.status) &&
7
+ execution.status !== plugin_action_execution_status_enum_1.PluginActionExecutionStatus.SUCCEEDED;
8
+ return {
9
+ id: execution.id,
10
+ action: execution.action,
11
+ status: execution.status,
12
+ trigger: execution.trigger,
13
+ startedAt: execution.startedAt,
14
+ deadlineAt: execution.deadlineAt,
15
+ finishedAt: execution.finishedAt,
16
+ result: execution.status === plugin_action_execution_status_enum_1.PluginActionExecutionStatus.SUCCEEDED ? execution.result : null,
17
+ error: failed
18
+ ? { code: execution.errorCode ?? execution.status, message: execution.errorMessage ?? '' }
19
+ : null,
20
+ };
21
+ }
22
+ //# sourceMappingURL=plugin-action-execution.mapper.js.map
@@ -1,9 +1,15 @@
1
1
  import type { AuthorizationContext } from '../../idp';
2
+ import { CheckPluginReleaseCommand, PluginReleaseCheckResultDto } from '../dto/domain/check-plugin-release.command';
3
+ import type { PluginHistoryPageDto, PluginHistoryPluginDto } from '../dto/domain/plugin-history.dto';
4
+ import { ListPluginHistoryCommand } from '../dto/domain/list-plugin-history.command';
5
+ import { ListPluginHistoryQueryApiDto, PluginHistoryPageApiDto } from '../dto/presentation/plugin-history-api.dto';
2
6
  import { FindPluginByRepositoryCommand } from '../dto/domain/find-plugin-by-repository.command';
3
7
  import { GetPluginDetailsCommand } from '../dto/domain/get-plugin-details.command';
4
8
  import { GetPluginGalleryCommand } from '../dto/domain/get-plugin-gallery.command';
5
9
  import { GetPluginInstallationEntryCommand } from '../dto/domain/get-plugin-installation-entry.command';
6
10
  import { InstallPluginCommand } from '../dto/domain/install-plugin.command';
11
+ import type { PluginActionExecutionView, PluginActionWorkerContext, StartedPluginActionExecution } from '../dto/domain/plugin-action-execution.dto';
12
+ import { PluginActionExecutionApiDto, PluginActionWorkerContextApiDto, StartedPluginActionExecutionApiDto } from '../dto/presentation/plugin-action-api.dto';
7
13
  import { ListInstallationsCommand } from '../dto/domain/list-installations.command';
8
14
  import { ListPublicationsCommand } from '../dto/domain/list-publications.command';
9
15
  import { InstalledPluginDto, PluginInstallationDto, PluginInstallationEntryDto } from '../dto/domain/plugin-installation.dto';
@@ -17,7 +23,7 @@ import { InstalledPluginApiDto, InstallPluginApiDto, PluginEntryApiDto, PluginIn
17
23
  import { PluginGalleryEntryApiDto } from '../dto/presentation/plugin-gallery-api.dto';
18
24
  import { PluginLookupApiDto } from '../dto/presentation/plugin-lookup-api.dto';
19
25
  import { PluginSuspensionResponseApiDto, SuspendPluginApiDto } from '../dto/presentation/plugin-suspension-api.dto';
20
- import { PluginPublisherDiagnosticsApiDto, PublicationResponseApiDto, PublishPluginApiDto, UpdatePluginByRepositoryApiDto } from '../dto/presentation/publication-api.dto';
26
+ import { CheckPluginReleaseApiDto, PluginPublisherDiagnosticsApiDto, PluginReleaseCheckResultApiDto, PublicationResponseApiDto, PublishPluginApiDto, UpdatePluginByRepositoryApiDto } from '../dto/presentation/publication-api.dto';
21
27
  import { PluginVersion } from '../entities/plugin-version.entity';
22
28
  import { Plugin } from '../entities/plugin.entity';
23
29
  import { PluginPublicationScope } from '../enums/plugin-publication-scope.enum';
@@ -33,15 +39,19 @@ export declare class PluginPresentationMapper {
33
39
  toGetPluginGalleryCommand(context: AuthorizationContext): GetPluginGalleryCommand;
34
40
  toGetPluginDetailsCommand(pluginId: string, context: AuthorizationContext): GetPluginDetailsCommand;
35
41
  toListInstallationsCommand(context: AuthorizationContext, includeUninstalled: boolean): ListInstallationsCommand;
42
+ toListPluginHistoryCommand(context: AuthorizationContext, query: ListPluginHistoryQueryApiDto): ListPluginHistoryCommand;
43
+ toPluginHistoryResponse(page: PluginHistoryPageDto): PluginHistoryPageApiDto;
36
44
  toFindPluginByRepositoryCommand(repository: string, context: AuthorizationContext): FindPluginByRepositoryCommand;
37
45
  toGetPluginInstallationEntryCommand(installationId: string, context: AuthorizationContext): GetPluginInstallationEntryCommand;
38
46
  toInstallCommand(pluginId: string, context: AuthorizationContext, dto: InstallPluginApiDto): InstallPluginCommand;
39
47
  toUpdateCommand(pluginId: string, context: AuthorizationContext): UpdatePluginCommand;
40
48
  toUpdateByRepositoryCommand(context: AuthorizationContext, dto: UpdatePluginByRepositoryApiDto): UpdatePluginCommand;
49
+ toCheckReleaseCommand(context: AuthorizationContext, dto: CheckPluginReleaseApiDto): CheckPluginReleaseCommand;
41
50
  toUninstallCommand(pluginId: string, context: AuthorizationContext): UninstallPluginCommand;
42
51
  toSuspendCommand(context: AuthorizationContext, dto: SuspendPluginApiDto): SuspendPluginCommand;
43
52
  toResumeCommand(context: AuthorizationContext, dto: SuspendPluginApiDto): ResumePluginCommand;
44
53
  toMemberDto(plugin: Plugin, version: PluginVersion | null, context: PluginViewContext): PluginGalleryEntryDto;
54
+ toHistoryPlugin(plugin: Plugin, version: PluginVersion | null): PluginHistoryPluginDto;
45
55
  toLookupResponse(result: {
46
56
  pluginId: string;
47
57
  }): PluginLookupApiDto;
@@ -55,6 +65,11 @@ export declare class PluginPresentationMapper {
55
65
  toInstalledPluginResponseList(dtos: InstalledPluginDto[]): InstalledPluginApiDto[];
56
66
  toInstallationEntryResponse(dto: PluginInstallationEntryDto): PluginEntryApiDto;
57
67
  toUpdateResultResponse(dto: PluginUpdateResultDto): PluginUpdateResultApiDto;
68
+ toReleaseCheckResponse(dto: PluginReleaseCheckResultDto): PluginReleaseCheckResultApiDto;
58
69
  toSuspensionResponse(dto: PluginSuspensionDto): PluginSuspensionResponseApiDto;
70
+ toStartedActionExecutionResponse(dto: StartedPluginActionExecution): StartedPluginActionExecutionApiDto;
71
+ toActionExecutionResponse(dto: PluginActionExecutionView): PluginActionExecutionApiDto;
72
+ toActionWorkerContextResponse(dto: PluginActionWorkerContext): PluginActionWorkerContextApiDto;
73
+ private displayNameOf;
59
74
  private toSource;
60
75
  }
@@ -8,10 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.PluginPresentationMapper = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
+ const check_plugin_release_command_1 = require("../dto/domain/check-plugin-release.command");
12
+ const list_plugin_history_command_1 = require("../dto/domain/list-plugin-history.command");
11
13
  const find_plugin_by_repository_command_1 = require("../dto/domain/find-plugin-by-repository.command");
12
14
  const get_plugin_details_command_1 = require("../dto/domain/get-plugin-details.command");
13
15
  const get_plugin_gallery_command_1 = require("../dto/domain/get-plugin-gallery.command");
14
16
  const get_plugin_installation_entry_command_1 = require("../dto/domain/get-plugin-installation-entry.command");
17
+ const plugin_manifest_util_1 = require("../utils/plugin-manifest.util");
15
18
  const install_plugin_command_1 = require("../dto/domain/install-plugin.command");
16
19
  const list_installations_command_1 = require("../dto/domain/list-installations.command");
17
20
  const list_publications_command_1 = require("../dto/domain/list-publications.command");
@@ -45,6 +48,23 @@ let PluginPresentationMapper = class PluginPresentationMapper {
45
48
  toListInstallationsCommand(context, includeUninstalled) {
46
49
  return new list_installations_command_1.ListInstallationsCommand(context, includeUninstalled);
47
50
  }
51
+ toListPluginHistoryCommand(context, query) {
52
+ return new list_plugin_history_command_1.ListPluginHistoryCommand(context, query.type ?? 'all', query.limit ?? list_plugin_history_command_1.PLUGIN_HISTORY_DEFAULT_LIMIT, query.cursor ?? null);
53
+ }
54
+ toPluginHistoryResponse(page) {
55
+ return {
56
+ items: page.items.map(item => ({
57
+ id: item.id,
58
+ occurredAt: item.occurredAt.toISOString(),
59
+ action: item.action,
60
+ scope: item.scope,
61
+ plugin: { ...item.plugin },
62
+ actor: item.actor ? { ...item.actor } : null,
63
+ version: item.version,
64
+ })),
65
+ nextCursor: page.nextCursor,
66
+ };
67
+ }
48
68
  toFindPluginByRepositoryCommand(repository, context) {
49
69
  return new find_plugin_by_repository_command_1.FindPluginByRepositoryCommand(repository, context);
50
70
  }
@@ -60,6 +80,9 @@ let PluginPresentationMapper = class PluginPresentationMapper {
60
80
  toUpdateByRepositoryCommand(context, dto) {
61
81
  return new update_plugin_command_1.UpdatePluginCommand(context, undefined, dto.repository);
62
82
  }
83
+ toCheckReleaseCommand(context, dto) {
84
+ return new check_plugin_release_command_1.CheckPluginReleaseCommand(context, dto.repository, dto.ref, dto.version);
85
+ }
63
86
  toUninstallCommand(pluginId, context) {
64
87
  return new uninstall_plugin_command_1.UninstallPluginCommand(pluginId, context);
65
88
  }
@@ -72,7 +95,7 @@ let PluginPresentationMapper = class PluginPresentationMapper {
72
95
  toMemberDto(plugin, version, context) {
73
96
  return {
74
97
  pluginId: plugin.id,
75
- displayName: version?.displayName ?? (plugin.isPrivateRepo ? plugin.repoOwner : plugin.repoName),
98
+ displayName: this.displayNameOf(plugin, version),
76
99
  description: version?.description ?? '',
77
100
  currentSemver: version?.semver ?? null,
78
101
  currentVersionId: version?.id ?? null,
@@ -83,6 +106,16 @@ let PluginPresentationMapper = class PluginPresentationMapper {
83
106
  addedAt: plugin.createdAt.toISOString(),
84
107
  nextCheckAt: plugin.nextUpdateCheckAt?.toISOString() ?? null,
85
108
  credentialRequirements: version?.credentialRequirements ?? [],
109
+ ...(version?.backend
110
+ ? { backendOrigin: new URL((0, plugin_manifest_util_1.resolveBackendUrl)(version.backend, version.deliveryUrl)).origin }
111
+ : {}),
112
+ };
113
+ }
114
+ toHistoryPlugin(plugin, version) {
115
+ return {
116
+ pluginId: plugin.id,
117
+ displayName: this.displayNameOf(plugin, version),
118
+ ownerName: plugin.repoOwner,
86
119
  };
87
120
  }
88
121
  toLookupResponse(result) {
@@ -102,6 +135,7 @@ let PluginPresentationMapper = class PluginPresentationMapper {
102
135
  addedAt: dto.addedAt,
103
136
  nextCheckAt: dto.nextCheckAt,
104
137
  credentialRequirements: dto.credentialRequirements.map(requirement => typeof requirement === 'string' ? requirement : { ...requirement }),
138
+ ...(dto.backendOrigin ? { backendOrigin: dto.backendOrigin } : {}),
105
139
  };
106
140
  }
107
141
  toGalleryEntryResponseList(dtos) {
@@ -175,6 +209,17 @@ let PluginPresentationMapper = class PluginPresentationMapper {
175
209
  diagnostics: dto.diagnostics ? this.toDiagnosticsResponse(dto.diagnostics) : null,
176
210
  };
177
211
  }
212
+ toReleaseCheckResponse(dto) {
213
+ return {
214
+ pluginId: dto.pluginId,
215
+ repository: dto.repository,
216
+ commitSha: dto.commitSha,
217
+ candidateVersion: dto.candidateVersion,
218
+ baselineVersion: dto.baselineVersion,
219
+ collectionsEvaluated: dto.collectionsEvaluated,
220
+ issues: dto.issues.map(issue => ({ code: issue.code, detail: issue.detail })),
221
+ };
222
+ }
178
223
  toSuspensionResponse(dto) {
179
224
  return {
180
225
  pluginId: dto.pluginId,
@@ -182,6 +227,40 @@ let PluginPresentationMapper = class PluginPresentationMapper {
182
227
  note: dto.note,
183
228
  };
184
229
  }
230
+ toStartedActionExecutionResponse(dto) {
231
+ return { id: dto.id, status: dto.status };
232
+ }
233
+ toActionExecutionResponse(dto) {
234
+ return {
235
+ id: dto.id,
236
+ action: dto.action,
237
+ status: dto.status,
238
+ trigger: dto.trigger,
239
+ startedAt: dto.startedAt,
240
+ deadlineAt: dto.deadlineAt,
241
+ finishedAt: dto.finishedAt,
242
+ result: dto.result,
243
+ error: dto.error ? { code: dto.error.code, message: dto.error.message } : null,
244
+ };
245
+ }
246
+ toActionWorkerContextResponse(dto) {
247
+ return {
248
+ executionId: dto.executionId,
249
+ action: dto.action,
250
+ input: dto.input,
251
+ trigger: dto.trigger,
252
+ deadlineAt: dto.deadlineAt,
253
+ plugin: { id: dto.plugin.id, repositoryId: dto.plugin.repositoryId },
254
+ pluginVersion: dto.pluginVersion,
255
+ installationId: dto.installationId,
256
+ projectId: dto.projectId,
257
+ userId: dto.userId,
258
+ credentialHandles: dto.credentialHandles.map(handle => ({ ...handle })),
259
+ };
260
+ }
261
+ displayNameOf(plugin, version) {
262
+ return version?.displayName ?? (plugin.isPrivateRepo ? plugin.repoOwner : plugin.repoName);
263
+ }
185
264
  toSource(plugin) {
186
265
  const owner = {
187
266
  ownerName: plugin.repoOwner,