@croct/plug 0.11.0-alpha.2 → 0.11.0-alpha.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.
@@ -0,0 +1,4 @@
1
+ import {JsonObject} from '@croct/json';
2
+
3
+ export * from '@croct/json/mutable';
4
+ export type NullableJsonObject = JsonObject | null;
@@ -0,0 +1 @@
1
+ export {SdkEvent, SdkEventType} from '@croct/sdk/sdkEvents';
@@ -0,0 +1 @@
1
+ export {Token, TokenPayload, Headers, TokenProvider, TokenStore} from '@croct/sdk/token';
@@ -0,0 +1,14 @@
1
+ import {EventInfo as SdkEventInfo} from '@croct/sdk/tracker';
2
+ import {TrackingEvent, TrackingEventType} from '@croct/sdk/trackingEvents';
3
+
4
+ export {TrackerFacade} from '@croct/sdk/facade/trackerFacade';
5
+ export {EventListener} from '@croct/sdk/tracker';
6
+ export {
7
+ TrackingEvent,
8
+ TrackingEventType,
9
+ ExternalTrackingEvent,
10
+ ExternalTrackingEventPayload,
11
+ ExternalTrackingEventType,
12
+ } from '@croct/sdk/trackingEvents';
13
+
14
+ export type EventInfo<T extends TrackingEventType> = SdkEventInfo<TrackingEvent<T>>;
@@ -0,0 +1,2 @@
1
+ export * from '@croct/sdk/validation';
2
+ export * from '@croct/sdk/error';
package/src/slot.ts ADDED
@@ -0,0 +1,37 @@
1
+ import {JsonObject} from '@croct/json';
2
+
3
+ export interface SlotMap {
4
+ }
5
+
6
+ type LatestSlotVersionMap = {[K in keyof SlotMap]: {latest: SlotMap[K]}};
7
+
8
+ export interface VersionedSlotMap extends LatestSlotVersionMap {
9
+ }
10
+
11
+ type LatestAlias = 'latest';
12
+
13
+ export type SlotId = keyof VersionedSlotMap extends never ? string : keyof VersionedSlotMap;
14
+
15
+ export type SlotVersion<I extends SlotId = SlotId> = LatestAlias | (
16
+ I extends keyof VersionedSlotMap
17
+ ? keyof VersionedSlotMap[I]
18
+ : never
19
+ );
20
+
21
+ export type VersionedSlotId<I extends SlotId = SlotId> = I | {[K in SlotId]: `${K}@${SlotVersion<K> & string}`}[I];
22
+
23
+ type VersionedSlotContent<I extends SlotId, V extends string = LatestAlias, C extends JsonObject = JsonObject> =
24
+ I extends keyof VersionedSlotMap
25
+ ? (V extends keyof VersionedSlotMap[I]
26
+ ? VersionedSlotMap[I][V]
27
+ : C)
28
+ : C;
29
+
30
+ export type ExtractSlotVersion<I extends string> = I extends `${string}@${infer V}`
31
+ ? (LatestAlias extends V ? LatestAlias : (V extends `${number}` ? V : never))
32
+ : LatestAlias;
33
+
34
+ export type ExtractSlotId<I extends string> = I extends `${infer V}@${string}` ? V : I;
35
+
36
+ export type SlotContent<I extends VersionedSlotId, C extends JsonObject = JsonObject> =
37
+ VersionedSlotContent<ExtractSlotId<I>, ExtractSlotVersion<I>, C>;