@antcde/connect-ts 0.4.27-rc.2 → 0.4.27-rc.4
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/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/hostSlot.d.ts +23 -0
- package/build/comms/hostSlot.d.ts.map +1 -0
- package/build/comms/hostSlot.js +55 -0
- 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 +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/service-runtime.d.ts +2 -2
- package/build/service-runtime.d.ts.map +1 -1
- package/build/service-runtime.js +2 -2
- package/build/service-types-app.d.ts +1 -1
- package/build/service-types-app.d.ts.map +1 -1
- 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/resourceAccess.d.ts +1 -1
- package/build/services/AppService/factory/resourceAccess.d.ts.map +1 -1
- package/build/services/AppService/factory/resourceAccess.js +12 -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/resourceSnapshot.d.ts +13 -0
- package/build/services/AppService/factory/resourceSnapshot.d.ts.map +1 -1
- package/build/services/AppService/factory/resourceSnapshot.js +21 -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 +43 -29
- package/build/services/AppService/factory/resources.d.ts.map +1 -1
- package/build/services/AppService/factory/resources.js +8 -7
- 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 +4 -5
- package/build/services/AppService/index.d.ts.map +1 -1
- package/build/services/AppService/index.js +4 -6
- package/build/services/AppService/types/appCategories.d.ts +28 -0
- package/build/services/AppService/types/appCategories.d.ts.map +1 -1
- 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 +18 -1
- package/build/services/AppService/types/resourceEntitlements.d.ts.map +1 -1
- package/build/services/AppService/types/resourceReleases.d.ts +93 -6
- package/build/services/AppService/types/resourceReleases.d.ts.map +1 -1
- package/build/services/AppService/types/resourceRequests.d.ts +10 -0
- package/build/services/AppService/types/resourceRequests.d.ts.map +1 -1
- package/build/services/AppService/types/sellableResources.d.ts +43 -1
- package/build/services/AppService/types/sellableResources.d.ts.map +1 -1
- 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 +30 -10
- package/build/services/AppService/types/snapshotPayload.d.ts.map +1 -1
- package/build/services/AppService/types/snapshotPayload.js +5 -2
- package/build/services/AppService/types/snapshotSources.d.ts +19 -1
- package/build/services/AppService/types/snapshotSources.d.ts.map +1 -1
- 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/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 +4 -0
- package/build/services/AppService/types.d.ts.map +1 -1
- package/build/services/AppService/types.js +4 -0
- package/build/services/Webhook/TriggerService.d.ts +44 -0
- package/build/services/Webhook/TriggerService.d.ts.map +1 -1
- package/build/services/Webhook/TriggerService.js +15 -0
- package/package.json +1 -1
package/build/comms/transport.js
CHANGED
|
@@ -6,16 +6,31 @@ export function transferPort(target, initData) {
|
|
|
6
6
|
target.postMessage({ type: COMLINK_INIT, clientId: initData.clientId, context: clone(initData.context) }, '*', [port2]);
|
|
7
7
|
return port1;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Listen for every port the host hands over, not just the first.
|
|
11
|
+
*
|
|
12
|
+
* The host answers each READY with a fresh port and closes the one before it, so
|
|
13
|
+
* a client that had to retry its announcement receives several INITs and only
|
|
14
|
+
* the last one is live. Binding to the first and unsubscribing — which is what
|
|
15
|
+
* this did — left the client holding a closed port while believing it was
|
|
16
|
+
* connected.
|
|
17
|
+
*
|
|
18
|
+
* `expectedSource` is the window the handover must come from — the host frame, or
|
|
19
|
+
* the relay forwarding on its behalf (see createPortRelay). Listening for repeat
|
|
20
|
+
* handovers means a forged COMLINK_INIT no longer merely races the first one, it
|
|
21
|
+
* can replace a connection already in use, so the sender is checked rather than
|
|
22
|
+
* trusted. Pass null only where there is no window to check against (tests).
|
|
23
|
+
*/
|
|
24
|
+
export function onPort(expectedSource, cb) {
|
|
25
|
+
const handler = (event) => {
|
|
26
|
+
if (event.data?.type !== COMLINK_INIT || !event.ports[0])
|
|
27
|
+
return;
|
|
28
|
+
if (expectedSource && event.source !== expectedSource)
|
|
29
|
+
return;
|
|
30
|
+
cb({ port: event.ports[0], clientId: event.data.clientId, context: event.data.context });
|
|
31
|
+
};
|
|
32
|
+
globalThis.addEventListener('message', handler);
|
|
33
|
+
return () => globalThis.removeEventListener('message', handler);
|
|
19
34
|
}
|
|
20
35
|
export function requestPort(target) {
|
|
21
36
|
target.postMessage({ type: COMLINK_READY }, '*');
|
package/build/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type { AiDevEndpoint } from './services/AiService';
|
|
|
14
14
|
export type { DmsNotificationEvent, DmsSubscribableType, DmsSubscriptionInput, DmsSubscriptionState, DmsSubscriptionSummary, TaskNotificationEvent } from './services/Notifications/NotificationService';
|
|
15
15
|
export type { SecretOAuth2AuthCodeConfig } from './services/SecretService';
|
|
16
16
|
export type { AiPreferences, DevModePreferences } from './services/userPreferences';
|
|
17
|
-
export type { AuthorizationRequiredResult, TriggerDispatchResult } from './services/Webhook/TriggerService';
|
|
17
|
+
export type { AuthorizationRequiredResult, ResourceAccessDeniedResult, TriggerDispatchResult, TriggerResourceReason } from './services/Webhook/TriggerService';
|
|
18
18
|
export * from './types';
|
|
19
19
|
export { randomUUID } from './utils';
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,UAAU,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAC9F,OAAO,EAAE,KAAK,MAAM,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAA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AAE,MAAM,mCAAmC,CAAA;AAG9J,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { CHANNEL_ALL } from './services/AppService';
|
|
2
2
|
export { isResourceAccessError, RESOURCE_ACCESS_REASONS } from './services/AppService/factory/resourceAccess';
|
|
3
|
-
export { isSnapshotPayloadSchema } from './services/AppService/factory/resourceSnapshot';
|
|
3
|
+
export { isFileSnapshotSource, isSnapshotPayloadSchema } from './services/AppService/factory/resourceSnapshot';
|
|
4
4
|
export { isAsyncImport } from './services/RecordService';
|
|
5
5
|
export { taskStatuses } from './services/TaskService';
|
|
6
6
|
export { buildTaskQuery, defaultGetTaskQuery, defaultGetTasksQuery } from './services/TaskServiceQueries';
|
|
7
7
|
export { defaultUserPreferences, parseUserPreferences, userPreferencesSchema } from './services/userPreferences';
|
|
8
|
-
export { isAuthorizationRequired } from './services/Webhook/TriggerService';
|
|
8
|
+
export { isAuthorizationRequired, isResourceAccessDenied } from './services/Webhook/TriggerService';
|
|
9
9
|
//# sourceMappingURL=service-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-runtime.d.ts","sourceRoot":"","sources":["../src/service-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AAC7G,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAA;
|
|
1
|
+
{"version":3,"file":"service-runtime.d.ts","sourceRoot":"","sources":["../src/service-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AAC7G,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAA;AAC9G,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACzG,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAChH,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA"}
|
package/build/service-runtime.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Kept separate from `service-types.ts` so that file remains type-only.
|
|
3
3
|
export { CHANNEL_ALL } from './services/AppService';
|
|
4
4
|
export { isResourceAccessError, RESOURCE_ACCESS_REASONS } from './services/AppService/factory/resourceAccess';
|
|
5
|
-
export { isSnapshotPayloadSchema } from './services/AppService/factory/resourceSnapshot';
|
|
5
|
+
export { isFileSnapshotSource, isSnapshotPayloadSchema } from './services/AppService/factory/resourceSnapshot';
|
|
6
6
|
export { isAsyncImport } from './services/RecordService';
|
|
7
7
|
export { taskStatuses } from './services/TaskService';
|
|
8
8
|
export { buildTaskQuery, defaultGetTaskQuery, defaultGetTasksQuery } from './services/TaskServiceQueries';
|
|
9
9
|
export { defaultUserPreferences, parseUserPreferences, userPreferencesSchema } from './services/userPreferences';
|
|
10
|
-
export { isAuthorizationRequired } from './services/Webhook/TriggerService';
|
|
10
|
+
export { isAuthorizationRequired, isResourceAccessDenied } from './services/Webhook/TriggerService';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { AccessBlock, AccessBlockVersion, AccessibleChannel, AccessLevel, AccessRequest, AccessRequestStatus, AccessScope, AcquireResourceData, AdminContact, AdminRole, App, AppAssignment, AppAvailability, AppCategory, AppChangelogActionType, AppChangelogEntry, AppConfigResource, AppConfigSlice, AppDelegates, AppFormData, AppImpactAnalysis, AppImpactLicense, AppImpactProject, AppLicense, AppManifest, AppManifestCapabilities, AppManifestColumn, AppManifestColumnType, AppManifestIntent, AppManifestQueryParam, AppManifestQueryParamAccess, AppManifestQueryParamType, AppManifestSignals, AppManifestTable, AppManifestTableContext, AppManifestTopic, AppManifestTopicDirection, AppManifestTopicScope, AppMedia, AppMediaFormData, AppResourceItemStatus, AppResourceStatus, AppResourceStatusSummary, AppResourceSyncResult, AppRunnableContexts, AppScope, AppScopeProject, AppSeatPicture, AppSortOption, AppTableColumnStatus, AppTableColumnStatusEntry, AppTableStatusItem, AppTemplate, AppTrustLevel, AppUpdateResult, AppUpdateStatus, AppVersion, AppVersionAuthor, AppVersionFormData, AppVersionSummary, AssignedRole, AssignedUser, AssignSeatData, AttachVersionToAppFormData, AvailableSeatUser, AvailableUpdate, AvailableUpdatesParams, AvailableUpdatesResponse, BatchUpdateAppResult, BatchUpdateAppsParams, BatchUpdateAppsResponse, BillingPeriod, ChannelAccessMode, ChannelPublishedChanges, ChannelUnpublishHolder, ChannelUnpublishImpact, ConfirmPaymentData, CreateAccessRequestData, CreatePricingTierData, CreateReleaseChannelData, CreateResourceChannelData, CreateResourceVersionData, CreateSellableResourceData, CreateSubscriptionData, EveryoneGrant, FetchAccessRequestsParams, FetchAppChangelogParams, FetchAppsParams, FetchAppSubscriptionsParams, FetchResourcesParams, JsonSchema, LicenseAssignment, ListApp, PricingFeature, PricingModel, PricingTier, ProjectSeatBundle, ProjectSeatView, PublisherStatsAccessRequests, PublisherStatsApp, ReleaseChannel, ReleaseChannelAccessOverride, ReleaseChannelMember, RequestSeatChangeData, RequestTierChangeData, ResourceAccessBlock, ResourceAccessEntry, ResourceAccessError, ResourceAccessReason, ResourceCategory, ResourceChannel, ResourceConsumer, ResourceEntitlement, ResourceEntitlementSummary, ResourcePayloadState, ResourcePayloadType, ResourceSortOption, ResourceStoreMode, ResourceSubscription, ResourceUnpublishImpact, ResourceVersion, ResourceVersionSummary, RespondAccessRequestData, SeatAllocation, SeatLimitAccessBlock, SeatOccupant, SellableResource, SellableResourceListItem, SnapshotColumnSelection, SnapshotErrorCode, SnapshotErrorContext, SnapshotFieldSchema, SnapshotFieldType, SnapshotPayloadConfig, SnapshotPayloadSchema, SnapshotPreview, SnapshotRowFilter, SnapshotSource, SnapshotSourceOwner, SnapshotSourceSelection, SnapshotSourceUnavailableReason, StoreCapabilities, Subscription, SubscriptionSeat, SubscriptionStatus, SurplusSeatAssignment, UninstallConflict, UnpublishChannelResponse, UpdateAppMediaFormData, UpdateInstalledAppParams, UpdatePricingTierData, UpdateReleaseChannelData, UpdateSellableResourceData, UpdateSubscriptionData, VersionWithdrawnAccessBlock, } from './services/AppService';
|
|
1
|
+
export type { AccessBlock, AccessBlockVersion, AccessibleChannel, AccessLevel, AccessRequest, AccessRequestStatus, AccessScope, AcquireResourceData, AdminContact, AdminRole, App, AppAssignment, AppAvailability, AppCategory, AppChangelogActionType, AppChangelogEntry, AppConfigResource, AppConfigSlice, AppDelegates, AppFormData, AppImpactAnalysis, AppImpactLicense, AppImpactProject, AppLicense, AppManifest, AppManifestCapabilities, AppManifestColumn, AppManifestColumnType, AppManifestIntent, AppManifestQueryParam, AppManifestQueryParamAccess, AppManifestQueryParamType, AppManifestSignals, AppManifestTable, AppManifestTableContext, AppManifestTopic, AppManifestTopicDirection, AppManifestTopicScope, AppMedia, AppMediaFormData, AppResourceItemStatus, AppResourceStatus, AppResourceStatusSummary, AppResourceSyncResult, AppRunnableContexts, AppScope, AppScopeProject, AppSeatPicture, AppSortOption, AppTableColumnStatus, AppTableColumnStatusEntry, AppTableStatusItem, AppTemplate, AppTrustLevel, AppUpdateResult, AppUpdateStatus, AppVersion, AppVersionAuthor, AppVersionFormData, AppVersionSummary, AssignedRole, AssignedUser, AssignSeatData, AttachVersionToAppFormData, AvailableSeatUser, AvailableUpdate, AvailableUpdatesParams, AvailableUpdatesResponse, BatchUpdateAppResult, BatchUpdateAppsParams, BatchUpdateAppsResponse, BillingPeriod, ChannelAccessMode, ChannelPublishedChanges, ChannelUnpublishHolder, ChannelUnpublishImpact, ConfirmPaymentData, CreateAccessRequestData, CreatePricingTierData, CreateReleaseChannelData, CreateResourceChannelData, CreateResourceVersionData, CreateSellableResourceData, CreateSubscriptionData, EveryoneGrant, FetchAccessRequestsParams, FetchAppChangelogParams, FetchAppsParams, FetchAppSubscriptionsParams, FetchCategoriesParams, FetchResourcesParams, JsonSchema, LicenseAssignment, LicenseResourceAccessEntry, ListApp, PricingFeature, PricingModel, PricingTier, ProjectSeatBundle, ProjectSeatView, PublisherStatsAccessRequests, PublisherStatsApp, ReleaseChannel, ReleaseChannelAccessOverride, ReleaseChannelMember, RequestSeatChangeData, RequestTierChangeData, ResourceAccessBlock, ResourceAccessEntry, ResourceAccessError, ResourceAccessReason, ResourceAdminRole, ResourceAssignedRole, ResourceAssignedUser, ResourceAssignments, ResourceCategory, ResourceChannel, ResourceChannelAccessMode, ResourceChannelAccessOverride, ResourceChannelMember, ResourceConsumer, ResourceEntitlement, ResourceEntitlementSummary, ResourcePayloadState, ResourcePayloadType, ResourceSortOption, ResourceStoreMode, ResourceSubscription, ResourceUnpublishImpact, ResourceVersion, ResourceVersionFileSource, ResourceVersionSource, ResourceVersionSummary, ResourceVersionTableSource, RespondAccessRequestData, RetryResourceVersionData, SeatAllocation, SeatLimitAccessBlock, SeatOccupant, SellableResource, SellableResourceListItem, SnapshotColumnSelection, SnapshotErrorCode, SnapshotErrorContext, SnapshotFieldSchema, SnapshotFieldType, SnapshotFileColumnSelection, SnapshotFileSchemaSource, SnapshotFileSourceSelection, SnapshotPayloadConfig, SnapshotPayloadSchema, SnapshotPreview, SnapshotRowFilter, SnapshotSchemaSource, SnapshotSource, SnapshotSourceOwner, SnapshotSourceSelection, SnapshotSourceUnavailableReason, SnapshotTableColumnSelection, SnapshotTableSchemaSource, SnapshotTableSourceSelection, SnapshotUpload, SnapshotUploadColumnProposal, SnapshotUploadFormat, StoreCapabilities, StoreKind, StoreKindSlug, StoreKindSource, StoreSubcategory, StoreTaxonomy, Subscription, SubscriptionSeat, SubscriptionStatus, SurplusSeatAssignment, UninstallConflict, UnpublishChannelResponse, UpdateAppMediaFormData, UpdateInstalledAppParams, UpdatePricingTierData, UpdateReleaseChannelData, UpdateResourceChannelData, UpdateSellableResourceData, UpdateSubscriptionData, UploadSnapshotFileData, VersionWithdrawnAccessBlock, } from './services/AppService';
|
|
2
2
|
//# sourceMappingURL=service-types-app.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-types-app.d.ts","sourceRoot":"","sources":["../src/service-types-app.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,EACH,aAAa,EACb,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,EACrB,QAAQ,EACR,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,eAAe,EACf,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,0BAA0B,EA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C1B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"service-types-app.d.ts","sourceRoot":"","sources":["../src/service-types-app.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,EACH,aAAa,EACb,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,EACrB,QAAQ,EACR,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,eAAe,EACf,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,yBAA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,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { App, AppCategory, CategoryRelationData, FetchCategoriesParams } from '../types';
|
|
2
|
+
import type { AntHttpClient } from "../../../AntHttpClient";
|
|
3
|
+
import type { DataWrapper } from "../../../types";
|
|
4
|
+
/**
|
|
5
|
+
* The operator-curated category catalog. Split out of the AppService factory to
|
|
6
|
+
* keep `index.ts` focused, alongside `taxonomy.ts` which navigates the same
|
|
7
|
+
* rows.
|
|
8
|
+
*/
|
|
9
|
+
export interface AppCategoryFactory {
|
|
10
|
+
/**
|
|
11
|
+
* The category catalog.
|
|
12
|
+
*
|
|
13
|
+
* Pass `{ assignable: true }` in a publisher's listing editor: curated buckets
|
|
14
|
+
* like "System" are browsable but never publisher-assignable, and submitting
|
|
15
|
+
* one in `category_ids` is a 422 (AAD-935 item 2). Discover's rail wants the
|
|
16
|
+
* FULL list — System is a real browse destination.
|
|
17
|
+
*/
|
|
18
|
+
fetchCategories: (params?: FetchCategoriesParams) => Promise<DataWrapper<AppCategory[]>>;
|
|
19
|
+
fetchCategory: (categoryId: string) => Promise<AppCategory>;
|
|
20
|
+
/**
|
|
21
|
+
* Replace an app's publisher-chosen categories.
|
|
22
|
+
*
|
|
23
|
+
* **Does NOT round-trip.** The server re-attaches curated memberships the
|
|
24
|
+
* publisher may not assign, so the response can list more categories than were
|
|
25
|
+
* sent. Reconcile from the response, never from the request.
|
|
26
|
+
*/
|
|
27
|
+
updateAppCategories: (appId: string, data: CategoryRelationData) => Promise<DataWrapper<App>>;
|
|
28
|
+
}
|
|
29
|
+
export declare function newAppCategoryFactory(client: AntHttpClient): AppCategoryFactory;
|
|
30
|
+
//# sourceMappingURL=categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/categories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAG1C;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;IACxF,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3D;;;;;;OAMG;IACH,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;CAC9F;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,kBAAkB,CAU/E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import qs from 'qs';
|
|
2
|
+
export function newAppCategoryFactory(client) {
|
|
3
|
+
return {
|
|
4
|
+
fetchCategories: (params = {}) => {
|
|
5
|
+
const queryString = qs.stringify(params, { skipNulls: true, arrayFormat: 'brackets' });
|
|
6
|
+
return client.get(`/store/app-categories${queryString ? `?${queryString}` : ''}`);
|
|
7
|
+
},
|
|
8
|
+
fetchCategory: categoryId => client.get(`/store/app-categories/${categoryId}`),
|
|
9
|
+
updateAppCategories: (appId, data) => client.post(`/store/apps/${appId}/categories`, data),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -8,7 +8,7 @@ import type { ResourceAccessError } from '../types';
|
|
|
8
8
|
* root via `service-runtime.ts`.
|
|
9
9
|
*/
|
|
10
10
|
/** Every refusal reason the access layer can return. */
|
|
11
|
-
export declare const RESOURCE_ACCESS_REASONS: readonly ["not_entitled", "entitlement_revoked", "subscription_expired", "subscription_pending_approval", "version_withdrawn", "version_not_ready", "payload_backend_not_implemented"];
|
|
11
|
+
export declare const RESOURCE_ACCESS_REASONS: readonly ["not_entitled", "entitlement_revoked", "subscription_expired", "subscription_pending_approval", "channel_not_accessible", "not_granted", "version_withdrawn", "version_not_ready", "payload_backend_not_implemented"];
|
|
12
12
|
/**
|
|
13
13
|
* Narrow an unknown error (typically an axios rejection) to an access-layer
|
|
14
14
|
* refusal, so the caller can branch on `reason` rather than on the status code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceAccess.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"resourceAccess.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/factory/resourceAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAwB,MAAM,UAAU,CAAA;AAEzE;;;;;;;GAOG;AAEH,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,iOAkB1B,CAAA;AAoBV;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,QAAQ,EAAE;QAAE,IAAI,EAAE,mBAAmB,CAAA;KAAE,CAAA;CAAE,CAY1G"}
|
|
@@ -12,10 +12,22 @@ export const RESOURCE_ACCESS_REASONS = [
|
|
|
12
12
|
'entitlement_revoked',
|
|
13
13
|
'subscription_expired',
|
|
14
14
|
'subscription_pending_approval',
|
|
15
|
+
// AAD-949. Reachable ONLY by a license that holds a live entitlement, because
|
|
16
|
+
// the entitlement checks run first — so the remedy is "ask the publisher to add
|
|
17
|
+
// you to that channel", never "buy this". Do not collapse it into
|
|
18
|
+
// `not_entitled`: the two are answered by different people.
|
|
19
|
+
'channel_not_accessible',
|
|
20
|
+
// AAD-954. The only reason about a PERSON rather than a license, and checked
|
|
21
|
+
// last — so it is reachable only inside a license that genuinely bought the
|
|
22
|
+
// resource on a track it may use. The remedy is always "ask your license
|
|
23
|
+
// admin", never "buy this".
|
|
24
|
+
'not_granted',
|
|
15
25
|
'version_withdrawn',
|
|
16
26
|
'version_not_ready',
|
|
17
27
|
'payload_backend_not_implemented',
|
|
18
28
|
];
|
|
29
|
+
const _reasonsMatchTheUnion = true;
|
|
30
|
+
void _reasonsMatchTheUnion;
|
|
19
31
|
function isRecord(value) {
|
|
20
32
|
return typeof value === 'object' && value !== null;
|
|
21
33
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ResourceAssignments } from '../types';
|
|
2
|
+
import type { AntHttpClient } from "../../../AntHttpClient";
|
|
3
|
+
import type { DataWrapper } from "../../../types";
|
|
4
|
+
/**
|
|
5
|
+
* Who inside the BUYING license may use a resource that license bought
|
|
6
|
+
* (AAD-954).
|
|
7
|
+
*
|
|
8
|
+
* The buyer-side counterpart of `factory/assignments.ts`'s license-scope half,
|
|
9
|
+
* and deliberately the same vocabulary, so the admin mental model carries over
|
|
10
|
+
* from an installed app unchanged.
|
|
11
|
+
*
|
|
12
|
+
* **The default on purchase is CLOSED** — license admins can read immediately,
|
|
13
|
+
* nobody else until granted. This matches the app store: a purchased thing opens
|
|
14
|
+
* closed there too (the only automatic "everyone" grant is for first-party
|
|
15
|
+
* always-available apps, never a purchase). It matters more for a resource: an
|
|
16
|
+
* app mediates what it shows, a resource returns its dataset wholesale, and a
|
|
17
|
+
* disclosure cannot be undone while opening up is one click.
|
|
18
|
+
*
|
|
19
|
+
* **Three differences from the app equivalent, all deliberate:**
|
|
20
|
+
*
|
|
21
|
+
* 1. **No `channelIds` argument anywhere.** A resource entitlement pins one
|
|
22
|
+
* channel and one version for the whole license, so every user necessarily
|
|
23
|
+
* reads the same build. Do not add a channel picker to this screen — there is
|
|
24
|
+
* nothing for it to change.
|
|
25
|
+
* 2. **No `licenseId` argument.** The entitlement is unique per license and the
|
|
26
|
+
* acting license comes from the session header, so there is nothing to pass.
|
|
27
|
+
* 3. **No project scope.** Resources are not installed into projects, so the
|
|
28
|
+
* license/project switch the app screen has does not belong here.
|
|
29
|
+
*
|
|
30
|
+
* Every method is license-admin-only (403 otherwise) and returns the FULL
|
|
31
|
+
* picture after the change, so there is never a follow-up refetch.
|
|
32
|
+
*
|
|
33
|
+
* Granting is not the only gate. A read also needs the license to hold a live
|
|
34
|
+
* entitlement and to be allowed to draw from its channel; those fail with
|
|
35
|
+
* `not_entitled` / `subscription_expired` / `channel_not_accessible` instead.
|
|
36
|
+
* A missing grant is specifically `not_granted`, which always means *ask your
|
|
37
|
+
* license admin* and never *buy it* — see `RESOURCE_ACCESS_REASONS`.
|
|
38
|
+
*/
|
|
39
|
+
export interface ResourceAssignmentFactory {
|
|
40
|
+
/**
|
|
41
|
+
* The current access picture: who is assigned, who always has access, and
|
|
42
|
+
* which roles could still be added.
|
|
43
|
+
*
|
|
44
|
+
* 404 when the calling license holds no entitlement to this resource — from
|
|
45
|
+
* the buyer's side there is nothing there to be forbidden from.
|
|
46
|
+
*/
|
|
47
|
+
fetchResourceAssignments: (resourceId: string) => Promise<DataWrapper<ResourceAssignments>>;
|
|
48
|
+
/** Open the resource to every member of the license. */
|
|
49
|
+
setResourceEveryone: (resourceId: string) => Promise<DataWrapper<ResourceAssignments>>;
|
|
50
|
+
/** Close it again, back to whoever holds an explicit grant (admins keep access). */
|
|
51
|
+
clearResourceEveryone: (resourceId: string) => Promise<DataWrapper<ResourceAssignments>>;
|
|
52
|
+
/** Idempotent. 400 if the role belongs to another license. */
|
|
53
|
+
assignResourceRole: (resourceId: string, roleId: string) => Promise<DataWrapper<ResourceAssignments>>;
|
|
54
|
+
/** Idempotent — removing a role that was never assigned is a no-op, not an error. */
|
|
55
|
+
unassignResourceRole: (resourceId: string, roleId: string) => Promise<DataWrapper<ResourceAssignments>>;
|
|
56
|
+
/**
|
|
57
|
+
* Idempotent. 404 if the user is not a member of the license — a grant on a
|
|
58
|
+
* non-member could never satisfy a read, so accepting it would be a lie this
|
|
59
|
+
* screen then displays as access.
|
|
60
|
+
*/
|
|
61
|
+
assignResourceUser: (resourceId: string, userId: string) => Promise<DataWrapper<ResourceAssignments>>;
|
|
62
|
+
/** Idempotent. */
|
|
63
|
+
unassignResourceUser: (resourceId: string, userId: string) => Promise<DataWrapper<ResourceAssignments>>;
|
|
64
|
+
}
|
|
65
|
+
export declare function newResourceAssignmentFactory(client: AntHttpClient): ResourceAssignmentFactory;
|
|
66
|
+
//# sourceMappingURL=resourceAssignments.d.ts.map
|
|
@@ -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,OAAO,KAAK,EACV,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,4BAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,+BAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAe;AAG1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;OAOG;IACH,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAA;IACtF,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE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AAS,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
|
+
}
|
|
@@ -59,4 +59,17 @@ export declare function newResourceSnapshotFactory(client: AntHttpClient): Resou
|
|
|
59
59
|
* crash lands in whichever component reads `fields` first.
|
|
60
60
|
*/
|
|
61
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
|
+
};
|
|
62
75
|
//# sourceMappingURL=resourceSnapshot.d.ts.map
|
|
@@ -1 +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,C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AAO,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"}
|
|
@@ -32,3 +32,24 @@ export function isSnapshotPayloadSchema(value) {
|
|
|
32
32
|
&& typeof field.order === 'number'
|
|
33
33
|
&& typeof field.source_column_id === 'string');
|
|
34
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
|
+
}
|