@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.
Files changed (116) hide show
  1. package/api/evaluate.cjs +45 -0
  2. package/api/evaluate.d.cts +23 -0
  3. package/api/evaluate.d.ts +9 -7
  4. package/api/evaluate.js +20 -22
  5. package/api/fetchContent.cjs +53 -0
  6. package/api/fetchContent.d.cts +45 -0
  7. package/api/fetchContent.d.ts +31 -11
  8. package/api/fetchContent.js +29 -21
  9. package/api/index.cjs +23 -0
  10. package/api/index.d.cts +27 -0
  11. package/api/index.d.ts +27 -2
  12. package/api/index.js +2 -6
  13. package/component.cjs +15 -0
  14. package/component.d.cts +19 -0
  15. package/component.d.ts +12 -9
  16. package/component.js +0 -3
  17. package/constants.cjs +39 -0
  18. package/constants.d.cts +7 -0
  19. package/constants.d.ts +7 -5
  20. package/constants.js +12 -9
  21. package/index.cjs +24 -0
  22. package/index.d.cts +27 -0
  23. package/index.d.ts +26 -3
  24. package/index.js +5 -6
  25. package/package.json +33 -6
  26. package/playground.cjs +166 -0
  27. package/playground.d.cts +64 -0
  28. package/playground.d.ts +18 -8
  29. package/playground.js +130 -138
  30. package/plug.cjs +271 -0
  31. package/plug.d.cts +86 -0
  32. package/plug.d.ts +34 -17
  33. package/plug.js +243 -256
  34. package/plugin.cjs +15 -0
  35. package/plugin.d.cts +41 -0
  36. package/plugin.d.ts +18 -8
  37. package/plugin.js +0 -3
  38. package/preview.cjs +180 -0
  39. package/preview.d.cts +35 -0
  40. package/preview.d.ts +18 -6
  41. package/preview.js +143 -152
  42. package/sdk/apiKey.cjs +21 -0
  43. package/sdk/apiKey.js +1 -5
  44. package/sdk/evaluation.cjs +34 -0
  45. package/sdk/evaluation.d.cts +2 -0
  46. package/sdk/evaluation.d.ts +1 -1
  47. package/sdk/evaluation.js +8 -10
  48. package/sdk/index.cjs +33 -0
  49. package/sdk/index.d.cts +15 -0
  50. package/sdk/index.d.ts +9 -6
  51. package/sdk/index.js +8 -10
  52. package/sdk/json.cjs +15 -0
  53. package/sdk/json.d.cts +6 -0
  54. package/sdk/json.d.ts +4 -1
  55. package/sdk/json.js +0 -5
  56. package/sdk/sdkEvents.cjs +15 -0
  57. package/sdk/sdkEvents.d.cts +1 -0
  58. package/sdk/sdkEvents.js +0 -3
  59. package/sdk/token.cjs +27 -0
  60. package/sdk/token.d.cts +7 -0
  61. package/sdk/token.d.ts +7 -1
  62. package/sdk/token.js +4 -6
  63. package/sdk/tracking.cjs +27 -0
  64. package/sdk/tracking.d.cts +9 -0
  65. package/sdk/tracking.d.ts +8 -5
  66. package/sdk/tracking.js +4 -6
  67. package/sdk/validation.cjs +23 -0
  68. package/sdk/validation.js +2 -6
  69. package/slot.cjs +15 -0
  70. package/slot.d.cts +42 -0
  71. package/slot.d.ts +14 -12
  72. package/slot.js +0 -3
  73. package/versioning.cjs +15 -0
  74. package/versioning.d.cts +26 -0
  75. package/versioning.d.ts +8 -6
  76. package/versioning.js +0 -3
  77. package/api/evaluate.js.map +0 -1
  78. package/api/fetchContent.js.map +0 -1
  79. package/api/index.js.map +0 -1
  80. package/component.js.map +0 -1
  81. package/constants.js.map +0 -1
  82. package/index.js.map +0 -1
  83. package/playground.js.map +0 -1
  84. package/plug.js.map +0 -1
  85. package/plugin.js.map +0 -1
  86. package/preview.js.map +0 -1
  87. package/sdk/apiKey.js.map +0 -1
  88. package/sdk/evaluation.js.map +0 -1
  89. package/sdk/index.js.map +0 -1
  90. package/sdk/json.js.map +0 -1
  91. package/sdk/sdkEvents.js.map +0 -1
  92. package/sdk/token.js.map +0 -1
  93. package/sdk/tracking.js.map +0 -1
  94. package/sdk/validation.js.map +0 -1
  95. package/slot.js.map +0 -1
  96. package/src/api/evaluate.ts +0 -50
  97. package/src/api/fetchContent.ts +0 -70
  98. package/src/api/index.ts +0 -2
  99. package/src/component.ts +0 -19
  100. package/src/constants.ts +0 -5
  101. package/src/index.ts +0 -6
  102. package/src/playground.ts +0 -247
  103. package/src/plug.ts +0 -429
  104. package/src/plugin.ts +0 -39
  105. package/src/preview.ts +0 -226
  106. package/src/sdk/evaluation.ts +0 -2
  107. package/src/sdk/index.ts +0 -14
  108. package/src/sdk/json.ts +0 -4
  109. package/src/sdk/sdkEvents.ts +0 -1
  110. package/src/sdk/token.ts +0 -1
  111. package/src/sdk/tracking.ts +0 -14
  112. package/src/slot.ts +0 -48
  113. package/src/versioning.ts +0 -38
  114. package/versioning.js.map +0 -1
  115. /package/{src/sdk/apiKey.ts → sdk/apiKey.d.cts} +0 -0
  116. /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
@@ -1,4 +0,0 @@
1
- import {JsonObject} from '@croct/json';
2
-
3
- export * from '@croct/json/mutable';
4
- export type NullableJsonObject = JsonObject | null;
@@ -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';
@@ -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