@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.
- 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.js +1 -1
- package/build/comms/hostAPI.js +1 -1
- package/build/comms/models.d.ts +20 -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/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/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 +37 -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 +62 -0
- package/build/services/AppService/factory/resourceSnapshot.d.ts.map +1 -0
- package/build/services/AppService/factory/resourceSnapshot.js +34 -0
- package/build/services/AppService/factory/resources.d.ts +153 -0
- package/build/services/AppService/factory/resources.d.ts.map +1 -0
- package/build/services/AppService/factory/resources.js +44 -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/index.d.ts +59 -0
- package/build/services/AppService/index.d.ts.map +1 -0
- package/build/services/AppService/index.js +76 -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 +16 -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/resourceEntitlements.d.ts +101 -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 +143 -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 +105 -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 +189 -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/snapshotPayload.d.ts +146 -0
- package/build/services/AppService/types/snapshotPayload.d.ts.map +1 -0
- package/build/services/AppService/types/snapshotPayload.js +16 -0
- package/build/services/AppService/types/snapshotSources.d.ts +98 -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/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.d.ts +23 -0
- package/build/services/AppService/types.d.ts.map +1 -0
- package/build/services/AppService/types.js +25 -0
- package/build/services/DmsService.d.ts +13 -0
- package/build/services/DmsService.d.ts.map +1 -1
- 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 +1 -0
- package/build/services/ProjectService.d.ts.map +1 -1
- 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.types.d.ts +21 -4
- 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/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 +28 -0
- package/build/services/Webhook/TriggerService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerService.js +10 -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 +37 -0
- package/build/services/userPreferences.d.ts.map +1 -0
- package/build/services/userPreferences.js +39 -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,153 @@
|
|
|
1
|
+
import type { CreateResourceChannelData, CreateResourceVersionData, CreateSellableResourceData, FetchResourcesParams, ResourceAccessEntry, ResourceChannel, ResourceConsumer, ResourceEntitlement, ResourceUnpublishImpact, ResourceVersion, SellableResource, SellableResourceListItem, StoreCapabilities, UpdateSellableResourceData } from '../types';
|
|
2
|
+
import type { ResourceCommerceFactory } from './resourceCommerce';
|
|
3
|
+
import type { ResourceSnapshotFactory } from './resourceSnapshot';
|
|
4
|
+
import type { MessageResponse } from "../../../AntConnect";
|
|
5
|
+
import type { AntHttpClient } from "../../../AntHttpClient";
|
|
6
|
+
import type { DataWrapper } from "../../../types";
|
|
7
|
+
/**
|
|
8
|
+
* Sellable resources (AAD-898) — the Store's second sellable thing.
|
|
9
|
+
*
|
|
10
|
+
* **The whole surface is behind a backend feature flag, default off.** Call
|
|
11
|
+
* `fetchStoreCapabilities()` first and render nothing resource-related when
|
|
12
|
+
* `resources_enabled` is false. Every route below returns 404 while the flag is
|
|
13
|
+
* off, so a 404 here does NOT mean "not found" — probing is not a way to detect
|
|
14
|
+
* the flag.
|
|
15
|
+
*
|
|
16
|
+
* Scope headers are never passed as arguments: `X-License-ID` is applied
|
|
17
|
+
* centrally by the app's request interceptor, and the backend resolves the
|
|
18
|
+
* caller's license from it. That is the whole entitlement context.
|
|
19
|
+
*/
|
|
20
|
+
export interface SellableResourceFactory extends ResourceCommerceFactory, ResourceSnapshotFactory {
|
|
21
|
+
/**
|
|
22
|
+
* Which optional Store surfaces this deployment has on. NOT behind the flag —
|
|
23
|
+
* this is how you learn whether the flag is on.
|
|
24
|
+
*/
|
|
25
|
+
fetchStoreCapabilities: () => Promise<DataWrapper<StoreCapabilities>>;
|
|
26
|
+
fetchResources: (params?: FetchResourcesParams, requestConfig?: Record<string, any>) => Promise<DataWrapper<SellableResourceListItem[]>>;
|
|
27
|
+
fetchResource: (resourceId: string, requestConfig?: Record<string, any>) => Promise<DataWrapper<SellableResource>>;
|
|
28
|
+
createResource: (data: CreateSellableResourceData) => Promise<DataWrapper<SellableResource>>;
|
|
29
|
+
updateResource: (resourceId: string, data: UpdateSellableResourceData) => Promise<DataWrapper<SellableResource>>;
|
|
30
|
+
/** 409 when any license still holds an entitlement — revoke them first. */
|
|
31
|
+
deleteResource: (resourceId: string) => Promise<MessageResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Read what the resource sells, at THIS license's pinned version.
|
|
34
|
+
*
|
|
35
|
+
* On refusal the response body is a `ResourceAccessError` carrying a
|
|
36
|
+
* `reason` — branch on that, not on the status code, since three distinct
|
|
37
|
+
* states share 403. Use `isResourceAccessError()` to narrow an axios error.
|
|
38
|
+
*
|
|
39
|
+
* A `snapshot` resource returns data since AAD-939. An `endpoint` resource still
|
|
40
|
+
* returns 501 `payload_backend_not_implemented` until AAD-899 — not a bug, it
|
|
41
|
+
* means the access layer resolved and no backend is registered for that type.
|
|
42
|
+
*
|
|
43
|
+
* An entitled read of an empty dataset is a 200 with an empty body — "empty"
|
|
44
|
+
* and "not entitled" never look the same.
|
|
45
|
+
*
|
|
46
|
+
* **Formats (AAD-939).** `json` is canonical and comes back in the usual
|
|
47
|
+
* `{ data }` envelope. `csv` returns a RAW `text/csv` body with no envelope, so
|
|
48
|
+
* request it with `responseType: 'text'` and do not read `.data`. An unsupported
|
|
49
|
+
* format is a 422, never a silent fall back to JSON.
|
|
50
|
+
*
|
|
51
|
+
* **Conditional GET.** A pinned version's content is immutable, so the response
|
|
52
|
+
* carries a strong `ETag`; echo it back as `If-None-Match` for a 304. JSON and CSV
|
|
53
|
+
* have separate validators.
|
|
54
|
+
*
|
|
55
|
+
* **Size.** A dataset may be up to 100 MB. There is no paging yet, so a browser
|
|
56
|
+
* consumer should not assume a small body.
|
|
57
|
+
*/
|
|
58
|
+
readResourceData: (resourceId: string, params?: {
|
|
59
|
+
format?: 'json' | 'csv';
|
|
60
|
+
}, requestConfig?: Record<string, any>) => Promise<DataWrapper<unknown>>;
|
|
61
|
+
/**
|
|
62
|
+
* The publisher's full version catalogue.
|
|
63
|
+
*
|
|
64
|
+
* ⚠️ **PUBLISHER-ONLY — a buyer gets 403.** This was `view` (which every license
|
|
65
|
+
* that can see the listing passes), so an entitled buyer could enumerate every
|
|
66
|
+
* draft the publisher had registered and never released. It is now gated on the
|
|
67
|
+
* publishing hat, and an unrelated license's admin is refused too.
|
|
68
|
+
*
|
|
69
|
+
* **Do not call this from a consumer surface.** Everything a buyer needs is on
|
|
70
|
+
* the detail payload: `entitlement.pinned_version` is what they read,
|
|
71
|
+
* `channels[].active_version` is what is on offer, and `SellableResource.versions`
|
|
72
|
+
* carries the FULL version for exactly those two — see there.
|
|
73
|
+
*/
|
|
74
|
+
fetchResourceVersions: (resourceId: string) => Promise<DataWrapper<ResourceVersion[]>>;
|
|
75
|
+
/**
|
|
76
|
+
* Poll this after creating a version whose payload is prepared asynchronously
|
|
77
|
+
* (AAD-939) — `payload_state` moves `pending` -> `ready` | `failed`.
|
|
78
|
+
*/
|
|
79
|
+
fetchResourceVersion: (resourceId: string, versionId: string) => Promise<DataWrapper<ResourceVersion>>;
|
|
80
|
+
/**
|
|
81
|
+
* Register a version.
|
|
82
|
+
*
|
|
83
|
+
* **For a `snapshot` resource this returns `payload_state: 'pending'` and the
|
|
84
|
+
* artifact is built by a QUEUED JOB (AAD-939).** Do not treat the response as
|
|
85
|
+
* servable: poll `fetchResourceVersion()` until `payload_state` leaves `pending`,
|
|
86
|
+
* and arm Publish from the poll — publishing a version that is not `ready` is a
|
|
87
|
+
* 422 on `errors.version_id`.
|
|
88
|
+
*
|
|
89
|
+
* On `failed`, `payload_error` is publisher-facing and specific (for example
|
|
90
|
+
* "This selection produces 3,241,884 rows. The limit is 500,000."). Show it
|
|
91
|
+
* verbatim; it is written to be shown.
|
|
92
|
+
*
|
|
93
|
+
* Validate the selection with `previewResourceSnapshot()` first so the publisher
|
|
94
|
+
* sees the row count and size before committing to a version number.
|
|
95
|
+
*/
|
|
96
|
+
createResourceVersion: (resourceId: string, data: CreateResourceVersionData) => Promise<DataWrapper<ResourceVersion>>;
|
|
97
|
+
/** Refused while any license is pinned to it. */
|
|
98
|
+
deleteResourceVersion: (resourceId: string, versionId: string) => Promise<MessageResponse>;
|
|
99
|
+
fetchResourceChannels: (resourceId: string) => Promise<DataWrapper<ResourceChannel[]>>;
|
|
100
|
+
createResourceChannel: (resourceId: string, data: CreateResourceChannelData) => Promise<DataWrapper<ResourceChannel>>;
|
|
101
|
+
updateResourceChannel: (resourceId: string, channelId: string, data: CreateResourceChannelData) => Promise<DataWrapper<ResourceChannel>>;
|
|
102
|
+
/** The default channel cannot be deleted (400). */
|
|
103
|
+
deleteResourceChannel: (resourceId: string, channelId: string) => Promise<MessageResponse>;
|
|
104
|
+
/**
|
|
105
|
+
* Make a version live.
|
|
106
|
+
*
|
|
107
|
+
* Publishing FORWARD supersedes and moves nobody — existing buyers stay on
|
|
108
|
+
* their pin and simply gain an available update. Publishing an OLDER version
|
|
109
|
+
* is a rollback: buyers stranded ahead of it are force-moved down onto it,
|
|
110
|
+
* regardless of their `auto_update` setting. 422 if the version's payload is
|
|
111
|
+
* not `ready`.
|
|
112
|
+
*/
|
|
113
|
+
publishResourceVersion: (resourceId: string, channelId: string, versionId: string) => Promise<DataWrapper<ResourceChannel>>;
|
|
114
|
+
/**
|
|
115
|
+
* Unrelease: clear the channel's active version AND withdraw every holder
|
|
116
|
+
* drawing from it. Synchronous — the pulled build stops being served
|
|
117
|
+
* immediately. Nobody is exempt, the publisher included.
|
|
118
|
+
*/
|
|
119
|
+
unpublishResourceChannel: (resourceId: string, channelId: string) => Promise<{
|
|
120
|
+
message: string;
|
|
121
|
+
data: {
|
|
122
|
+
withdrawn: {
|
|
123
|
+
entitlements: number;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
}>;
|
|
127
|
+
/** Who an unpublish would cut off — show this before confirming. */
|
|
128
|
+
fetchResourceUnpublishImpact: (resourceId: string, channelId: string) => Promise<DataWrapper<ResourceUnpublishImpact>>;
|
|
129
|
+
fetchResourceEntitlements: (resourceId: string) => Promise<DataWrapper<ResourceEntitlement[]>>;
|
|
130
|
+
/** Lifetime call totals per consuming license. Not a time series. */
|
|
131
|
+
fetchResourceConsumers: (resourceId: string) => Promise<DataWrapper<ResourceConsumer[]>>;
|
|
132
|
+
revokeResourceEntitlement: (resourceId: string, entitlementId: string) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
133
|
+
/**
|
|
134
|
+
* Force every cached entitlement decision for this resource to be recomputed.
|
|
135
|
+
* Revoking already does this; use it when state changed outside the normal
|
|
136
|
+
* paths, or to avoid waiting out the 60–300s decision TTL.
|
|
137
|
+
*/
|
|
138
|
+
flushResourceEntitlementCache: (resourceId: string) => Promise<MessageResponse>;
|
|
139
|
+
/** Everything this license holds, with the version each is pinned to. */
|
|
140
|
+
fetchMyResourceAccess: () => Promise<DataWrapper<ResourceAccessEntry[]>>;
|
|
141
|
+
/**
|
|
142
|
+
* Opt in to the version this license's channel now serves.
|
|
143
|
+
*
|
|
144
|
+
* The only routine way a pin moves forward — publishing does not move it, and
|
|
145
|
+
* that is the guarantee the buyer bought. Also the recovery action after a
|
|
146
|
+
* `version_withdrawn` block. 409 when already current.
|
|
147
|
+
*/
|
|
148
|
+
moveResourceToChannelVersion: (resourceId: string) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
149
|
+
switchResourceChannel: (resourceId: string, channelId: string) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
150
|
+
setResourceAutoUpdate: (resourceId: string, enabled: boolean) => Promise<DataWrapper<ResourceEntitlement>>;
|
|
151
|
+
}
|
|
152
|
+
export declare function newSellableResourceFactory(client: AntHttpClient): SellableResourceFactory;
|
|
153
|
+
//# 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,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,4BAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAK1C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,uBAAwB,SAAQ,uBAAuB,EAAE,uBAAuB;IAC/F;;;OAGG;IACH,sBAAsB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAGrE,cAAc,EAAE,CAA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W,CAAC,uBAAuB,CAAC,CAAC,CAAA;IAGtH,yBAAyB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAA;IAC9F,qEAAqE;IACrE,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAA;IACxF,yBAAyB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACnH;;;;OAIG;IACH,6BAA6B,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;IAG/E,yEAAyE;IACzE,qBAAqB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAA;IACxE;;;;;;OAMG;IACH,4BAA4B,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAC/F,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAC3G,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;CAC3G;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,uBAAuB,CAwDzF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import qs from 'qs';
|
|
2
|
+
import { newResourceCommerceFactory } from './resourceCommerce';
|
|
3
|
+
import { newResourceSnapshotFactory } from './resourceSnapshot';
|
|
4
|
+
export function newSellableResourceFactory(client) {
|
|
5
|
+
const base = (resourceId) => `/store/resources/${resourceId}`;
|
|
6
|
+
return {
|
|
7
|
+
// Commerce (AAD-898) and snapshot payloads (AAD-939) live in their own files for
|
|
8
|
+
// size; folded in here so the public surface stays one factory.
|
|
9
|
+
...newResourceCommerceFactory(client),
|
|
10
|
+
...newResourceSnapshotFactory(client),
|
|
11
|
+
fetchStoreCapabilities: () => client.get('/store/capabilities'),
|
|
12
|
+
fetchResources: (params = {}, requestConfig) => {
|
|
13
|
+
const queryString = qs.stringify(params, { skipNulls: true, arrayFormat: 'brackets' });
|
|
14
|
+
return client.get(`/store/resources${queryString ? `?${queryString}` : ''}`, requestConfig);
|
|
15
|
+
},
|
|
16
|
+
fetchResource: (resourceId, requestConfig) => client.get(base(resourceId), requestConfig),
|
|
17
|
+
createResource: data => client.post('/store/resources', data),
|
|
18
|
+
updateResource: (resourceId, data) => client.put(base(resourceId), data),
|
|
19
|
+
deleteResource: resourceId => client.delete(base(resourceId)),
|
|
20
|
+
readResourceData: (resourceId, params = {}, requestConfig) => {
|
|
21
|
+
const queryString = qs.stringify(params, { skipNulls: true });
|
|
22
|
+
return client.get(`${base(resourceId)}/data${queryString ? `?${queryString}` : ''}`, requestConfig);
|
|
23
|
+
},
|
|
24
|
+
fetchResourceVersions: resourceId => client.get(`${base(resourceId)}/versions`),
|
|
25
|
+
fetchResourceVersion: (resourceId, versionId) => client.get(`${base(resourceId)}/versions/${versionId}`),
|
|
26
|
+
createResourceVersion: (resourceId, data) => client.post(`${base(resourceId)}/versions`, data),
|
|
27
|
+
deleteResourceVersion: (resourceId, versionId) => client.delete(`${base(resourceId)}/versions/${versionId}`),
|
|
28
|
+
fetchResourceChannels: resourceId => client.get(`${base(resourceId)}/channels`),
|
|
29
|
+
createResourceChannel: (resourceId, data) => client.post(`${base(resourceId)}/channels`, data),
|
|
30
|
+
updateResourceChannel: (resourceId, channelId, data) => client.put(`${base(resourceId)}/channels/${channelId}`, data),
|
|
31
|
+
deleteResourceChannel: (resourceId, channelId) => client.delete(`${base(resourceId)}/channels/${channelId}`),
|
|
32
|
+
publishResourceVersion: (resourceId, channelId, versionId) => client.post(`${base(resourceId)}/channels/${channelId}/publish`, { version_id: versionId }),
|
|
33
|
+
unpublishResourceChannel: (resourceId, channelId) => client.delete(`${base(resourceId)}/channels/${channelId}/active-version`),
|
|
34
|
+
fetchResourceUnpublishImpact: (resourceId, channelId) => client.get(`${base(resourceId)}/channels/${channelId}/unpublish-impact`),
|
|
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
|
+
moveResourceToChannelVersion: resourceId => client.post(`${base(resourceId)}/entitlement/version`),
|
|
41
|
+
switchResourceChannel: (resourceId, channelId) => client.post(`${base(resourceId)}/entitlement/channel`, { channel_id: channelId }),
|
|
42
|
+
setResourceAutoUpdate: (resourceId, enabled) => client.post(`${base(resourceId)}/entitlement/auto-update`, { enabled }),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AssignSeatData, AvailableSeatUser, ConfirmPaymentData, CreatePricingTierData, CreateSubscriptionData, FetchAppSubscriptionsParams, PricingTier, RequestSeatChangeData, RequestTierChangeData, Subscription, SubscriptionSeat, UpdatePricingTierData, UpdateSubscriptionData } from '../types';
|
|
2
|
+
import type { MessageResponse } from "../../../AntConnect";
|
|
3
|
+
import type { AntHttpClient } from "../../../AntHttpClient";
|
|
4
|
+
import type { DataWrapper } from "../../../types";
|
|
5
|
+
export interface SubscriptionFactory {
|
|
6
|
+
fetchPricingTiers: (appId: string, requestConfig?: Record<string, any>) => Promise<DataWrapper<PricingTier[]>>;
|
|
7
|
+
createPricingTier: (appId: string, data: CreatePricingTierData) => Promise<DataWrapper<PricingTier>>;
|
|
8
|
+
updatePricingTier: (appId: string, tierId: string, data: UpdatePricingTierData) => Promise<DataWrapper<PricingTier>>;
|
|
9
|
+
deletePricingTier: (appId: string, tierId: string) => Promise<MessageResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the current subscription for the current license, or `data: null`
|
|
12
|
+
* when none exists. Prefers an active/trial/grace subscription; falls back to
|
|
13
|
+
* a `pending_approval` purchase request so the App Detail page can render the
|
|
14
|
+
* "pending approval" state instead of the purchase CTA. "No subscription yet"
|
|
15
|
+
* is a normal state — callers must handle null without treating it as an error.
|
|
16
|
+
*/
|
|
17
|
+
fetchCurrentSubscription: (appId: string) => Promise<DataWrapper<Subscription | null>>;
|
|
18
|
+
fetchSubscription: (appId: string, subscriptionId: string) => Promise<DataWrapper<Subscription>>;
|
|
19
|
+
/**
|
|
20
|
+
* Buyer requests to purchase a tier. The returned subscription is
|
|
21
|
+
* `pending_approval` — access is NOT granted until the publisher approves.
|
|
22
|
+
*/
|
|
23
|
+
createSubscription: (appId: string, data: CreateSubscriptionData) => Promise<DataWrapper<Subscription>>;
|
|
24
|
+
updateSubscription: (appId: string, subscriptionId: string, data: UpdateSubscriptionData) => Promise<DataWrapper<Subscription>>;
|
|
25
|
+
cancelSubscription: (appId: string, subscriptionId: string) => Promise<DataWrapper<Subscription>>;
|
|
26
|
+
/**
|
|
27
|
+
* Buyer recovery: reactivate a cancelled subscription that is still inside
|
|
28
|
+
* its paid period. Restores `trial`/`active` without a new purchase. The BE
|
|
29
|
+
* returns 409 if the subscription is not cancelled or its period has already
|
|
30
|
+
* ended (in that case create a fresh subscription instead).
|
|
31
|
+
*/
|
|
32
|
+
reactivateSubscription: (appId: string, subscriptionId: string) => Promise<DataWrapper<Subscription>>;
|
|
33
|
+
/** Publisher inbox — pending purchase requests awaiting approval for this app. */
|
|
34
|
+
fetchPendingApprovals: (appId: string) => Promise<DataWrapper<Subscription[]>>;
|
|
35
|
+
/**
|
|
36
|
+
* Publisher list of the app's subscriptions (active/trial/grace/expired/
|
|
37
|
+
* cancelled). Excludes `pending_approval` by default — use `fetchPendingApprovals`
|
|
38
|
+
* for the inbox. Drives the "Active subscriptions" list + renewal confirmation.
|
|
39
|
+
*/
|
|
40
|
+
fetchAppSubscriptions: (appId: string, params?: FetchAppSubscriptionsParams) => Promise<DataWrapper<Subscription[]>>;
|
|
41
|
+
/** Publisher approves a pending purchase request — grants access (trial/active). */
|
|
42
|
+
approvePurchase: (appId: string, subscriptionId: string) => Promise<DataWrapper<Subscription>>;
|
|
43
|
+
/** Publisher denies a pending purchase request — no access is granted (cancelled). */
|
|
44
|
+
denyPurchase: (appId: string, subscriptionId: string) => Promise<DataWrapper<Subscription>>;
|
|
45
|
+
/**
|
|
46
|
+
* Publisher confirms the next recurring offline payment was received,
|
|
47
|
+
* advancing the billing period. NOTE: this is a PUBLISHER (seller) action —
|
|
48
|
+
* it replaces the former buyer-side `confirmSubscriptionPayment`.
|
|
49
|
+
*/
|
|
50
|
+
confirmRenewal: (appId: string, subscriptionId: string, data?: ConfirmPaymentData) => Promise<DataWrapper<Subscription>>;
|
|
51
|
+
/** Buyer requests a tier change. Returns 202 — change is applied on confirm. */
|
|
52
|
+
requestTierChange: (appId: string, subscriptionId: string, data: RequestTierChangeData) => Promise<DataWrapper<Subscription>>;
|
|
53
|
+
/** Publisher confirms a pending tier change request (records the offline payment). */
|
|
54
|
+
confirmTierChange: (appId: string, subscriptionId: string, data?: ConfirmPaymentData) => Promise<DataWrapper<Subscription>>;
|
|
55
|
+
/** Publisher rejects a pending tier change request. */
|
|
56
|
+
rejectTierChange: (appId: string, subscriptionId: string) => Promise<DataWrapper<Subscription>>;
|
|
57
|
+
/**
|
|
58
|
+
* Buyer requests a seat INCREASE (buying more seats — offline payment).
|
|
59
|
+
* Returns 202; the new seat count is applied only when the publisher confirms.
|
|
60
|
+
* Seat decreases use `updateSubscription` (no charge).
|
|
61
|
+
*/
|
|
62
|
+
requestSeatChange: (appId: string, subscriptionId: string, data: RequestSeatChangeData) => Promise<DataWrapper<Subscription>>;
|
|
63
|
+
/** Publisher confirms the offline payment — applies the new seat count. */
|
|
64
|
+
confirmSeatChange: (appId: string, subscriptionId: string, data?: ConfirmPaymentData) => Promise<DataWrapper<Subscription>>;
|
|
65
|
+
/** Publisher rejects a pending seat change request. */
|
|
66
|
+
rejectSeatChange: (appId: string, subscriptionId: string) => Promise<DataWrapper<Subscription>>;
|
|
67
|
+
fetchSubscriptionSeats: (appId: string, subscriptionId: string) => Promise<DataWrapper<SubscriptionSeat[]>>;
|
|
68
|
+
assignSubscriptionSeat: (appId: string, subscriptionId: string, data: AssignSeatData) => Promise<DataWrapper<SubscriptionSeat>>;
|
|
69
|
+
removeSubscriptionSeat: (appId: string, subscriptionId: string, seatId: string) => Promise<MessageResponse>;
|
|
70
|
+
fetchAvailableSeatUsers: (appId: string, subscriptionId: string) => Promise<DataWrapper<AvailableSeatUser[]>>;
|
|
71
|
+
}
|
|
72
|
+
export declare function newSubscriptionFactory(client: AntHttpClient): SubscriptionFactory;
|
|
73
|
+
//# sourceMappingURL=subscriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,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;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import qs from 'qs';
|
|
2
|
+
export function newSubscriptionFactory(client) {
|
|
3
|
+
return {
|
|
4
|
+
// Pricing tiers
|
|
5
|
+
fetchPricingTiers: (appId, requestConfig) => client.get(`/store/apps/${appId}/pricing-tiers`, requestConfig),
|
|
6
|
+
createPricingTier: (appId, data) => client.post(`/store/apps/${appId}/pricing-tiers`, data),
|
|
7
|
+
updatePricingTier: (appId, tierId, data) => client.put(`/store/apps/${appId}/pricing-tiers/${tierId}`, data),
|
|
8
|
+
deletePricingTier: (appId, tierId) => client.delete(`/store/apps/${appId}/pricing-tiers/${tierId}`),
|
|
9
|
+
// Subscriptions
|
|
10
|
+
fetchCurrentSubscription: appId => client.get(`/store/apps/${appId}/subscriptions/current`),
|
|
11
|
+
fetchSubscription: (appId, subscriptionId) => client.get(`/store/apps/${appId}/subscriptions/${subscriptionId}`),
|
|
12
|
+
createSubscription: (appId, data) => client.post(`/store/apps/${appId}/subscriptions`, data),
|
|
13
|
+
updateSubscription: (appId, subscriptionId, data) => client.put(`/store/apps/${appId}/subscriptions/${subscriptionId}`, data),
|
|
14
|
+
cancelSubscription: (appId, subscriptionId) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/cancel`),
|
|
15
|
+
reactivateSubscription: (appId, subscriptionId) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/reactivate`, {}),
|
|
16
|
+
// Purchase approval (offline payment)
|
|
17
|
+
fetchPendingApprovals: appId => client.get(`/store/apps/${appId}/subscriptions/pending`),
|
|
18
|
+
fetchAppSubscriptions: (appId, params = {}) => {
|
|
19
|
+
const queryString = qs.stringify(params, { skipNulls: true });
|
|
20
|
+
return client.get(`/store/apps/${appId}/subscriptions${queryString ? `?${queryString}` : ''}`);
|
|
21
|
+
},
|
|
22
|
+
approvePurchase: (appId, subscriptionId) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/approve`, {}),
|
|
23
|
+
denyPurchase: (appId, subscriptionId) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/deny`, {}),
|
|
24
|
+
confirmRenewal: (appId, subscriptionId, data = {}) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/confirm-renewal`, data),
|
|
25
|
+
// Tier change flow
|
|
26
|
+
requestTierChange: (appId, subscriptionId, data) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/request-tier-change`, data),
|
|
27
|
+
confirmTierChange: (appId, subscriptionId, data = {}) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/confirm-tier-change`, data),
|
|
28
|
+
rejectTierChange: (appId, subscriptionId) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/reject-tier-change`, {}),
|
|
29
|
+
// Seat change flow (increase = offline payment, publisher-approved)
|
|
30
|
+
requestSeatChange: (appId, subscriptionId, data) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/request-seat-change`, data),
|
|
31
|
+
confirmSeatChange: (appId, subscriptionId, data = {}) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/confirm-seat-change`, data),
|
|
32
|
+
rejectSeatChange: (appId, subscriptionId) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/reject-seat-change`, {}),
|
|
33
|
+
// Subscription seats
|
|
34
|
+
fetchSubscriptionSeats: (appId, subscriptionId) => client.get(`/store/apps/${appId}/subscriptions/${subscriptionId}/seats`),
|
|
35
|
+
assignSubscriptionSeat: (appId, subscriptionId, data) => client.post(`/store/apps/${appId}/subscriptions/${subscriptionId}/seats`, data),
|
|
36
|
+
removeSubscriptionSeat: (appId, subscriptionId, seatId) => client.delete(`/store/apps/${appId}/subscriptions/${subscriptionId}/seats/${seatId}`),
|
|
37
|
+
fetchAvailableSeatUsers: (appId, subscriptionId) => client.get(`/store/apps/${appId}/subscriptions/${subscriptionId}/seats/available-users`),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AppAccessRequestFactory } from './factory/accessRequests';
|
|
2
|
+
import type { AppAssignmentFactory } from './factory/assignments';
|
|
3
|
+
import type { ReleaseChannelFactory } from './factory/channels';
|
|
4
|
+
import type { AppMediaFactory } from './factory/media';
|
|
5
|
+
import type { SellableResourceFactory } from './factory/resources';
|
|
6
|
+
import type { SubscriptionFactory } from './factory/subscriptions';
|
|
7
|
+
import type { App, AppCategory, AppChangelogEntry, AppConfigResource, AppImpactAnalysis, AppResourceStatus, AppResourceSyncResult, AppRunnableContexts, AppTemplate, AppUpdateResult, AppVersionFormData, AvailableUpdatesParams, AvailableUpdatesResponse, BatchUpdateAppsParams, BatchUpdateAppsResponse, CategoryRelationData, FetchAppChangelogParams, FetchAppsParams, ListApp, PublisherStatsApp, UpdateInstalledAppParams } from './types';
|
|
8
|
+
import type { MessageResponse } from "../../AntConnect";
|
|
9
|
+
import type { AntHttpClient } from "../../AntHttpClient";
|
|
10
|
+
import type { DataWrapper } from "../../types";
|
|
11
|
+
export * from './types';
|
|
12
|
+
export interface AppService extends SubscriptionFactory, SellableResourceFactory, ReleaseChannelFactory, AppAssignmentFactory, AppAccessRequestFactory, AppMediaFactory {
|
|
13
|
+
createApp: (appData: AppTemplate) => Promise<DataWrapper<App>>;
|
|
14
|
+
updateApp: (id: string, appData: Partial<AppTemplate>) => Promise<DataWrapper<App>>;
|
|
15
|
+
deleteApp: (id: string) => Promise<MessageResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Force-delete a deprecated app, cascading the uninstall/deactivation across
|
|
18
|
+
* every license and project. Only valid for deprecated apps (409 otherwise).
|
|
19
|
+
*/
|
|
20
|
+
forceDeleteApp: (id: string) => Promise<MessageResponse>;
|
|
21
|
+
deleteAppImage: (id: string) => Promise<MessageResponse>;
|
|
22
|
+
createVersion: (appId: string, versionData: AppVersionFormData) => Promise<DataWrapper<App>>;
|
|
23
|
+
deleteVersion: (appId: string, versionId: string) => Promise<MessageResponse>;
|
|
24
|
+
fetchImpactAnalysis: (appId: string) => Promise<DataWrapper<AppImpactAnalysis>>;
|
|
25
|
+
fetchAppContent: (appId: string, versionId: string, path: string) => Promise<any>;
|
|
26
|
+
fetchVersionReadme: (appId: string, versionId: string) => Promise<any>;
|
|
27
|
+
fetchVersionConfig: (appId: string, versionId: string) => Promise<any>;
|
|
28
|
+
fetchVersionChangelog: (appId: string, versionId: string) => Promise<any>;
|
|
29
|
+
getAppResourceStatus: (appId: string, resource: AppConfigResource) => Promise<AppResourceStatus>;
|
|
30
|
+
syncAppResource: (appId: string, resource: AppConfigResource) => Promise<AppResourceSyncResult>;
|
|
31
|
+
fetchApps: (params: FetchAppsParams, requestConfig?: Record<string, any>) => Promise<DataWrapper<ListApp[]>>;
|
|
32
|
+
fetchApp: (appId: string, requestConfig?: Record<string, any>) => Promise<App>;
|
|
33
|
+
fetchAppProjects: (appId: string, requestConfig?: Record<string, any>) => Promise<DataWrapper<AppRunnableContexts>>;
|
|
34
|
+
fetchPublisherStats: () => Promise<DataWrapper<PublisherStatsApp[]>>;
|
|
35
|
+
installApp: (licenseId: string, versionId: string, channelId?: string) => Promise<DataWrapper<App>>;
|
|
36
|
+
uninstallApp: (licenseId: string, versionId: string, force?: boolean) => Promise<DataWrapper<App>>;
|
|
37
|
+
activateApp: (projectId: string, versionId: string, channelId?: string) => Promise<DataWrapper<App>>;
|
|
38
|
+
deactivateApp: (projectId: string, versionId: string) => Promise<DataWrapper<App>>;
|
|
39
|
+
setLicenseAppAutoUpdate: (licenseId: string, appId: string, enabled: boolean) => Promise<DataWrapper<App>>;
|
|
40
|
+
setProjectAppAutoUpdate: (projectId: string, appId: string, enabled: boolean) => Promise<DataWrapper<App>>;
|
|
41
|
+
setLicenseAppChannel: (licenseId: string, appId: string, channelId: string) => Promise<DataWrapper<App>>;
|
|
42
|
+
setProjectAppChannel: (projectId: string, appId: string, channelId: string) => Promise<DataWrapper<App>>;
|
|
43
|
+
linkApp: (taskId: string, appId: string) => Promise<DataWrapper<App>>;
|
|
44
|
+
unlinkApp: (taskId: string, appId: string) => Promise<DataWrapper<App>>;
|
|
45
|
+
/** Save (or clear) the app's restorable view state on a task↔app link. */
|
|
46
|
+
saveAppState: (taskId: string, appId: string, state: Record<string, string> | null) => Promise<DataWrapper<App>>;
|
|
47
|
+
deprecateApp: (appId: string, message?: string) => Promise<DataWrapper<App>>;
|
|
48
|
+
undeprecateApp: (appId: string) => Promise<DataWrapper<App>>;
|
|
49
|
+
updateInstalledApp: (appId: string, params?: UpdateInstalledAppParams, requestConfig?: Record<string, any>) => Promise<DataWrapper<AppUpdateResult>>;
|
|
50
|
+
batchUpdateApps: (params?: BatchUpdateAppsParams) => Promise<DataWrapper<BatchUpdateAppsResponse>>;
|
|
51
|
+
fetchAvailableUpdates: (params?: AvailableUpdatesParams) => Promise<DataWrapper<AvailableUpdatesResponse>>;
|
|
52
|
+
fetchCategories: (params?: any) => Promise<DataWrapper<AppCategory[]>>;
|
|
53
|
+
fetchCategory: (categoryId: string) => Promise<AppCategory>;
|
|
54
|
+
updateAppCategories: (appId: string, data: CategoryRelationData) => Promise<DataWrapper<App>>;
|
|
55
|
+
fetchAppChangelog: (appId: string, params?: FetchAppChangelogParams) => Promise<DataWrapper<AppChangelogEntry[]>>;
|
|
56
|
+
}
|
|
57
|
+
export declare function newAppService(client: AntHttpClient): AppService;
|
|
58
|
+
export default AppService;
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/AppService/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAA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AAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;IACtE,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3D,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAG7F,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;CAClH;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU,CAoG/D;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import qs from 'qs';
|
|
2
|
+
import { newAppAccessRequestFactory } from './factory/accessRequests';
|
|
3
|
+
import { newAppAssignmentFactory } from './factory/assignments';
|
|
4
|
+
import { newReleaseChannelFactory } from './factory/channels';
|
|
5
|
+
import { maybeFormData, toFormData } from './factory/formData';
|
|
6
|
+
import { newAppMediaFactory } from './factory/media';
|
|
7
|
+
import { newSellableResourceFactory } from './factory/resources';
|
|
8
|
+
import { newSubscriptionFactory } from './factory/subscriptions';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export function newAppService(client) {
|
|
11
|
+
return {
|
|
12
|
+
...newSubscriptionFactory(client),
|
|
13
|
+
...newSellableResourceFactory(client),
|
|
14
|
+
...newReleaseChannelFactory(client),
|
|
15
|
+
...newAppAssignmentFactory(client),
|
|
16
|
+
...newAppAccessRequestFactory(client),
|
|
17
|
+
...newAppMediaFactory(client),
|
|
18
|
+
// An icon File is sent as multipart; a scalar-only edit stays JSON. updateApp
|
|
19
|
+
// is a PUT, but PHP doesn't parse multipart PUT bodies, so spoof it with POST
|
|
20
|
+
// + `_method=PUT` when a file rides along.
|
|
21
|
+
createApp: appData => client.post('/store/apps', maybeFormData(appData)),
|
|
22
|
+
updateApp: (id, appData) => appData.image instanceof Blob
|
|
23
|
+
? client.post(`/store/apps/${id}`, toFormData({ ...appData, _method: 'PUT' }))
|
|
24
|
+
: client.put(`/store/apps/${id}`, appData),
|
|
25
|
+
deleteApp: id => client.delete(`/store/apps/${id}`),
|
|
26
|
+
forceDeleteApp: id => client.delete(`/store/apps/${id}/force`),
|
|
27
|
+
deleteAppImage: id => client.delete(`/store/apps/${id}/deleteAppImage`),
|
|
28
|
+
createVersion: (appId, versionData) => client.post(`/store/apps/${appId}/versions`, maybeFormData(versionData)),
|
|
29
|
+
deleteVersion: (appId, versionId) => client.delete(`/store/apps/${appId}/versions/${versionId}`),
|
|
30
|
+
fetchImpactAnalysis: appId => client.get(`/store/apps/${appId}/impact-analysis`),
|
|
31
|
+
fetchAppContent: (appId, versionId, path) => client.get(`/store/apps/${appId}/versions/${versionId}/contents/${path}`),
|
|
32
|
+
fetchVersionReadme: (appId, versionId) => client.get(`/store/apps/${appId}/versions/${versionId}/readme`),
|
|
33
|
+
fetchVersionConfig: (appId, versionId) => client.get(`/store/apps/${appId}/versions/${versionId}/config`),
|
|
34
|
+
fetchVersionChangelog: (appId, versionId) => client.get(`/store/apps/${appId}/versions/${versionId}/changelog`),
|
|
35
|
+
getAppResourceStatus: (appId, resource) => client.get(`/store/apps/${appId}/config/${resource}/status`),
|
|
36
|
+
syncAppResource: (appId, resource) => client.post(`/store/apps/${appId}/config/${resource}/sync`),
|
|
37
|
+
fetchApps: (params = {}, requestConfig) => {
|
|
38
|
+
// `config` is CSV, not bracket-array — pull it out of the default
|
|
39
|
+
// `arrayFormat: 'brackets'` serialization and append it joined.
|
|
40
|
+
const { config, ...rest } = params;
|
|
41
|
+
const queryString = qs.stringify(rest, { skipNulls: true, arrayFormat: 'brackets' });
|
|
42
|
+
const configString = config?.length ? `config=${config.join(',')}` : '';
|
|
43
|
+
const query = [queryString, configString].filter(Boolean).join('&');
|
|
44
|
+
return client.get(`/store/apps${query ? `?${query}` : ''}`, requestConfig);
|
|
45
|
+
},
|
|
46
|
+
fetchApp: (appId, requestConfig) => client.get(`/store/apps/${appId}`, requestConfig),
|
|
47
|
+
fetchAppProjects: (appId, requestConfig) => client.get(`/store/apps/${appId}/projects`, requestConfig),
|
|
48
|
+
fetchPublisherStats: () => client.get('/store/publisher/stats'),
|
|
49
|
+
installApp: (licenseId, versionId, channelId) => client.post(`/store/resources/apps-versions/${versionId}/licenses/${licenseId}`, channelId ? { channel_id: channelId } : undefined),
|
|
50
|
+
uninstallApp: (licenseId, versionId, force) => client.delete(`/store/resources/apps-versions/${versionId}/licenses/${licenseId}${force ? '?force=true' : ''}`),
|
|
51
|
+
activateApp: (projectId, versionId, channelId) => client.post(`/store/resources/apps-versions/${versionId}/projects/${projectId}`, channelId ? { channel_id: channelId } : undefined),
|
|
52
|
+
deactivateApp: (projectId, versionId) => client.delete(`/store/resources/apps-versions/${versionId}/projects/${projectId}`),
|
|
53
|
+
setLicenseAppAutoUpdate: (licenseId, appId, enabled) => client.post(`/store/resources/apps/${appId}/licenses/${licenseId}/auto-update`, { enabled }),
|
|
54
|
+
setProjectAppAutoUpdate: (projectId, appId, enabled) => client.post(`/store/resources/apps/${appId}/projects/${projectId}/auto-update`, { enabled }),
|
|
55
|
+
setLicenseAppChannel: (licenseId, appId, channelId) => client.post(`/store/resources/apps/${appId}/licenses/${licenseId}/channel`, { channel_id: channelId }),
|
|
56
|
+
setProjectAppChannel: (projectId, appId, channelId) => client.post(`/store/resources/apps/${appId}/projects/${projectId}/channel`, { channel_id: channelId }),
|
|
57
|
+
linkApp: (taskId, appId) => client.post(`/store/resources/apps/${appId}/tasks/${taskId}`),
|
|
58
|
+
unlinkApp: (taskId, appId) => client.delete(`/store/resources/apps/${appId}/tasks/${taskId}`),
|
|
59
|
+
saveAppState: (taskId, appId, state) => client.patch(`/store/resources/apps/${appId}/tasks/${taskId}`, { app_state: state }),
|
|
60
|
+
deprecateApp: (appId, message) => client.post(`/store/apps/${appId}/deprecate`, { message }),
|
|
61
|
+
undeprecateApp: appId => client.post(`/store/apps/${appId}/undeprecate`),
|
|
62
|
+
updateInstalledApp: (appId, params = {}, requestConfig) => client.post(`/store/apps/${appId}/update`, params, requestConfig),
|
|
63
|
+
batchUpdateApps: (params = {}) => client.post('/store/resources/apps/batch-update', params),
|
|
64
|
+
fetchAvailableUpdates: (params = {}) => client.get('/store/resources/apps/updates-available', { params }),
|
|
65
|
+
fetchCategories: (params = {}) => {
|
|
66
|
+
const queryString = qs.stringify(params, { skipNulls: true, arrayFormat: 'brackets' });
|
|
67
|
+
return client.get(`/store/app-categories${queryString ? `?${queryString}` : ''}`);
|
|
68
|
+
},
|
|
69
|
+
fetchCategory: categoryId => client.get(`/store/app-categories/${categoryId}`),
|
|
70
|
+
updateAppCategories: (appId, data) => client.post(`/store/apps/${appId}/categories`, data),
|
|
71
|
+
fetchAppChangelog: (appId, params = {}) => {
|
|
72
|
+
const queryString = qs.stringify(params, { skipNulls: true });
|
|
73
|
+
return client.get(`/store/apps/${appId}/changelog${queryString ? `?${queryString}` : ''}`);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|