@abyss-project/probe 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/.eslintrc.js +32 -32
  2. package/.prettierrc +5 -5
  3. package/README.md +22 -22
  4. package/dist/api/index.d.ts +2 -1
  5. package/dist/api/index.js +2 -1
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/api/probe-delivery-subscription.api.d.ts +11 -0
  8. package/dist/api/probe-delivery-subscription.api.js +42 -0
  9. package/dist/api/probe-delivery-subscription.api.js.map +1 -0
  10. package/dist/api/probe-delivery-subscription.application.api.d.ts +11 -0
  11. package/dist/api/probe-delivery-subscription.application.api.js +38 -0
  12. package/dist/api/probe-delivery-subscription.application.api.js.map +1 -0
  13. package/dist/api/probe-webhook.application.api.d.ts +1 -1
  14. package/dist/api/probe-webhook.application.api.js.map +1 -1
  15. package/dist/index.d.ts +29 -7
  16. package/dist/index.js +29 -7
  17. package/dist/index.js.map +1 -1
  18. package/dist/types/enum/api-error.enum.d.ts +2 -1
  19. package/dist/types/enum/api-error.enum.js +1 -0
  20. package/dist/types/enum/api-error.enum.js.map +1 -1
  21. package/dist/types/enum/probe-scan.enum.js.map +1 -1
  22. package/dist/types/interface/api/requests/index.d.ts +1 -0
  23. package/dist/types/interface/api/requests/index.js +1 -0
  24. package/dist/types/interface/api/requests/index.js.map +1 -1
  25. package/dist/types/interface/api/requests/probe-delivery-subscription.request.d.ts +23 -0
  26. package/dist/types/interface/api/requests/probe-delivery-subscription.request.js +3 -0
  27. package/dist/types/interface/api/requests/probe-delivery-subscription.request.js.map +1 -0
  28. package/dist/types/interface/api/requests/probe-webhook.request.d.ts +1 -4
  29. package/dist/types/interface/api/responses/index.d.ts +1 -0
  30. package/dist/types/interface/api/responses/index.js +1 -0
  31. package/dist/types/interface/api/responses/index.js.map +1 -1
  32. package/dist/types/interface/api/responses/probe-delivery-subscription.response.d.ts +10 -0
  33. package/dist/types/interface/api/responses/probe-delivery-subscription.response.js +3 -0
  34. package/dist/types/interface/api/responses/probe-delivery-subscription.response.js.map +1 -0
  35. package/dist/types/tests/probe.dto.test.js +22 -0
  36. package/dist/types/tests/probe.dto.test.js.map +1 -1
  37. package/dist/utils/probe-webhook-signature.utils.js.map +1 -1
  38. package/package.json +19 -15
  39. package/src/api/index.ts +2 -1
  40. package/src/api/probe-delivery-subscription.api.ts +183 -0
  41. package/src/api/probe-delivery-subscription.application.api.ts +186 -0
  42. package/src/api/probe-scan.api.test.ts +47 -47
  43. package/src/api/probe-scan.api.ts +203 -203
  44. package/src/api/probe-scan.application.api.test.ts +35 -35
  45. package/src/api/probe-scan.application.api.ts +157 -157
  46. package/src/api/probe-usage.api.ts +47 -47
  47. package/src/api/probe-usage.application.api.ts +25 -25
  48. package/src/api/probe-webhook.application.api.test.ts +18 -18
  49. package/src/api/probe-webhook.application.api.ts +10 -23
  50. package/src/constants/index.ts +1 -1
  51. package/src/index.ts +73 -16
  52. package/src/types/enum/api-error.enum.ts +2 -0
  53. package/src/types/enum/index.ts +2 -2
  54. package/src/types/enum/probe-scan.enum.ts +3 -2
  55. package/src/types/index.ts +2 -2
  56. package/src/types/interface/api/index.ts +5 -5
  57. package/src/types/interface/api/requests/index.ts +1 -0
  58. package/src/types/interface/api/requests/probe-delivery-subscription.request.ts +42 -0
  59. package/src/types/interface/api/requests/probe-scan.request.ts +54 -54
  60. package/src/types/interface/api/requests/probe-usage.request.ts +7 -7
  61. package/src/types/interface/api/requests/probe-webhook.request.ts +9 -11
  62. package/src/types/interface/api/responses/index.ts +1 -0
  63. package/src/types/interface/api/responses/probe-delivery-subscription.response.ts +27 -0
  64. package/src/types/interface/api/responses/probe-scan.response.ts +45 -45
  65. package/src/types/interface/api/responses/probe-usage.response.ts +25 -25
  66. package/src/types/interface/api/responses/probe-webhook.response.ts +24 -24
  67. package/src/types/interface/api/type-message/api-error.ts +7 -7
  68. package/src/types/interface/api/type-message/base-paginate.ts +11 -11
  69. package/src/types/interface/api/type-message/response.ts +6 -6
  70. package/src/types/interface/index.ts +2 -2
  71. package/src/types/interface/models/index.ts +3 -3
  72. package/src/types/interface/models/probe-scan.dto.ts +67 -67
  73. package/src/types/interface/models/probe-webhook-delivery.dto.ts +11 -14
  74. package/src/types/interface/models/probe-webhook.dto.ts +29 -29
  75. package/src/types/tests/probe.dto.test.ts +40 -4
  76. package/src/utils/enum.utils.ts +1 -1
  77. package/src/utils/error.utils.ts +30 -30
  78. package/src/utils/index.ts +4 -4
  79. package/src/utils/probe-scan-cost.utils.ts +101 -101
  80. package/src/utils/probe-webhook-signature.utils.ts +4 -3
  81. package/tsconfig.check.json +15 -15
  82. package/tsconfig.json +36 -36
  83. package/dist/api/probe-webhook.api.d.ts +0 -6
  84. package/dist/api/probe-webhook.api.js +0 -41
  85. package/dist/api/probe-webhook.api.js.map +0 -1
  86. package/dist/api/probe-webhook.api.test.d.ts +0 -1
  87. package/dist/api/probe-webhook.api.test.js +0 -43
  88. package/dist/api/probe-webhook.api.test.js.map +0 -1
  89. package/src/api/probe-webhook.api.test.ts +0 -17
  90. package/src/api/probe-webhook.api.ts +0 -119
