@croct/plug 0.16.4 → 0.17.0
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/api/evaluate.cjs +45 -0
- package/api/evaluate.d.cts +23 -0
- package/api/evaluate.d.ts +9 -7
- package/api/evaluate.js +20 -22
- package/api/fetchContent.cjs +53 -0
- package/api/fetchContent.d.cts +45 -0
- package/api/fetchContent.d.ts +31 -11
- package/api/fetchContent.js +29 -21
- package/api/index.cjs +23 -0
- package/api/index.d.cts +27 -0
- package/api/index.d.ts +27 -2
- package/api/index.js +2 -6
- package/component.cjs +15 -0
- package/component.d.cts +19 -0
- package/component.d.ts +12 -9
- package/component.js +0 -3
- package/constants.cjs +39 -0
- package/constants.d.cts +7 -0
- package/constants.d.ts +7 -5
- package/constants.js +12 -9
- package/index.cjs +24 -0
- package/index.d.cts +27 -0
- package/index.d.ts +26 -3
- package/index.js +5 -6
- package/package.json +33 -6
- package/playground.cjs +166 -0
- package/playground.d.cts +64 -0
- package/playground.d.ts +18 -8
- package/playground.js +130 -138
- package/plug.cjs +271 -0
- package/plug.d.cts +86 -0
- package/plug.d.ts +34 -17
- package/plug.js +243 -256
- package/plugin.cjs +15 -0
- package/plugin.d.cts +41 -0
- package/plugin.d.ts +18 -8
- package/plugin.js +0 -3
- package/preview.cjs +180 -0
- package/preview.d.cts +35 -0
- package/preview.d.ts +18 -6
- package/preview.js +143 -152
- package/sdk/apiKey.cjs +21 -0
- package/sdk/apiKey.js +1 -5
- package/sdk/evaluation.cjs +34 -0
- package/sdk/evaluation.d.cts +2 -0
- package/sdk/evaluation.d.ts +1 -1
- package/sdk/evaluation.js +8 -10
- package/sdk/index.cjs +33 -0
- package/sdk/index.d.cts +15 -0
- package/sdk/index.d.ts +9 -6
- package/sdk/index.js +8 -10
- package/sdk/json.cjs +15 -0
- package/sdk/json.d.cts +6 -0
- package/sdk/json.d.ts +4 -1
- package/sdk/json.js +0 -5
- package/sdk/sdkEvents.cjs +15 -0
- package/sdk/sdkEvents.d.cts +1 -0
- package/sdk/sdkEvents.js +0 -3
- package/sdk/token.cjs +27 -0
- package/sdk/token.d.cts +7 -0
- package/sdk/token.d.ts +7 -1
- package/sdk/token.js +4 -6
- package/sdk/tracking.cjs +27 -0
- package/sdk/tracking.d.cts +9 -0
- package/sdk/tracking.d.ts +8 -5
- package/sdk/tracking.js +4 -6
- package/sdk/validation.cjs +23 -0
- package/sdk/validation.js +2 -6
- package/slot.cjs +15 -0
- package/slot.d.cts +42 -0
- package/slot.d.ts +14 -12
- package/slot.js +0 -3
- package/versioning.cjs +15 -0
- package/versioning.d.cts +26 -0
- package/versioning.d.ts +8 -6
- package/versioning.js +0 -3
- package/api/evaluate.js.map +0 -1
- package/api/fetchContent.js.map +0 -1
- package/api/index.js.map +0 -1
- package/component.js.map +0 -1
- package/constants.js.map +0 -1
- package/index.js.map +0 -1
- package/playground.js.map +0 -1
- package/plug.js.map +0 -1
- package/plugin.js.map +0 -1
- package/preview.js.map +0 -1
- package/sdk/apiKey.js.map +0 -1
- package/sdk/evaluation.js.map +0 -1
- package/sdk/index.js.map +0 -1
- package/sdk/json.js.map +0 -1
- package/sdk/sdkEvents.js.map +0 -1
- package/sdk/token.js.map +0 -1
- package/sdk/tracking.js.map +0 -1
- package/sdk/validation.js.map +0 -1
- package/slot.js.map +0 -1
- package/src/api/evaluate.ts +0 -50
- package/src/api/fetchContent.ts +0 -70
- package/src/api/index.ts +0 -2
- package/src/component.ts +0 -19
- package/src/constants.ts +0 -5
- package/src/index.ts +0 -6
- package/src/playground.ts +0 -247
- package/src/plug.ts +0 -429
- package/src/plugin.ts +0 -39
- package/src/preview.ts +0 -226
- package/src/sdk/evaluation.ts +0 -2
- package/src/sdk/index.ts +0 -14
- package/src/sdk/json.ts +0 -4
- package/src/sdk/sdkEvents.ts +0 -1
- package/src/sdk/token.ts +0 -1
- package/src/sdk/tracking.ts +0 -14
- package/src/slot.ts +0 -48
- package/src/versioning.ts +0 -38
- package/versioning.js.map +0 -1
- /package/{src/sdk/apiKey.ts → sdk/apiKey.d.cts} +0 -0
- /package/{src/sdk/validation.ts → sdk/validation.d.cts} +0 -0
package/src/sdk/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {EventListener, EventDispatcher, EventSubscriber, EventManager} from '@croct/sdk/eventManager';
|
|
2
|
-
import {SdkEventMap, SdkEventType} from '@croct/sdk/sdkEvents';
|
|
3
|
-
|
|
4
|
-
export {Logger} from '@croct/sdk/logging';
|
|
5
|
-
export {SessionFacade} from '@croct/sdk/facade/sessionFacade';
|
|
6
|
-
export {UserFacade} from '@croct/sdk/facade/userFacade';
|
|
7
|
-
export {Tab} from '@croct/sdk/tab';
|
|
8
|
-
export {CidAssigner} from '@croct/sdk/cid';
|
|
9
|
-
export {SdkEventType, SdkEvent} from '@croct/sdk/sdkEvents';
|
|
10
|
-
|
|
11
|
-
export type SdkEventListener<T extends SdkEventType> = EventListener<SdkEventMap[T]>;
|
|
12
|
-
export type SdkEventDispatcher = EventDispatcher<Record<string, Record<string, any>>>;
|
|
13
|
-
export type SdkEventSubscriber = EventSubscriber<SdkEventMap>;
|
|
14
|
-
export type SdkEventManager = EventManager<SdkEventMap, Record<string, Record<string, any>>>;
|
package/src/sdk/json.ts
DELETED
package/src/sdk/sdkEvents.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {SdkEvent, SdkEventType} from '@croct/sdk/sdkEvents';
|
package/src/sdk/token.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {Token, TokenPayload, TokenHeaders, TokenProvider, TokenStore} from '@croct/sdk/token';
|
package/src/sdk/tracking.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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>>;
|
package/src/slot.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {JsonObject} from '@croct/json';
|
|
2
|
-
import {CanonicalVersionId, Version, Versioned, VersionedId} from './versioning';
|
|
3
|
-
import {ComponentContent, ComponentVersionId} from './component';
|
|
4
|
-
|
|
5
|
-
export interface SlotMap {
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
type LatestSlotVersionMap = {[K in keyof SlotMap]: {latest: SlotMap[K]}};
|
|
9
|
-
|
|
10
|
-
export interface VersionedSlotMap extends LatestSlotVersionMap {
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Creates an intersection of the given types distributing over unions.
|
|
15
|
-
*
|
|
16
|
-
* The difference between this type and the built-in `&` operator is that the
|
|
17
|
-
* `&` operator creates an intersection of the union members instead of
|
|
18
|
-
* creating a union of the intersection members. For example, given the types
|
|
19
|
-
* `Left = A | B` and `Right = C`, the type `Left & Right` expands to
|
|
20
|
-
* `(A | B) & C`, but `Merge<Left, Right>` expands to `A & C | B & C`,
|
|
21
|
-
* which improves type inference when narrowing the type.
|
|
22
|
-
*/
|
|
23
|
-
type Intersection<T, E> = T extends infer O ? O & E : never;
|
|
24
|
-
|
|
25
|
-
type UnionContent<T = null> = {
|
|
26
|
-
[K in ComponentVersionId]: Intersection<ComponentContent<K>, {_component: K | T}>;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
type UnknownContent = UnionContent[ComponentVersionId] extends never
|
|
30
|
-
? (JsonObject & {_component: string | null})
|
|
31
|
-
: UnionContent[ComponentVersionId];
|
|
32
|
-
|
|
33
|
-
type VersionedContent<I extends VersionedSlotId> = Versioned<I, VersionedSlotMap, UnknownContent>;
|
|
34
|
-
|
|
35
|
-
export type DynamicSlotId = any;
|
|
36
|
-
|
|
37
|
-
export type SlotId = keyof VersionedSlotMap extends never ? string : keyof VersionedSlotMap;
|
|
38
|
-
|
|
39
|
-
export type SlotVersion<I extends SlotId> = Version<VersionedSlotMap, I>;
|
|
40
|
-
|
|
41
|
-
export type SlotVersionId<I extends SlotId = SlotId> = CanonicalVersionId<I, VersionedSlotMap>;
|
|
42
|
-
|
|
43
|
-
export type VersionedSlotId<I extends SlotId = SlotId> = VersionedId<I, VersionedSlotMap>;
|
|
44
|
-
|
|
45
|
-
export type CompatibleSlotContent<T extends ComponentVersionId = ComponentVersionId> = UnionContent<never>[T];
|
|
46
|
-
|
|
47
|
-
export type SlotContent<I extends VersionedSlotId = VersionedSlotId, C extends JsonObject = JsonObject> =
|
|
48
|
-
JsonObject extends C ? (string extends I ? UnknownContent : VersionedContent<I>) : C;
|
package/src/versioning.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {JsonObject} from '@croct/json';
|
|
2
|
-
|
|
3
|
-
export type LatestAlias = 'latest';
|
|
4
|
-
|
|
5
|
-
export type CanonicalVersionId<I extends string, M> = {
|
|
6
|
-
[K in I]: `${K}@${Extract<Version<M, K>, `${number}`>}`
|
|
7
|
-
}[I];
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Utility type that coerces any type to a string if it is not a string literal.
|
|
11
|
-
*/
|
|
12
|
-
type CastString<T extends string> = T extends `${infer V}` ? V : string;
|
|
13
|
-
|
|
14
|
-
export type VersionedId<I extends string, M> = CastString<I> | {[K in I]: `${K}@${Version<M, K> & string}`}[I];
|
|
15
|
-
|
|
16
|
-
export type Version<M, I extends string> = LatestAlias | (I extends keyof M ? keyof M[I] : never);
|
|
17
|
-
|
|
18
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
19
|
-
|
|
20
|
-
type Expand<T> = {[K in keyof T]: T[K]};
|
|
21
|
-
|
|
22
|
-
type FlattenVersionMap<T> = Expand<
|
|
23
|
-
UnionToIntersection<
|
|
24
|
-
{
|
|
25
|
-
[K in Extract<keyof T, string>]: {
|
|
26
|
-
[K2 in Extract<keyof T[K], string> as (`${K}@${K2}` | (LatestAlias extends K2 ? K : never))]: T[K][K2];
|
|
27
|
-
}
|
|
28
|
-
}[Extract<keyof T, string>]
|
|
29
|
-
>
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
export type Versioned<I extends string, M, C extends JsonObject = JsonObject> =
|
|
33
|
-
// Ensure T is string
|
|
34
|
-
I extends `${infer K}`
|
|
35
|
-
? K extends keyof FlattenVersionMap<M>
|
|
36
|
-
? FlattenVersionMap<M>[K]
|
|
37
|
-
: C
|
|
38
|
-
: C;
|
package/versioning.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versioning.js","sourceRoot":"","sources":["src/versioning.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|