@antcde/connect-ts 0.4.26 → 0.4.27-rc.2

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 (214) hide show
  1. package/README.md +67 -3
  2. package/build/AntConnect.d.ts +8 -0
  3. package/build/AntConnect.d.ts.map +1 -1
  4. package/build/AntConnect.js +8 -0
  5. package/build/AntHttpClient.d.ts +0 -5
  6. package/build/AntHttpClient.d.ts.map +1 -1
  7. package/build/AntHttpClient.js +0 -5
  8. package/build/ai/index.d.ts +5 -0
  9. package/build/ai/index.d.ts.map +1 -0
  10. package/build/ai/index.js +3 -0
  11. package/build/ai/mutationDescriptors.d.ts +3 -0
  12. package/build/ai/mutationDescriptors.d.ts.map +1 -0
  13. package/build/ai/mutationDescriptors.js +207 -0
  14. package/build/ai/mutationTargets.d.ts +21 -0
  15. package/build/ai/mutationTargets.d.ts.map +1 -0
  16. package/build/ai/mutationTargets.js +72 -0
  17. package/build/ai/queryDescriptors.d.ts +3 -0
  18. package/build/ai/queryDescriptors.d.ts.map +1 -0
  19. package/build/ai/queryDescriptors.js +174 -0
  20. package/build/ai/types.d.ts +35 -0
  21. package/build/ai/types.d.ts.map +1 -0
  22. package/build/comms/client.js +1 -1
  23. package/build/comms/hostAPI.js +1 -1
  24. package/build/comms/models.d.ts +20 -2
  25. package/build/comms/models.d.ts.map +1 -1
  26. package/build/comms/signalChangeTypes.d.ts +27 -1
  27. package/build/comms/signalChangeTypes.d.ts.map +1 -1
  28. package/build/comms/signalChangeTypes.js +7 -0
  29. package/build/comms/signalTypes.d.ts +21 -3
  30. package/build/comms/signalTypes.d.ts.map +1 -1
  31. package/build/index.d.ts +8 -35
  32. package/build/index.d.ts.map +1 -1
  33. package/build/index.js +8 -3
  34. package/build/service-runtime.d.ts +9 -0
  35. package/build/service-runtime.d.ts.map +1 -0
  36. package/build/service-runtime.js +10 -0
  37. package/build/service-types-app.d.ts +2 -0
  38. package/build/service-types-app.d.ts.map +1 -0
  39. package/build/service-types-app.js +3 -0
  40. package/build/service-types.d.ts +37 -0
  41. package/build/service-types.d.ts.map +1 -0
  42. package/build/service-types.js +7 -0
  43. package/build/services/AiService.d.ts +18 -0
  44. package/build/services/AiService.d.ts.map +1 -0
  45. package/build/services/AiService.js +9 -0
  46. package/build/services/AppService/factory/accessRequests.d.ts +19 -0
  47. package/build/services/AppService/factory/accessRequests.d.ts.map +1 -0
  48. package/build/services/AppService/factory/accessRequests.js +17 -0
  49. package/build/services/AppService/factory/assignments.d.ts +57 -0
  50. package/build/services/AppService/factory/assignments.d.ts.map +1 -0
  51. package/build/services/AppService/factory/assignments.js +30 -0
  52. package/build/services/AppService/factory/channels.d.ts +35 -0
  53. package/build/services/AppService/factory/channels.d.ts.map +1 -0
  54. package/build/services/AppService/factory/channels.js +18 -0
  55. package/build/services/AppService/factory/formData.d.ts +14 -0
  56. package/build/services/AppService/factory/formData.d.ts.map +1 -0
  57. package/build/services/AppService/factory/formData.js +50 -0
  58. package/build/services/AppService/factory/media.d.ts +17 -0
  59. package/build/services/AppService/factory/media.d.ts.map +1 -0
  60. package/build/services/AppService/factory/media.js +10 -0
  61. package/build/services/AppService/factory/resourceAccess.d.ts +21 -0
  62. package/build/services/AppService/factory/resourceAccess.d.ts.map +1 -0
  63. package/build/services/AppService/factory/resourceAccess.js +37 -0
  64. package/build/services/AppService/factory/resourceCommerce.d.ts +52 -0
  65. package/build/services/AppService/factory/resourceCommerce.d.ts.map +1 -0
  66. package/build/services/AppService/factory/resourceCommerce.js +18 -0
  67. package/build/services/AppService/factory/resourceSnapshot.d.ts +62 -0
  68. package/build/services/AppService/factory/resourceSnapshot.d.ts.map +1 -0
  69. package/build/services/AppService/factory/resourceSnapshot.js +34 -0
  70. package/build/services/AppService/factory/resources.d.ts +153 -0
  71. package/build/services/AppService/factory/resources.d.ts.map +1 -0
  72. package/build/services/AppService/factory/resources.js +44 -0
  73. package/build/services/AppService/factory/subscriptions.d.ts +73 -0
  74. package/build/services/AppService/factory/subscriptions.d.ts.map +1 -0
  75. package/build/services/AppService/factory/subscriptions.js +39 -0
  76. package/build/services/AppService/index.d.ts +59 -0
  77. package/build/services/AppService/index.d.ts.map +1 -0
  78. package/build/services/AppService/index.js +76 -0
  79. package/build/services/AppService/types/accessRequests.d.ts +164 -0
  80. package/build/services/AppService/types/accessRequests.d.ts.map +1 -0
  81. package/build/services/AppService/types/app.d.ts +124 -0
  82. package/build/services/AppService/types/app.d.ts.map +1 -0
  83. package/build/services/AppService/types/app.js +6 -0
  84. package/build/services/AppService/types/appCategories.d.ts +16 -0
  85. package/build/services/AppService/types/appCategories.d.ts.map +1 -0
  86. package/build/services/AppService/types/appCategories.js +1 -0
  87. package/build/services/AppService/types/appChangelog.d.ts +31 -0
  88. package/build/services/AppService/types/appChangelog.d.ts.map +1 -0
  89. package/build/services/AppService/types/appChangelog.js +1 -0
  90. package/build/services/AppService/types/appConfigStatus.d.ts +68 -0
  91. package/build/services/AppService/types/appConfigStatus.d.ts.map +1 -0
  92. package/build/services/AppService/types/appConfigStatus.js +11 -0
  93. package/build/services/AppService/types/appList.d.ts +211 -0
  94. package/build/services/AppService/types/appList.d.ts.map +1 -0
  95. package/build/services/AppService/types/appList.js +1 -0
  96. package/build/services/AppService/types/appManifest.d.ts +100 -0
  97. package/build/services/AppService/types/appManifest.d.ts.map +1 -0
  98. package/build/services/AppService/types/appManifest.js +4 -0
  99. package/build/services/AppService/types/appMedia.d.ts +136 -0
  100. package/build/services/AppService/types/appMedia.d.ts.map +1 -0
  101. package/build/services/AppService/types/appMedia.js +1 -0
  102. package/build/services/AppService/types/appRequests.d.ts +126 -0
  103. package/build/services/AppService/types/appRequests.d.ts.map +1 -0
  104. package/build/services/AppService/types/appRequests.js +1 -0
  105. package/build/services/AppService/types/appScopes.d.ts +165 -0
  106. package/build/services/AppService/types/appScopes.d.ts.map +1 -0
  107. package/build/services/AppService/types/appScopes.js +1 -0
  108. package/build/services/AppService/types/channels.d.ts +45 -0
  109. package/build/services/AppService/types/channels.d.ts.map +1 -0
  110. package/build/services/AppService/types/channels.js +1 -0
  111. package/build/services/AppService/types/pricingTiers.d.ts +111 -0
  112. package/build/services/AppService/types/pricingTiers.d.ts.map +1 -0
  113. package/build/services/AppService/types/pricingTiers.js +1 -0
  114. package/build/services/AppService/types/publisherStats.d.ts +20 -0
  115. package/build/services/AppService/types/publisherStats.d.ts.map +1 -0
  116. package/build/services/AppService/types/publisherStats.js +1 -0
  117. package/build/services/AppService/types/releaseChannels.d.ts +127 -0
  118. package/build/services/AppService/types/releaseChannels.d.ts.map +1 -0
  119. package/build/services/AppService/types/releaseChannels.js +1 -0
  120. package/build/services/AppService/types/resourceEntitlements.d.ts +101 -0
  121. package/build/services/AppService/types/resourceEntitlements.d.ts.map +1 -0
  122. package/build/services/AppService/types/resourceEntitlements.js +1 -0
  123. package/build/services/AppService/types/resourceReleases.d.ts +143 -0
  124. package/build/services/AppService/types/resourceReleases.d.ts.map +1 -0
  125. package/build/services/AppService/types/resourceReleases.js +1 -0
  126. package/build/services/AppService/types/resourceRequests.d.ts +105 -0
  127. package/build/services/AppService/types/resourceRequests.d.ts.map +1 -0
  128. package/build/services/AppService/types/resourceRequests.js +1 -0
  129. package/build/services/AppService/types/seats.d.ts +220 -0
  130. package/build/services/AppService/types/seats.d.ts.map +1 -0
  131. package/build/services/AppService/types/seats.js +4 -0
  132. package/build/services/AppService/types/sellableResources.d.ts +189 -0
  133. package/build/services/AppService/types/sellableResources.d.ts.map +1 -0
  134. package/build/services/AppService/types/sellableResources.js +1 -0
  135. package/build/services/AppService/types/snapshotPayload.d.ts +146 -0
  136. package/build/services/AppService/types/snapshotPayload.d.ts.map +1 -0
  137. package/build/services/AppService/types/snapshotPayload.js +16 -0
  138. package/build/services/AppService/types/snapshotSources.d.ts +98 -0
  139. package/build/services/AppService/types/snapshotSources.d.ts.map +1 -0
  140. package/build/services/AppService/types/snapshotSources.js +7 -0
  141. package/build/services/AppService/types/subscriptions.d.ts +182 -0
  142. package/build/services/AppService/types/subscriptions.d.ts.map +1 -0
  143. package/build/services/AppService/types/subscriptions.js +1 -0
  144. package/build/services/AppService/types.d.ts +23 -0
  145. package/build/services/AppService/types.d.ts.map +1 -0
  146. package/build/services/AppService/types.js +25 -0
  147. package/build/services/DmsService.d.ts +13 -0
  148. package/build/services/DmsService.d.ts.map +1 -1
  149. package/build/services/DmsServiceImpl.d.ts.map +1 -1
  150. package/build/services/DmsServiceImpl.js +8 -0
  151. package/build/services/LicenseService.d.ts +1 -1
  152. package/build/services/LicenseService.d.ts.map +1 -1
  153. package/build/services/LicenseService.js +1 -1
  154. package/build/services/OAuthClientService.d.ts +20 -0
  155. package/build/services/OAuthClientService.d.ts.map +1 -0
  156. package/build/services/OAuthClientService.js +12 -0
  157. package/build/services/OAuthClientService.types.d.ts +37 -0
  158. package/build/services/OAuthClientService.types.d.ts.map +1 -0
  159. package/build/services/OAuthClientService.types.js +4 -0
  160. package/build/services/ProjectService.d.ts +1 -0
  161. package/build/services/ProjectService.d.ts.map +1 -1
  162. package/build/services/ReleaseService.d.ts +1 -0
  163. package/build/services/ReleaseService.d.ts.map +1 -1
  164. package/build/services/SecretService.d.ts +22 -0
  165. package/build/services/SecretService.d.ts.map +1 -0
  166. package/build/services/SecretService.js +21 -0
  167. package/build/services/SecretService.types.d.ts +147 -0
  168. package/build/services/SecretService.types.d.ts.map +1 -0
  169. package/build/services/SecretService.types.js +1 -0
  170. package/build/services/SecretSharing.types.d.ts +112 -0
  171. package/build/services/SecretSharing.types.d.ts.map +1 -0
  172. package/build/services/SecretSharing.types.js +1 -0
  173. package/build/services/TableService.js +7 -7
  174. package/build/services/TaskService.d.ts +3 -3
  175. package/build/services/TaskService.d.ts.map +1 -1
  176. package/build/services/TaskService.js +1 -1
  177. package/build/services/TaskService.types.d.ts +21 -4
  178. package/build/services/TaskService.types.d.ts.map +1 -1
  179. package/build/services/TaskServiceQueries.d.ts +2 -0
  180. package/build/services/TaskServiceQueries.d.ts.map +1 -1
  181. package/build/services/TaskServiceQueries.js +13 -2
  182. package/build/services/TaskTemplate.types.d.ts +74 -1
  183. package/build/services/TaskTemplate.types.d.ts.map +1 -1
  184. package/build/services/TokenService.d.ts +5 -1
  185. package/build/services/TokenService.d.ts.map +1 -1
  186. package/build/services/TokenService.js +1 -2
  187. package/build/services/UserService.d.ts +3 -0
  188. package/build/services/UserService.d.ts.map +1 -1
  189. package/build/services/UserService.js +4 -4
  190. package/build/services/Webhook/TriggerHistoryService.d.ts +1 -1
  191. package/build/services/Webhook/TriggerHistoryService.d.ts.map +1 -1
  192. package/build/services/Webhook/TriggerSecretService.d.ts +88 -0
  193. package/build/services/Webhook/TriggerSecretService.d.ts.map +1 -0
  194. package/build/services/Webhook/TriggerSecretService.js +9 -0
  195. package/build/services/Webhook/TriggerService.d.ts +28 -0
  196. package/build/services/Webhook/TriggerService.d.ts.map +1 -1
  197. package/build/services/Webhook/TriggerService.js +10 -0
  198. package/build/services/Websockets/StoreEvents.d.ts +44 -0
  199. package/build/services/Websockets/StoreEvents.d.ts.map +1 -0
  200. package/build/services/Websockets/StoreEvents.js +5 -0
  201. package/build/services/userPreferences.d.ts +37 -0
  202. package/build/services/userPreferences.d.ts.map +1 -0
  203. package/build/services/userPreferences.js +39 -0
  204. package/package.json +8 -7
  205. package/schemas/app-config.schema.json +85 -8
  206. package/build/services/AppManifest.d.ts +0 -39
  207. package/build/services/AppManifest.d.ts.map +0 -1
  208. package/build/services/AppService.d.ts +0 -57
  209. package/build/services/AppService.d.ts.map +0 -1
  210. package/build/services/AppService.js +0 -47
  211. package/build/services/AppService.types.d.ts +0 -173
  212. package/build/services/AppService.types.d.ts.map +0 -1
  213. /package/build/{services/AppManifest.js → ai/types.js} +0 -0
  214. /package/build/services/{AppService.types.js → AppService/types/accessRequests.js} +0 -0
