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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/README.md +67 -3
  2. package/build/AntConnect.d.ts +8 -0
  3. package/build/AntConnect.d.ts.map +1 -1
  4. package/build/AntConnect.js +8 -0
  5. package/build/AntHttpClient.d.ts +0 -5
  6. package/build/AntHttpClient.d.ts.map +1 -1
  7. package/build/AntHttpClient.js +0 -5
  8. package/build/ai/index.d.ts +5 -0
  9. package/build/ai/index.d.ts.map +1 -0
  10. package/build/ai/index.js +3 -0
  11. package/build/ai/mutationDescriptors.d.ts +3 -0
  12. package/build/ai/mutationDescriptors.d.ts.map +1 -0
  13. package/build/ai/mutationDescriptors.js +207 -0
  14. package/build/ai/mutationTargets.d.ts +21 -0
  15. package/build/ai/mutationTargets.d.ts.map +1 -0
  16. package/build/ai/mutationTargets.js +72 -0
  17. package/build/ai/queryDescriptors.d.ts +3 -0
  18. package/build/ai/queryDescriptors.d.ts.map +1 -0
  19. package/build/ai/queryDescriptors.js +174 -0
  20. package/build/ai/types.d.ts +35 -0
  21. package/build/ai/types.d.ts.map +1 -0
  22. package/build/comms/client.js +1 -1
  23. package/build/comms/hostAPI.js +1 -1
  24. package/build/comms/models.d.ts +20 -2
  25. package/build/comms/models.d.ts.map +1 -1
  26. package/build/comms/signalChangeTypes.d.ts +27 -1
  27. package/build/comms/signalChangeTypes.d.ts.map +1 -1
  28. package/build/comms/signalChangeTypes.js +7 -0
  29. package/build/comms/signalTypes.d.ts +21 -3
  30. package/build/comms/signalTypes.d.ts.map +1 -1
  31. package/build/index.d.ts +8 -35
  32. package/build/index.d.ts.map +1 -1
  33. package/build/index.js +8 -3
  34. package/build/service-runtime.d.ts +9 -0
  35. package/build/service-runtime.d.ts.map +1 -0
  36. package/build/service-runtime.js +10 -0
  37. package/build/service-types-app.d.ts +2 -0
  38. package/build/service-types-app.d.ts.map +1 -0
  39. package/build/service-types-app.js +3 -0
  40. package/build/service-types.d.ts +37 -0
  41. package/build/service-types.d.ts.map +1 -0
  42. package/build/service-types.js +7 -0
  43. package/build/services/AiService.d.ts +18 -0
  44. package/build/services/AiService.d.ts.map +1 -0
  45. package/build/services/AiService.js +9 -0
  46. package/build/services/AppService/factory/accessRequests.d.ts +19 -0
  47. package/build/services/AppService/factory/accessRequests.d.ts.map +1 -0
  48. package/build/services/AppService/factory/accessRequests.js +17 -0
  49. package/build/services/AppService/factory/assignments.d.ts +57 -0
  50. package/build/services/AppService/factory/assignments.d.ts.map +1 -0
  51. package/build/services/AppService/factory/assignments.js +30 -0
  52. package/build/services/AppService/factory/channels.d.ts +35 -0
  53. package/build/services/AppService/factory/channels.d.ts.map +1 -0
  54. package/build/services/AppService/factory/channels.js +18 -0
  55. package/build/services/AppService/factory/formData.d.ts +14 -0
  56. package/build/services/AppService/factory/formData.d.ts.map +1 -0
  57. package/build/services/AppService/factory/formData.js +50 -0
  58. package/build/services/AppService/factory/media.d.ts +17 -0
  59. package/build/services/AppService/factory/media.d.ts.map +1 -0
  60. package/build/services/AppService/factory/media.js +10 -0
  61. package/build/services/AppService/factory/resourceAccess.d.ts +21 -0
  62. package/build/services/AppService/factory/resourceAccess.d.ts.map +1 -0
  63. package/build/services/AppService/factory/resourceAccess.js +37 -0
  64. package/build/services/AppService/factory/resourceCommerce.d.ts +52 -0
  65. package/build/services/AppService/factory/resourceCommerce.d.ts.map +1 -0
  66. package/build/services/AppService/factory/resourceCommerce.js +18 -0
  67. package/build/services/AppService/factory/resourceSnapshot.d.ts +62 -0
  68. package/build/services/AppService/factory/resourceSnapshot.d.ts.map +1 -0
  69. package/build/services/AppService/factory/resourceSnapshot.js +34 -0
  70. package/build/services/AppService/factory/resources.d.ts +153 -0
  71. package/build/services/AppService/factory/resources.d.ts.map +1 -0
  72. package/build/services/AppService/factory/resources.js +44 -0
  73. package/build/services/AppService/factory/subscriptions.d.ts +73 -0
  74. package/build/services/AppService/factory/subscriptions.d.ts.map +1 -0
  75. package/build/services/AppService/factory/subscriptions.js +39 -0
  76. package/build/services/AppService/index.d.ts +59 -0
  77. package/build/services/AppService/index.d.ts.map +1 -0
  78. package/build/services/AppService/index.js +76 -0
  79. package/build/services/AppService/types/accessRequests.d.ts +164 -0
  80. package/build/services/AppService/types/accessRequests.d.ts.map +1 -0
  81. package/build/services/AppService/types/app.d.ts +124 -0
  82. package/build/services/AppService/types/app.d.ts.map +1 -0
  83. package/build/services/AppService/types/app.js +6 -0
  84. package/build/services/AppService/types/appCategories.d.ts +16 -0
  85. package/build/services/AppService/types/appCategories.d.ts.map +1 -0
  86. package/build/services/AppService/types/appCategories.js +1 -0
  87. package/build/services/AppService/types/appChangelog.d.ts +31 -0
  88. package/build/services/AppService/types/appChangelog.d.ts.map +1 -0
  89. package/build/services/AppService/types/appChangelog.js +1 -0
  90. package/build/services/AppService/types/appConfigStatus.d.ts +68 -0
  91. package/build/services/AppService/types/appConfigStatus.d.ts.map +1 -0
  92. package/build/services/AppService/types/appConfigStatus.js +11 -0
  93. package/build/services/AppService/types/appList.d.ts +211 -0
  94. package/build/services/AppService/types/appList.d.ts.map +1 -0
  95. package/build/services/AppService/types/appList.js +1 -0
  96. package/build/services/AppService/types/appManifest.d.ts +100 -0
  97. package/build/services/AppService/types/appManifest.d.ts.map +1 -0
  98. package/build/services/AppService/types/appManifest.js +4 -0
  99. package/build/services/AppService/types/appMedia.d.ts +136 -0
  100. package/build/services/AppService/types/appMedia.d.ts.map +1 -0
  101. package/build/services/AppService/types/appMedia.js +1 -0
  102. package/build/services/AppService/types/appRequests.d.ts +126 -0
  103. package/build/services/AppService/types/appRequests.d.ts.map +1 -0
  104. package/build/services/AppService/types/appRequests.js +1 -0
  105. package/build/services/AppService/types/appScopes.d.ts +165 -0
  106. package/build/services/AppService/types/appScopes.d.ts.map +1 -0
  107. package/build/services/AppService/types/appScopes.js +1 -0
  108. package/build/services/AppService/types/channels.d.ts +45 -0
  109. package/build/services/AppService/types/channels.d.ts.map +1 -0
  110. package/build/services/AppService/types/channels.js +1 -0
  111. package/build/services/AppService/types/pricingTiers.d.ts +111 -0
  112. package/build/services/AppService/types/pricingTiers.d.ts.map +1 -0
  113. package/build/services/AppService/types/pricingTiers.js +1 -0
  114. package/build/services/AppService/types/publisherStats.d.ts +20 -0
  115. package/build/services/AppService/types/publisherStats.d.ts.map +1 -0
  116. package/build/services/AppService/types/publisherStats.js +1 -0
  117. package/build/services/AppService/types/releaseChannels.d.ts +127 -0
  118. package/build/services/AppService/types/releaseChannels.d.ts.map +1 -0
  119. package/build/services/AppService/types/releaseChannels.js +1 -0
  120. package/build/services/AppService/types/resourceEntitlements.d.ts +101 -0
  121. package/build/services/AppService/types/resourceEntitlements.d.ts.map +1 -0
  122. package/build/services/AppService/types/resourceEntitlements.js +1 -0
  123. package/build/services/AppService/types/resourceReleases.d.ts +143 -0
  124. package/build/services/AppService/types/resourceReleases.d.ts.map +1 -0
  125. package/build/services/AppService/types/resourceReleases.js +1 -0
  126. package/build/services/AppService/types/resourceRequests.d.ts +105 -0
  127. package/build/services/AppService/types/resourceRequests.d.ts.map +1 -0
  128. package/build/services/AppService/types/resourceRequests.js +1 -0
  129. package/build/services/AppService/types/seats.d.ts +220 -0
  130. package/build/services/AppService/types/seats.d.ts.map +1 -0
  131. package/build/services/AppService/types/seats.js +4 -0
  132. package/build/services/AppService/types/sellableResources.d.ts +189 -0
  133. package/build/services/AppService/types/sellableResources.d.ts.map +1 -0
  134. package/build/services/AppService/types/sellableResources.js +1 -0
  135. package/build/services/AppService/types/snapshotPayload.d.ts +146 -0
  136. package/build/services/AppService/types/snapshotPayload.d.ts.map +1 -0
  137. package/build/services/AppService/types/snapshotPayload.js +16 -0
  138. package/build/services/AppService/types/snapshotSources.d.ts +98 -0
  139. package/build/services/AppService/types/snapshotSources.d.ts.map +1 -0
  140. package/build/services/AppService/types/snapshotSources.js +7 -0
  141. package/build/services/AppService/types/subscriptions.d.ts +182 -0
  142. package/build/services/AppService/types/subscriptions.d.ts.map +1 -0
  143. package/build/services/AppService/types/subscriptions.js +1 -0
  144. package/build/services/AppService/types.d.ts +23 -0
  145. package/build/services/AppService/types.d.ts.map +1 -0
  146. package/build/services/AppService/types.js +25 -0
  147. package/build/services/DmsService.d.ts +13 -0
  148. package/build/services/DmsService.d.ts.map +1 -1
  149. package/build/services/DmsServiceImpl.d.ts.map +1 -1
  150. package/build/services/DmsServiceImpl.js +8 -0
  151. package/build/services/LicenseService.d.ts +1 -1
  152. package/build/services/LicenseService.d.ts.map +1 -1
  153. package/build/services/LicenseService.js +1 -1
  154. package/build/services/OAuthClientService.d.ts +20 -0
  155. package/build/services/OAuthClientService.d.ts.map +1 -0
  156. package/build/services/OAuthClientService.js +12 -0
  157. package/build/services/OAuthClientService.types.d.ts +37 -0
  158. package/build/services/OAuthClientService.types.d.ts.map +1 -0
  159. package/build/services/OAuthClientService.types.js +4 -0
  160. package/build/services/ProjectService.d.ts +1 -0
  161. package/build/services/ProjectService.d.ts.map +1 -1
  162. package/build/services/ReleaseService.d.ts +1 -0
  163. package/build/services/ReleaseService.d.ts.map +1 -1
  164. package/build/services/SecretService.d.ts +22 -0
  165. package/build/services/SecretService.d.ts.map +1 -0
  166. package/build/services/SecretService.js +21 -0
  167. package/build/services/SecretService.types.d.ts +147 -0
  168. package/build/services/SecretService.types.d.ts.map +1 -0
  169. package/build/services/SecretService.types.js +1 -0
  170. package/build/services/SecretSharing.types.d.ts +112 -0
  171. package/build/services/SecretSharing.types.d.ts.map +1 -0
  172. package/build/services/SecretSharing.types.js +1 -0
  173. package/build/services/TableService.js +7 -7
  174. package/build/services/TaskService.d.ts +3 -3
  175. package/build/services/TaskService.d.ts.map +1 -1
  176. package/build/services/TaskService.js +1 -1
  177. package/build/services/TaskService.types.d.ts +21 -4
  178. package/build/services/TaskService.types.d.ts.map +1 -1
  179. package/build/services/TaskServiceQueries.d.ts +2 -0
  180. package/build/services/TaskServiceQueries.d.ts.map +1 -1
  181. package/build/services/TaskServiceQueries.js +13 -2
  182. package/build/services/TaskTemplate.types.d.ts +74 -1
  183. package/build/services/TaskTemplate.types.d.ts.map +1 -1
  184. package/build/services/TokenService.d.ts +5 -1
  185. package/build/services/TokenService.d.ts.map +1 -1
  186. package/build/services/TokenService.js +1 -2
  187. package/build/services/UserService.d.ts +3 -0
  188. package/build/services/UserService.d.ts.map +1 -1
  189. package/build/services/UserService.js +4 -4
  190. package/build/services/Webhook/TriggerHistoryService.d.ts +1 -1
  191. package/build/services/Webhook/TriggerHistoryService.d.ts.map +1 -1
  192. package/build/services/Webhook/TriggerSecretService.d.ts +88 -0
  193. package/build/services/Webhook/TriggerSecretService.d.ts.map +1 -0
  194. package/build/services/Webhook/TriggerSecretService.js +9 -0
  195. package/build/services/Webhook/TriggerService.d.ts +28 -0
  196. package/build/services/Webhook/TriggerService.d.ts.map +1 -1
  197. package/build/services/Webhook/TriggerService.js +10 -0
  198. package/build/services/Websockets/StoreEvents.d.ts +44 -0
  199. package/build/services/Websockets/StoreEvents.d.ts.map +1 -0
  200. package/build/services/Websockets/StoreEvents.js +5 -0
  201. package/build/services/userPreferences.d.ts +37 -0
  202. package/build/services/userPreferences.d.ts.map +1 -0
  203. package/build/services/userPreferences.js +39 -0
  204. package/package.json +8 -7
  205. package/schemas/app-config.schema.json +85 -8
  206. package/build/services/AppManifest.d.ts +0 -39
  207. package/build/services/AppManifest.d.ts.map +0 -1
  208. package/build/services/AppService.d.ts +0 -57
  209. package/build/services/AppService.d.ts.map +0 -1
  210. package/build/services/AppService.js +0 -47
  211. package/build/services/AppService.types.d.ts +0 -173
  212. package/build/services/AppService.types.d.ts.map +0 -1
  213. /package/build/{services/AppManifest.js → ai/types.js} +0 -0
  214. /package/build/services/{AppService.types.js → AppService/types/accessRequests.js} +0 -0
