@bigfootai/bigfoot-types 2.7.12 → 2.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.
Files changed (4) hide show
  1. package/model.js +19 -1
  2. package/model.ts +41 -7
  3. package/package.json +4 -1
  4. package/utils.ts +2 -2
package/model.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Table = exports.FieldVariation = exports.FieldType = exports.Template = exports.Thread = exports.ExternalTask = exports.Event = exports.ResponseStatus = exports.EventStatus = exports.Conference = exports.Task = exports.Block = exports.Note = exports.Article = exports.Person = exports.Domain = exports.Tenant = exports.BusinessObject = exports.Tag = exports.Provider = exports.Sync = exports.Primitive = exports.MutationType = exports.MarkType = exports.DocumentType = exports.RecurrenceRFC = exports.InviteStatus = exports.SharingApproach = exports.StepStatus = exports.TaskStatus = exports.SharingLevel = exports.ClientType = exports.TagType = exports.BlockType = exports.BusinessObjectType = void 0;
3
+ exports.Table = exports.FieldVariation = exports.FieldType = exports.Template = exports.Thread = exports.ExternalTask = exports.Event = exports.Calendar = exports.ResponseStatus = exports.EventStatus = exports.Conference = exports.Task = exports.Block = exports.Note = exports.Article = exports.Person = exports.Domain = exports.Tenant = exports.BusinessObject = exports.Tag = exports.Provider = exports.Sync = exports.Primitive = exports.ProcessingStage = exports.MutationType = exports.MarkType = exports.DocumentType = exports.RecurrenceRFC = exports.InviteStatus = exports.SharingApproach = exports.StepStatus = exports.TaskStatus = exports.SharingLevel = exports.ClientType = exports.TagType = exports.BlockType = exports.BusinessObjectType = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  /*
6
6
  These are the core primitives of our model. These represent the entities that show
@@ -10,6 +10,7 @@ the platform.
10
10
  // CORE START
11
11
  var BusinessObjectType;
12
12
  (function (BusinessObjectType) {
13
+ BusinessObjectType["Calendar"] = "calendar";
13
14
  BusinessObjectType["Event"] = "event";
14
15
  BusinessObjectType["Task"] = "task";
15
16
  BusinessObjectType["Document"] = "document";
@@ -109,6 +110,13 @@ var MutationType;
109
110
  MutationType["Update"] = "update";
110
111
  MutationType["Delete"] = "delete";
111
112
  })(MutationType || (exports.MutationType = MutationType = {}));
113
+ var ProcessingStage;
114
+ (function (ProcessingStage) {
115
+ ProcessingStage["NotProcessed"] = "not_processed";
116
+ ProcessingStage["Processing"] = "processing";
117
+ ProcessingStage["Processed"] = "processed";
118
+ ProcessingStage["Failed"] = "failed";
119
+ })(ProcessingStage || (exports.ProcessingStage = ProcessingStage = {}));
112
120
  class Primitive {
113
121
  constructor() {
114
122
  this._id = (0, uuid_1.v4)();
@@ -150,6 +158,9 @@ exports.Tag = Tag;
150
158
  class BusinessObject extends Primitive {
151
159
  constructor(provider, uri, externalId, businessObjectType, externalResponse) {
152
160
  super();
161
+ this.processingStage = ProcessingStage.NotProcessed;
162
+ this.processingAttempts = 0;
163
+ this.dateProcessed = 0;
153
164
  this.provider = provider;
154
165
  this.uri = uri;
155
166
  this.externalId = externalId;
@@ -240,6 +251,13 @@ var ResponseStatus;
240
251
  ResponseStatus["Tentative"] = "tentative";
241
252
  ResponseStatus["Accepted"] = "accepted";
242
253
  })(ResponseStatus || (exports.ResponseStatus = ResponseStatus = {}));
254
+ class Calendar extends BusinessObject {
255
+ constructor(provider, uri, externalId, externalResponse, timeZone) {
256
+ super(provider, uri, externalId, BusinessObjectType.Calendar, externalResponse);
257
+ this.timeZone = timeZone;
258
+ }
259
+ }
260
+ exports.Calendar = Calendar;
243
261
  class Event extends BusinessObject {
244
262
  constructor(provider, uri, externalId, externalResponse, calendarId, status, dateStart, organizedBy) {
245
263
  super(provider, uri, externalId, BusinessObjectType.Event, externalResponse);
package/model.ts CHANGED
@@ -7,6 +7,7 @@ the platform.
7
7
  */
