Skip to content

Commit

Permalink
Merge pull request #191 from runlightyear/incremental-sync
Browse files Browse the repository at this point in the history
Incremental sync
  • Loading branch information
ebouck authored Nov 4, 2024
2 parents 2e37df9 + 6afef6c commit 60a06b5
Show file tree
Hide file tree
Showing 33 changed files with 161 additions and 27 deletions.
8 changes: 8 additions & 0 deletions packages/@runlightyear/airtable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/airtable

## 1.2.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 1.2.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/airtable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/airtable",
"version": "1.2.7",
"version": "1.2.8",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/cli

## 1.5.3

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 1.5.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/cli",
"version": "1.5.2",
"version": "1.5.3",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/gcal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/gcal

## 0.11.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.11.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/gcal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/gcal",
"version": "0.11.7",
"version": "0.11.8",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/github

## 1.3.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 1.3.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/github/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/github",
"version": "1.3.7",
"version": "1.3.8",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/gmail/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/gmail

## 0.6.9

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.6.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/gmail/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/gmail",
"version": "0.6.8",
"version": "0.6.9",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/gsheets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/gsheets

## 0.8.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.8.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/gsheets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/gsheets",
"version": "0.8.7",
"version": "0.8.8",
"publishConfig": {
"access": "public"
},
Expand Down
10 changes: 10 additions & 0 deletions packages/@runlightyear/lightyear/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @runlightyear/lightyear

## 1.14.0

### Minor Changes

- 2945bf3af: Use the updated objects delta api

### Patch Changes

- 2c7824971: Fix bugs with streaming logs

## 1.13.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/lightyear/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/lightyear",
"version": "1.13.0",
"version": "1.14.0",
"publishConfig": {
"access": "public"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/@runlightyear/lightyear/src/base/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ export async function getDelta(props: GetDeltaProps) {
const envName = getEnvName();

const response = await baseRequest({
method: "POST",
method: "GET",
uri: `/api/v1/envs/${envName}/collections/${collection}/models/${model}/objects/delta`,
data: {
appName: app,
customAppName: customApp,
managedUserExternalId: managedUserExternalId ?? null,
params: {
// appName: app ?? undefined,
customAppName: customApp ?? undefined,
managedUserId: managedUserExternalId ?? undefined,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as process from "process";
import { dayjsUtc } from "../util/dayjsUtc";
import baseRequest from "../base/baseRequest";
import { getEnvName } from "../util/getEnvName";
import { BaseRequestError } from "../base/BaseRequestError";

export type LogDisplayLevel = "DEBUG" | "INFO";

Expand Down Expand Up @@ -150,7 +151,7 @@ export class PrefixedRedactedConsole {
});
}

if (this.logQueue.length === 50) {
if (this.logQueue.length === 100) {
// do not await this so we can stream in the background
this.flushQueue();
}
Expand All @@ -161,12 +162,20 @@ export class PrefixedRedactedConsole {
const envName = getEnvName();
const logsToStream = [...this.logQueue];
this.logQueue = [];
await baseRequest({
method: "POST",
uri: `/api/v1/envs/${envName}/logs`,
data: { ...this.streamLogsTo, logs: logsToStream },
suppressLogs: true,
});
try {
await baseRequest({
method: "POST",
uri: `/api/v1/envs/${envName}/logs`,
data: { ...this.streamLogsTo, logs: logsToStream },
suppressLogs: true,
});
} catch (error) {
console.error("Error flushing logs to server", error);
if (error instanceof BaseRequestError) {
const json = await error.response.json();
console.error(json);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ export abstract class ModelSynchronizer<T> {
});
more = delta.more;

console.debug("Delta:", delta);

for (const change of delta.changes) {
if (change.operation === "CREATE") {
const newObjectId = await this.create({
Expand All @@ -242,6 +244,7 @@ export abstract class ModelSynchronizer<T> {
model: this.model,
app: authData.appName ?? undefined,
customApp: authData.customAppName ?? undefined,
objectId: change.objectId,
managedUserId: authData.managedUser?.externalId ?? null,
localObjectId: newObject.id,
localUpdatedAt: newObject.updatedAt,
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/linear/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/linear

## 0.10.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.10.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/linear/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/linear",
"version": "0.10.7",
"version": "0.10.8",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/notion/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/notion

## 1.3.7

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 1.3.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/notion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/notion",
"version": "1.3.6",
"version": "1.3.7",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/openai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/openai

## 1.3.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 1.3.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/openai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/openai",
"version": "1.3.7",
"version": "1.3.8",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/postmark/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/postmark

## 0.5.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.5.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/postmark/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/postmark",
"version": "0.5.7",
"version": "0.5.8",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/salesforce/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/salesforce

## 0.9.7

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.9.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/salesforce/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/salesforce",
"version": "0.9.6",
"version": "0.9.7",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/slack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/slack

## 0.18.9

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.18.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/slack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/slack",
"version": "0.18.8",
"version": "0.18.9",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/@runlightyear/smtp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @runlightyear/smtp

## 0.3.8

### Patch Changes

- Updated dependencies [2c7824971]
- Updated dependencies [2945bf3af]
- @runlightyear/lightyear@1.14.0

## 0.3.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/@runlightyear/smtp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@runlightyear/smtp",
"version": "0.3.7",
"version": "0.3.8",
"publishConfig": {
"access": "public"
},
Expand Down
Loading

0 comments on commit 60a06b5

Please sign in to comment.