@@ -74,6 +74,21 @@ const _deliveryRecord = {
74
74
  createdAt: new Date(),
75
75
  };
76
76
  const _deliveryRecordAdHoc = { ..._deliveryRecord, webhookId: null };
77
+ const _createSubscription = {
78
+ eventTypes: ['PROBE_SCAN_COMPLETED'],
79
+ url: 'https://example.com/hook',
80
+ };
81
+ const _updateSubscription = { isEnabled: false };
82
+ const _subscriptionQuery = {
83
+ organizationId: 'o1',
84
+ isEnabled: true,
85
+ page: 1,
86
+ limit: 20,
87
+ };
88
+ const _deliveryQuery = { organizationId: 'o1', page: 2 };
89
+ const _secret = created.data.secret;
90
+ const _noSecret = read.data.secret;
91
+ const _callbackCode = __1.Code.probeCallbackRequiresSubscription;
77
92
  const _usage = { used: 10, limit: 1000, remaining: 990 };
78
93
  const _usageUnlimited = { used: 10, limit: -1, remaining: -1 };
79
94
  const _asyncCost = (0, utils_1.estimateProbeScanCost)(5 * 1024 * 1024, __1.ProbeScanMode.ASYNC);
@@ -89,6 +104,13 @@ void _historyItem;
89
104
  void _scanSyncData;
90
105
  void _scanAsyncData;
91
106
  void _webhook;
107
+ void _createSubscription;
108
+ void _updateSubscription;
109
+ void _subscriptionQuery;
110
+ void _deliveryQuery;
111
+ void _secret;
112
+ void _noSecret;
113
+ void _callbackCode;
92
114
  void _updateBody;
93
115
  void _updateBody2;
94
116
  void _deliveryPayload;