8
8
  // CORE START
9
9
  export enum BusinessObjectType {
10
+ Calendar = 'calendar',
10
11
  Event = 'event',
11
12
  Task = 'task',
12
13
  Document = 'document',
@@ -107,6 +108,13 @@ export enum MutationType {
107
108
  Delete = 'delete',
108
109
  }
109
110
 
111
+ export enum ProcessingStage {
112
+ NotProcessed = 'not_processed',
113
+ Processing = 'processing',
114
+ Processed = 'processed',
115
+ Failed = 'failed',
116
+ }
117
+
110
118
  export interface Mark {
111
119
  type: string;
112
120
  attrs?: Map<string, string>;
@@ -315,8 +323,11 @@ export class BusinessObject extends Primitive {
315
323
  externalId: string; // An identifier that allows us to do entity resolution
316
324
  businessObjectType: BusinessObjectType;
317
325
  externalResponse: any; // The full response from the external system that created this object
326
+ processingStage: ProcessingStage; // Indicates if the business object has been processed yet
327
+ processingAttempts: number; // Indicates the number of attempts made to process this business object
328
+ dateProcessed: number; // The date this document was last processed
318
329
  iconUrl?: string | null; // The url of an icon that represents the business object
319
- document?: Document | null; // The business object formatted as a document for ML to ingest
330
+ document?: any | null; // The business object formatted as a document for ML to ingest
320
331
  parentId?: string | null; // The business object that is the parent of this business object
321
332
 
322
333
  constructor(
@@ -328,6 +339,10 @@ export class BusinessObject extends Primitive {
328
339
  ) {
329
340
  super();
330
341
 
342
+ this.processingStage = ProcessingStage.NotProcessed;
343
+ this.processingAttempts = 0;
344
+ this.dateProcessed = 0;
345
+
331
346
  this.provider = provider;
332
347
  this.uri = uri;
333
348
  this.externalId = externalId;
@@ -556,12 +571,6 @@ export interface PersonAcceptance extends PersonReference {
556
571
  responseStatus: ResponseStatus;
557
572
  }
558
573
 
559
- export interface Calendar extends BusinessObject {
560
- timeZone: string;
561
- description?: string | null;
562
- location?: string | null;
563
- }
564
-
565
574
  export interface Attachment {
566
575
  externalId: string;
567
576
  url: string;
@@ -581,6 +590,31 @@ export interface CalendarProviderRequest {
581
590
  credential: Credential;
582
591
  }
583
592
 
593
+ export class Calendar extends BusinessObject {
594
+ timeZone: string;
595
+ description?: string | null;
596
+ location?: string | null;
597
+ events?: Event[] | null;
598
+
599
+ constructor(
600
+ provider: string,
601
+ uri: string,
602
+ externalId: string,
603
+ externalResponse: any,
604
+ timeZone: string
605
+ ) {
606
+ super(
607
+ provider,
608
+ uri,
609
+ externalId,
610
+ BusinessObjectType.Calendar,
611
+ externalResponse
612
+ );
613
+
614
+ this.timeZone = timeZone;
615
+ }
616
+ }
617
+
584
618
  export class Event extends BusinessObject {
585
619
  calendarId: string;
586
620
  status: EventStatus;
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "author": "Bigfoot",
3
3
  "name": "@bigfootai/bigfoot-types",
4
- "version": "2.7.12",
4
+ "version": "2.8.0",
5
5
  "description": "The internal library for the types used in the Bigfoot platform",
6
6
  "main": "model.js",
7
7
  "license": "ISC",
8
8
  "repository": "Notify-AI/bigfoot-types",
9
+ "scripts": {
10
+ "build": "npx tsc"
11
+ },
9
12
  "dependencies": {
10
13
  "parse5": "^7.1.2",
11
14
  "prosemirror-model": "^1.19.4",
package/utils.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { DOMParser } from 'prosemirror-model';
1
+ import { DOMParser, Node } from 'prosemirror-model';
2
2
  import { schema } from 'prosemirror-schema-basic';
3
3
  import { parse } from 'parse5';
4
4
 
5
- export const parseHtmlToDocument = (html: string): Record<string, any> => {
5
+ export const parseHtmlToDocument = (html: string): Node => {
6
6
  // Parse the html into a DOM
7
7
  const document = parse(html);
8
8