@antcde/connect-ts 0.4.26 → 0.4.27-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -3
- package/build/AntConnect.d.ts +8 -0
- package/build/AntConnect.d.ts.map +1 -1
- package/build/AntConnect.js +8 -0
- package/build/AntHttpClient.d.ts +0 -5
- package/build/AntHttpClient.d.ts.map +1 -1
- package/build/AntHttpClient.js +0 -5
- package/build/ai/index.d.ts +5 -0
- package/build/ai/index.d.ts.map +1 -0
- package/build/ai/index.js +3 -0
- package/build/ai/mutationDescriptors.d.ts +3 -0
- package/build/ai/mutationDescriptors.d.ts.map +1 -0
- package/build/ai/mutationDescriptors.js +207 -0
- package/build/ai/mutationTargets.d.ts +21 -0
- package/build/ai/mutationTargets.d.ts.map +1 -0
- package/build/ai/mutationTargets.js +72 -0
- package/build/ai/queryDescriptors.d.ts +3 -0
- package/build/ai/queryDescriptors.d.ts.map +1 -0
- package/build/ai/queryDescriptors.js +174 -0
- package/build/ai/types.d.ts +35 -0
- package/build/ai/types.d.ts.map +1 -0
- package/build/comms/client.d.ts.map +1 -1
- package/build/comms/client.js +39 -41
- package/build/comms/connection.d.ts +32 -0
- package/build/comms/connection.d.ts.map +1 -0
- package/build/comms/connection.js +159 -0
- package/build/comms/handshake.d.ts +16 -0
- package/build/comms/handshake.d.ts.map +1 -0
- package/build/comms/handshake.js +73 -0
- package/build/comms/host.d.ts.map +1 -1
- package/build/comms/host.js +22 -26
- package/build/comms/hostAPI.js +1 -1
- package/build/comms/hostSlot.d.ts +23 -0
- package/build/comms/hostSlot.d.ts.map +1 -0
- package/build/comms/hostSlot.js +55 -0
- package/build/comms/models.d.ts +31 -2
- package/build/comms/models.d.ts.map +1 -1
- package/build/comms/signalChangeTypes.d.ts +27 -1
- package/build/comms/signalChangeTypes.d.ts.map +1 -1
- package/build/comms/signalChangeTypes.js +7 -0
- package/build/comms/signalTypes.d.ts +21 -3
- package/build/comms/signalTypes.d.ts.map +1 -1
- package/build/comms/transport.d.ts +18 -2
- package/build/comms/transport.d.ts.map +1 -1
- package/build/comms/transport.js +25 -10
- package/build/index.d.ts +8 -35
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -3
- package/build/service-runtime.d.ts +9 -0
- package/build/service-runtime.d.ts.map +1 -0
- package/build/service-runtime.js +10 -0
- package/build/service-types-app.d.ts +2 -0
- package/build/service-types-app.d.ts.map +1 -0
- package/build/service-types-app.js +3 -0
- package/build/service-types.d.ts +37 -0
- package/build/service-types.d.ts.map +1 -0
- package/build/service-types.js +7 -0
- package/build/services/AiService.d.ts +18 -0
- package/build/services/AiService.d.ts.map +1 -0
- package/build/services/AiService.js +9 -0
- package/build/services/AppService/factory/accessRequests.d.ts +19 -0
- package/build/services/AppService/factory/accessRequests.d.ts.map +1 -0
- package/build/services/AppService/factory/accessRequests.js +17 -0
- package/build/services/AppService/factory/assignments.d.ts +57 -0
- package/build/services/AppService/factory/assignments.d.ts.map +1 -0
- package/build/services/AppService/factory/assignments.js +30 -0
- package/build/services/AppService/factory/categories.d.ts +30 -0
- package/build/services/AppService/factory/categories.d.ts.map +1 -0
- package/build/services/AppService/factory/categories.js +11 -0
- package/build/services/AppService/factory/channels.d.ts +35 -0
- package/build/services/AppService/factory/channels.d.ts.map +1 -0
- package/build/services/AppService/factory/channels.js +18 -0
- package/build/services/AppService/factory/formData.d.ts +14 -0
- package/build/services/AppService/factory/formData.d.ts.map +1 -0
- package/build/services/AppService/factory/formData.js +50 -0
- package/build/services/AppService/factory/media.d.ts +17 -0
- package/build/services/AppService/factory/media.d.ts.map +1 -0
- package/build/services/AppService/factory/media.js +10 -0
- package/build/services/AppService/factory/resourceAccess.d.ts +21 -0
- package/build/services/AppService/factory/resourceAccess.d.ts.map +1 -0
- package/build/services/AppService/factory/resourceAccess.js +49 -0
- package/build/services/AppService/factory/resourceAssignments.d.ts +66 -0
- package/build/services/AppService/factory/resourceAssignments.d.ts.map +1 -0
- package/build/services/AppService/factory/resourceAssignments.js +12 -0
- package/build/services/AppService/factory/resourceChannels.d.ts +89 -0
- package/build/services/AppService/factory/resourceChannels.d.ts.map +1 -0
- package/build/services/AppService/factory/resourceChannels.js +19 -0
- package/build/services/AppService/factory/resourceCommerce.d.ts +52 -0
- package/build/services/AppService/factory/resourceCommerce.d.ts.map +1 -0
- package/build/services/AppService/factory/resourceCommerce.js +18 -0
- package/build/services/AppService/factory/resourceSnapshot.d.ts +75 -0
- package/build/services/AppService/factory/resourceSnapshot.d.ts.map +1 -0
- package/build/services/AppService/factory/resourceSnapshot.js +55 -0
- package/build/services/AppService/factory/resourceUploads.d.ts +37 -0
- package/build/services/AppService/factory/resourceUploads.d.ts.map +1 -0
- package/build/services/AppService/factory/resourceUploads.js +8 -0
- package/build/services/AppService/factory/resources.d.ts +167 -0
- package/build/services/AppService/factory/resources.d.ts.map +1 -0
- package/build/services/AppService/factory/resources.js +45 -0
- package/build/services/AppService/factory/subscriptions.d.ts +73 -0
- package/build/services/AppService/factory/subscriptions.d.ts.map +1 -0
- package/build/services/AppService/factory/subscriptions.js +39 -0
- package/build/services/AppService/factory/taxonomy.d.ts +25 -0
- package/build/services/AppService/factory/taxonomy.d.ts.map +1 -0
- package/build/services/AppService/factory/taxonomy.js +5 -0
- package/build/services/AppService/index.d.ts +58 -0
- package/build/services/AppService/index.d.ts.map +1 -0
- package/build/services/AppService/index.js +74 -0
- package/build/services/AppService/types/accessRequests.d.ts +164 -0
- package/build/services/AppService/types/accessRequests.d.ts.map +1 -0
- package/build/services/AppService/types/app.d.ts +124 -0
- package/build/services/AppService/types/app.d.ts.map +1 -0
- package/build/services/AppService/types/app.js +6 -0
- package/build/services/AppService/types/appCategories.d.ts +44 -0
- package/build/services/AppService/types/appCategories.d.ts.map +1 -0
- package/build/services/AppService/types/appCategories.js +1 -0
- package/build/services/AppService/types/appChangelog.d.ts +31 -0
- package/build/services/AppService/types/appChangelog.d.ts.map +1 -0
- package/build/services/AppService/types/appChangelog.js +1 -0
- package/build/services/AppService/types/appConfigStatus.d.ts +68 -0
- package/build/services/AppService/types/appConfigStatus.d.ts.map +1 -0
- package/build/services/AppService/types/appConfigStatus.js +11 -0
- package/build/services/AppService/types/appList.d.ts +211 -0
- package/build/services/AppService/types/appList.d.ts.map +1 -0
- package/build/services/AppService/types/appList.js +1 -0
- package/build/services/AppService/types/appManifest.d.ts +100 -0
- package/build/services/AppService/types/appManifest.d.ts.map +1 -0
- package/build/services/AppService/types/appManifest.js +4 -0
- package/build/services/AppService/types/appMedia.d.ts +136 -0
- package/build/services/AppService/types/appMedia.d.ts.map +1 -0
- package/build/services/AppService/types/appMedia.js +1 -0
- package/build/services/AppService/types/appRequests.d.ts +126 -0
- package/build/services/AppService/types/appRequests.d.ts.map +1 -0
- package/build/services/AppService/types/appRequests.js +1 -0
- package/build/services/AppService/types/appScopes.d.ts +165 -0
- package/build/services/AppService/types/appScopes.d.ts.map +1 -0
- package/build/services/AppService/types/appScopes.js +1 -0
- package/build/services/AppService/types/channels.d.ts +45 -0
- package/build/services/AppService/types/channels.d.ts.map +1 -0
- package/build/services/AppService/types/channels.js +1 -0
- package/build/services/AppService/types/pricingTiers.d.ts +111 -0
- package/build/services/AppService/types/pricingTiers.d.ts.map +1 -0
- package/build/services/AppService/types/pricingTiers.js +1 -0
- package/build/services/AppService/types/publisherStats.d.ts +20 -0
- package/build/services/AppService/types/publisherStats.d.ts.map +1 -0
- package/build/services/AppService/types/publisherStats.js +1 -0
- package/build/services/AppService/types/releaseChannels.d.ts +127 -0
- package/build/services/AppService/types/releaseChannels.d.ts.map +1 -0
- package/build/services/AppService/types/releaseChannels.js +1 -0
- package/build/services/AppService/types/resourceAssignments.d.ts +38 -0
- package/build/services/AppService/types/resourceAssignments.d.ts.map +1 -0
- package/build/services/AppService/types/resourceAssignments.js +10 -0
- package/build/services/AppService/types/resourceEntitlements.d.ts +118 -0
- package/build/services/AppService/types/resourceEntitlements.d.ts.map +1 -0
- package/build/services/AppService/types/resourceEntitlements.js +1 -0
- package/build/services/AppService/types/resourceReleases.d.ts +230 -0
- package/build/services/AppService/types/resourceReleases.d.ts.map +1 -0
- package/build/services/AppService/types/resourceReleases.js +1 -0
- package/build/services/AppService/types/resourceRequests.d.ts +115 -0
- package/build/services/AppService/types/resourceRequests.d.ts.map +1 -0
- package/build/services/AppService/types/resourceRequests.js +1 -0
- package/build/services/AppService/types/seats.d.ts +220 -0
- package/build/services/AppService/types/seats.d.ts.map +1 -0
- package/build/services/AppService/types/seats.js +4 -0
- package/build/services/AppService/types/sellableResources.d.ts +231 -0
- package/build/services/AppService/types/sellableResources.d.ts.map +1 -0
- package/build/services/AppService/types/sellableResources.js +1 -0
- package/build/services/AppService/types/snapshotFileSource.d.ts +110 -0
- package/build/services/AppService/types/snapshotFileSource.d.ts.map +1 -0
- package/build/services/AppService/types/snapshotFileSource.js +8 -0
- package/build/services/AppService/types/snapshotPayload.d.ts +166 -0
- package/build/services/AppService/types/snapshotPayload.d.ts.map +1 -0
- package/build/services/AppService/types/snapshotPayload.js +19 -0
- package/build/services/AppService/types/snapshotSources.d.ts +116 -0
- package/build/services/AppService/types/snapshotSources.d.ts.map +1 -0
- package/build/services/AppService/types/snapshotSources.js +7 -0
- package/build/services/AppService/types/snapshotUploads.d.ts +109 -0
- package/build/services/AppService/types/snapshotUploads.d.ts.map +1 -0
- package/build/services/AppService/types/snapshotUploads.js +20 -0
- package/build/services/AppService/types/subscriptions.d.ts +182 -0
- package/build/services/AppService/types/subscriptions.d.ts.map +1 -0
- package/build/services/AppService/types/subscriptions.js +1 -0
- package/build/services/AppService/types/taxonomy.d.ts +76 -0
- package/build/services/AppService/types/taxonomy.d.ts.map +1 -0
- package/build/services/AppService/types/taxonomy.js +1 -0
- package/build/services/AppService/types.d.ts +27 -0
- package/build/services/AppService/types.d.ts.map +1 -0
- package/build/services/AppService/types.js +29 -0
- package/build/services/DmsService.d.ts +6 -151
- package/build/services/DmsService.d.ts.map +1 -1
- package/build/services/DmsService.types.d.ts +169 -0
- package/build/services/DmsService.types.d.ts.map +1 -0
- package/build/services/DmsService.types.js +1 -0
- package/build/services/DmsServiceImpl.d.ts.map +1 -1
- package/build/services/DmsServiceImpl.js +8 -0
- package/build/services/LicenseService.d.ts +1 -1
- package/build/services/LicenseService.d.ts.map +1 -1
- package/build/services/LicenseService.js +1 -1
- package/build/services/OAuthClientService.d.ts +20 -0
- package/build/services/OAuthClientService.d.ts.map +1 -0
- package/build/services/OAuthClientService.js +12 -0
- package/build/services/OAuthClientService.types.d.ts +37 -0
- package/build/services/OAuthClientService.types.d.ts.map +1 -0
- package/build/services/OAuthClientService.types.js +4 -0
- package/build/services/ProjectService.d.ts +21 -0
- package/build/services/ProjectService.d.ts.map +1 -1
- package/build/services/ProjectService.js +1 -0
- package/build/services/ReleaseService.d.ts +1 -0
- package/build/services/ReleaseService.d.ts.map +1 -1
- package/build/services/SecretService.d.ts +22 -0
- package/build/services/SecretService.d.ts.map +1 -0
- package/build/services/SecretService.js +21 -0
- package/build/services/SecretService.types.d.ts +147 -0
- package/build/services/SecretService.types.d.ts.map +1 -0
- package/build/services/SecretService.types.js +1 -0
- package/build/services/SecretSharing.types.d.ts +112 -0
- package/build/services/SecretSharing.types.d.ts.map +1 -0
- package/build/services/SecretSharing.types.js +1 -0
- package/build/services/TableService.js +7 -7
- package/build/services/TaskService.d.ts +3 -3
- package/build/services/TaskService.d.ts.map +1 -1
- package/build/services/TaskService.js +1 -1
- package/build/services/TaskService.requests.d.ts +61 -0
- package/build/services/TaskService.requests.d.ts.map +1 -0
- package/build/services/TaskService.requests.js +1 -0
- package/build/services/TaskService.types.d.ts +21 -53
- package/build/services/TaskService.types.d.ts.map +1 -1
- package/build/services/TaskServiceQueries.d.ts +2 -0
- package/build/services/TaskServiceQueries.d.ts.map +1 -1
- package/build/services/TaskServiceQueries.js +13 -2
- package/build/services/TaskTemplate.types.d.ts +74 -1
- package/build/services/TaskTemplate.types.d.ts.map +1 -1
- package/build/services/TokenService.d.ts +5 -1
- package/build/services/TokenService.d.ts.map +1 -1
- package/build/services/TokenService.js +1 -2
- package/build/services/UserService.d.ts +3 -0
- package/build/services/UserService.d.ts.map +1 -1
- package/build/services/UserService.js +4 -4
- package/build/services/Webhook/EventService.d.ts +7 -0
- package/build/services/Webhook/EventService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerHistoryService.d.ts +1 -1
- package/build/services/Webhook/TriggerHistoryService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerSecretService.d.ts +88 -0
- package/build/services/Webhook/TriggerSecretService.d.ts.map +1 -0
- package/build/services/Webhook/TriggerSecretService.js +9 -0
- package/build/services/Webhook/TriggerService.d.ts +108 -0
- package/build/services/Webhook/TriggerService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerService.js +25 -0
- package/build/services/Websockets/StoreEvents.d.ts +44 -0
- package/build/services/Websockets/StoreEvents.d.ts.map +1 -0
- package/build/services/Websockets/StoreEvents.js +5 -0
- package/build/services/userPreferences.d.ts +47 -0
- package/build/services/userPreferences.d.ts.map +1 -0
- package/build/services/userPreferences.js +42 -0
- package/package.json +8 -7
- package/schemas/app-config.schema.json +85 -8
- package/build/services/AppManifest.d.ts +0 -39
- package/build/services/AppManifest.d.ts.map +0 -1
- package/build/services/AppService.d.ts +0 -57
- package/build/services/AppService.d.ts.map +0 -1
- package/build/services/AppService.js +0 -47
- package/build/services/AppService.types.d.ts +0 -173
- package/build/services/AppService.types.d.ts.map +0 -1
- /package/build/{services/AppManifest.js → ai/types.js} +0 -0
- /package/build/services/{AppService.types.js → AppService/types/accessRequests.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceAssignments.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceAssignments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;OAMG;IACH,wBAAwB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAE3F,wDAAwD;IACxD,mBAAmB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACtF,oFAAoF;IACpF,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAExF,8DAA8D;IAC9D,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACrG,qFAAqF;IACrF,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAEvG;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACrG,kBAAkB;IAClB,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;CACxG;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,aAAa,GAAG,yBAAyB,CAe7F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function newResourceAssignmentFactory(client) {
|
|
2
|
+
const base = (resourceId) => `/store/resources/${resourceId}/entitlement/assignments`;
|
|
3
|
+
return {
|
|
4
|
+
fetchResourceAssignments: resourceId => client.get(base(resourceId)),
|
|
5
|
+
setResourceEveryone: resourceId => client.post(`${base(resourceId)}/everyone`),
|
|
6
|
+
clearResourceEveryone: resourceId => client.delete(`${base(resourceId)}/everyone`),
|
|
7
|
+
assignResourceRole: (resourceId, roleId) => client.post(`${base(resourceId)}/roles/${roleId}`),
|
|
8
|
+
unassignResourceRole: (resourceId, roleId) => client.delete(`${base(resourceId)}/roles/${roleId}`),
|
|
9
|
+
assignResourceUser: (resourceId, userId) => client.post(`${base(resourceId)}/users/${userId}`),
|
|
10
|
+
unassignResourceUser: (resourceId, userId) => client.delete(`${base(resourceId)}/users/${userId}`),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { CreateResourceChannelData, ResourceChannel, ResourceChannelMember, ResourceUnpublishImpact, UpdateResourceChannelData } from '../types';
|
|
2
|
+
import type { MessageResponse } from "../../../AntConnect";
|
|
3
|
+
import type { AntHttpClient } from "../../../AntHttpClient";
|
|
4
|
+
import type { DataWrapper } from "../../../types";
|
|
5
|
+
/**
|
|
6
|
+
* Resource release channels and the licenses allowed to draw from them
|
|
7
|
+
* (AAD-898, access modes AAD-949).
|
|
8
|
+
*
|
|
9
|
+
* Split out of `factory/resources.ts` for size and folded back into
|
|
10
|
+
* `SellableResourceFactory` there, so the public surface is unchanged — this
|
|
11
|
+
* mirrors how `factory/channels.ts` sits under `AppService`.
|
|
12
|
+
*
|
|
13
|
+
* **The mental model differs from the app store's in one place that matters.**
|
|
14
|
+
* On an app, membership of a `specific_licenses` channel is itself a way to be
|
|
15
|
+
* entitled. On a resource it is NOT: entitlement always comes from a purchase,
|
|
16
|
+
* and `access_mode` only narrows which entitled licenses may draw from a track.
|
|
17
|
+
* Adding a license to a channel therefore gives it nothing it did not already
|
|
18
|
+
* have — do not build an "grant access by adding to a channel" affordance.
|
|
19
|
+
*/
|
|
20
|
+
export interface ResourceChannelFactory {
|
|
21
|
+
/**
|
|
22
|
+
* List channels.
|
|
23
|
+
*
|
|
24
|
+
* Scoped to the viewer server-side: a publisher gets every channel with
|
|
25
|
+
* `member_count`, a buyer gets only channels their license may draw from, with
|
|
26
|
+
* `member_count: null`. A restricted channel simply does not appear for a
|
|
27
|
+
* non-member, so an empty list is a legitimate state, not an error.
|
|
28
|
+
*/
|
|
29
|
+
fetchResourceChannels: (resourceId: string) => Promise<DataWrapper<ResourceChannel[]>>;
|
|
30
|
+
createResourceChannel: (resourceId: string, data: CreateResourceChannelData) => Promise<DataWrapper<ResourceChannel>>;
|
|
31
|
+
/**
|
|
32
|
+
* Partial update — send only the keys you are changing.
|
|
33
|
+
*
|
|
34
|
+
* Promoting a channel with `is_default: true` demotes the previous default
|
|
35
|
+
* atomically; UNSETTING the current default is refused with a 400, because a
|
|
36
|
+
* resource must always have exactly one.
|
|
37
|
+
*/
|
|
38
|
+
updateResourceChannel: (resourceId: string, channelId: string, data: UpdateResourceChannelData) => Promise<DataWrapper<ResourceChannel>>;
|
|
39
|
+
/** Refused (400) for the default channel, and for a channel that still has members. */
|
|
40
|
+
deleteResourceChannel: (resourceId: string, channelId: string) => Promise<MessageResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Make a version live.
|
|
43
|
+
*
|
|
44
|
+
* Publishing FORWARD supersedes and moves nobody — existing buyers stay on
|
|
45
|
+
* their pin and simply gain an available update. Publishing an OLDER version
|
|
46
|
+
* is a rollback: buyers stranded ahead of it are force-moved down onto it,
|
|
47
|
+
* regardless of their `auto_update` setting. 422 if the version's payload is
|
|
48
|
+
* not `ready`.
|
|
49
|
+
*/
|
|
50
|
+
publishResourceVersion: (resourceId: string, channelId: string, versionId: string) => Promise<DataWrapper<ResourceChannel>>;
|
|
51
|
+
/**
|
|
52
|
+
* Unrelease: clear the channel's active version AND withdraw every holder
|
|
53
|
+
* drawing from it. Synchronous — the pulled build stops being served
|
|
54
|
+
* immediately. Nobody is exempt, the publisher included.
|
|
55
|
+
*
|
|
56
|
+
* Also the required first step before deleting a version this channel serves:
|
|
57
|
+
* that delete is refused with a 409 rather than performing this silently.
|
|
58
|
+
*/
|
|
59
|
+
unpublishResourceChannel: (resourceId: string, channelId: string) => Promise<{
|
|
60
|
+
message: string;
|
|
61
|
+
data: {
|
|
62
|
+
withdrawn: {
|
|
63
|
+
entitlements: number;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
/** Who an unpublish would cut off — show this before confirming. */
|
|
68
|
+
fetchResourceUnpublishImpact: (resourceId: string, channelId: string) => Promise<DataWrapper<ResourceUnpublishImpact>>;
|
|
69
|
+
/** Paginated. Publisher-only; a buyer gets 403 even for a channel they are on. */
|
|
70
|
+
fetchResourceChannelMembers: (resourceId: string, channelId: string, params?: {
|
|
71
|
+
page?: number;
|
|
72
|
+
per_page?: number;
|
|
73
|
+
}) => Promise<DataWrapper<ResourceChannelMember[]>>;
|
|
74
|
+
/**
|
|
75
|
+
* Add a license by UUID. 400 if it is already a member.
|
|
76
|
+
*
|
|
77
|
+
* There is deliberately no endpoint that enumerates licenses, so this is a
|
|
78
|
+
* paste-a-UUID flow exactly as on the app side.
|
|
79
|
+
*/
|
|
80
|
+
addResourceChannelMember: (resourceId: string, channelId: string, licenseId: string) => Promise<DataWrapper<ResourceChannelMember>>;
|
|
81
|
+
/**
|
|
82
|
+
* Remove a license. Takes effect immediately — the backend flushes its decision
|
|
83
|
+
* cache, so the next read from that license is refused rather than served for
|
|
84
|
+
* the rest of the TTL.
|
|
85
|
+
*/
|
|
86
|
+
removeResourceChannelMember: (resourceId: string, channelId: string, licenseId: string) => Promise<MessageResponse>;
|
|
87
|
+
}
|
|
88
|
+
export declare function newResourceChannelFactory(client: AntHttpClient): ResourceChannelFactory;
|
|
89
|
+
//# sourceMappingURL=resourceChannels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceChannels.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceChannels.ts"],"names":[],"mappings":"AAAA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CAAA;IAChJ,oEAAoE;IACpE,4BAA4B,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAA;IAGtH,kFAAkF;IAClF,2BAA2B,EAAE,CAAC,UAAU,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,qBAAqB,EAAE,CAAC,CAAC,CAAA;IACpK;;;;;OAKG;IACH,wBAAwB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAA;IACnI;;;;OAIG;IACH,2BAA2B,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;CACpH;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,sBAAsB,CAyBvF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import qs from 'qs';
|
|
2
|
+
export function newResourceChannelFactory(client) {
|
|
3
|
+
const base = (resourceId) => `/store/resources/${resourceId}/channels`;
|
|
4
|
+
return {
|
|
5
|
+
fetchResourceChannels: resourceId => client.get(base(resourceId)),
|
|
6
|
+
createResourceChannel: (resourceId, data) => client.post(base(resourceId), data),
|
|
7
|
+
updateResourceChannel: (resourceId, channelId, data) => client.put(`${base(resourceId)}/${channelId}`, data),
|
|
8
|
+
deleteResourceChannel: (resourceId, channelId) => client.delete(`${base(resourceId)}/${channelId}`),
|
|
9
|
+
publishResourceVersion: (resourceId, channelId, versionId) => client.post(`${base(resourceId)}/${channelId}/publish`, { version_id: versionId }),
|
|
10
|
+
unpublishResourceChannel: (resourceId, channelId) => client.delete(`${base(resourceId)}/${channelId}/active-version`),
|
|
11
|
+
fetchResourceUnpublishImpact: (resourceId, channelId) => client.get(`${base(resourceId)}/${channelId}/unpublish-impact`),
|
|
12
|
+
fetchResourceChannelMembers: (resourceId, channelId, params = {}) => {
|
|
13
|
+
const queryString = qs.stringify(params, { skipNulls: true });
|
|
14
|
+
return client.get(`${base(resourceId)}/${channelId}/members${queryString ? `?${queryString}` : ''}`);
|
|
15
|
+
},
|
|
16
|
+
addResourceChannelMember: (resourceId, channelId, licenseId) => client.post(`${base(resourceId)}/${channelId}/members`, { license_id: licenseId }),
|
|
17
|
+
removeResourceChannelMember: (resourceId, channelId, licenseId) => client.delete(`${base(resourceId)}/${channelId}/members/${licenseId}`),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -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,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;IACtF;;;;OAIG;IACH,yBAAyB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAA;IACjH,yBAAyB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,qBAA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U,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,75 @@
|
|
|
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
|
+
/**
|
|
63
|
+
* Narrow a version's source, or a schema's, to the FILE variant (AAD-948).
|
|
64
|
+
*
|
|
65
|
+
* A runtime guard rather than a cast, because the discriminator is optional on the
|
|
66
|
+
* table half — `source.type` is absent for every version written before AAD-948 and
|
|
67
|
+
* for every table-sourced version since. `value.type === 'file'` is the only safe
|
|
68
|
+
* test, and putting it here means no call site has to remember that.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isFileSnapshotSource(value: unknown): value is {
|
|
71
|
+
type: 'file';
|
|
72
|
+
upload_id: string;
|
|
73
|
+
sha256: string | null;
|
|
74
|
+
};
|
|
75
|
+
//# 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;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAYrE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Narrow a version's source, or a schema's, to the FILE variant (AAD-948).
|
|
37
|
+
*
|
|
38
|
+
* A runtime guard rather than a cast, because the discriminator is optional on the
|
|
39
|
+
* table half — `source.type` is absent for every version written before AAD-948 and
|
|
40
|
+
* for every table-sourced version since. `value.type === 'file'` is the only safe
|
|
41
|
+
* test, and putting it here means no call site has to remember that.
|
|
42
|
+
*/
|
|
43
|
+
export function isFileSnapshotSource(value) {
|
|
44
|
+
if (typeof value !== 'object' || value === null)
|
|
45
|
+
return false;
|
|
46
|
+
const source = value;
|
|
47
|
+
// Every asserted field is CHECKED. A guard that narrows `upload_id` to `string`
|
|
48
|
+
// on the strength of the discriminator alone hands the caller a typed value that
|
|
49
|
+
// can be undefined at runtime — the exact failure a guard exists to prevent.
|
|
50
|
+
// `verified` is deliberately not asserted here: it is not validated, and the
|
|
51
|
+
// typed union already carries it for anyone who needs it.
|
|
52
|
+
return source.type === 'file'
|
|
53
|
+
&& typeof source.upload_id === 'string'
|
|
54
|
+
&& (typeof source.sha256 === 'string' || source.sha256 === null);
|
|
55
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SnapshotUpload, UploadSnapshotFileData } from '../types/snapshotUploads';
|
|
2
|
+
import type { AntHttpClient } from "../../../AntHttpClient";
|
|
3
|
+
import type { DataWrapper } from "../../../types";
|
|
4
|
+
/**
|
|
5
|
+
* Staging dataset files for a snapshot version (AAD-948).
|
|
6
|
+
*
|
|
7
|
+
* Its own factory rather than more methods on `resources.ts`, which is at 228 of the
|
|
8
|
+
* 250-line limit. The public surface is unchanged — both are composed into
|
|
9
|
+
* `SellableResourceFactory` and reached as `c.apps.*`.
|
|
10
|
+
*/
|
|
11
|
+
export interface ResourceUploadFactory {
|
|
12
|
+
/**
|
|
13
|
+
* Stage a dataset file and get back what the server made of it.
|
|
14
|
+
*
|
|
15
|
+
* Synchronous: the response carries the row count, the column count and a PROPOSED
|
|
16
|
+
* type per column, which is what the publisher confirms or overrides before a
|
|
17
|
+
* version exists.
|
|
18
|
+
*
|
|
19
|
+
* **Nothing is created if the file cannot be read.** A truncated JSON document, a
|
|
20
|
+
* CSV row that disagrees with its header, binary content or non-UTF-8 text is a
|
|
21
|
+
* **422 on `errors.file`** and leaves no upload behind. Render that as "pick another
|
|
22
|
+
* file", never as a failed version — a failed version is a different event with a
|
|
23
|
+
* retry attached.
|
|
24
|
+
*/
|
|
25
|
+
uploadSnapshotFile: (resourceId: string, data: UploadSnapshotFileData, requestConfig?: Record<string, any>) => Promise<DataWrapper<SnapshotUpload>>;
|
|
26
|
+
/**
|
|
27
|
+
* Discard an upload the publisher decided against.
|
|
28
|
+
*
|
|
29
|
+
* **409 once a version has claimed it.** At that point the bytes are that version's
|
|
30
|
+
* source, and removing them would turn its retry into a re-upload for no reason the
|
|
31
|
+
* publisher asked for. Deleting the version is the way to remove those, and it takes
|
|
32
|
+
* the upload with it.
|
|
33
|
+
*/
|
|
34
|
+
deleteSnapshotUpload: (resourceId: string, uploadId: string, requestConfig?: Record<string, any>) => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export declare function newResourceUploadFactory(client: AntHttpClient): ResourceUploadFactory;
|
|
37
|
+
//# sourceMappingURL=resourceUploads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceUploads.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceUploads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAG1C;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;OAYG;IACH,kBAAkB,EAAE,CAClB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,sBAAsB,EAC5B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAChC,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAA;IAEzC;;;;;;;OAOG;IACH,oBAAoB,EAAE,CACpB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;CACnB;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,GAAG,qBAAqB,CAUrF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { maybeFormData } from './formData';
|
|
2
|
+
export function newResourceUploadFactory(client) {
|
|
3
|
+
const base = (resourceId) => `/store/resources/${resourceId}/snapshot-uploads`;
|
|
4
|
+
return {
|
|
5
|
+
uploadSnapshotFile: (resourceId, data, requestConfig) => client.post(base(resourceId), maybeFormData(data), requestConfig),
|
|
6
|
+
deleteSnapshotUpload: (resourceId, uploadId, requestConfig) => client.delete(`${base(resourceId)}/${uploadId}`, requestConfig),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { CreateResourceVersionData, CreateSellableResourceData, FetchResourcesParams, LicenseResourceAccessEntry, ResourceAccessEntry, ResourceConsumer, ResourceEntitlement, ResourceVersion, RetryResourceVersionData, SellableResource, SellableResourceListItem, StoreCapabilities, UpdateSellableResourceData } from '../types';
|
|
2
|
+
import type { ResourceAssignmentFactory } from './resourceAssignments';
|
|
3
|
+
import type { ResourceChannelFactory } from './resourceChannels';
|
|
4
|
+
import type { ResourceCommerceFactory } from './resourceCommerce';
|
|
5
|
+
import type { ResourceSnapshotFactory } from './resourceSnapshot';
|
|
6
|
+
import type { ResourceUploadFactory } from './resourceUploads';
|
|
7
|
+
import type { MessageResponse } from "../../../AntConnect";
|
|
8
|
+
import type { AntHttpClient } from "../../../AntHttpClient";
|
|
9
|
+
import type { DataWrapper } from "../../../types";
|
|
10
|
+
/**
|
|
11
|
+
* Sellable resources (AAD-898) — the Store's second sellable thing.
|
|
12
|
+
*
|
|
13
|
+
* **The whole surface is behind a backend feature flag, default off.** Call
|
|
14
|
+
* `fetchStoreCapabilities()` first and render nothing resource-related when
|
|
15
|
+
* `resources_enabled` is false. Every route below returns 404 while the flag is
|
|
16
|
+
* off, so a 404 here does NOT mean "not found" — probing is not a way to detect
|
|
17
|
+
* the flag.
|
|
18
|
+
*
|
|
19
|
+
* Scope headers are never passed as arguments: `X-License-ID` is applied
|
|
20
|
+
* centrally by the app's request interceptor, and the backend resolves the
|
|
21
|
+
* caller's license from it. That is the whole entitlement context.
|
|
22
|
+
*/
|
|
23
|
+
export interface SellableResourceFactory extends ResourceAssignmentFactory, ResourceChannelFactory, ResourceCommerceFactory, ResourceSnapshotFactory, ResourceUploadFactory {
|
|
24
|
+
/**
|
|
25
|
+
* Which optional Store surfaces this deployment has on. NOT behind the flag —
|
|
26
|
+
* this is how you learn whether the flag is on.
|
|
27
|
+
*/
|
|
28
|
+
fetchStoreCapabilities: () => Promise<DataWrapper<StoreCapabilities>>;
|
|
29
|
+
fetchResources: (params?: FetchResourcesParams, requestConfig?: Record<string, any>) => Promise<DataWrapper<SellableResourceListItem[]>>;
|
|
30
|
+
fetchResource: (resourceId: string, requestConfig?: Record<string, any>) => Promise<DataWrapper<SellableResource>>;
|
|
31
|
+
createResource: (data: CreateSellableResourceData) => Promise<DataWrapper<SellableResource>>;
|
|
32
|
+
updateResource: (resourceId: string, data: UpdateSellableResourceData) => Promise<DataWrapper<SellableResource>>;
|
|
33
|
+
/** 409 when any license still holds an entitlement — revoke them first. */
|
|
34
|
+
deleteResource: (resourceId: string) => Promise<MessageResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Read what the resource sells, at THIS license's pinned version.
|
|
37
|
+
*
|
|
38
|
+
* On refusal the response body is a `ResourceAccessError` carrying a
|
|
39
|
+
* `reason` — branch on that, not on the status code, since three distinct
|
|
40
|
+
* states share 403. Use `isResourceAccessError()` to narrow an axios error.
|
|
41
|
+
*
|
|
42
|
+
* A `snapshot` resource returns data since AAD-939. An `endpoint` resource still
|
|
43
|
+
* returns 501 `payload_backend_not_implemented` until AAD-899 — not a bug, it
|
|
44
|
+
* means the access layer resolved and no backend is registered for that type.
|
|
45
|
+
*
|
|
46
|
+
* An entitled read of an empty dataset is a 200 with an empty body — "empty"
|
|
47
|
+
* and "not entitled" never look the same.
|
|
48
|
+
*
|
|
49
|
+
* **Formats (AAD-939).** `json` is canonical and comes back in the usual
|
|
50
|
+
* `{ data }` envelope. `csv` returns a RAW `text/csv` body with no envelope, so
|
|
51
|
+
* request it with `responseType: 'text'` and do not read `.data`. An unsupported
|
|
52
|
+
* format is a 422, never a silent fall back to JSON.
|
|
53
|
+
*
|
|
54
|
+
* **Conditional GET.** A pinned version's content is immutable, so the response
|
|
55
|
+
* carries a strong `ETag`; echo it back as `If-None-Match` for a 304. JSON and CSV
|
|
56
|
+
* have separate validators.
|
|
57
|
+
*
|
|
58
|
+
* **Size.** A dataset may be up to 100 MB. There is no paging yet, so a browser
|
|
59
|
+
* consumer should not assume a small body.
|
|
60
|
+
*/
|
|
61
|
+
readResourceData: (resourceId: string, params?: {
|
|
62
|
+
format?: 'json' | 'csv';
|
|
63
|
+
}, requestConfig?: Record<string, any>) => Promise<DataWrapper<unknown>>;
|
|
64
|
+
/**
|
|
65
|
+
* The publisher's full version catalogue.
|
|
66
|
+
*
|
|
67
|
+
* ⚠️ **PUBLISHER-ONLY — a buyer gets 403.** This was `view` (which every license
|
|
68
|
+
* that can see the listing passes), so an entitled buyer could enumerate every
|
|
69
|
+
* draft the publisher had registered and never released. It is now gated on the
|
|
70
|
+
* publishing hat, and an unrelated license's admin is refused too.
|
|
71
|
+
*
|
|
72
|
+
* **Do not call this from a consumer surface.** Everything a buyer needs is on
|
|
73
|
+
* the detail payload: `entitlement.pinned_version` is what they read,
|
|
74
|
+
* `channels[].active_version` is what is on offer, and `SellableResource.versions`
|
|
75
|
+
* carries the FULL version for exactly those two — see there.
|
|
76
|
+
*/
|
|
77
|
+
fetchResourceVersions: (resourceId: string) => Promise<DataWrapper<ResourceVersion[]>>;
|
|
78
|
+
/**
|
|
79
|
+
* Poll this after creating a version whose payload is prepared asynchronously
|
|
80
|
+
* (AAD-939) — `payload_state` moves `pending` -> `ready` | `failed`.
|
|
81
|
+
*/
|
|
82
|
+
fetchResourceVersion: (resourceId: string, versionId: string) => Promise<DataWrapper<ResourceVersion>>;
|
|
83
|
+
/**
|
|
84
|
+
* Register a version.
|
|
85
|
+
*
|
|
86
|
+
* **For a `snapshot` resource this returns `payload_state: 'pending'` and the
|
|
87
|
+
* artifact is built by a QUEUED JOB (AAD-939).** Do not treat the response as
|
|
88
|
+
* servable: poll `fetchResourceVersion()` until `payload_state` leaves `pending`,
|
|
89
|
+
* and arm Publish from the poll — publishing a version that is not `ready` is a
|
|
90
|
+
* 422 on `errors.version_id`.
|
|
91
|
+
*
|
|
92
|
+
* On `failed`, `payload_error` is publisher-facing and specific (for example
|
|
93
|
+
* "This selection produces 3,241,884 rows. The limit is 500,000."). Show it
|
|
94
|
+
* verbatim; it is written to be shown.
|
|
95
|
+
*
|
|
96
|
+
* Validate the selection with `previewResourceSnapshot()` first so the publisher
|
|
97
|
+
* sees the row count and size before committing to a version number.
|
|
98
|
+
*/
|
|
99
|
+
createResourceVersion: (resourceId: string, data: CreateResourceVersionData) => Promise<DataWrapper<ResourceVersion>>;
|
|
100
|
+
/**
|
|
101
|
+
* Delete a version.
|
|
102
|
+
*
|
|
103
|
+
* **409, not a silent unpublish (AAD-950).** Refused while a channel is serving
|
|
104
|
+
* the version — the message names the channel — and while any license is pinned
|
|
105
|
+
* to it. Pull the channel with `unpublishResourceChannel()` first, deliberately,
|
|
106
|
+
* so the publisher sees the blast radius via `fetchResourceUnpublishImpact()`
|
|
107
|
+
* instead of it happening behind a delete.
|
|
108
|
+
*
|
|
109
|
+
* The version number is freed for reuse ONLY if the version was never live. One
|
|
110
|
+
* that was published and later removed keeps its number reserved permanently, and
|
|
111
|
+
* re-creating it is a 409 saying so — a buyer may hold that dataset, and the
|
|
112
|
+
* version string is how they identify it.
|
|
113
|
+
*/
|
|
114
|
+
deleteResourceVersion: (resourceId: string, versionId: string) => Promise<MessageResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Re-run a failed materialisation, KEEPING the version number (AAD-950).
|
|
117
|
+
*
|
|
118
|
+
* The escape from a failed publish. 409 unless `payload_state` is `failed`
|
|
119
|
+
* (`ready` has nothing to retry, `pending` already has a job running); 422 on a
|
|
120
|
+
* resource with no payload to prepare.
|
|
121
|
+
*
|
|
122
|
+
* Returns the version back in `pending` — resume the same poll you run after
|
|
123
|
+
* `createResourceVersion()`; there is no second state machine.
|
|
124
|
+
*
|
|
125
|
+
* Pass `payload_config` to REPLACE the stored selection. Send it whenever the
|
|
126
|
+
* failure was caused by the selection itself rather than by a transient fault —
|
|
127
|
+
* `source_table_missing` and `unpublishable_column_type` will reproduce forever on
|
|
128
|
+
* a bare replay. It is held to the same contract as on create, personal-data
|
|
129
|
+
* declaration included.
|
|
130
|
+
*/
|
|
131
|
+
retryResourceVersion: (resourceId: string, versionId: string, data?: RetryResourceVersionData) => Promise<DataWrapper<ResourceVersion>>;
|
|
132
|
+
fetchResourceEntitlements: (resourceId: string) => Promise<DataWrapper<ResourceEntitlement[]>>;
|
|
133
|
+
/** Lifetime call totals per consuming license. Not a time series. */
|
|
134
|
+
fetchResourceConsumers: (resourceId: string) => Promise<DataWrapper<ResourceConsumer[]>>;
|
|
135
|
+
revokeResourceEntitlement: (resourceId: string, entitlementId: string) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
136
|
+
/**
|
|
137
|
+
* Force every cached entitlement decision for this resource to be recomputed.
|
|
138
|
+
* Revoking already does this; use it when state changed outside the normal
|
|
139
|
+
* paths, or to avoid waiting out the 60–300s decision TTL.
|
|
140
|
+
*/
|
|
141
|
+
flushResourceEntitlementCache: (resourceId: string) => Promise<MessageResponse>;
|
|
142
|
+
/** Everything this license holds, with the version each is pinned to. */
|
|
143
|
+
fetchMyResourceAccess: () => Promise<DataWrapper<ResourceAccessEntry[]>>;
|
|
144
|
+
/**
|
|
145
|
+
* Everything the LICENSE holds, usable or not — the trigger resource picker
|
|
146
|
+
* (AAD-940).
|
|
147
|
+
*
|
|
148
|
+
* Use this and not `fetchMyResourceAccess()` when choosing a resource for a
|
|
149
|
+
* trigger to consume. That one filters by the signed-in user's grant and drops
|
|
150
|
+
* revoked rows, and a trigger has no user, so it both hides resources the
|
|
151
|
+
* trigger could legitimately consume and makes a lapsed entitlement look like
|
|
152
|
+
* nothing was ever bought.
|
|
153
|
+
*/
|
|
154
|
+
fetchLicenseResourceAccess: () => Promise<DataWrapper<LicenseResourceAccessEntry[]>>;
|
|
155
|
+
/**
|
|
156
|
+
* Opt in to the version this license's channel now serves.
|
|
157
|
+
*
|
|
158
|
+
* The only routine way a pin moves forward — publishing does not move it, and
|
|
159
|
+
* that is the guarantee the buyer bought. Also the recovery action after a
|
|
160
|
+
* `version_withdrawn` block. 409 when already current.
|
|
161
|
+
*/
|
|
162
|
+
moveResourceToChannelVersion: (resourceId: string) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
163
|
+
switchResourceChannel: (resourceId: string, channelId: string) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
164
|
+
setResourceAutoUpdate: (resourceId: string, enabled: boolean) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
165
|
+
}
|
|
166
|
+
export declare function newSellableResourceFactory(client: AntHttpClient): SellableResourceFactory;
|
|
167
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,4BAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAQ1C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,uBAAwB,SAAQ,yBAAyB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,qBAAqB;IACzK;;;OAGG;IACH,sBAAsB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAGrE,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAA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AO,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;CAC3G;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,uBAAuB,CAmDzF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import qs from 'qs';
|
|
2
|
+
import { newResourceAssignmentFactory } from './resourceAssignments';
|
|
3
|
+
import { newResourceChannelFactory } from './resourceChannels';
|
|
4
|
+
import { newResourceCommerceFactory } from './resourceCommerce';
|
|
5
|
+
import { newResourceSnapshotFactory } from './resourceSnapshot';
|
|
6
|
+
import { newResourceUploadFactory } from './resourceUploads';
|
|
7
|
+
export function newSellableResourceFactory(client) {
|
|
8
|
+
const base = (resourceId) => `/store/resources/${resourceId}`;
|
|
9
|
+
return {
|
|
10
|
+
// Commerce (AAD-898) and snapshot payloads (AAD-939) live in their own files for
|
|
11
|
+
// size; folded in here so the public surface stays one factory.
|
|
12
|
+
...newResourceAssignmentFactory(client),
|
|
13
|
+
...newResourceChannelFactory(client),
|
|
14
|
+
...newResourceCommerceFactory(client),
|
|
15
|
+
...newResourceSnapshotFactory(client),
|
|
16
|
+
...newResourceUploadFactory(client),
|
|
17
|
+
fetchStoreCapabilities: () => client.get('/store/capabilities'),
|
|
18
|
+
fetchResources: (params = {}, requestConfig) => {
|
|
19
|
+
const queryString = qs.stringify(params, { skipNulls: true, arrayFormat: 'brackets' });
|
|
20
|
+
return client.get(`/store/resources${queryString ? `?${queryString}` : ''}`, requestConfig);
|
|
21
|
+
},
|
|
22
|
+
fetchResource: (resourceId, requestConfig) => client.get(base(resourceId), requestConfig),
|
|
23
|
+
createResource: data => client.post('/store/resources', data),
|
|
24
|
+
updateResource: (resourceId, data) => client.put(base(resourceId), data),
|
|
25
|
+
deleteResource: resourceId => client.delete(base(resourceId)),
|
|
26
|
+
readResourceData: (resourceId, params = {}, requestConfig) => {
|
|
27
|
+
const queryString = qs.stringify(params, { skipNulls: true });
|
|
28
|
+
return client.get(`${base(resourceId)}/data${queryString ? `?${queryString}` : ''}`, requestConfig);
|
|
29
|
+
},
|
|
30
|
+
fetchResourceVersions: resourceId => client.get(`${base(resourceId)}/versions`),
|
|
31
|
+
fetchResourceVersion: (resourceId, versionId) => client.get(`${base(resourceId)}/versions/${versionId}`),
|
|
32
|
+
createResourceVersion: (resourceId, data) => client.post(`${base(resourceId)}/versions`, data),
|
|
33
|
+
deleteResourceVersion: (resourceId, versionId) => client.delete(`${base(resourceId)}/versions/${versionId}`),
|
|
34
|
+
retryResourceVersion: (resourceId, versionId, data = {}) => client.post(`${base(resourceId)}/versions/${versionId}/retry`, data),
|
|
35
|
+
fetchResourceEntitlements: resourceId => client.get(`${base(resourceId)}/entitlements`),
|
|
36
|
+
fetchResourceConsumers: resourceId => client.get(`${base(resourceId)}/consumers`),
|
|
37
|
+
revokeResourceEntitlement: (resourceId, entitlementId) => client.post(`${base(resourceId)}/entitlements/${entitlementId}/revoke`),
|
|
38
|
+
flushResourceEntitlementCache: resourceId => client.post(`${base(resourceId)}/entitlements/flush-cache`),
|
|
39
|
+
fetchMyResourceAccess: () => client.get('/store/resources/my-access'),
|
|
40
|
+
fetchLicenseResourceAccess: () => client.get('/store/resources/license-access'),
|
|
41
|
+
moveResourceToChannelVersion: resourceId => client.post(`${base(resourceId)}/entitlement/version`),
|
|
42
|
+
switchResourceChannel: (resourceId, channelId) => client.post(`${base(resourceId)}/entitlement/channel`, { channel_id: channelId }),
|
|
43
|
+
setResourceAutoUpdate: (resourceId, enabled) => client.post(`${base(resourceId)}/entitlement/auto-update`, { enabled }),
|
|
44
|
+
};
|
|
45
|
+
}
|