@@ -1 +1 @@
1
- {"version":3,"file":"probe.dto.test.js","sourceRoot":"","sources":["../../../src/types/tests/probe.dto.test.ts"],"names":[],"mappings":";;AAQA,0BAaY;AAKZ,uCAAoD;AAMpD,MAAM,SAAS,GAAmC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAClF,MAAM,MAAM,GAAgC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxE,MAAM,SAAS,GAAkC;IAC/C,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;CACZ,CAAC;AAIF,MAAM,WAAW,GAAqB;IACpC,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,mBAAe,CAAC,IAAI;IAC5B,OAAO,EAAE,oBAAgB,CAAC,KAAK;IAC/B,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,aAAa;IACvB,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,iBAAiB;IAC3B,IAAI,EAAE,iBAAa,CAAC,IAAI;IACxB,SAAS,EAAE,IAAI,IAAI,EAAE;IACrB,UAAU,EAAE,IAAI,IAAI,EAAE;IACtB,SAAS,EAAE,CAAC;CACb,CAAC;AAGF,MAAM,YAAY,GAA0B;IAC1C,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,aAAa;IACvB,QAAQ,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;AACzB,KAAK,kBAAkB,CAAC;AACxB,KAAK,cAAc,CAAC;AACpB,KAAK,OAAO,CAAC;AACb,KAAK,SAAS,CAAC;AACf,KAAK,aAAa,CAAC;AACnB,KAAK,WAAW,CAAC;AACjB,KAAK,YAAY,CAAC;AAClB,KAAK,gBAAgB,CAAC;AACtB,KAAK,eAAe,CAAC;AACrB,KAAK,oBAAoB,CAAC;AAC1B,KAAK,MAAM,CAAC;AACZ,KAAK,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"probe-webhook-signature.utils.js","sourceRoot":"","sources":["../../src/utils/probe-webhook-signature.utils.ts"],"names":[],"mappings":";;AAiCA,kEAsBC;AAtBD,SAAgB,2BAA2B,CAAC,KAAuC;IACjF,IAAI,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAG1D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAW,MAAM;SAC5B,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;SAClC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;SACrB,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,IAAI,KAAK,CAAC,eAAe,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAEnE,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,eAAe,CAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,EACzC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAC7B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QAGP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"probe-webhook-signature.utils.js","sourceRoot":"","sources":["../../src/utils/probe-webhook-signature.utils.ts"],"names":[],"mappings":";;AAkCA,kEAsBC;AAtBD,SAAgB,2BAA2B,CAAC,KAAuC;IACjF,IAAI,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAG1D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAW,MAAM;SAC5B,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;SAClC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;SACrB,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,IAAI,KAAK,CAAC,eAAe,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAEnE,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,eAAe,CAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,EACzC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAC7B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QAGP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,24 +1,12 @@
1
1
  {
2
2
  "name": "@abyss-project/probe",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Core package to interact with AbyssProbe",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "publishConfig": {
8
- "main": "dist/index.js",
9
- "types": "dist/index.d.ts"
10
- },
11
- "scripts": {
12
- "lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
13
- "lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
14
- "tsc": "tsc",
15
- "build": "tsc",
16
- "prepublishOnly": "tsc && node ../../scripts/check-sdk-surface.cjs",
17
- "dev": "tsc --watch"
18
- },
19
7
  "repository": {
20
8
  "type": "git",
21
- "url": "https://gitlab.com/abyss-group/abyss-tools/abyss-tools"
9
+ "url": "https://gitlab.com/abyss-group/abyss-probe.git"
22
10
  },
23
11
  "keywords": [],
24
12
  "author": "scylla",
@@ -38,6 +26,7 @@
38
26
  "uuid": "^8.3.2"
39
27
  },
40
28
  "devDependencies": {
29
+ "@abyss-project/flow": "^1.3.0",
41
30
  "@types/express-serve-static-core": "^4.19.6",
42
31
  "@types/jsonwebtoken": "^8.5.0",
43
32
  "@types/node": "^20.11.0",
@@ -56,5 +45,20 @@
56
45
  "prettier": "2.3.1",
57
46
  "tsc-watch": "^4.6.2",
58
47
  "typescript": "5.9.3"
48
+ },
49
+ "peerDependencies": {
50
+ "@abyss-project/flow": "^1.3.0"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "@abyss-project/flow": {
54
+ "optional": true
55
+ }
56
+ },
57
+ "scripts": {
58
+ "lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
59
+ "lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
60
+ "tsc": "tsc",
61
+ "build": "tsc",
62
+ "dev": "tsc --watch"
59
63
  }
60
- }
64
+ }
package/src/api/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './probe-scan.api';
2
- export * from './probe-webhook.api';
3
2
  export * from './probe-scan.application.api';
4
3
  export * from './probe-webhook.application.api';
5
4
  export * from './probe-usage.api';
6
5
  export * from './probe-usage.application.api';