@@ -0,0 +1,7 @@
1
+ // Aggregated service type re-exports.
2
+ // Kept separate from `index.ts` to keep that file under the 250-line limit.
3
+ // Add new service-type re-exports here, organized alphabetically by service.
4
+ //
5
+ // This barrel is type-only — runtime values (functions, constants) live in
6
+ // `./service-runtime` and are re-exported from `index.ts` directly.
7
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { AntHttpClient } from "../AntHttpClient";
2
+ /**
3
+ * One selectable server-side model, as offered by GET /ai/dev-endpoints.
4
+ *
5
+ * Deliberately carries no URL. The server resolves the key against its own
6
+ * config, so a client can never point the gateway at an address of its choosing
7
+ * — handing the URL out here would only invite one to be sent back.
8
+ */
9
+ export interface AiDevEndpoint {
10
+ key: string;
11
+ label: string;
12
+ }
13
+ export interface AiService {
14
+ getDevEndpoints: () => Promise<AiDevEndpoint[]>;
15
+ }
16
+ export declare function newAiService(httpClient: AntHttpClient): AiService;
17
+ export default AiService;
18
+ //# sourceMappingURL=AiService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiService.d.ts","sourceRoot":"","sources":["../../src/services/AiService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAuB;AAEpD;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,SAAS;IACxB,eAAe,EAAE,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC,CAAA;CAChD;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,aAAa,GAAG,SAAS,CAQjE;AAED,eAAe,SAAS,CAAA"}
@@ -0,0 +1,9 @@
1
+ export function newAiService(httpClient) {
2
+ return {
3
+ // `get` hands back the whole response body, so the envelope is unwrapped
4
+ // here rather than in every caller — the declared return type is the list.
5
+ getDevEndpoints: () => httpClient
6
+ .get('/ai/dev-endpoints')
7
+ .then(response => response.data),
8
+ };
9
+ }
@@ -0,0 +1,19 @@
1
+ import type { AccessRequest, CreateAccessRequestData, FetchAccessRequestsParams, RespondAccessRequestData } from '../types';
2
+ import type { MessageResponse } from "../../../AntConnect";
3
+ import type { AntHttpClient } from "../../../AntHttpClient";
4
+ import type { DataWrapper } from "../../../types";
5
+ /**
6
+ * The request-access model: a consumer asks for an app the publisher gates, the
7
+ * publisher responds. Split out of the AppService factory to keep `index.ts`
8
+ * focused; composed into `AppService` there.
9
+ */
10
+ export interface AppAccessRequestFactory {
11
+ requestAccess: (appId: string, data?: CreateAccessRequestData) => Promise<DataWrapper<AccessRequest>>;
12
+ cancelAccessRequest: (requestId: string) => Promise<MessageResponse>;
13
+ fetchMyAccessRequests: (params?: FetchAccessRequestsParams) => Promise<DataWrapper<AccessRequest[]>>;
14
+ fetchAppAccessRequests: (appId: string, params?: FetchAccessRequestsParams, requestConfig?: Record<string, any>) => Promise<DataWrapper<AccessRequest[]>>;
15
+ respondToAccessRequest: (requestId: string, data: RespondAccessRequestData) => Promise<DataWrapper<AccessRequest>>;
16
+ revokeAccessRequest: (requestId: string) => Promise<DataWrapper<AccessRequest>>;
17
+ }
18
+ export declare function newAppAccessRequestFactory(client: AntHttpClient): AppAccessRequestFactory;
19
+ //# sourceMappingURL=accessRequests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessRequests.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/accessRequests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,4BAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAG1C;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAA;IACrG,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;IACpE,qBAAqB,EAAE,CAAC,MAAM,CAAC,EAAE,yBAAyB,KAAK,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;IACpG,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,yBAAyB,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;IACzJ,sBAAsB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,KAAK,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAA;IAClH,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAA;CAChF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,uBAAuB,CAiBzF"}
@@ -0,0 +1,17 @@
1
+ import qs from 'qs';
2
+ export function newAppAccessRequestFactory(client) {
3
+ return {
4
+ requestAccess: (appId, data = {}) => client.post(`/store/apps/${appId}/access-requests`, data),
5
+ cancelAccessRequest: requestId => client.delete(`/store/access-requests/${requestId}/cancel`),
6
+ fetchMyAccessRequests: (params = {}) => {
7
+ const queryString = qs.stringify(params, { skipNulls: true });
8
+ return client.get(`/store/access-requests/my${queryString ? `?${queryString}` : ''}`);
9
+ },
10
+ fetchAppAccessRequests: (appId, params = {}, requestConfig) => {
11
+ const queryString = qs.stringify(params, { skipNulls: true });
12
+ return client.get(`/store/apps/${appId}/access-requests${queryString ? `?${queryString}` : ''}`, requestConfig);
13
+ },
14
+ respondToAccessRequest: (requestId, data) => client.post(`/store/access-requests/${requestId}/respond`, data),
15
+ revokeAccessRequest: requestId => client.post(`/store/access-requests/${requestId}/revoke`),
16
+ };
17
+ }
@@ -0,0 +1,57 @@
1
+ import type { AppAssignment, AppDelegates, AppSeatPicture, LicenseAssignment, ProjectSeatView, SeatAllocation } from '../types';
2
+ import type { AntHttpClient } from "../../../AntHttpClient";
3
+ import type { DataWrapper } from "../../../types";
4
+ /**
5
+ * Store v3 seat allocation, assignment (license→project→role) and per-app
6
+ * management delegation. Split out of the AppService factory to keep
7
+ * `index.ts` focused; composed into `AppService` there.
8
+ */
9
+ export interface AppAssignmentFactory {
10
+ fetchAppSeats: (appId: string) => Promise<DataWrapper<AppSeatPicture>>;
11
+ fetchProjectSeats: (appId: string, projectId: string) => Promise<DataWrapper<ProjectSeatView>>;
12
+ setProjectSeatAllocation: (appId: string, projectId: string, seats: number | null) => Promise<DataWrapper<SeatAllocation>>;
13
+ assignAppRole: (appId: string, projectId: string, roleId: string, channelIds: string[]) => Promise<DataWrapper<AppAssignment>>;
14
+ unassignAppRole: (appId: string, projectId: string, roleId: string) => Promise<DataWrapper<AppAssignment>>;
15
+ assignAppUser: (appId: string, projectId: string, userId: string, channelIds: string[]) => Promise<DataWrapper<AppAssignment>>;
16
+ unassignAppUser: (appId: string, projectId: string, userId: string) => Promise<DataWrapper<AppAssignment>>;
17
+ assignAppLicenseRole: (appId: string, licenseId: string, roleId: string, channelIds: string[]) => Promise<DataWrapper<LicenseAssignment>>;
18
+ unassignAppLicenseRole: (appId: string, licenseId: string, roleId: string) => Promise<DataWrapper<LicenseAssignment>>;
19
+ assignAppLicenseUser: (appId: string, licenseId: string, userId: string, channelIds: string[]) => Promise<DataWrapper<LicenseAssignment>>;
20
+ unassignAppLicenseUser: (appId: string, licenseId: string, userId: string) => Promise<DataWrapper<LicenseAssignment>>;
21
+ setAppEveryone: (appId: string, projectId: string, channelIds: string[]) => Promise<DataWrapper<AppAssignment>>;
22
+ clearAppEveryone: (appId: string, projectId: string) => Promise<DataWrapper<AppAssignment>>;
23
+ setAppLicenseEveryone: (appId: string, licenseId: string, channelIds: string[]) => Promise<DataWrapper<LicenseAssignment>>;
24
+ clearAppLicenseEveryone: (appId: string, licenseId: string) => Promise<DataWrapper<LicenseAssignment>>;
25
+ setPreferredChannel: (appId: string, channelId: string) => Promise<DataWrapper<{
26
+ app_id: string;
27
+ channel_id: string;
28
+ }>>;
29
+ fetchAppManagers: (appId: string) => Promise<DataWrapper<AppDelegates>>;
30
+ grantAppManageRole: (appId: string, roleId: string) => Promise<DataWrapper<{
31
+ granted: boolean;
32
+ }>>;
33
+ revokeAppManageRole: (appId: string, roleId: string) => Promise<DataWrapper<{
34
+ granted: boolean;
35
+ }>>;
36
+ grantAppManageUser: (appId: string, userId: string) => Promise<DataWrapper<{
37
+ granted: boolean;
38
+ }>>;
39
+ revokeAppManageUser: (appId: string, userId: string) => Promise<DataWrapper<{
40
+ granted: boolean;
41
+ }>>;
42
+ fetchProjectAssigners: (appId: string, projectId: string) => Promise<DataWrapper<AppDelegates>>;
43
+ grantAppAssignRole: (appId: string, projectId: string, roleId: string) => Promise<DataWrapper<{
44
+ granted: boolean;
45
+ }>>;
46
+ revokeAppAssignRole: (appId: string, projectId: string, roleId: string) => Promise<DataWrapper<{
47
+ granted: boolean;
48
+ }>>;
49
+ grantAppAssignUser: (appId: string, projectId: string, userId: string) => Promise<DataWrapper<{
50
+ granted: boolean;
51
+ }>>;
52
+ revokeAppAssignUser: (appId: string, projectId: string, userId: string) => Promise<DataWrapper<{
53
+ granted: boolean;
54
+ }>>;
55
+ }
56
+ export declare function newAppAssignmentFactory(client: AntHttpClient): AppAssignmentFactory;
57
+ //# sourceMappingURL=assignments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignments.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/assignments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAE1C;;;;GAIG;AAC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,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAA;IACpH,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAA;CACtH;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,GAAG,oBAAoB,CA+CnF"}
@@ -0,0 +1,30 @@
1
+ export function newAppAssignmentFactory(client) {
2
+ return {
3
+ fetchAppSeats: appId => client.get(`/store/resources/apps/${appId}/seats`),
4
+ fetchProjectSeats: (appId, projectId) => client.get(`/store/resources/apps/${appId}/projects/${projectId}/seats`),
5
+ setProjectSeatAllocation: (appId, projectId, seats) => client.put(`/store/resources/apps/${appId}/projects/${projectId}/allocation`, { seats }),
6
+ assignAppRole: (appId, projectId, roleId, channelIds) => client.post(`/store/resources/apps/${appId}/projects/${projectId}/assignments/roles/${roleId}`, { channel_ids: channelIds }),
7
+ unassignAppRole: (appId, projectId, roleId) => client.delete(`/store/resources/apps/${appId}/projects/${projectId}/assignments/roles/${roleId}`),
8
+ assignAppUser: (appId, projectId, userId, channelIds) => client.post(`/store/resources/apps/${appId}/projects/${projectId}/assignments/users/${userId}`, { channel_ids: channelIds }),
9
+ unassignAppUser: (appId, projectId, userId) => client.delete(`/store/resources/apps/${appId}/projects/${projectId}/assignments/users/${userId}`),
10
+ assignAppLicenseRole: (appId, licenseId, roleId, channelIds) => client.post(`/store/resources/apps/${appId}/licenses/${licenseId}/assignments/roles/${roleId}`, { channel_ids: channelIds }),
11
+ unassignAppLicenseRole: (appId, licenseId, roleId) => client.delete(`/store/resources/apps/${appId}/licenses/${licenseId}/assignments/roles/${roleId}`),
12
+ assignAppLicenseUser: (appId, licenseId, userId, channelIds) => client.post(`/store/resources/apps/${appId}/licenses/${licenseId}/assignments/users/${userId}`, { channel_ids: channelIds }),
13
+ unassignAppLicenseUser: (appId, licenseId, userId) => client.delete(`/store/resources/apps/${appId}/licenses/${licenseId}/assignments/users/${userId}`),
14
+ setAppEveryone: (appId, projectId, channelIds) => client.post(`/store/resources/apps/${appId}/projects/${projectId}/assignments/everyone`, { channel_ids: channelIds }),
15
+ clearAppEveryone: (appId, projectId) => client.delete(`/store/resources/apps/${appId}/projects/${projectId}/assignments/everyone`),
16
+ setAppLicenseEveryone: (appId, licenseId, channelIds) => client.post(`/store/resources/apps/${appId}/licenses/${licenseId}/assignments/everyone`, { channel_ids: channelIds }),
17
+ clearAppLicenseEveryone: (appId, licenseId) => client.delete(`/store/resources/apps/${appId}/licenses/${licenseId}/assignments/everyone`),
18
+ setPreferredChannel: (appId, channelId) => client.put(`/store/resources/apps/${appId}/preferred-channel`, { channel_id: channelId }),
19
+ fetchAppManagers: appId => client.get(`/store/apps/${appId}/managers`),
20
+ grantAppManageRole: (appId, roleId) => client.post(`/store/apps/${appId}/managers/roles/${roleId}`),
21
+ revokeAppManageRole: (appId, roleId) => client.delete(`/store/apps/${appId}/managers/roles/${roleId}`),
22
+ grantAppManageUser: (appId, userId) => client.post(`/store/apps/${appId}/managers/users/${userId}`),
23
+ revokeAppManageUser: (appId, userId) => client.delete(`/store/apps/${appId}/managers/users/${userId}`),
24
+ fetchProjectAssigners: (appId, projectId) => client.get(`/store/resources/apps/${appId}/projects/${projectId}/assigners`),
25
+ grantAppAssignRole: (appId, projectId, roleId) => client.post(`/store/resources/apps/${appId}/projects/${projectId}/assigners/roles/${roleId}`),
26
+ revokeAppAssignRole: (appId, projectId, roleId) => client.delete(`/store/resources/apps/${appId}/projects/${projectId}/assigners/roles/${roleId}`),
27
+ grantAppAssignUser: (appId, projectId, userId) => client.post(`/store/resources/apps/${appId}/projects/${projectId}/assigners/users/${userId}`),
28
+ revokeAppAssignUser: (appId, projectId, userId) => client.delete(`/store/resources/apps/${appId}/projects/${projectId}/assigners/users/${userId}`),
29
+ };
30
+ }
@@ -0,0 +1,35 @@
1
+ import type { ChannelUnpublishImpact, CreateReleaseChannelData, ReleaseChannel, ReleaseChannelMember, UnpublishChannelResponse, UpdateReleaseChannelData } from '../types';
2
+ import type { MessageResponse } from "../../../AntConnect";
3
+ import type { AntHttpClient } from "../../../AntHttpClient";
4
+ import type { DataWrapper } from "../../../types";
5
+ /**
6
+ * Publisher release-channel CRUD + membership. Split out of the AppService
7
+ * factory to keep `index.ts` focused; composed into `AppService` there.
8
+ */
9
+ export interface ReleaseChannelFactory {
10
+ fetchReleaseChannels: (appId: string) => Promise<DataWrapper<ReleaseChannel[]>>;
11
+ createReleaseChannel: (appId: string, data: CreateReleaseChannelData) => Promise<DataWrapper<ReleaseChannel>>;
12
+ updateReleaseChannel: (appId: string, channelId: string, data: UpdateReleaseChannelData) => Promise<DataWrapper<ReleaseChannel>>;
13
+ deleteReleaseChannel: (appId: string, channelId: string) => Promise<MessageResponse>;
14
+ publishToChannel: (appId: string, channelId: string, versionId: string) => Promise<DataWrapper<ReleaseChannel>>;
15
+ /**
16
+ * Clears the channel's active version (pulls it from this channel).
17
+ *
18
+ * DESTRUCTIVE (AAD-892): this also revokes access for every install that
19
+ * draws releases from the channel — including consumers still on an older
20
+ * version of it. Call `fetchUnpublishImpact` first and confirm. Installs are
21
+ * blocked, not uninstalled, so publishing again (or the consumer updating)
22
+ * restores them with permissions intact.
23
+ */
24
+ unpublishFromChannel: (appId: string, channelId: string) => Promise<UnpublishChannelResponse>;
25
+ /** Who would lose access if this channel were unreleased. Read-only. */
26
+ fetchUnpublishImpact: (appId: string, channelId: string) => Promise<DataWrapper<ChannelUnpublishImpact>>;
27
+ fetchChannelMembers: (appId: string, channelId: string, params?: {
28
+ page?: number;
29
+ per_page?: number;
30
+ }) => Promise<DataWrapper<ReleaseChannelMember[]>>;
31
+ addChannelMember: (appId: string, channelId: string, licenseId: string) => Promise<DataWrapper<ReleaseChannelMember>>;
32
+ removeChannelMember: (appId: string, channelId: string, licenseId: string) => Promise<MessageResponse>;
33
+ }
34
+ export declare function newReleaseChannelFactory(client: AntHttpClient): ReleaseChannelFactory;
35
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,4BAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAG1C;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;IAC/E,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,KAAK,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAA;IAC7G,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,KAAK,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAA;IAChI,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;IACpF,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAA;IAC/G;;;;;;;;OAQG;IACH,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAA;IAC7F,wEAAwE;IACxE,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAA;IACxG,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAA;IACtJ,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAA;IACrH,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;CACvG;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,GAAG,qBAAqB,CA2BrF"}
@@ -0,0 +1,18 @@
1
+ import qs from 'qs';
2
+ export function newReleaseChannelFactory(client) {
3
+ return {
4
+ fetchReleaseChannels: appId => client.get(`/store/apps/${appId}/release-channels`),
5
+ createReleaseChannel: (appId, data) => client.post(`/store/apps/${appId}/release-channels`, data),
6
+ updateReleaseChannel: (appId, channelId, data) => client.put(`/store/apps/${appId}/release-channels/${channelId}`, data),
7
+ deleteReleaseChannel: (appId, channelId) => client.delete(`/store/apps/${appId}/release-channels/${channelId}`),
8
+ publishToChannel: (appId, channelId, versionId) => client.post(`/store/apps/${appId}/release-channels/${channelId}/publish`, { version_id: versionId }),
9
+ unpublishFromChannel: (appId, channelId) => client.delete(`/store/apps/${appId}/release-channels/${channelId}/active-version`),
10
+ fetchUnpublishImpact: (appId, channelId) => client.get(`/store/apps/${appId}/release-channels/${channelId}/unpublish-impact`),
11
+ fetchChannelMembers: (appId, channelId, params = {}) => {
12
+ const queryString = qs.stringify(params, { skipNulls: true });
13
+ return client.get(`/store/apps/${appId}/release-channels/${channelId}/members${queryString ? `?${queryString}` : ''}`);
14
+ },
15
+ addChannelMember: (appId, channelId, licenseId) => client.post(`/store/apps/${appId}/release-channels/${channelId}/members`, { license_id: licenseId }),
16
+ removeChannelMember: (appId, channelId, licenseId) => client.delete(`/store/apps/${appId}/release-channels/${channelId}/members/${licenseId}`),
17
+ };
18
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Build a multipart `FormData` body for app-store uploads. Files/Blobs ride as
3
+ * native parts; arrays expand to `key[]` entries; booleans serialise to
4
+ * '1'/'0' (Laravel boolean-validation friendly); null/undefined are skipped.
5
+ * Lets axios set the multipart boundary — never set Content-Type by hand.
6
+ */
7
+ export declare function toFormData(data: Record<string, unknown>): FormData;
8
+ /**
9
+ * Return a multipart `FormData` when the payload carries a File/Blob, otherwise
10
+ * the plain object (sent as JSON). Lets a single endpoint accept either a file
11
+ * upload or a scalar-only request without branching at every call site.
12
+ */
13
+ export declare function maybeFormData<T extends object>(data: T): T | FormData;
14
+ //# sourceMappingURL=formData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formData.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/formData.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAIlE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAErE"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Build a multipart `FormData` body for app-store uploads. Files/Blobs ride as
3
+ * native parts; arrays expand to `key[]` entries; booleans serialise to
4
+ * '1'/'0' (Laravel boolean-validation friendly); null/undefined are skipped.
5
+ * Lets axios set the multipart boundary — never set Content-Type by hand.
6
+ */
7
+ export function toFormData(data) {
8
+ const form = new FormData();
9
+ appendObject(form, data);
10
+ return form;
11
+ }
12
+ /**
13
+ * Return a multipart `FormData` when the payload carries a File/Blob, otherwise
14
+ * the plain object (sent as JSON). Lets a single endpoint accept either a file
15
+ * upload or a scalar-only request without branching at every call site.
16
+ */
17
+ export function maybeFormData(data) {
18
+ return hasBlob(data) ? toFormData(data) : data;
19
+ }
20
+ // Detect a File/Blob at any nesting depth so nested uploads still switch the
21
+ // request to multipart (mirrors toFormData's recursive append).
22
+ function hasBlob(value) {
23
+ if (value instanceof Blob)
24
+ return true;
25
+ if (Array.isArray(value))
26
+ return value.some(hasBlob);
27
+ if (value !== null && typeof value === 'object')
28
+ return Object.values(value).some(hasBlob);
29
+ return false;
30
+ }
31
+ function appendObject(form, obj, prefix) {
32
+ for (const [key, value] of Object.entries(obj))
33
+ appendValue(form, prefix ? `${prefix}[${key}]` : key, value);
34
+ }
35
+ function appendValue(form, key, value) {
36
+ if (value === null || value === undefined)
37
+ return;
38
+ // File extends Blob — `instanceof Blob` covers both and avoids clashing with
39
+ // the unrelated `File` interface declared elsewhere in the SDK.
40
+ if (value instanceof Blob)
41
+ form.append(key, value);
42
+ else if (Array.isArray(value))
43
+ value.forEach(item => appendValue(form, `${key}[]`, item));
44
+ else if (typeof value === 'boolean')
45
+ form.append(key, value ? '1' : '0');
46
+ else if (typeof value === 'object')
47
+ appendObject(form, value, key);
48
+ else
49
+ form.append(key, String(value));
50
+ }
@@ -0,0 +1,17 @@
1
+ import type { AppMedia, AppMediaFormData, ReorderMediaFormData, UpdateAppMediaFormData } from '../types';
2
+ import type { MessageResponse } from "../../../AntConnect";
3
+ import type { AntHttpClient } from "../../../AntHttpClient";
4
+ import type { DataWrapper } from "../../../types";
5
+ /**
6
+ * Screenshot / gallery media on a store listing. Split out of the AppService
7
+ * factory to keep `index.ts` focused; composed into `AppService` there.
8
+ */
9
+ export interface AppMediaFactory {
10
+ fetchAppMedia: (appId: string) => Promise<DataWrapper<AppMedia[]>>;
11
+ uploadAppMedia: (appId: string, mediaData: AppMediaFormData) => Promise<DataWrapper<AppMedia>>;
12
+ updateAppMedia: (appId: string, mediaId: string, mediaData: UpdateAppMediaFormData) => Promise<DataWrapper<AppMedia>>;
13
+ deleteAppMedia: (appId: string, mediaId: string) => Promise<MessageResponse>;
14
+ reorderAppMedia: (appId: string, data: ReorderMediaFormData) => Promise<MessageResponse>;
15
+ }
16
+ export declare function newAppMediaFactory(client: AntHttpClient): AppMediaFactory;
17
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,4BAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAG1C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IAClE,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,KAAK,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC9F,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,sBAAsB,KAAK,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAA;IACrH,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;IAC5E,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;CACzF;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAYzE"}
@@ -0,0 +1,10 @@
1
+ import { maybeFormData } from './formData';
2
+ export function newAppMediaFactory(client) {
3
+ return {
4
+ fetchAppMedia: appId => client.get(`/store/apps/${appId}/media`),
5
+ uploadAppMedia: (appId, mediaData) => client.post(`/store/apps/${appId}/media`, maybeFormData(mediaData)),
6
+ updateAppMedia: (appId, mediaId, mediaData) => client.put(`/store/apps/${appId}/media/${mediaId}`, mediaData),
7
+ deleteAppMedia: (appId, mediaId) => client.delete(`/store/apps/${appId}/media/${mediaId}`),
8
+ reorderAppMedia: (appId, data) => client.post(`/store/apps/${appId}/media/reorder`, data),
9
+ };
10
+ }
@@ -0,0 +1,21 @@
1
+ import type { ResourceAccessError } from '../types';
2
+ /**
3
+ * Runtime helpers for narrowing an access-layer refusal (AAD-898).
4
+ *
5
+ * Kept out of `factory/resources.ts` because these are values, not part of the
6
+ * factory — and because branching on `reason` is something every caller does,
7
+ * not only the one that made the request. Both are re-exported from the package
8
+ * root via `service-runtime.ts`.
9
+ */
10
+ /** Every refusal reason the access layer can return. */
11
+ export declare const RESOURCE_ACCESS_REASONS: readonly ["not_entitled", "entitlement_revoked", "subscription_expired", "subscription_pending_approval", "version_withdrawn", "version_not_ready", "payload_backend_not_implemented"];
12
+ /**
13
+ * Narrow an unknown error (typically an axios rejection) to an access-layer
14
+ * refusal, so the caller can branch on `reason` rather than on the status code.
15
+ */
16
+ export declare function isResourceAccessError(error: unknown): error is {
17
+ response: {
18
+ data: ResourceAccessError;
19
+ };
20
+ };
21
+ //# sourceMappingURL=resourceAccess.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceAccess.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEnD;;;;;;;GAOG;AAEH,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,wLAQ1B,CAAA;AAMV;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,QAAQ,EAAE;QAAE,IAAI,EAAE,mBAAmB,CAAA;KAAE,CAAA;CAAE,CAY1G"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Runtime helpers for narrowing an access-layer refusal (AAD-898).
3
+ *
4
+ * Kept out of `factory/resources.ts` because these are values, not part of the
5
+ * factory — and because branching on `reason` is something every caller does,
6
+ * not only the one that made the request. Both are re-exported from the package
7
+ * root via `service-runtime.ts`.
8
+ */
9
+ /** Every refusal reason the access layer can return. */
10
+ export const RESOURCE_ACCESS_REASONS = [
11
+ 'not_entitled',
12
+ 'entitlement_revoked',
13
+ 'subscription_expired',
14
+ 'subscription_pending_approval',
15
+ 'version_withdrawn',
16
+ 'version_not_ready',
17
+ 'payload_backend_not_implemented',
18
+ ];
19
+ function isRecord(value) {
20
+ return typeof value === 'object' && value !== null;
21
+ }
22
+ /**
23
+ * Narrow an unknown error (typically an axios rejection) to an access-layer
24
+ * refusal, so the caller can branch on `reason` rather than on the status code.
25
+ */
26
+ export function isResourceAccessError(error) {
27
+ const response = isRecord(error) ? error.response : undefined;
28
+ const data = isRecord(response) ? response.data : undefined;
29
+ if (!isRecord(data))
30
+ return false;
31
+ // `message` is checked as well as `reason`: the predicate asserts the full
32
+ // `ResourceAccessError` shape, and a guard that narrows to a field it never
33
+ // verified is how a `message.length` somewhere downstream becomes a crash.
34
+ return typeof data.message === 'string'
35
+ && typeof data.reason === 'string'
36
+ && RESOURCE_ACCESS_REASONS.includes(data.reason);
37
+ }
@@ -0,0 +1,52 @@
1
+ import type { AcquireResourceData, ResourceEntitlementSummary, ResourceSubscription } from '../types';
2
+ import type { CreatePricingTierData, PricingTier, UpdatePricingTierData } from '../types/pricingTiers';
3
+ import type { MessageResponse } from "../../../AntConnect";
4
+ import type { AntHttpClient } from "../../../AntHttpClient";
5
+ import type { DataWrapper } from "../../../types";
6
+ /**
7
+ * Pricing and purchase for sellable resources (AAD-898).
8
+ *
9
+ * Split out of `resources.ts` for file size when AAD-939 landed, along the same
10
+ * seam the backend already uses: commerce is REUSED from apps (`pricing_tiers` and
11
+ * `subscriptions` are polymorphic), whereas the rest of `resources.ts` is
12
+ * resource-specific. Folded into `SellableResourceFactory`, so callers still reach
13
+ * everything as `c.apps.*` and the public surface is unchanged.
14
+ *
15
+ * Money is handled offline: there is no payment processor, and a paid purchase is
16
+ * approval-gated by the publisher.
17
+ */
18
+ export interface ResourceCommerceFactory {
19
+ /** Storefront-public: a prospective buyer may read these. */
20
+ fetchResourcePricingTiers: (resourceId: string) => Promise<DataWrapper<PricingTier[]>>;
21
+ /**
22
+ * Free and flat only. A seat tier is rejected with 422 on `errors.pricing_model`
23
+ * — resource entitlements are license-level and seats do not exist for them.
24
+ * Sending `seat_based: true` is rejected the same way.
25
+ */
26
+ createResourcePricingTier: (resourceId: string, data: CreatePricingTierData) => Promise<DataWrapper<PricingTier>>;
27
+ updateResourcePricingTier: (resourceId: string, tierId: string, data: UpdatePricingTierData) => Promise<DataWrapper<PricingTier>>;
28
+ deleteResourcePricingTier: (resourceId: string, tierId: string) => Promise<MessageResponse>;
29
+ /**
30
+ * Acquire the resource.
31
+ *
32
+ * FREE resource: omit `pricing_tier_id`; you get an entitlement immediately.
33
+ * SUBSCRIPTION resource: pass the tier; you get a `pending_approval`
34
+ * subscription that grants NO access until the publisher approves it.
35
+ */
36
+ acquireResource: (resourceId: string, data?: AcquireResourceData) => Promise<DataWrapper<ResourceSubscription | ResourceEntitlementSummary>>;
37
+ fetchCurrentResourceSubscription: (resourceId: string) => Promise<DataWrapper<ResourceSubscription | null>>;
38
+ /** Publisher approval inbox. */
39
+ fetchPendingResourceSubscriptions: (resourceId: string) => Promise<DataWrapper<ResourceSubscription[]>>;
40
+ /** Publisher: every subscription on this resource. */
41
+ fetchResourceSubscriptions: (resourceId: string) => Promise<DataWrapper<ResourceSubscription[]>>;
42
+ /** Publisher: approving is what creates the entitlement and unlocks reads. */
43
+ approveResourceSubscription: (resourceId: string, subscriptionId: string) => Promise<DataWrapper<ResourceSubscription>>;
44
+ denyResourceSubscription: (resourceId: string, subscriptionId: string) => Promise<DataWrapper<ResourceSubscription>>;
45
+ cancelResourceSubscription: (resourceId: string, subscriptionId: string) => Promise<DataWrapper<ResourceSubscription>>;
46
+ reactivateResourceSubscription: (resourceId: string, subscriptionId: string) => Promise<DataWrapper<ResourceSubscription>>;
47
+ confirmResourceRenewal: (resourceId: string, subscriptionId: string, data?: {
48
+ external_payment_ref?: string;
49
+ }) => Promise<DataWrapper<ResourceSubscription>>;
50
+ }
51
+ export declare function newResourceCommerceFactory(client: AntHttpClient): ResourceCommerceFactory;
52
+ //# sourceMappingURL=resourceCommerce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceCommerce.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceCommerce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrG,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACtG,OAAO,KAAK,EAAE,eAAe,EAAE,4BAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAE1C;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,uBAAuB;IAEtC,6DAA6D;IAC7D,yBAAyB,EAAE,CAAC,UAAU,E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B,CAAC,CAAC,CAAA;IACpH,0BAA0B,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAA;IACtH,8BAA8B,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAA;IAC1H,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAA;CAC7J;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,uBAAuB,CAwBzF"}
@@ -0,0 +1,18 @@
1
+ export function newResourceCommerceFactory(client) {
2
+ const base = (resourceId) => `/store/resources/${resourceId}`;
3
+ return {
4
+ fetchResourcePricingTiers: resourceId => client.get(`${base(resourceId)}/pricing-tiers`),
5
+ createResourcePricingTier: (resourceId, data) => client.post(`${base(resourceId)}/pricing-tiers`, data),
6
+ updateResourcePricingTier: (resourceId, tierId, data) => client.put(`${base(resourceId)}/pricing-tiers/${tierId}`, data),
7
+ deleteResourcePricingTier: (resourceId, tierId) => client.delete(`${base(resourceId)}/pricing-tiers/${tierId}`),
8
+ acquireResource: (resourceId, data = {}) => client.post(`${base(resourceId)}/subscriptions`, data),
9
+ fetchCurrentResourceSubscription: resourceId => client.get(`${base(resourceId)}/subscriptions/current`),
10
+ fetchPendingResourceSubscriptions: resourceId => client.get(`${base(resourceId)}/subscriptions/pending`),
11
+ fetchResourceSubscriptions: resourceId => client.get(`${base(resourceId)}/subscriptions`),
12
+ approveResourceSubscription: (resourceId, subscriptionId) => client.post(`${base(resourceId)}/subscriptions/${subscriptionId}/approve`),
13
+ denyResourceSubscription: (resourceId, subscriptionId) => client.post(`${base(resourceId)}/subscriptions/${subscriptionId}/deny`),
14
+ cancelResourceSubscription: (resourceId, subscriptionId) => client.post(`${base(resourceId)}/subscriptions/${subscriptionId}/cancel`),
15
+ reactivateResourceSubscription: (resourceId, subscriptionId) => client.post(`${base(resourceId)}/subscriptions/${subscriptionId}/reactivate`),
16
+ confirmResourceRenewal: (resourceId, subscriptionId, data = {}) => client.post(`${base(resourceId)}/subscriptions/${subscriptionId}/confirm-renewal`, data),
17
+ };
18
+ }
@@ -0,0 +1,62 @@
1
+ import type { SnapshotPayloadConfig, SnapshotPayloadSchema, SnapshotPreview } from '../types/snapshotPayload';
2
+ import type { SnapshotSource } from '../types/snapshotSources';
3
+ import type { AntHttpClient } from "../../../AntHttpClient";
4
+ import type { DataWrapper } from "../../../types";
5
+ /**
6
+ * Snapshot payloads (AAD-939) — publishing a dataset from a linked table.
7
+ *
8
+ * Split out of `resources.ts` for file size; folded into `SellableResourceFactory`
9
+ * so callers still reach everything as `c.apps.*` and the public surface is
10
+ * unchanged.
11
+ *
12
+ * **The publish flow is: preview → create → POLL → publish.** Skipping the poll is
13
+ * the mistake this whole contract is shaped to prevent — see
14
+ * `createResourceVersion` in `resources.ts`.
15
+ */
16
+ export interface ResourceSnapshotFactory {
17
+ /**
18
+ * The tables this publisher can build a dataset from.
19
+ *
20
+ * Use this for the source picker rather than the generic table listing: that one
21
+ * carries no project attribution (so same-named tables in different projects are
22
+ * indistinguishable), no row count, and no publishable-column count — filling
23
+ * those in from it meant one request per table.
24
+ *
25
+ * Rows with `is_publishable: false` have nothing publishable in them. Show them
26
+ * disabled rather than filtering them out, so a publisher looking for a table they
27
+ * know exists finds it and learns why it cannot be used.
28
+ *
29
+ * The set returned is exactly the set `createResourceVersion` will accept, so the
30
+ * picker can never offer a table the create then refuses. 404 on a resource whose
31
+ * `payload_type` is not `snapshot`.
32
+ */
33
+ fetchSnapshotSources: (resourceId: string, requestConfig?: Record<string, any>) => Promise<DataWrapper<SnapshotSource[]>>;
34
+ /**
35
+ * Dry-run a column selection before creating a version from it.
36
+ *
37
+ * Returns the row count, an estimated size, the ceilings, the declared schema and
38
+ * a truncated sample. Publisher-only; 404 on a resource whose `payload_type` is
39
+ * not `snapshot`.
40
+ *
41
+ * **Show `exceeds_limits` before letting the publisher continue.** Above either
42
+ * ceiling the backend REFUSES the version rather than truncating it — a partial
43
+ * dataset is indistinguishable from a complete one once published — so a
44
+ * publisher who is not warned here meets a wall at the last step instead.
45
+ *
46
+ * Unlike creating a version, this does NOT require the personal-data declaration:
47
+ * the publisher is still assembling a selection.
48
+ */
49
+ previewResourceSnapshot: (resourceId: string, payloadConfig: Omit<SnapshotPayloadConfig, 'declarations'> & Partial<Pick<SnapshotPayloadConfig, 'declarations'>>, requestConfig?: Record<string, any>) => Promise<DataWrapper<SnapshotPreview>>;
50
+ }
51
+ export declare function newResourceSnapshotFactory(client: AntHttpClient): ResourceSnapshotFactory;
52
+ /**
53
+ * Narrow a version's `payload_schema` to a snapshot schema.
54
+ *
55
+ * `ResourceVersion.payload_schema` is typed for snapshots because they are the only
56
+ * payload type that records one today, but AAD-899 may store a different shape — so
57
+ * a component rendering the field list should narrow rather than assume. Use this
58
+ * instead of a cast: `as` would happily assert a shape that is not there, and the
59
+ * crash lands in whichever component reads `fields` first.
60
+ */
61
+ export declare function isSnapshotPayloadSchema(value: unknown): value is SnapshotPayloadSchema;
62
+ //# sourceMappingURL=resourceSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceSnapshot.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC7G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;;;;OAeG;IACH,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;IAEzH;;;;;;;;;;;;;;OAcG;IACH,uBAAuB,EAAE,CACvB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,IAAI,CAAC,qBAAqB,EAAE,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC,EACjH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAChC,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAA;CAC3C;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,uBAAuB,CAQzF;AAMD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAgBtF"}
@@ -0,0 +1,34 @@
1
+ export function newResourceSnapshotFactory(client) {
2
+ return {
3
+ fetchSnapshotSources: (resourceId, requestConfig) => client.get(`/store/resources/${resourceId}/snapshot-sources`, requestConfig),
4
+ previewResourceSnapshot: (resourceId, payloadConfig, requestConfig) => client.post(`/store/resources/${resourceId}/snapshot-preview`, { payload_config: payloadConfig }, requestConfig),
5
+ };
6
+ }
7
+ function isRecord(value) {
8
+ return typeof value === 'object' && value !== null;
9
+ }
10
+ /**
11
+ * Narrow a version's `payload_schema` to a snapshot schema.
12
+ *
13
+ * `ResourceVersion.payload_schema` is typed for snapshots because they are the only
14
+ * payload type that records one today, but AAD-899 may store a different shape — so
15
+ * a component rendering the field list should narrow rather than assume. Use this
16
+ * instead of a cast: `as` would happily assert a shape that is not there, and the
17
+ * crash lands in whichever component reads `fields` first.
18
+ */
19
+ export function isSnapshotPayloadSchema(value) {
20
+ if (!isRecord(value))
21
+ return false;
22
+ // Every field the predicate asserts is verified. A guard that narrows to
23
+ // something it never checked is how `schema.fields.map` becomes a runtime error.
24
+ return typeof value.schema_version === 'number'
25
+ && typeof value.row_count === 'number'
26
+ && typeof value.byte_size === 'number'
27
+ && Array.isArray(value.fields)
28
+ && value.fields.every(field => isRecord(field)
29
+ && typeof field.key === 'string'
30
+ && typeof field.type === 'string'
31
+ && typeof field.nullable === 'boolean'
32
+ && typeof field.order === 'number'
33
+ && typeof field.source_column_id === 'string');
34
+ }