memorysync-sdk 1.7.3 → 1.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/dist/index.d.mts CHANGED
@@ -807,6 +807,17 @@ interface AddRequest {
807
807
  sessionId?: string;
808
808
  metadata?: Record<string, unknown>;
809
809
  endUserId?: string;
810
+ /**
811
+ * Your own identifier for this record, at most 128 characters.
812
+ *
813
+ * Send it and re-sending the record is recognised rather than stored a second
814
+ * time: the call resolves to an {@link AddSkippedResponse} with reason
815
+ * `already_ingested` and the ids the first write produced. That makes an
816
+ * interrupted write safe to retry without first checking whether it landed.
817
+ * Near-duplicate detection is always on but compares *meaning*, so it is a
818
+ * filter and not a guarantee.
819
+ */
820
+ clientRef?: string;
810
821
  }
811
822
  interface MemoryRecord {
812
823
  id: number;
@@ -832,6 +843,16 @@ interface AddSkippedResponse {
832
843
  type AddResponse = MemoryRecord | AddSkippedResponse;
833
844
  interface BulkAddItem {
834
845
  text: string;
846
+ /**
847
+ * Your own identifier for this record, at most 128 characters.
848
+ *
849
+ * Send it and re-submitting the record is recognised rather than stored a
850
+ * second time: the item comes back `skipped` with reason `already_ingested`
851
+ * and the ids the first submission produced. This is what makes a large import
852
+ * safe to re-run. Near-duplicate detection is always on but compares
853
+ * *meaning*, so it is a filter and not a guarantee.
854
+ */
855
+ clientRef?: string;
835
856
  source?: string;
836
857
  eventType?: string;
837
858
  tags?: string[];
package/dist/index.d.ts CHANGED
@@ -807,6 +807,17 @@ interface AddRequest {
807
807
  sessionId?: string;
808
808
  metadata?: Record<string, unknown>;
809
809
  endUserId?: string;
810
+ /**
811
+ * Your own identifier for this record, at most 128 characters.
812
+ *
813
+ * Send it and re-sending the record is recognised rather than stored a second
814
+ * time: the call resolves to an {@link AddSkippedResponse} with reason
815
+ * `already_ingested` and the ids the first write produced. That makes an
816
+ * interrupted write safe to retry without first checking whether it landed.
817
+ * Near-duplicate detection is always on but compares *meaning*, so it is a
818
+ * filter and not a guarantee.
819
+ */
820
+ clientRef?: string;
810
821
  }
811
822
  interface MemoryRecord {
812
823
  id: number;
@@ -832,6 +843,16 @@ interface AddSkippedResponse {
832
843
  type AddResponse = MemoryRecord | AddSkippedResponse;
833
844
  interface BulkAddItem {
834
845
  text: string;
846
+ /**
847
+ * Your own identifier for this record, at most 128 characters.
848
+ *
849
+ * Send it and re-submitting the record is recognised rather than stored a
850
+ * second time: the item comes back `skipped` with reason `already_ingested`
851
+ * and the ids the first submission produced. This is what makes a large import
852
+ * safe to re-run. Near-duplicate detection is always on but compares
853
+ * *meaning*, so it is a filter and not a guarantee.
854
+ */
855
+ clientRef?: string;
835
856
  source?: string;
836
857
  eventType?: string;
837
858
  tags?: string[];
package/dist/index.js CHANGED
@@ -576,7 +576,7 @@ var IntegrationsNamespace = class extends Namespace {
576
576
  };
577
577
 
578
578
  // src/control-plane.ts
579
- var SDK_VERSION = "1.7.3";
579
+ var SDK_VERSION = "1.8.0";
580
580
  function safeJson(text) {
581
581
  try {
582
582
  return JSON.parse(text);
@@ -1148,7 +1148,7 @@ function asSkipped(raw, defaultReason) {
1148
1148
  }
1149
1149
  return null;
1150
1150
  }
1151
- var SDK_VERSION2 = "1.7.3";
1151
+ var SDK_VERSION2 = "1.8.0";
1152
1152
  function camelToSnakeKey(key) {
1153
1153
  return key.replace(/([A-Z])/g, "_$1").toLowerCase();
1154
1154
  }
@@ -1315,6 +1315,7 @@ var MemorySyncClient = class {
1315
1315
  if (req.sessionId !== void 0) body.session_id = req.sessionId;
1316
1316
  if (req.metadata !== void 0) body.metadata = req.metadata;
1317
1317
  if (req.endUserId !== void 0) body.end_user_id = req.endUserId;
1318
+ if (req.clientRef !== void 0) body.client_ref = req.clientRef;
1318
1319
  const raw = await this.request("POST", "/memory/add", {
1319
1320
  body,
1320
1321
  endUserOverride: req.endUserId
@@ -1335,6 +1336,7 @@ var MemorySyncClient = class {
1335
1336
  if (i.metadata !== void 0) o.metadata = i.metadata;
1336
1337
  if (i.importance !== void 0) o.importance = i.importance;
1337
1338
  if (i.endUserId !== void 0) o.end_user_id = i.endUserId;
1339
+ if (i.clientRef !== void 0) o.client_ref = i.clientRef;
1338
1340
  return o;
1339
1341
  }),
1340
1342
  deduplicate: opts.deduplicate ?? true