@platecms/delta-client 0.6.0 → 0.8.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/README.md +309 -96
- package/package.json +4 -6
- package/src/__generated__/fragment-masking.ts +87 -0
- package/src/__generated__/gql.ts +52 -0
- package/src/__generated__/graphql.ts +3141 -0
- package/src/__generated__/{index.d.ts → index.ts} +1 -1
- package/src/api/index.ts +1 -0
- package/src/apollo/index.ts +70 -0
- package/src/graphql/tags/tag.query.gql +5 -0
- package/src/graphql/tags/tags.fragments.gql +17 -0
- package/src/index.ts +1 -0
- package/src/schema/index.spec.ts +211 -0
- package/src/schema/index.ts +18 -0
- package/src/schema/lib/schemas/array.spec.ts +111 -0
- package/src/schema/lib/schemas/array.ts +38 -0
- package/src/schema/lib/schemas/asset.spec.ts +101 -0
- package/src/schema/lib/schemas/asset.ts +12 -0
- package/src/schema/lib/schemas/baseSchema.ts +42 -0
- package/src/schema/lib/schemas/boolean.spec.ts +65 -0
- package/src/schema/lib/schemas/boolean.ts +12 -0
- package/src/schema/lib/schemas/buildingBlock.spec.ts +56 -0
- package/src/schema/lib/schemas/buildingBlock.ts +33 -0
- package/src/schema/lib/schemas/contentItem.spec.ts +61 -0
- package/src/schema/lib/schemas/contentItem.ts +31 -0
- package/src/schema/lib/schemas/contentType.spec.ts +113 -0
- package/src/schema/lib/schemas/contentType.ts +12 -0
- package/src/schema/lib/schemas/date.spec.ts +82 -0
- package/src/schema/lib/schemas/date.ts +17 -0
- package/src/schema/lib/schemas/gridPlacement.spec.ts +77 -0
- package/src/schema/lib/schemas/gridPlacement.ts +12 -0
- package/src/schema/lib/schemas/index.ts +66 -0
- package/src/schema/lib/schemas/number.spec.ts +65 -0
- package/src/schema/lib/schemas/number.ts +12 -0
- package/src/schema/lib/schemas/pathPart.spec.ts +120 -0
- package/src/schema/lib/schemas/pathPart.ts +12 -0
- package/src/schema/lib/schemas/smartText.spec.ts +105 -0
- package/src/schema/lib/schemas/smartText.ts +12 -0
- package/src/schema/lib/schemas/string.spec.ts +65 -0
- package/src/schema/lib/schemas/string.ts +12 -0
- package/src/schema/lib/schemas/tag.spec.ts +89 -0
- package/src/schema/lib/schemas/tag.ts +12 -0
- package/src/schema/lib/utils/isContentValue.spec.ts +111 -0
- package/src/schema/lib/utils/isContentValue.ts +17 -0
- package/src/schema/lib/utils/isPrimitiveValue.spec.ts +38 -0
- package/src/schema/lib/utils/isPrimitiveValue.ts +7 -0
- package/src/slate/index.ts +84 -0
- package/src/utils/{index.d.ts → index.ts} +3 -2
- package/src/utils/lib/connectors/BaseConnector.ts +26 -0
- package/src/utils/lib/connectors/WindowConnector.ts +70 -0
- package/src/utils/lib/events/ConnectorEvents.ts +89 -0
- package/src/utils/lib/events/EventEmitter.ts +19 -0
- package/src/__generated__/fragment-masking.d.ts +0 -19
- package/src/__generated__/fragment-masking.js +0 -22
- package/src/__generated__/fragment-masking.js.map +0 -1
- package/src/__generated__/gql.d.ts +0 -12
- package/src/__generated__/gql.js +0 -13
- package/src/__generated__/gql.js.map +0 -1
- package/src/__generated__/graphql.d.ts +0 -2157
- package/src/__generated__/graphql.js +0 -70
- package/src/__generated__/graphql.js.map +0 -1
- package/src/__generated__/index.js +0 -6
- package/src/__generated__/index.js.map +0 -1
- package/src/api/index.d.ts +0 -2
- package/src/api/index.js +0 -4
- package/src/api/index.js.map +0 -1
- package/src/apollo/index.d.ts +0 -7
- package/src/apollo/index.js +0 -40
- package/src/apollo/index.js.map +0 -1
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -3
- package/src/index.js.map +0 -1
- package/src/schema/index.d.ts +0 -2
- package/src/schema/index.js +0 -8
- package/src/schema/index.js.map +0 -1
- package/src/schema/lib/nodes.d.ts +0 -46
- package/src/schema/lib/nodes.js +0 -14
- package/src/schema/lib/nodes.js.map +0 -1
- package/src/schema/lib/parser.d.ts +0 -12
- package/src/schema/lib/parser.js +0 -49
- package/src/schema/lib/parser.js.map +0 -1
- package/src/schema/lib/schema.d.ts +0 -17
- package/src/schema/lib/schema.js +0 -65
- package/src/schema/lib/schema.js.map +0 -1
- package/src/schema/lib/utils.d.ts +0 -12
- package/src/schema/lib/utils.js +0 -66
- package/src/schema/lib/utils.js.map +0 -1
- package/src/slate/index.d.ts +0 -65
- package/src/slate/index.js +0 -3
- package/src/slate/index.js.map +0 -1
- package/src/utils/index.js +0 -6
- package/src/utils/index.js.map +0 -1
- package/src/utils/lib/connectors/BaseConnector.d.ts +0 -16
- package/src/utils/lib/connectors/BaseConnector.js +0 -17
- package/src/utils/lib/connectors/BaseConnector.js.map +0 -1
- package/src/utils/lib/connectors/WindowConnector.d.ts +0 -10
- package/src/utils/lib/connectors/WindowConnector.js +0 -53
- package/src/utils/lib/connectors/WindowConnector.js.map +0 -1
- package/src/utils/lib/events/ConnectorEvents.d.ts +0 -63
- package/src/utils/lib/events/ConnectorEvents.js +0 -24
- package/src/utils/lib/events/ConnectorEvents.js.map +0 -1
- package/src/utils/lib/events/EventEmitter.d.ts +0 -7
- package/src/utils/lib/events/EventEmitter.js +0 -21
- package/src/utils/lib/events/EventEmitter.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BaseEditor } from "slate";
|
|
2
|
+
import { ReactEditor } from "slate-react";
|
|
3
|
+
import { Root } from "@platecms/delta-cast";
|
|
4
|
+
|
|
5
|
+
declare module "slate" {
|
|
6
|
+
interface CustomTypes {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
Editor: BaseEditor & ReactEditor;
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
+
Element: DeltaElement;
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
+
Text: DeltaLeaf;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface DeltaLeafMarkdown {
|
|
17
|
+
title?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DeltaElement =
|
|
21
|
+
| BlockquoteElement
|
|
22
|
+
| CodeElement
|
|
23
|
+
| ContentValueElement
|
|
24
|
+
| HeadingElement
|
|
25
|
+
| LinkElement
|
|
26
|
+
| ListElement
|
|
27
|
+
| ListItemElement
|
|
28
|
+
| ParagraphElement;
|
|
29
|
+
|
|
30
|
+
export type DeltaLeaf = DeltaLeafMarkdown & {
|
|
31
|
+
text: string;
|
|
32
|
+
bold?: true;
|
|
33
|
+
italic?: true;
|
|
34
|
+
underline?: true;
|
|
35
|
+
strikethrough?: true;
|
|
36
|
+
inlineCode?: true;
|
|
37
|
+
highlight?: true;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export interface ParagraphElement {
|
|
41
|
+
type: "paragraph";
|
|
42
|
+
children: (ContentValueElement | DeltaLeaf | LinkElement)[];
|
|
43
|
+
}
|
|
44
|
+
export interface HeadingElement {
|
|
45
|
+
type: "heading";
|
|
46
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
47
|
+
children: DeltaLeaf[];
|
|
48
|
+
}
|
|
49
|
+
export interface ListElement {
|
|
50
|
+
type: "list";
|
|
51
|
+
ordered: boolean;
|
|
52
|
+
children: ListItemElement[];
|
|
53
|
+
}
|
|
54
|
+
export interface ListItemElement {
|
|
55
|
+
type: "listItem";
|
|
56
|
+
children: DeltaLeaf[];
|
|
57
|
+
}
|
|
58
|
+
export interface BlockquoteElement {
|
|
59
|
+
type: "blockquote";
|
|
60
|
+
children: DeltaLeaf[];
|
|
61
|
+
}
|
|
62
|
+
export interface CodeElement {
|
|
63
|
+
type: "code";
|
|
64
|
+
children: DeltaLeaf[];
|
|
65
|
+
}
|
|
66
|
+
export interface ContentValueElement {
|
|
67
|
+
type: "contentValue";
|
|
68
|
+
prn: string;
|
|
69
|
+
root: Root | undefined;
|
|
70
|
+
children: DeltaLeaf[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface LinkElement {
|
|
74
|
+
type: "link";
|
|
75
|
+
url: string;
|
|
76
|
+
children: DeltaLeaf[];
|
|
77
|
+
|
|
78
|
+
target?: "_parent" | "_top" | "blank" | "self";
|
|
79
|
+
|
|
80
|
+
internal?: {
|
|
81
|
+
prn: string;
|
|
82
|
+
anchor?: boolean;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EventEmitter } from "../events/EventEmitter";
|
|
2
|
+
import { ConnectorEventOption } from "../events/ConnectorEvents";
|
|
3
|
+
|
|
4
|
+
export abstract class BaseConnector extends EventEmitter<{
|
|
5
|
+
message: [args: ConnectorEventOption];
|
|
6
|
+
connected: [];
|
|
7
|
+
disconnected: [];
|
|
8
|
+
statusChanged: [status: "connected" | "connecting" | "disconnected" | "idle"];
|
|
9
|
+
}> {
|
|
10
|
+
protected status: "connected" | "connecting" | "disconnected" | "idle" = "idle";
|
|
11
|
+
|
|
12
|
+
public abstract connectorName: string;
|
|
13
|
+
|
|
14
|
+
protected constructor(protected id: string) {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public updateStatus(status: "connected" | "connecting" | "disconnected" | "idle"): void {
|
|
19
|
+
this.status = status;
|
|
20
|
+
this.emit("statusChanged", status);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public abstract send(event: ConnectorEventOption): void;
|
|
24
|
+
|
|
25
|
+
public abstract connect(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BaseConnector } from "./BaseConnector";
|
|
2
|
+
import { ConnectorEventOption } from "../events/ConnectorEvents";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* WindowConnector provides the lowest level of communication between the client and the host.
|
|
6
|
+
* It uses the window.postMessage API to send and receive messages making it completely dependent on the window API.
|
|
7
|
+
* This connector can be used when the client and host are in the same window context, such as in an iframe or a popup window.
|
|
8
|
+
*/
|
|
9
|
+
export class WindowConnector extends BaseConnector {
|
|
10
|
+
public connectorName = "window";
|
|
11
|
+
|
|
12
|
+
public constructor(
|
|
13
|
+
id: string,
|
|
14
|
+
private readonly receiveOn: Window,
|
|
15
|
+
private readonly sendOn: Window,
|
|
16
|
+
) {
|
|
17
|
+
super(id);
|
|
18
|
+
|
|
19
|
+
this.receiveOn.addEventListener("message", (event: MessageEvent) => {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
21
|
+
if (event.data.type === "offer") {
|
|
22
|
+
this.updateStatus("connecting");
|
|
23
|
+
this.sendOn.postMessage({ type: "answer", payload: null }, "*");
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
25
|
+
} else if (event.data.type === "answer") {
|
|
26
|
+
this.updateStatus("connected");
|
|
27
|
+
this.sendOn.postMessage({ type: "connected", payload: null }, "*");
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
29
|
+
} else if (event.data.type === "connected") {
|
|
30
|
+
this.updateStatus("connected");
|
|
31
|
+
} else if (this.status === "connected") {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
33
|
+
if (event.data.payload !== null) {
|
|
34
|
+
try {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
36
|
+
const data = JSON.parse(event.data.payload as string);
|
|
37
|
+
this.emit("message", {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
39
|
+
type: event.data.type,
|
|
40
|
+
payload: data,
|
|
41
|
+
});
|
|
42
|
+
} catch (error) {
|
|
43
|
+
//TODO: Handle error
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public send(event: ConnectorEventOption): void {
|
|
51
|
+
this.sendOn.postMessage(
|
|
52
|
+
{
|
|
53
|
+
type: event.type,
|
|
54
|
+
payload: JSON.stringify(event.payload),
|
|
55
|
+
},
|
|
56
|
+
"*",
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public connect(): void {
|
|
61
|
+
this.updateStatus("connecting");
|
|
62
|
+
this.sendOn.postMessage(
|
|
63
|
+
{
|
|
64
|
+
type: "offer",
|
|
65
|
+
payload: null,
|
|
66
|
+
},
|
|
67
|
+
"*",
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BuildingBlock, ExperienceComponent } from "../../../__generated__/graphql";
|
|
2
|
+
|
|
3
|
+
export enum ConnectorEventType {
|
|
4
|
+
ROOT_EXPERIENCE_COMPONENT_SEND = "root-experience-component-send",
|
|
5
|
+
ROOT_EXPERIENCE_COMPONENT_REQUIRED = "root-experience-component-required",
|
|
6
|
+
|
|
7
|
+
ROOT_EXPERIENCE_COMPONENT_SET_MODE = "root-experience-component-set-mode",
|
|
8
|
+
|
|
9
|
+
BLUEPRINT_OVERLAY_OPEN = "blueprint-overlay-open",
|
|
10
|
+
|
|
11
|
+
EXPERIENCE_COMPONENT_EDIT = "experience-component-edit",
|
|
12
|
+
EXPERIENCE_COMPONENT_REMOVE = "experience-component-remove",
|
|
13
|
+
EXPERIENCE_COMPONENT_CREATE = "experience-component-create",
|
|
14
|
+
|
|
15
|
+
GRID_PLACEMENT_UP = "grid-placement-up",
|
|
16
|
+
GRID_PLACEMENT_DOWN = "grid-placement-down",
|
|
17
|
+
|
|
18
|
+
MOUSE_UP = "mouse-up",
|
|
19
|
+
MOUSE_MOVE = "mouse-move",
|
|
20
|
+
DRAG_START = "drag-start",
|
|
21
|
+
DRAG_END = "drag-end",
|
|
22
|
+
|
|
23
|
+
NEGOTIATE_BUILDING_BLOCKS = "negotiate-building-blocks",
|
|
24
|
+
SNAPSHOT_GENERATE = "snapshot-generate",
|
|
25
|
+
SNAPSHOT_GENERATED = "snapshot-generated",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ConnectorEvent<T> {
|
|
29
|
+
type: ConnectorEventType;
|
|
30
|
+
payload: T;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//expose event types to ensure cross project type safety
|
|
34
|
+
export type RootExperienceComponentSendEvent = ConnectorEvent<ExperienceComponent>;
|
|
35
|
+
export type RootExperienceComponentRequiredEvent = ConnectorEvent<null>;
|
|
36
|
+
export type RootExperienceComponentSetModeEvent = ConnectorEvent<{
|
|
37
|
+
prn?: string;
|
|
38
|
+
uuid?: string;
|
|
39
|
+
mode: "drag" | "edit" | "preview";
|
|
40
|
+
type?: "blueprint" | "experience";
|
|
41
|
+
}>;
|
|
42
|
+
|
|
43
|
+
export type ExperienceComponentCreateEvent = ConnectorEvent<{ index: number }>;
|
|
44
|
+
export type ExperienceComponentEditEvent = ConnectorEvent<{
|
|
45
|
+
prn?: string;
|
|
46
|
+
uuid?: string;
|
|
47
|
+
}>;
|
|
48
|
+
|
|
49
|
+
export type ExperienceComponentRemoveEvent = ConnectorEvent<{
|
|
50
|
+
prn?: string;
|
|
51
|
+
uuid?: string;
|
|
52
|
+
}>;
|
|
53
|
+
|
|
54
|
+
export type GridPlacementUpEvent = ConnectorEvent<{
|
|
55
|
+
prn?: string;
|
|
56
|
+
uuid?: string;
|
|
57
|
+
}>;
|
|
58
|
+
export type GridPlacementDownEvent = ConnectorEvent<{
|
|
59
|
+
prn?: string;
|
|
60
|
+
uuid?: string;
|
|
61
|
+
}>;
|
|
62
|
+
|
|
63
|
+
export type MouseUpEvent = ConnectorEvent<null>;
|
|
64
|
+
export type MouseMoveEvent = ConnectorEvent<{ x: number; y: number }>;
|
|
65
|
+
export type DragStartEvent = ConnectorEvent<BuildingBlock>;
|
|
66
|
+
export type DragEndEvent = ConnectorEvent<null>;
|
|
67
|
+
|
|
68
|
+
export type NegotiateBuildingBlocksEvent = ConnectorEvent<Record<string, string>>;
|
|
69
|
+
export type SnapshotGenerateEvent = ConnectorEvent<null>;
|
|
70
|
+
export type SnapshotGeneratedEvent = ConnectorEvent<string>;
|
|
71
|
+
|
|
72
|
+
export type ConnectorEventOption =
|
|
73
|
+
| DragEndEvent
|
|
74
|
+
| DragStartEvent
|
|
75
|
+
| ExperienceComponentCreateEvent
|
|
76
|
+
| ExperienceComponentEditEvent
|
|
77
|
+
| ExperienceComponentRemoveEvent
|
|
78
|
+
| GridPlacementDownEvent
|
|
79
|
+
| GridPlacementUpEvent
|
|
80
|
+
| MouseMoveEvent
|
|
81
|
+
| MouseUpEvent
|
|
82
|
+
| NegotiateBuildingBlocksEvent
|
|
83
|
+
| RootExperienceComponentRequiredEvent
|
|
84
|
+
| RootExperienceComponentSendEvent
|
|
85
|
+
| RootExperienceComponentSetModeEvent
|
|
86
|
+
| SnapshotGeneratedEvent
|
|
87
|
+
| SnapshotGenerateEvent;
|
|
88
|
+
|
|
89
|
+
export default {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type Listener<T extends unknown[]> = (...args: T) => void;
|
|
2
|
+
|
|
3
|
+
export class EventEmitter<TEventMap extends Record<string, unknown[]>> {
|
|
4
|
+
private eventListeners: { [K in keyof TEventMap]?: Set<Listener<TEventMap[K]>> } = {};
|
|
5
|
+
|
|
6
|
+
public on<T extends keyof TEventMap>(eventName: T, listener: Listener<TEventMap[T]>): void {
|
|
7
|
+
const listeners = this.eventListeners[eventName] || new Set();
|
|
8
|
+
listeners.add(listener);
|
|
9
|
+
this.eventListeners[eventName] = listeners;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public emit<T extends keyof TEventMap>(eventName: T, ...args: TEventMap[T]): void {
|
|
13
|
+
const listeners = this.eventListeners[eventName] || new Set();
|
|
14
|
+
|
|
15
|
+
for (const listener of listeners) {
|
|
16
|
+
listener(...args);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
-
import { Incremental } from './graphql';
|
|
3
|
-
export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<infer TType, any> ? [TType] extends [{
|
|
4
|
-
' $fragmentName'?: infer TKey;
|
|
5
|
-
}] ? TKey extends string ? {
|
|
6
|
-
' $fragmentRefs'?: {
|
|
7
|
-
[key in TKey]: TType;
|
|
8
|
-
};
|
|
9
|
-
} : never : never : never;
|
|
10
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>): TType;
|
|
11
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined): TType | undefined;
|
|
12
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null): TType | null;
|
|
13
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined): TType | null | undefined;
|
|
14
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>): Array<TType>;
|
|
15
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): Array<TType> | null | undefined;
|
|
16
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
|
|
17
|
-
export declare function useFragment<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
|
|
18
|
-
export declare function makeFragmentData<F extends DocumentTypeDecoration<any, any>, FT extends ResultOf<F>>(data: FT, _fragment: F): FragmentType<F>;
|
|
19
|
-
export declare function isFragmentReady<TQuery, TFrag>(queryNode: DocumentTypeDecoration<TQuery, any>, fragmentNode: TypedDocumentNode<TFrag>, data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined): data is FragmentType<typeof fragmentNode>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFragment = useFragment;
|
|
4
|
-
exports.makeFragmentData = makeFragmentData;
|
|
5
|
-
exports.isFragmentReady = isFragmentReady;
|
|
6
|
-
function useFragment(_documentNode, fragmentType) {
|
|
7
|
-
return fragmentType;
|
|
8
|
-
}
|
|
9
|
-
function makeFragmentData(data, _fragment) {
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
function isFragmentReady(queryNode, fragmentNode, data) {
|
|
13
|
-
const deferredFields = queryNode.__meta__
|
|
14
|
-
?.deferredFields;
|
|
15
|
-
if (!deferredFields)
|
|
16
|
-
return true;
|
|
17
|
-
const fragDef = fragmentNode.definitions[0];
|
|
18
|
-
const fragName = fragDef?.name?.value;
|
|
19
|
-
const fields = (fragName && deferredFields[fragName]) || [];
|
|
20
|
-
return fields.length > 0 && fields.every(field => data && field in data);
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=fragment-masking.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","sourceRoot":"","sources":["../../../../../../packages/delta-client/src/__generated__/fragment-masking.ts"],"names":[],"mappings":";;AAyDA,kCAKC;AAGD,4CAKC;AACD,0CAeC;AA7BD,SAAgB,WAAW,CACzB,aAAiD,EACjD,YAA6M;IAE7M,OAAO,YAAmB,CAAC;AAC7B,CAAC;AAGD,SAAgB,gBAAgB,CAG9B,IAAQ,EAAE,SAAY;IACtB,OAAO,IAAuB,CAAC;AACjC,CAAC;AACD,SAAgB,eAAe,CAC7B,SAA8C,EAC9C,YAAsC,EACtC,IAAiF;IAEjF,MAAM,cAAc,GAAI,SAAgF,CAAC,QAAQ;QAC/G,EAAE,cAAc,CAAC;IAEnB,IAAI,CAAC,cAAc;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC,CAAuC,CAAC;IAClF,MAAM,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC;IAEtC,MAAM,MAAM,GAAG,CAAC,QAAQ,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as types from './graphql';
|
|
2
|
-
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
-
type Documents = {
|
|
4
|
-
"query tag($prn: [PRN!]!) {\n tag(prn: $prn) {\n ...tagFragment\n }\n}": typeof types.TagDocument;
|
|
5
|
-
"fragment tagFragment on Tag {\n _id: prn\n prn\n name\n path\n color\n visibility\n forceVisibilityOnDescendants\n stage\n amountOfChildren\n amountOfContentExperiences\n amountOfContentItems\n hasForcedVisibility\n nestingLevel\n createdAt\n updatedAt\n}": typeof types.TagFragmentFragmentDoc;
|
|
6
|
-
};
|
|
7
|
-
declare const documents: Documents;
|
|
8
|
-
export declare function graphql(source: string): unknown;
|
|
9
|
-
export declare function graphql(source: "query tag($prn: [PRN!]!) {\n tag(prn: $prn) {\n ...tagFragment\n }\n}"): (typeof documents)["query tag($prn: [PRN!]!) {\n tag(prn: $prn) {\n ...tagFragment\n }\n}"];
|
|
10
|
-
export declare function graphql(source: "fragment tagFragment on Tag {\n _id: prn\n prn\n name\n path\n color\n visibility\n forceVisibilityOnDescendants\n stage\n amountOfChildren\n amountOfContentExperiences\n amountOfContentItems\n hasForcedVisibility\n nestingLevel\n createdAt\n updatedAt\n}"): (typeof documents)["fragment tagFragment on Tag {\n _id: prn\n prn\n name\n path\n color\n visibility\n forceVisibilityOnDescendants\n stage\n amountOfChildren\n amountOfContentExperiences\n amountOfContentItems\n hasForcedVisibility\n nestingLevel\n createdAt\n updatedAt\n}"];
|
|
11
|
-
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|
|
12
|
-
export {};
|
package/src/__generated__/gql.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.graphql = graphql;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const types = tslib_1.__importStar(require("./graphql"));
|
|
6
|
-
const documents = {
|
|
7
|
-
"query tag($prn: [PRN!]!) {\n tag(prn: $prn) {\n ...tagFragment\n }\n}": types.TagDocument,
|
|
8
|
-
"fragment tagFragment on Tag {\n _id: prn\n prn\n name\n path\n color\n visibility\n forceVisibilityOnDescendants\n stage\n amountOfChildren\n amountOfContentExperiences\n amountOfContentItems\n hasForcedVisibility\n nestingLevel\n createdAt\n updatedAt\n}": types.TagFragmentFragmentDoc,
|
|
9
|
-
};
|
|
10
|
-
function graphql(source) {
|
|
11
|
-
return documents[source] ?? {};
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","sourceRoot":"","sources":["../../../../../../packages/delta-client/src/__generated__/gql.ts"],"names":[],"mappings":";;AA+CA,0BAEC;;AAhDD,yDAAmC;AAkBnC,MAAM,SAAS,GAAc;IACzB,4EAA4E,EAAE,KAAK,CAAC,WAAW;IAC/F,gRAAgR,EAAE,KAAK,CAAC,sBAAsB;CACjT,CAAC;AAyBF,SAAgB,OAAO,CAAC,MAAc;IACpC,OAAQ,SAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC"}
|