6
+ export * from './probe-delivery-subscription.api';
7
+ export * from './probe-delivery-subscription.application.api';
@@ -0,0 +1,183 @@
1
+ // ──────────────────────────────────────────────
2
+ // AbyssProbe delivery-subscription API for a personal or organization caller: the endpoints that
3
+ // receive the verdict of the caller's scans (`PROBE_SCAN_COMPLETED`). The subscriptions live in
4
+ // Flow; AbyssProbe checks the caller's access to the scope (self, or a member of the organization
5
+ // named by `organizationId`) and calls Flow for it. Mirrors
6
+ // apps/api/src/api/controllers/probe-delivery-subscription.controller.ts.
7
+ //
8
+ // See probe-delivery-subscription.application.api.ts for the application counterpart.
9
+ // ──────────────────────────────────────────────
10
+
11
+ import { AbyssProbeCore } from '..';
12
+ import type {
13
+ ICreateProbeDeliverySubscriptionBody,
14
+ ICreateProbeDeliverySubscriptionResponse,
15
+ IDeleteProbeDeliverySubscriptionResponse,
16
+ IGetProbeDeliveryResponse,
17
+ IGetProbeDeliverySubscriptionResponse,
18
+ IPaginateProbeDeliveryQuery,
19
+ IPaginateProbeDeliveryResponse,
20
+ IPaginateProbeDeliverySubscriptionQuery,
21
+ IPaginateProbeDeliverySubscriptionResponse,
22
+ IProbeDeliverySubscriptionScopeQuery,
23
+ IReplayProbeDeliveryResponse,
24
+ IResetSecretProbeDeliverySubscriptionResponse,
25
+ IUpdateProbeDeliverySubscriptionBody,
26
+ IUpdateProbeDeliverySubscriptionResponse,
27
+ } from '../types';
28
+
29
+ const DEFAULT_API_KEY_HEADER = 'abyss-api-key';
30
+
31
+ function authHeader(apiKey?: string): Record<string, string> {
32
+ return apiKey ? { [DEFAULT_API_KEY_HEADER]: apiKey } : {};
33
+ }
34
+
35
+ /** Renames `organizationId` to the wire's `organization_id` (see probe-scan.api.ts). */
36
+ function serializeProbeQuery<T extends object>(query: T): Record<string, unknown> {
37
+ const out: Record<string, unknown> = {};
38
+ for (const [key, value] of Object.entries(query as Record<string, unknown>)) {
39
+ if (value === undefined || value === null) continue;
40
+ out[key === 'organizationId' ? 'organization_id' : key] = value;
41
+ }
42
+ return out;
43
+ }
44
+
45
+ const SUBSCRIPTIONS_PATH = 'delivery-subscription';
46
+
47
+ /** `GET /delivery-subscription` — the subscriptions of the scope. */
48
+ export const paginateProbeDeliverySubscription = async (
49
+ query: IPaginateProbeDeliverySubscriptionQuery = {},
50
+ apiKey?: string,
51
+ ): Promise<IPaginateProbeDeliverySubscriptionResponse> =>
52
+ (
53
+ await AbyssProbeCore.axios.get<IPaginateProbeDeliverySubscriptionResponse>(SUBSCRIPTIONS_PATH, {
54
+ params: serializeProbeQuery(query),
55
+ headers: authHeader(apiKey),
56
+ })
57
+ ).data;
58
+
59
+ /** `GET /delivery-subscription/:deliverySubscriptionId` — never carries the secret. */
60
+ export const getProbeDeliverySubscription = async (
61
+ deliverySubscriptionId: string,
62
+ scope: IProbeDeliverySubscriptionScopeQuery = {},
63
+ apiKey?: string,
64
+ ): Promise<IGetProbeDeliverySubscriptionResponse> =>
65
+ (
66
+ await AbyssProbeCore.axios.get<IGetProbeDeliverySubscriptionResponse>(
67
+ `${SUBSCRIPTIONS_PATH}/${deliverySubscriptionId}`,
68
+ { params: serializeProbeQuery(scope), headers: authHeader(apiKey) },
69
+ )
70
+ ).data;
71
+
72
+ /**
73
+ * `POST /delivery-subscription` — HTTP 201. The response's `secret` (signing secret of the
74
+ * deliveries) is returned ONLY here and by {@link resetSecretProbeDeliverySubscription}.
75
+ */
76
+ export const createProbeDeliverySubscription = async (
77
+ body: ICreateProbeDeliverySubscriptionBody,
78
+ scope: IProbeDeliverySubscriptionScopeQuery = {},
79
+ apiKey?: string,
80
+ ): Promise<ICreateProbeDeliverySubscriptionResponse> =>
81
+ (
82
+ await AbyssProbeCore.axios.post<ICreateProbeDeliverySubscriptionResponse>(
83
+ SUBSCRIPTIONS_PATH,
84
+ body,
85
+ { params: serializeProbeQuery(scope), headers: authHeader(apiKey) },
86
+ )
87
+ ).data;
88
+
89
+ /** `PUT /delivery-subscription/:deliverySubscriptionId` — at least one field. */
90
+ export const updateProbeDeliverySubscription = async (
91
+ deliverySubscriptionId: string,
92
+ body: IUpdateProbeDeliverySubscriptionBody,
93
+ scope: IProbeDeliverySubscriptionScopeQuery = {},
94
+ apiKey?: string,
95
+ ): Promise<IUpdateProbeDeliverySubscriptionResponse> =>
96
+ (
97
+ await AbyssProbeCore.axios.put<IUpdateProbeDeliverySubscriptionResponse>(
98
+ `${SUBSCRIPTIONS_PATH}/${deliverySubscriptionId}`,
99
+ body,
100
+ { params: serializeProbeQuery(scope), headers: authHeader(apiKey) },
101
+ )
102
+ ).data;
103
+
104
+ /** `DELETE /delivery-subscription/:deliverySubscriptionId`. */
105
+ export const deleteProbeDeliverySubscription = async (
106
+ deliverySubscriptionId: string,
107
+ scope: IProbeDeliverySubscriptionScopeQuery = {},
108
+ apiKey?: string,
109
+ ): Promise<IDeleteProbeDeliverySubscriptionResponse> =>
110
+ (
111
+ await AbyssProbeCore.axios.delete<IDeleteProbeDeliverySubscriptionResponse>(
112
+ `${SUBSCRIPTIONS_PATH}/${deliverySubscriptionId}`,
113
+ { params: serializeProbeQuery(scope), headers: authHeader(apiKey) },
114
+ )
115
+ ).data;
116
+
117
+ /** `POST /delivery-subscription/:deliverySubscriptionId/reset-secret` — the new secret, once. */
118
+ export const resetSecretProbeDeliverySubscription = async (
119
+ deliverySubscriptionId: string,
120
+ scope: IProbeDeliverySubscriptionScopeQuery = {},
121
+ apiKey?: string,
122
+ ): Promise<IResetSecretProbeDeliverySubscriptionResponse> =>
123
+ (
124
+ await AbyssProbeCore.axios.post<IResetSecretProbeDeliverySubscriptionResponse>(
125
+ `${SUBSCRIPTIONS_PATH}/${deliverySubscriptionId}/reset-secret`,
126
+ undefined,
127
+ { params: serializeProbeQuery(scope), headers: authHeader(apiKey) },
128
+ )
129
+ ).data;
130
+
131
+ /** `GET /delivery-subscription/delivery` — the deliveries of every subscription of the scope. */
132
+ export const paginateProbeScopeDelivery = async (
133
+ query: IPaginateProbeDeliveryQuery = {},
134
+ apiKey?: string,
135
+ ): Promise<IPaginateProbeDeliveryResponse> =>
136
+ (
137
+ await AbyssProbeCore.axios.get<IPaginateProbeDeliveryResponse>(
138
+ `${SUBSCRIPTIONS_PATH}/delivery`,
139
+ { params: serializeProbeQuery(query), headers: authHeader(apiKey) },
140
+ )
141
+ ).data;
142
+
143
+ /** `GET /delivery-subscription/:deliverySubscriptionId/delivery`. */
144
+ export const paginateProbeDelivery = async (
145
+ deliverySubscriptionId: string,
146
+ query: IPaginateProbeDeliveryQuery = {},
147
+ apiKey?: string,
148
+ ): Promise<IPaginateProbeDeliveryResponse> =>
149
+ (
150
+ await AbyssProbeCore.axios.get<IPaginateProbeDeliveryResponse>(
151
+ `${SUBSCRIPTIONS_PATH}/${deliverySubscriptionId}/delivery`,
152
+ { params: serializeProbeQuery(query), headers: authHeader(apiKey) },
153
+ )
154
+ ).data;
155
+
156
+ /** `GET /delivery-subscription/:deliverySubscriptionId/delivery/:deliveryId`. */
157
+ export const getProbeDelivery = async (
158
+ deliverySubscriptionId: string,
159
+ deliveryId: string,
160
+ scope: IProbeDeliverySubscriptionScopeQuery = {},
161
+ apiKey?: string,
162
+ ): Promise<IGetProbeDeliveryResponse> =>
163
+ (
164
+ await AbyssProbeCore.axios.get<IGetProbeDeliveryResponse>(
165
+ `${SUBSCRIPTIONS_PATH}/${deliverySubscriptionId}/delivery/${deliveryId}`,
166
+ { params: serializeProbeQuery(scope), headers: authHeader(apiKey) },
167
+ )
168
+ ).data;
169
+
170
+ /** `POST .../delivery/:deliveryId/replay` — only a delivered or failed one (409 otherwise). */
171
+ export const replayProbeDelivery = async (
172
+ deliverySubscriptionId: string,
173
+ deliveryId: string,
174
+ scope: IProbeDeliverySubscriptionScopeQuery = {},
175
+ apiKey?: string,
176
+ ): Promise<IReplayProbeDeliveryResponse> =>
177
+ (
178
+ await AbyssProbeCore.axios.post<IReplayProbeDeliveryResponse>(
179
+ `${SUBSCRIPTIONS_PATH}/${deliverySubscriptionId}/delivery/${deliveryId}/replay`,
180
+ undefined,
181
+ { params: serializeProbeQuery(scope), headers: authHeader(apiKey) },
182
+ )
183
+ ).data;
@@ -0,0 +1,186 @@
1
+ // ──────────────────────────────────────────────
2
+ // AbyssProbe delivery-subscription API for an application caller (project API key, or a project
3
+ // member's session): the endpoints that receive the verdict of the application's scans. The
4
+ // application counterpart of probe-delivery-subscription.api.ts, with `FULL_ACCESS` on the
5
+ // application as the access rule and no scope argument (the scope is the `:applicationId` URL
6
+ // segment). Mirrors
7
+ // apps/api/src/api/controllers/probe-delivery-subscription-application.controller.ts.
8
+ //
9
+ // `authHeaderApplication` sends `API_KEY_APPLICATION_HEADER` instead of the personal header.
10
+ // ──────────────────────────────────────────────
11
+
12
+ import { AbyssProbeCore, API_KEY_APPLICATION_HEADER } from '..';
13
+ import type {
14
+ ICreateProbeDeliverySubscriptionBody,
15
+ ICreateProbeDeliverySubscriptionResponse,
16
+ IDeleteProbeDeliverySubscriptionResponse,
17
+ IGetProbeDeliveryResponse,
18
+ IGetProbeDeliverySubscriptionResponse,
19
+ IPaginateProbeDeliveryQuery,
20
+ IPaginateProbeDeliveryResponse,
21
+ IPaginateProbeDeliverySubscriptionQuery,
22
+ IPaginateProbeDeliverySubscriptionResponse,
23
+ IReplayProbeDeliveryResponse,
24
+ IResetSecretProbeDeliverySubscriptionResponse,
25
+ IUpdateProbeDeliverySubscriptionBody,
26
+ IUpdateProbeDeliverySubscriptionResponse,
27
+ } from '../types';
28
+
29
+ function authHeaderApplication(applicationApiKey?: string): Record<string, string> {
30
+ return applicationApiKey ? { [API_KEY_APPLICATION_HEADER]: applicationApiKey } : {};
31
+ }
32
+
33
+ /** Drops undefined/null: no `organizationId` ever travels on an application call. */
34
+ function serializeProbeQuery<T extends object>(query: T): Record<string, unknown> {
35
+ const out: Record<string, unknown> = {};
36
+ for (const [key, value] of Object.entries(query as Record<string, unknown>)) {
37
+ if (value === undefined || value === null) continue;
38
+ out[key] = value;
39
+ }
40
+ return out;
41
+ }
42
+
43
+ const subscriptionsPath = (applicationId: string): string =>
44
+ `application/${applicationId}/delivery-subscription`;
45
+
46
+ /** `GET /application/:applicationId/delivery-subscription`. */
47
+ export const paginateProbeDeliverySubscriptionApplication = async (
48
+ applicationId: string,
49
+ query: Omit<IPaginateProbeDeliverySubscriptionQuery, 'organizationId'> = {},
50
+ applicationApiKey?: string,
51
+ ): Promise<IPaginateProbeDeliverySubscriptionResponse> =>
52
+ (
53
+ await AbyssProbeCore.axios.get<IPaginateProbeDeliverySubscriptionResponse>(
54
+ subscriptionsPath(applicationId),
55
+ { params: serializeProbeQuery(query), headers: authHeaderApplication(applicationApiKey) },
56
+ )
57
+ ).data;
58
+
59
+ /** `GET /application/:applicationId/delivery-subscription/:deliverySubscriptionId` — no secret. */
60
+ export const getProbeDeliverySubscriptionApplication = async (
61
+ applicationId: string,
62
+ deliverySubscriptionId: string,
63
+ applicationApiKey?: string,
64
+ ): Promise<IGetProbeDeliverySubscriptionResponse> =>
65
+ (
66
+ await AbyssProbeCore.axios.get<IGetProbeDeliverySubscriptionResponse>(
67
+ `${subscriptionsPath(applicationId)}/${deliverySubscriptionId}`,
68
+ { headers: authHeaderApplication(applicationApiKey) },
69
+ )
70
+ ).data;
71
+
72
+ /**
73
+ * `POST /application/:applicationId/delivery-subscription` — HTTP 201, the `secret` once. With a
74
+ * project member's session the subscription is theirs; with an API key it is recorded under the
75
+ * project's creator.
76
+ */
77
+ export const createProbeDeliverySubscriptionApplication = async (
78
+ applicationId: string,
79
+ body: ICreateProbeDeliverySubscriptionBody,
80
+ applicationApiKey?: string,
81
+ ): Promise<ICreateProbeDeliverySubscriptionResponse> =>
82
+ (
83
+ await AbyssProbeCore.axios.post<ICreateProbeDeliverySubscriptionResponse>(
84
+ subscriptionsPath(applicationId),
85
+ body,
86
+ { headers: authHeaderApplication(applicationApiKey) },
87
+ )
88
+ ).data;
89
+
90
+ /** `PUT /application/:applicationId/delivery-subscription/:deliverySubscriptionId`. */
91
+ export const updateProbeDeliverySubscriptionApplication = async (
92
+ applicationId: string,
93
+ deliverySubscriptionId: string,
94
+ body: IUpdateProbeDeliverySubscriptionBody,
95
+ applicationApiKey?: string,
96
+ ): Promise<IUpdateProbeDeliverySubscriptionResponse> =>
97
+ (
98
+ await AbyssProbeCore.axios.put<IUpdateProbeDeliverySubscriptionResponse>(
99
+ `${subscriptionsPath(applicationId)}/${deliverySubscriptionId}`,
100
+ body,
101
+ { headers: authHeaderApplication(applicationApiKey) },
102
+ )
103
+ ).data;
104
+
105
+ /** `DELETE /application/:applicationId/delivery-subscription/:deliverySubscriptionId`. */
106
+ export const deleteProbeDeliverySubscriptionApplication = async (
107
+ applicationId: string,
108
+ deliverySubscriptionId: string,
109
+ applicationApiKey?: string,
110
+ ): Promise<IDeleteProbeDeliverySubscriptionResponse> =>
111
+ (
112
+ await AbyssProbeCore.axios.delete<IDeleteProbeDeliverySubscriptionResponse>(
113
+ `${subscriptionsPath(applicationId)}/${deliverySubscriptionId}`,
114
+ { headers: authHeaderApplication(applicationApiKey) },
115
+ )
116
+ ).data;
117
+
118
+ /** `POST .../delivery-subscription/:deliverySubscriptionId/reset-secret` — the new secret, once. */
119
+ export const resetSecretProbeDeliverySubscriptionApplication = async (
120
+ applicationId: string,
121
+ deliverySubscriptionId: string,
122
+ applicationApiKey?: string,
123
+ ): Promise<IResetSecretProbeDeliverySubscriptionResponse> =>
124
+ (
125
+ await AbyssProbeCore.axios.post<IResetSecretProbeDeliverySubscriptionResponse>(
126
+ `${subscriptionsPath(applicationId)}/${deliverySubscriptionId}/reset-secret`,
127
+ undefined,
128
+ { headers: authHeaderApplication(applicationApiKey) },
129
+ )
130
+ ).data;
131
+
132
+ /** `GET /application/:applicationId/delivery-subscription/delivery` — every subscription of the application. */
133
+ export const paginateProbeScopeDeliveryApplication = async (
134
+ applicationId: string,
135
+ query: Omit<IPaginateProbeDeliveryQuery, 'organizationId'> = {},
136
+ applicationApiKey?: string,
137
+ ): Promise<IPaginateProbeDeliveryResponse> =>
138
+ (
139
+ await AbyssProbeCore.axios.get<IPaginateProbeDeliveryResponse>(
140
+ `${subscriptionsPath(applicationId)}/delivery`,
141
+ { params: serializeProbeQuery(query), headers: authHeaderApplication(applicationApiKey) },
142
+ )
143
+ ).data;
144
+
145
+ /** `GET .../delivery-subscription/:deliverySubscriptionId/delivery`. */
146
+ export const paginateProbeDeliveryApplication = async (
147
+ applicationId: string,
148
+ deliverySubscriptionId: string,
149
+ query: Omit<IPaginateProbeDeliveryQuery, 'organizationId'> = {},
150
+ applicationApiKey?: string,
151
+ ): Promise<IPaginateProbeDeliveryResponse> =>
152
+ (
153
+ await AbyssProbeCore.axios.get<IPaginateProbeDeliveryResponse>(
154
+ `${subscriptionsPath(applicationId)}/${deliverySubscriptionId}/delivery`,
155
+ { params: serializeProbeQuery(query), headers: authHeaderApplication(applicationApiKey) },
156
+ )
157
+ ).data;
158
+
159
+ /** `GET .../delivery-subscription/:deliverySubscriptionId/delivery/:deliveryId`. */
160
+ export const getProbeDeliveryApplication = async (
161
+ applicationId: string,
162
+ deliverySubscriptionId: string,
163
+ deliveryId: string,
164
+ applicationApiKey?: string,
165
+ ): Promise<IGetProbeDeliveryResponse> =>
166
+ (
167
+ await AbyssProbeCore.axios.get<IGetProbeDeliveryResponse>(
168
+ `${subscriptionsPath(applicationId)}/${deliverySubscriptionId}/delivery/${deliveryId}`,
169
+ { headers: authHeaderApplication(applicationApiKey) },
170
+ )
171
+ ).data;
172
+
173
+ /** `POST .../delivery/:deliveryId/replay` — only a delivered or failed one (409 otherwise). */
174
+ export const replayProbeDeliveryApplication = async (
175
+ applicationId: string,
176
+ deliverySubscriptionId: string,
177
+ deliveryId: string,
178
+ applicationApiKey?: string,
179
+ ): Promise<IReplayProbeDeliveryResponse> =>
180
+ (
181
+ await AbyssProbeCore.axios.post<IReplayProbeDeliveryResponse>(
182
+ `${subscriptionsPath(applicationId)}/${deliverySubscriptionId}/delivery/${deliveryId}/replay`,
183
+ undefined,
184
+ { headers: authHeaderApplication(applicationApiKey) },
185
+ )
186
+ ).data;
@@ -1,47 +1,47 @@
1
- // Type-level compile test for the probe-scan api surface.
2
- // No jest runner in this SDK package; compile guard only (mirrors this
3
- // package's own extraction-plan-preset.api.test.ts).
4
- // Run: npx tsc --noEmit (from packages/abyss_probe_core), or `npm run build`.
5
-
6
- import * as api from './probe-scan.api';
7
-
8
- // All five functions must be exported with these exact signatures.
9
- const _scan: typeof api.scan = api.scan;
10
- const _scanSync: typeof api.scanSync = api.scanSync;
11
- const _scanAsync: typeof api.scanAsync = api.scanAsync;
12
- const _getScan: typeof api.getScan = api.getScan;
13
- const _listScans: typeof api.listScans = api.listScans;
14
-
15
- void _scan;
16
- void _scanSync;
17
- void _scanAsync;
18
- void _getScan;
19
- void _listScans;
20
-
21
- // The accepted file inputs (#519). A Blob covers the browser's File and Node's
22
- // file-backed fs.openAsBlob(path); raw bytes are accepted as a Uint8Array (and
23
- // therefore a Buffer). A Node stream is refused AT COMPILE TIME: the body is a
24
- // spec FormData, whose parts need a known length, so honouring a stream would
25
- // mean buffering up to 2 GiB in memory.
26
- declare const blob: Blob;
27
- declare const bytes: Uint8Array;
28
- declare const buffer: Buffer;
29
- declare const stream: NodeJS.ReadableStream;
30
-
31
- const _fromBlob: api.ProbeScanFileInput = blob;
32
- const _fromBytes: api.ProbeScanFileInput = bytes;
33
- const _fromBuffer: api.ProbeScanFileInput = buffer;
34
- // @ts-expect-error a Readable stream is not an accepted scan input since 2.12.0
35
- const _fromStream: api.ProbeScanFileInput = stream;
36
-
37
- void _fromBlob;
38
- void _fromBytes;
39
- void _fromBuffer;
40
- void _fromStream;
41
-
42
- // buildScanForm returns the FormData alone — axios sets the multipart
43
- // content type and boundary, so there are no headers to merge in.
44
- const _form: FormData = api.buildScanForm(blob, { filename: 'f.bin' });
45
- void _form;
46
-
47
- export {};
1
+ // Type-level compile test for the probe-scan api surface.
2
+ // No jest runner in this SDK package; compile guard only (mirrors this
3
+ // package's own extraction-plan-preset.api.test.ts).
4
+ // Run: npx tsc --noEmit (from packages/abyss_probe_core), or `npm run build`.
5
+
6
+ import * as api from './probe-scan.api';
7
+
8
+ // All five functions must be exported with these exact signatures.
9
+ const _scan: typeof api.scan = api.scan;
10
+ const _scanSync: typeof api.scanSync = api.scanSync;
11
+ const _scanAsync: typeof api.scanAsync = api.scanAsync;
12
+ const _getScan: typeof api.getScan = api.getScan;
13
+ const _listScans: typeof api.listScans = api.listScans;
14
+
15
+ void _scan;
16
+ void _scanSync;
17
+ void _scanAsync;
18
+ void _getScan;
19
+ void _listScans;
20
+
21
+ // The accepted file inputs (#519). A Blob covers the browser's File and Node's
22
+ // file-backed fs.openAsBlob(path); raw bytes are accepted as a Uint8Array (and
23
+ // therefore a Buffer). A Node stream is refused AT COMPILE TIME: the body is a
24
+ // spec FormData, whose parts need a known length, so honouring a stream would
25
+ // mean buffering up to 2 GiB in memory.
26
+ declare const blob: Blob;
27
+ declare const bytes: Uint8Array;
28
+ declare const buffer: Buffer;
29
+ declare const stream: NodeJS.ReadableStream;
30
+
31
+ const _fromBlob: api.ProbeScanFileInput = blob;
32
+ const _fromBytes: api.ProbeScanFileInput = bytes;
33
+ const _fromBuffer: api.ProbeScanFileInput = buffer;
34
+ // @ts-expect-error a Readable stream is not an accepted scan input since 2.12.0
35
+ const _fromStream: api.ProbeScanFileInput = stream;
36
+
37
+ void _fromBlob;
38
+ void _fromBytes;
39
+ void _fromBuffer;
40
+ void _fromStream;
41
+
42
+ // buildScanForm returns the FormData alone — axios sets the multipart
43
+ // content type and boundary, so there are no headers to merge in.
44
+ const _form: FormData = api.buildScanForm(blob, { filename: 'f.bin' });
45
+ void _form;
46
+
47
+ export {};