Skip to content

Instantly share code, notes, and snippets.

View ehatricksmith's full-sized avatar

Ed Hatrick-Smith ehatricksmith

View GitHub Profile
import * as Y from "yjs";
import { WebsocketProvider } from "y-websocket";
const doc = new Y.Doc();
// The provider takes care of broadcasting and receiving sync and awareness
const provider = new WebsocketProvider(
"wss://dovetailapp.com/api/yjs",
"00000000-0000-0000-0000-000000000000", // docId
doc
import * as Y from "yjs";
import { WebsocketProvider } from "y-websocket";
const doc = new Y.Doc();
// The provider takes care of broadcasting and receiving sync and awareness.
// This will automatically perform the initial sync.
const provider = new WebsocketProvider(
"wss://dovetailapp.com/api/yjs",
"00000000-0000-0000-0000-000000000000", // docId
const {
data: { project },
} = await apolloClient.query<graphqlTypes.TagsDataQuery, graphqlTypes.TagsDataQueryVariables>({
query: PROJECT_EXPORT_TAGS_QUERY,
variables: { id: projectId, limit: 25, offset },
fetchPolicy: "network-only",
});
export type TagsDataQuery = {
readonly project: {
readonly __typename: "Project";
readonly id: string;
readonly tags: {
readonly __typename: "TagsConnection";
readonly totalCount: number;
readonly nodes: ReadonlyArray<{
readonly __typename: "Tag";
readonly id: string;
const EXPORT_TAGS_QUERY = gql`
query ExportTagsDataQuery($id: UUID!, $offset: Int, $limit: Int!) {
project: projectById(id: $id) {
id
tags: tagsByProjectId(condition: { deleted: false, deletedCascade: false }, offset: $offset, first: $limit) {
totalCount
nodes {
id
title
color
import { PreparedQuery } from '@pgtyped/query';
export type file_retention_status = 'DELETED' | 'EXPIRED' | 'NOTIFIED' | 'PROCESSED';
export type file_upload_status = 'CANCELLED' | 'DONE' | 'FAILED' | 'UPLOADING';
export interface IGetFileByIdParams {
id: string;
}
/* @name getFileById */
SELECT *
FROM dovetail.file
WHERE id = :id!;
```tsx
import * as Y from "yjs";
import * as util from "util";
const ydoc = new Y.Doc();
// Create a top level data type
const ytext = ydoc.getText("text");
****// Insert subsequent characters
import * as Y from "yjs";
import * as util from "util";
const ydoc = new Y.Doc();
// Create a top level data type
const ytext = ydoc.getText("text");
// Insert subsequent characters
ytext.insert(0, "A");
{
structs: [
Item { // This insert is a tombstone
id: ID { client: 2617533864, clock: 0 },
length: 1,
origin: null,
left: null,
right: null,
rightOrigin: null,
parent: 'listOfNumbers',