@@ -0,0 +1,189 @@
1
+ import type { AppLicense } from './app';
2
+ import type { AppTierSummary } from './appList';
3
+ import type { PricingTier } from './pricingTiers';
4
+ import type { ResourceEntitlementSummary } from './resourceEntitlements';
5
+ import type { ResourceChannel, ResourceVersion } from './resourceReleases';
6
+ import type { Subscription } from './subscriptions';
7
+ /**
8
+ * Sellable resources — the Store's second sellable thing alongside apps
9
+ * (AAD-898). Access to a dataset, a live feed, a processing API, a calculation
10
+ * service, a relay to an external system.
11
+ *
12
+ * The whole surface sits behind ONE backend feature flag, default off. Read it
13
+ * from {@link StoreCapabilities} via `fetchStoreCapabilities()` BEFORE rendering
14
+ * anything: with the flag off every `/store/resources` route returns 404 by
15
+ * design, so probing them is not a substitute — and the acceptance criterion is
16
+ * that the store UI is indistinguishable from today when the flag is off.
17
+ *
18
+ * Resources are a SIBLING of apps, not a variant of them. They share commerce
19
+ * (`PricingTier`, `Subscription` — both already polymorphic) and share no
20
+ * install/seat machinery: an entitlement is LICENSE-LEVEL. There are no seats,
21
+ * no per-user grants and no project activation.
22
+ *
23
+ * The rest of the surface lives in sibling files, all re-exported through the
24
+ * same barrel: `resourceReleases` (versions, channels), `resourceEntitlements`
25
+ * (claims, refusal reasons) and `resourceRequests` (list params, request bodies).
26
+ */
27
+ /**
28
+ * What backs a resource when an entitled caller reads it.
29
+ *
30
+ * - `snapshot` — a materialised dataset (AAD-939)
31
+ * - `endpoint` — live dispatch to the publisher's trigger (AAD-899)
32
+ */
33
+ export type ResourcePayloadType = 'snapshot' | 'endpoint';
34
+ /** Discover subcategory, under the "Services" kind (AAD-935 item 1). */
35
+ export type ResourceCategory = 'data' | 'service';
36
+ /** Which optional Store surfaces this deployment has switched on. */
37
+ export interface StoreCapabilities {
38
+ /**
39
+ * The sellable-resource surface. When false, render exactly as before: no
40
+ * Services category, no resource rows, no filter options, no dead tabs.
41
+ */
42
+ resources_enabled: boolean;
43
+ /**
44
+ * Whether THIS license may publish a DATA listing (AAD-939).
45
+ *
46
+ * A per-license grant sitting UNDER `resources_enabled`, off by default: v1 is
47
+ * first-party publishers only, granted by an operator, and it stays off in
48
+ * production until the legal position resolves. Always false when
49
+ * `resources_enabled` is false.
50
+ *
51
+ * **Hide the create-a-dataset action when this is false.** Creating a `data`
52
+ * listing without the grant is a 403, and discovering that after the publisher has
53
+ * filled in a form is not "disabled means disabled in the UI". Creating a
54
+ * `service` listing is unaffected.
55
+ */
56
+ resources_can_publish_data: boolean;
57
+ /**
58
+ * Which dynamic-table column types a dataset can publish (AAD-939).
59
+ *
60
+ * **Grey out unpublishable columns against THIS, never a hardcoded list.** A
61
+ * client-side copy that drifted from the server's would offer a column that then
62
+ * 422s at create, and the failure would land on the publisher rather than on
63
+ * whoever changed the list. Values match `SnapshotFieldType`.
64
+ */
65
+ resources_snapshot_field_types: string[];
66
+ /**
67
+ * Whether the per-license data-publishing grant is globally waived on this
68
+ * deployment (AAD-939) — development and staging only.
69
+ *
70
+ * `resources_can_publish_data` alone cannot say WHY this license may publish: a
71
+ * real grant and an open gate look identical. This distinguishes them, which is
72
+ * what lets a dev/staging build show "publishing gate is open" rather than
73
+ * implying every license has been individually approved.
74
+ *
75
+ * Diagnostic, not behavioural — branch on `resources_can_publish_data`. Reported
76
+ * raw, so it is visible even while `resources_enabled` is false: a bypass sitting
77
+ * armed behind a disabled surface is still worth surfacing.
78
+ */
79
+ resources_data_publishing_gate_bypassed: boolean;
80
+ }
81
+ /**
82
+ * A storefront row.
83
+ *
84
+ * Field names deliberately match `ListApp` for every shared card concept, so a
85
+ * Discover view can merge apps and resources into one array without translating
86
+ * anything.
87
+ *
88
+ * ⚠️ **Do not build client-side pagination over a merged list.** Two
89
+ * independently paginated lists cannot be merged into one correctly ordered
90
+ * page. Both `/store/apps` and `/store/resources` are currently UNPAGINATED, so
91
+ * a plain concatenation is correct today; when a unified server-side endpoint
92
+ * arrives it will replace the merge wholesale. Keep the merge behind a single
93
+ * composable so that swap is one file.
94
+ *
95
+ * There is no `kind` field — adding one would change the app payload while the
96
+ * flag is off. Stamp it client-side at merge time.
97
+ */
98
+ export interface SellableResourceListItem {
99
+ id: string;
100
+ title: string;
101
+ tagline: string | null;
102
+ icon: string | null;
103
+ image: string | null;
104
+ color: string | null;
105
+ payload_type: ResourcePayloadType;
106
+ category: ResourceCategory;
107
+ availability: 'always_available' | 'request_access' | 'private';
108
+ access_model: 'free' | 'subscription';
109
+ access_level: 'community' | 'enterprise';
110
+ trust_level: 'standard' | 'verified' | 'certified';
111
+ is_featured: boolean;
112
+ /**
113
+ * The publisher. Same `AppLicense` shape apps use, `theme` included, so a
114
+ * merged Discover grid renders the publisher swatch in the publisher's own
115
+ * colour on both card kinds rather than greying out one of them.
116
+ */
117
+ license: AppLicense | null;
118
+ /**
119
+ * Free/paid spread across active tiers — the SAME summary apps carry, from the
120
+ * shared presenter rather than a lookalike, so one card footer renders both.
121
+ * Null when the resource is not subscription-model.
122
+ */
123
+ tier_summary?: AppTierSummary | null;
124
+ /**
125
+ * Distinct non-revoked entitlements. The neutral popularity scalar: apps emit
126
+ * the same field name with the same meaning (distinct external installs), so a
127
+ * merged list can rank both kinds on it.
128
+ */
129
+ consumer_count?: number;
130
+ /** Whether the VIEWING license holds a non-revoked entitlement. */
131
+ has_access: boolean;
132
+ entitlement: ResourceEntitlementSummary | null;
133
+ /** Whether any channel currently serves a version. */
134
+ is_published: boolean;
135
+ created_at: string;
136
+ updated_at: string;
137
+ }
138
+ /** The full listing — the contract a buyer sees before purchasing. */
139
+ export interface SellableResource extends SellableResourceListItem {
140
+ description: string | null;
141
+ channels: ResourceChannel[];
142
+ /**
143
+ * The versions THIS viewer may see — not the whole catalogue.
144
+ *
145
+ * A publisher gets everything they have registered. Everyone else gets exactly
146
+ * two kinds, because they are the two a buyer surface resolves out of this list
147
+ * and both need the full version (`entitlement.pinned_version` and
148
+ * `channel.active_version` are summaries, without the declared schema or counts):
149
+ *
150
+ * 1. what each channel currently SERVES — the offer, and the Move target, and
151
+ * 2. the version this viewer is PINNED to — which stays here after it has been
152
+ * superseded and is no longer any channel's active version.
153
+ *
154
+ * That second one matters: publishing moves nobody, so a buyer routinely sits on
155
+ * a version no channel serves, and dropping it would blank the "what I have" side
156
+ * of their before/after comparison the moment the publisher released anything.
157
+ *
158
+ * Unreleased drafts and retired builds belong to the publisher alone — the raw
159
+ * list endpoint (`fetchResourceVersions`) is publisher-only for that reason.
160
+ * Still resolve "which version am I on?" from `entitlement.pinned_version`.
161
+ */
162
+ versions: ResourceVersion[];
163
+ pricing_tiers: PricingTier[];
164
+ }
165
+ /** An entry in the buyer's "My Access" list. */
166
+ export interface ResourceAccessEntry extends ResourceEntitlementSummary {
167
+ resource: {
168
+ id: string;
169
+ title: string;
170
+ tagline: string | null;
171
+ icon: string | null;
172
+ color: string | null;
173
+ payload_type: ResourcePayloadType;
174
+ category: ResourceCategory;
175
+ };
176
+ /** Whether this license's channel serves a version newer than the pin. */
177
+ update_available: boolean;
178
+ }
179
+ /** A row of the publisher's consumption view. Lifetime totals, not a time series. */
180
+ export interface ResourceConsumer {
181
+ license_id: string;
182
+ license_name: string | null;
183
+ call_count: number;
184
+ last_called_at: string | null;
185
+ is_revoked: boolean;
186
+ }
187
+ /** Re-exported for convenience: a resource purchase yields a normal Subscription. */
188
+ export type ResourceSubscription = Subscription;
189
+ //# sourceMappingURL=sellableResources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sellableResources.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/types/sellableResources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,mBAA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AY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,sEAAsE;AACtE,MAAM,WAAW,gBAAiB,SAAQ,wBAAwB;IAChE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,aAAa,EAAE,WAAW,EAAE,CAAA;CAC7B;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B;IACrE,QAAQ,EAAE;QACR,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;QACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;QACpB,YAAY,EAAE,mBAAmB,CAAA;QACjC,QAAQ,EAAE,gBAAgB,CAAA;KAC3B,CAAA;IACD,0EAA0E;IAC1E,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,qFAAqF;AACrF,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAA"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Snapshot payload shapes (AAD-939) — the first payload type a sellable resource
3
+ * can have.
4
+ *
5
+ * A snapshot publishes a linked dynamic table with an EXPLICIT column selection.
6
+ * File upload is deliberately not a source; there is one path in.
7
+ *
8
+ * Two things about this file are load-bearing:
9
+ *
10
+ * 1. `SnapshotPayloadSchema` is the DECLARED schema, recorded once per version and
11
+ * **not backfillable**. AAD-942 builds structural diffs on it.
12
+ * 2. Materialisation is QUEUED. A version is created `pending` and a job flips it
13
+ * to `ready` or `failed`, so nothing here is servable the moment
14
+ * `createResourceVersion` returns.
15
+ */
16
+ /** A column type a dataset may publish. */
17
+ export type SnapshotFieldType = 'boolean' | 'integer' | 'float' | 'text' | 'text-field' | 'link' | 'email' | 'dropdown' | 'sbscode' | 'date';
18
+ /** Which table a snapshot reads from. Must belong to the publisher's own license. */
19
+ export interface SnapshotSourceSelection {
20
+ table_id: string;
21
+ }
22
+ /** One published column. */
23
+ export interface SnapshotColumnSelection {
24
+ /** The logical `columns.id`. Selection is by ID, never by name. */
25
+ column_id: string;
26
+ /**
27
+ * Optional output key. Defaults to the column's name.
28
+ *
29
+ * Letters, numbers, underscores and hyphens only, and unique across the
30
+ * selection — a duplicate key collapses in JSON and produces two identically
31
+ * named CSV columns, so the dataset would not match its own schema.
32
+ */
33
+ key?: string | null;
34
+ }
35
+ /**
36
+ * A row filter.
37
+ *
38
+ * ⚠️ **Accepted and stored, but NOT yet applied.** The shape is fixed now so
39
+ * nothing has to be reshaped later, but a version carrying a non-empty filter
40
+ * fails materialisation with `payload_error` "Row filters are not supported yet".
41
+ * Do not offer filtering in the publish flow until the backend applies it — the
42
+ * preview reports `row_filters_supported: false` for exactly this reason.
43
+ */
44
+ export interface SnapshotRowFilter {
45
+ column_id: string;
46
+ operator: '=' | '>' | '<' | '>=' | '<=' | '<>' | 'like' | 'not like' | 'is null' | 'is not null' | 'between';
47
+ value?: unknown;
48
+ values?: unknown[];
49
+ boolean?: 'and' | 'or';
50
+ }
51
+ /**
52
+ * What the publisher declared for a snapshot version.
53
+ *
54
+ * `declarations.contains_personal_data` is REQUIRED on create and `true` is
55
+ * refused with a 422 — publishing personal data is not possible in v1, so this is
56
+ * a blocking question rather than a warning.
57
+ */
58
+ export interface SnapshotPayloadConfig {
59
+ source: SnapshotSourceSelection;
60
+ columns: SnapshotColumnSelection[];
61
+ filters?: SnapshotRowFilter[];
62
+ declarations: {
63
+ contains_personal_data: boolean;
64
+ };
65
+ }
66
+ /** One field of the declared schema. */
67
+ export interface SnapshotFieldSchema {
68
+ /** The stable key in the payload — what buyer code reads. */
69
+ key: string;
70
+ /** The publisher's human label. Display only; renaming it breaks nothing. */
71
+ label: string | null;
72
+ type: SnapshotFieldType;
73
+ /**
74
+ * Whether this field is null anywhere in THIS artifact.
75
+ *
76
+ * MEASURED, not declared. The source column's `required` flag is a write-time UI
77
+ * hint that no record write path enforces, so it cannot answer the question —
78
+ * a `required` column can and does contain nulls. A field is reported nullable
79
+ * when a null was actually seen, or when the dataset is empty (zero rows cannot
80
+ * demonstrate non-nullability).
81
+ *
82
+ * It describes the bytes the buyer received, not a promise about future versions.
83
+ */
84
+ nullable: boolean;
85
+ /** `observed` from the artifact, or `declared` from the column flag (preview only). */
86
+ nullable_source: 'observed' | 'declared';
87
+ /** How many rows had null here. Null when not measured (preview). */
88
+ null_count: number | null;
89
+ /** What the source column claimed. Recorded for AAD-942; not what `nullable` is from. */
90
+ declared_required: boolean;
91
+ /** Position in the payload. CSV column order follows it. */
92
+ order: number;
93
+ /** The source column's id, so AAD-942 can tell a rename from a remove-plus-add. */
94
+ source_column_id: string;
95
+ }
96
+ /**
97
+ * The declared schema stored on a materialised version.
98
+ *
99
+ * Null until the job completes. `row_count` / `byte_size` are also flattened onto
100
+ * `ResourceVersion` for convenience.
101
+ */
102
+ export interface SnapshotPayloadSchema {
103
+ /**
104
+ * 1 = nullability derived from the column flag (never shipped).
105
+ * 2 = nullability observed from the artifact, with `null_count`.
106
+ */
107
+ schema_version: number;
108
+ fields: SnapshotFieldSchema[];
109
+ row_count: number;
110
+ byte_size: number;
111
+ materialised_at: string;
112
+ source: {
113
+ table_id: string;
114
+ table_name: string | null;
115
+ };
116
+ }
117
+ /**
118
+ * A dry run of a selection, before creating a version from it.
119
+ *
120
+ * This is how a publisher learns they are over a ceiling BEFORE publishing.
121
+ * Above either ceiling the backend REFUSES the version rather than truncating it,
122
+ * so surfacing `exceeds_limits` here is what keeps that refusal from being a
123
+ * surprise at the last step.
124
+ */
125
+ export interface SnapshotPreview {
126
+ row_count: number;
127
+ /** Extrapolated from the sample, not measured. Order of magnitude only. */
128
+ estimated_bytes: number;
129
+ exceeds_limits: {
130
+ rows: boolean;
131
+ bytes: boolean;
132
+ };
133
+ limits: {
134
+ max_rows: number;
135
+ max_bytes: number;
136
+ };
137
+ /** Exactly the schema that would be recorded, so the contract is reviewable. */
138
+ schema: SnapshotFieldSchema[];
139
+ /** First N rows, shaped as the payload would be. Always a sample. */
140
+ sample: Array<Record<string, unknown>>;
141
+ /** True when `sample` is shorter than `row_count`. A preview may truncate; a published dataset never does. */
142
+ truncated: boolean;
143
+ /** False until row filters are applied server-side. */
144
+ row_filters_supported: boolean;
145
+ }
146
+ //# sourceMappingURL=snapshotPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotPayload.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/types/snapshotPayload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GACvB,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,YAAY,GACZ,MAAM,GACN,OAAO,GACP,UAAU,GACV,SAAS,GACT,MAAM,CAAA;AAEZ,qFAAqF;AACrF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,4BAA4B;AAC5B,MAAM,WAAW,uBAAuB;IACtC,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAA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AAG,IAAI,CAAA;KAC1B,CAAA;CACF;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE;QACd,IAAI,EAAE,OAAO,CAAA;QACb,KAAK,EAAE,OAAO,CAAA;KACf,CAAA;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;IACD,gFAAgF;IAChF,MAAM,EAAE,mBAAmB,EAAE,CAAA;IAC7B,qEAAqE;IACrE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACtC,8GAA8G;IAC9G,SAAS,EAAE,OAAO,CAAA;IAClB,uDAAuD;IACvD,qBAAqB,EAAE,OAAO,CAAA;CAC/B"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Snapshot payload shapes (AAD-939) — the first payload type a sellable resource
3
+ * can have.
4
+ *
5
+ * A snapshot publishes a linked dynamic table with an EXPLICIT column selection.
6
+ * File upload is deliberately not a source; there is one path in.
7
+ *
8
+ * Two things about this file are load-bearing:
9
+ *
10
+ * 1. `SnapshotPayloadSchema` is the DECLARED schema, recorded once per version and
11
+ * **not backfillable**. AAD-942 builds structural diffs on it.
12
+ * 2. Materialisation is QUEUED. A version is created `pending` and a job flips it
13
+ * to `ready` or `failed`, so nothing here is servable the moment
14
+ * `createResourceVersion` returns.
15
+ */
16
+ export {};
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Snapshot error detail and source-table listing (AAD-939).
3
+ *
4
+ * Split from `snapshotPayload.ts` for file size; re-exported through the same
5
+ * barrel, so the public surface is unchanged.
6
+ */
7
+ /**
8
+ * Why a snapshot version failed, as a code you can branch and translate on.
9
+ *
10
+ * **Branch on this, not on `payload_error`.** The prose is English-only and cannot
11
+ * be localised for the nl/de builds, and it is the only place the numbers appear if
12
+ * you read it as a string. `payload_error` stays the fallback for a code you have
13
+ * not localised yet.
14
+ *
15
+ * | code | context | means |
16
+ * | --- | --- | --- |
17
+ * | `row_limit_exceeded` | `actual_rows`, `max_rows` | too many rows — narrow the selection |
18
+ * | `byte_limit_exceeded` | `max_bytes` | too large; the write aborted, so there is no `actual_bytes` to report |
19
+ * | `row_filters_unsupported` | — | a row filter was stored; filters are not applied yet |
20
+ * | `source_table_missing` | — | the source table was deleted after the version was declared |
21
+ * | `unpublishable_column_type` | `column_name`, `column_type` | a selected column cannot be published |
22
+ * | `invalid_payload_config` | varies | the stored configuration could not be read |
23
+ * | `snapshot_limits_misconfigured` | `config_key`, `env_var`, `resolved` | the DEPLOYMENT's size ceiling is unset or zero |
24
+ * | `internal_error` | — | a backend fault; the publisher cannot act on it |
25
+ */
26
+ export type SnapshotErrorCode = 'row_limit_exceeded' | 'byte_limit_exceeded' | 'row_filters_unsupported' | 'source_table_missing' | 'unpublishable_column_type' | 'invalid_payload_config' | 'snapshot_limits_misconfigured' | 'internal_error';
27
+ /**
28
+ * The numbers behind a failure, so a client can build its own sentence.
29
+ *
30
+ * Every field is optional: which ones are present depends on the code. Key ORDER is
31
+ * not stable — it round-trips through a MySQL JSON column, which reorders object
32
+ * keys — so read by name.
33
+ */
34
+ export interface SnapshotErrorContext {
35
+ actual_rows?: number;
36
+ max_rows?: number;
37
+ max_bytes?: number;
38
+ column_name?: string;
39
+ column_type?: string;
40
+ /** `snapshot_limits_misconfigured` only — the setting at fault, e.g. `STORE_RESOURCE_SNAPSHOT_MAX_ROWS`. */
41
+ env_var?: string;
42
+ config_key?: string;
43
+ /** What the ceiling resolved to: `0`, or null when the setting is absent entirely. */
44
+ resolved?: number | null;
45
+ [key: string]: unknown;
46
+ }
47
+ /** Which table, and who owns it. */
48
+ export interface SnapshotSourceOwner {
49
+ type: 'project' | 'license' | 'unknown';
50
+ id: string | null;
51
+ /** The project (or license) name — what makes two same-named tables tellable apart. */
52
+ name: string | null;
53
+ }
54
+ /** Why a source table cannot be used. */
55
+ export type SnapshotSourceUnavailableReason = 'storage_missing' | 'no_publishable_columns';
56
+ /**
57
+ * A table the publisher can build a dataset from.
58
+ *
59
+ * From `previewResourceSnapshot`'s sibling, `fetchSnapshotSources()`. Use this rather
60
+ * than the generic table listing: that one has no project attribution, no row count
61
+ * and no publishable-column count, so a picker built on it shows identical rows for
62
+ * same-named tables in different projects and needs one extra request per table.
63
+ */
64
+ export interface SnapshotSource {
65
+ table_id: string;
66
+ name: string;
67
+ owner: SnapshotSourceOwner;
68
+ /**
69
+ * Live rows (soft-deleted excluded). Exact, so it can be compared to the ceiling.
70
+ *
71
+ * **Null when the table has no physical storage behind it** — a `tables` row whose
72
+ * underlying table was never created or has since been dropped, which does occur.
73
+ * Null means "could not look", which is not the same fact as a real `0`, and a
74
+ * publisher judging a selection against the row ceiling needs to tell them apart.
75
+ */
76
+ row_count: number | null;
77
+ column_count: number;
78
+ /** Columns of a type a dataset may publish. */
79
+ publishable_column_count: number;
80
+ /**
81
+ * False when the table cannot be used as a source.
82
+ *
83
+ * Show the row and disable it rather than filtering it out — a publisher looking
84
+ * for a table they know exists should find it and learn why it is unusable.
85
+ */
86
+ is_publishable: boolean;
87
+ /**
88
+ * Why it cannot be used, or null when it can.
89
+ *
90
+ * - `storage_missing` — no physical table behind the row; nothing we can publish
91
+ * - `no_publishable_columns` — real table, but no column of a publishable type
92
+ *
93
+ * Two genuinely different problems, so the disabled row can say which rather than
94
+ * leaving the reader to infer it from a zero.
95
+ */
96
+ unavailable_reason: SnapshotSourceUnavailableReason | null;
97
+ }
98
+ //# sourceMappingURL=snapshotSources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotSources.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/types/snapshotSources.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,iBAAiB,GACvB,oBAAoB,GACpB,qB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
2
+ * Snapshot error detail and source-table listing (AAD-939).
3
+ *
4
+ * Split from `snapshotPayload.ts` for file size; re-exported through the same
5
+ * barrel, so the public surface is unchanged.
6
+ */
7
+ export {};
@@ -0,0 +1,182 @@
1
+ import type { PricingModel, PricingTier } from './pricingTiers';
2
+ /**
3
+ * `pending_approval` is the initial state of a paid purchase: the buyer has
4
+ * requested to buy, but the publisher (seller) has not yet approved the offline
5
+ * payment. It grants NO access — the app stays locked until approval moves the
6
+ * subscription to `trial`/`active`.
7
+ */
8
+ export type SubscriptionStatus = 'pending_approval' | 'trial' | 'active' | 'grace_period' | 'expired' | 'cancelled';
9
+ /**
10
+ * Lightweight subscription summary embedded on App / ListApp resources to drive
11
+ * card state (in trial, in grace period, seats badge). Mirrors the
12
+ * `preloadedSubscription` shape on the backend (AppService::preloadSubscriptionData).
13
+ */
14
+ export interface AppSubscriptionSummary {
15
+ id: string;
16
+ status: SubscriptionStatus;
17
+ tier_id: string;
18
+ tier_name: string | null;
19
+ /**
20
+ * The tier's billing nature. Use this — not `status` — to tell a perpetual
21
+ * free plan apart from a time-limited trial of a paid tier. A free-tier
22
+ * subscription is always delivered as `status: 'active'` with
23
+ * `trial_ends_at: null` (the BE normalizes it), and `is_free: true`.
24
+ */
25
+ pricing_model: PricingModel | null;
26
+ /** Convenience flag: `pricing_model === 'free'`. */
27
+ is_free: boolean;
28
+ features: Record<string, unknown>[] | null;
29
+ seat_based: boolean;
30
+ seats_purchased: number;
31
+ seats_used: number;
32
+ /** Pending seat-increase target awaiting publisher approval (null = none). */
33
+ requested_seats_purchased?: number | null;
34
+ seat_change_requested_at?: string | null;
35
+ trial_ends_at: string | null;
36
+ grace_period_ends_at: string | null;
37
+ current_period_start: string | null;
38
+ current_period_end: string | null;
39
+ auto_renew: boolean;
40
+ has_seat: boolean;
41
+ /**
42
+ * Whether the current user may manage this subscription for the license
43
+ * (admin role or `apps.configure`): change plan, manage seats, cancel,
44
+ * reactivate. Gate the My Access manage controls on this. A seat-based app
45
+ * where the user has no seat AND `can_manage` is false grants no access.
46
+ */
47
+ can_manage: boolean;
48
+ }
49
+ export interface Subscription {
50
+ id: string;
51
+ subject_type: string;
52
+ subject_id: string;
53
+ license_id: string;
54
+ pricing_tier_id: string;
55
+ status: SubscriptionStatus;
56
+ seats_purchased: number;
57
+ current_period_start: string | null;
58
+ current_period_end: string | null;
59
+ grace_period_ends_at: string | null;
60
+ trial_ends_at: string | null;
61
+ payment_confirmed_at: string | null;
62
+ external_payment_ref: string | null;
63
+ auto_renew: boolean;
64
+ requested_tier_id: string | null;
65
+ tier_change_requested_at: string | null;
66
+ /** Pending seat-increase target awaiting publisher approval (null = none). */
67
+ requested_seats_purchased: number | null;
68
+ seat_change_requested_at: string | null;
69
+ /**
70
+ * True when the buyer must pick an active tier before the subscription
71
+ * can resume (e.g. their previous tier was archived). Pair with status
72
+ * `grace_period` to render a recovery CTA.
73
+ */
74
+ requires_tier_selection: boolean;
75
+ cancelled_at: string | null;
76
+ /**
77
+ * Set when the publisher has been notified that this recurring subscription's
78
+ * next offline payment is due (cleared once the period advances). Used by the
79
+ * publisher UI to show "renewal notice sent".
80
+ */
81
+ renewal_notified_at: string | null;
82
+ /**
83
+ * Optional buyer note attached at purchase time ("note to publisher"). Shown
84
+ * as a quote on the publisher approval-inbox row. Null when none was given.
85
+ */
86
+ message?: string | null;
87
+ created_at: string;
88
+ updated_at: string;
89
+ pricing_tier?: PricingTier;
90
+ /** Populated when there is a pending tier change request. */
91
+ requested_tier?: PricingTier | null;
92
+ /**
93
+ * Buyer license that owns the subscription. Embedded on publisher reads
94
+ * (approval inbox / active subscriptions) so rows can show the license name.
95
+ */
96
+ license?: SubscriptionLicense | null;
97
+ /**
98
+ * Who submitted the purchase request. Embedded on publisher reads for the
99
+ * "requested by {name}" line on the approval-inbox row.
100
+ */
101
+ requester?: SubscriptionRequester | null;
102
+ }
103
+ export interface SubscriptionLicense {
104
+ id: string;
105
+ name: string;
106
+ }
107
+ export interface SubscriptionRequester {
108
+ user_id: string;
109
+ user_name: string;
110
+ license_id: string;
111
+ license_name: string;
112
+ }
113
+ /** Query params for the publisher's per-app subscription list. */
114
+ export interface FetchAppSubscriptionsParams {
115
+ /** Filter by status; comma-separate for multiple. Omit to exclude pending_approval. */
116
+ status?: SubscriptionStatus | string;
117
+ }
118
+ export interface RequestTierChangeData {
119
+ pricing_tier_id: string;
120
+ }
121
+ export interface RequestSeatChangeData {
122
+ /** Desired TOTAL seat count (must exceed the current count — increase only). */
123
+ seats: number;
124
+ /** Optional buyer note to the publisher. */
125
+ message?: string;
126
+ }
127
+ /**
128
+ * Surplus seat assignment surfaced by the API when a seat-decrease attempt
129
+ * fails because seats are still occupied. Buyer must revoke seats first.
130
+ * Sized to the surplus, ordered most-recent-first.
131
+ */
132
+ export interface SurplusSeatAssignment {
133
+ seat_id: string;
134
+ user_id: string;
135
+ assigned_at: string;
136
+ }
137
+ export interface CreateSubscriptionData {
138
+ pricing_tier_id: string;
139
+ seats_purchased?: number;
140
+ /** Optional buyer note to the publisher (PO number, billing contact, etc.). */
141
+ message?: string;
142
+ }
143
+ export interface UpdateSubscriptionData {
144
+ /**
145
+ * Seat DECREASE only (no charge). Increasing seats is rejected (409) — use
146
+ * `requestSeatChange` so the publisher approves the offline payment.
147
+ */
148
+ seats_purchased?: number;
149
+ auto_renew?: boolean;
150
+ }
151
+ export interface ConfirmPaymentData {
152
+ external_payment_ref?: string;
153
+ }
154
+ export interface SubscriptionSeat {
155
+ id: string;
156
+ subscription_id: string;
157
+ user_id: string;
158
+ scope_type: string | null;
159
+ scope_id: string | null;
160
+ assigned_at: string;
161
+ assigned_by: string | null;
162
+ created_at: string;
163
+ user?: {
164
+ id: string;
165
+ name: string;
166
+ email: string;
167
+ };
168
+ assigned_by_user?: {
169
+ id: string;
170
+ name: string;
171
+ email: string;
172
+ };
173
+ }
174
+ export interface AssignSeatData {
175
+ user_id: string;
176
+ }
177
+ export interface AvailableSeatUser {
178
+ id: string;
179
+ name: string;
180
+ email: string;
181
+ }
182
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/types/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,GAAG,WAAW,CAAA;AAEnH;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,kBAAkB,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;;;;OAKG;IACH,aAAa,EAAE,YAAY,GAAG,IAAI,CAAA;IAClC,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAA;IAC1C,UAAU,EAAE,OAAO,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,yBAAyB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,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