@atproto/sync 0.1.40 → 0.2.1
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/CHANGELOG.md +26 -0
- package/dist/events.d.ts +12 -13
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/firehose/index.d.ts +8 -8
- package/dist/firehose/index.d.ts.map +1 -1
- package/dist/firehose/index.js +23 -13
- package/dist/firehose/index.js.map +1 -1
- package/dist/lexicons/com/atproto/sync/subscribeRepos.d.ts +3 -0
- package/dist/lexicons/com/atproto/sync/subscribeRepos.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.d.ts +152 -0
- package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.js +75 -0
- package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.js.map +1 -0
- package/dist/lexicons/com/atproto/sync/subscribeRepos.js +45 -0
- package/dist/lexicons/com/atproto/sync/subscribeRepos.js.map +1 -0
- package/dist/lexicons/com/atproto/sync.d.ts +2 -0
- package/dist/lexicons/com/atproto/sync.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/sync.js +41 -0
- package/dist/lexicons/com/atproto/sync.js.map +1 -0
- package/dist/lexicons/com/atproto.d.ts +2 -0
- package/dist/lexicons/com/atproto.d.ts.map +1 -0
- package/dist/lexicons/com/atproto.js +41 -0
- package/dist/lexicons/com/atproto.js.map +1 -0
- package/dist/lexicons/com.d.ts +2 -0
- package/dist/lexicons/com.d.ts.map +1 -0
- package/dist/lexicons/com.js +41 -0
- package/dist/lexicons/com.js.map +1 -0
- package/dist/lexicons/index.d.ts +2 -0
- package/dist/lexicons/index.d.ts.map +1 -0
- package/dist/lexicons/index.js +41 -0
- package/dist/lexicons/index.js.map +1 -0
- package/dist/util.d.ts +2 -2
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +7 -3
- package/dist/util.js.map +1 -1
- package/package.json +8 -7
- package/src/events.ts +12 -13
- package/src/firehose/index.ts +53 -45
- package/src/util.ts +10 -10
- package/tests/firehose.test.ts +11 -8
- package/tests/runner.test.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +4 -1
- package/tsconfig.tests.json +8 -0
- package/dist/firehose/lexicons.d.ts +0 -105
- package/dist/firehose/lexicons.d.ts.map +0 -1
- package/dist/firehose/lexicons.js +0 -299
- package/dist/firehose/lexicons.js.map +0 -1
- package/src/firehose/lexicons.ts +0 -446
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribeRepos.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAgC;AAEhC,MAAM,KAAK,GAAG,iCAAiC,CAAA;AAEtC,sBAAK;AAEd,oVAAoV;AACpV,MAAM,IAAI,GAAG,OAAC,CAAC,YAAY,CACzB,KAAK,EACL,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAC7C,OAAC,CAAC,UAAU,CACV;IACE,OAAC,CAAC,QAAQ,CAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAQ,CAAC;IACzC,OAAC,CAAC,QAAQ,CAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAQ,CAAC;IACrC,OAAC,CAAC,QAAQ,CAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAQ,CAAC;IAC7C,OAAC,CAAC,QAAQ,CAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAQ,CAAC;IAC3C,OAAC,CAAC,QAAQ,CAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAQ,CAAC;CACtC,EACD,KAAK,CACN,EACD,CAAC,cAAc,EAAE,iBAAiB,CAAC,CACpC,CAAA;AACQ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MAAM,EAAE,OAAC,CAAC,QAAQ,CAChB,OAAC,CAAC,MAAM,EASJ,CACL;CACF,CAAC,CACH,CAAA;AAEQ,0BAAO;AAUhB,MAAM,IAAI,GAAG,OAAC,CAAC,WAAW,CACxB,KAAK,EACL,MAAM,EACN,OAAC,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAuC;IACrD,OAAO,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;CAChC,CAAC,CACH,CAAA;AAEQ,oBAAI;AAqBb,0DAA0D;AAC1D,MAAM,MAAM,GAAG,OAAC,CAAC,WAAW,CAC1B,KAAK,EACL,QAAQ,EACR,OAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,OAAC,CAAC,MAAM,EAAmD;IACnE,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC;IACxB,IAAI,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC;CAC1B,CAAC,CACH,CAAA;AAEQ,wBAAM","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex'\n\nconst $nsid = 'com.atproto.sync.subscribeRepos'\n\nexport { $nsid }\n\n/** Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay. */\nconst main = l.subscription(\n $nsid,\n l.params({ cursor: l.optional(l.integer()) }),\n l.typedUnion(\n [\n l.typedRef<Commit>((() => commit) as any),\n l.typedRef<Sync>((() => sync) as any),\n l.typedRef<Identity>((() => identity) as any),\n l.typedRef<Account>((() => account) as any),\n l.typedRef<Info>((() => info) as any),\n ],\n false,\n ),\n ['FutureCursor', 'ConsumerTooSlow'],\n)\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Message = l.InferSubscriptionMessage<typeof main>\n\nexport const $lxm = main.nsid,\n $params = main.parameters,\n $message = main.message\n\n/** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */\ntype Commit = {\n $type?: 'com.atproto.sync.subscribeRepos#commit'\n\n /**\n * The stream sequence number of this message.\n */\n seq: number\n\n /**\n * @deprecated unused\n */\n rebase: boolean\n\n /**\n * @deprecated replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data.\n */\n tooBig: boolean\n\n /**\n * The repo this event comes from. Note that all other message types name this field 'did'.\n */\n repo: l.DidString\n\n /**\n * Repo commit object CID.\n */\n commit: l.Cid\n\n /**\n * The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event.\n */\n rev: l.TidString\n\n /**\n * The rev of the last emitted commit from this repo (if any).\n */\n since: l.TidString | null\n\n /**\n * CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list.\n */\n blocks: Uint8Array\n ops: RepoOp[]\n blobs: l.Cid[]\n\n /**\n * The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose.\n */\n prevData?: l.Cid\n\n /**\n * Timestamp of when this message was originally broadcast.\n */\n time: l.DatetimeString\n}\n\nexport type { Commit }\n\n/** Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. */\nconst commit = l.typedObject<Commit>(\n $nsid,\n 'commit',\n l.object({\n seq: l.integer(),\n rebase: l.boolean(),\n tooBig: l.boolean(),\n repo: l.string({ format: 'did' }),\n commit: l.cid(),\n rev: l.string({ format: 'tid' }),\n since: l.nullable(l.string({ format: 'tid' })),\n blocks: l.bytes({ maxLength: 2000000 }),\n ops: l.array(l.ref<RepoOp>((() => repoOp) as any), { maxLength: 200 }),\n blobs: l.array(l.cid()),\n prevData: l.optional(l.cid()),\n time: l.string({ format: 'datetime' }),\n }),\n)\n\nexport { commit }\n\n/** Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. */\ntype Sync = {\n $type?: 'com.atproto.sync.subscribeRepos#sync'\n\n /**\n * The stream sequence number of this message.\n */\n seq: number\n\n /**\n * The account this repo event corresponds to. Must match that in the commit object.\n */\n did: l.DidString\n\n /**\n * CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'.\n */\n blocks: Uint8Array\n\n /**\n * The rev of the commit. This value must match that in the commit object.\n */\n rev: string\n\n /**\n * Timestamp of when this message was originally broadcast.\n */\n time: l.DatetimeString\n}\n\nexport type { Sync }\n\n/** Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. */\nconst sync = l.typedObject<Sync>(\n $nsid,\n 'sync',\n l.object({\n seq: l.integer(),\n did: l.string({ format: 'did' }),\n blocks: l.bytes({ maxLength: 10000 }),\n rev: l.string(),\n time: l.string({ format: 'datetime' }),\n }),\n)\n\nexport { sync }\n\n/** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */\ntype Identity = {\n $type?: 'com.atproto.sync.subscribeRepos#identity'\n seq: number\n did: l.DidString\n time: l.DatetimeString\n\n /**\n * The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.\n */\n handle?: l.HandleString\n}\n\nexport type { Identity }\n\n/** Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. */\nconst identity = l.typedObject<Identity>(\n $nsid,\n 'identity',\n l.object({\n seq: l.integer(),\n did: l.string({ format: 'did' }),\n time: l.string({ format: 'datetime' }),\n handle: l.optional(l.string({ format: 'handle' })),\n }),\n)\n\nexport { identity }\n\n/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */\ntype Account = {\n $type?: 'com.atproto.sync.subscribeRepos#account'\n seq: number\n did: l.DidString\n time: l.DatetimeString\n\n /**\n * Indicates that the account has a repository which can be fetched from the host that emitted this event.\n */\n active: boolean\n\n /**\n * If active=false, this optional field indicates a reason for why the account is not active.\n */\n status?:\n | 'takendown'\n | 'suspended'\n | 'deleted'\n | 'deactivated'\n | 'desynchronized'\n | 'throttled'\n | l.UnknownString\n}\n\nexport type { Account }\n\n/** Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. */\nconst account = l.typedObject<Account>(\n $nsid,\n 'account',\n l.object({\n seq: l.integer(),\n did: l.string({ format: 'did' }),\n time: l.string({ format: 'datetime' }),\n active: l.boolean(),\n status: l.optional(\n l.string<{\n knownValues: [\n 'takendown',\n 'suspended',\n 'deleted',\n 'deactivated',\n 'desynchronized',\n 'throttled',\n ]\n }>(),\n ),\n }),\n)\n\nexport { account }\n\ntype Info = {\n $type?: 'com.atproto.sync.subscribeRepos#info'\n name: 'OutdatedCursor' | l.UnknownString\n message?: string\n}\n\nexport type { Info }\n\nconst info = l.typedObject<Info>(\n $nsid,\n 'info',\n l.object({\n name: l.string<{ knownValues: ['OutdatedCursor'] }>(),\n message: l.optional(l.string()),\n }),\n)\n\nexport { info }\n\n/** A repo operation, ie a mutation of a single record. */\ntype RepoOp = {\n $type?: 'com.atproto.sync.subscribeRepos#repoOp'\n action: 'create' | 'update' | 'delete' | l.UnknownString\n path: string\n\n /**\n * For creates and updates, the new record CID. For deletions, null.\n */\n cid: l.Cid | null\n\n /**\n * For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined.\n */\n prev?: l.Cid\n}\n\nexport type { RepoOp }\n\n/** A repo operation, ie a mutation of a single record. */\nconst repoOp = l.typedObject<RepoOp>(\n $nsid,\n 'repoOp',\n l.object({\n action: l.string<{ knownValues: ['create', 'update', 'delete'] }>(),\n path: l.string(),\n cid: l.nullable(l.cid()),\n prev: l.optional(l.cid()),\n }),\n)\n\nexport { repoOp }\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.$defs = void 0;
|
|
43
|
+
__exportStar(require("./subscribeRepos.defs.js"), exports);
|
|
44
|
+
exports.$defs = __importStar(require("./subscribeRepos.defs.js"));
|
|
45
|
+
//# sourceMappingURL=subscribeRepos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribeRepos.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2DAAwC;AACxC,kEAAiD","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from './subscribeRepos.defs.js'\nexport * as $defs from './subscribeRepos.defs.js'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/lexicons/com/atproto/sync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.subscribeRepos = void 0;
|
|
40
|
+
exports.subscribeRepos = __importStar(require("./sync/subscribeRepos.js"));
|
|
41
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../src/lexicons/com/atproto/sync.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA0D","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * as subscribeRepos from './sync/subscribeRepos.js'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atproto.d.ts","sourceRoot":"","sources":["../../../src/lexicons/com/atproto.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.sync = void 0;
|
|
40
|
+
exports.sync = __importStar(require("./atproto/sync.js"));
|
|
41
|
+
//# sourceMappingURL=atproto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atproto.js","sourceRoot":"","sources":["../../../src/lexicons/com/atproto.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0DAAyC","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * as sync from './atproto/sync.js'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"com.d.ts","sourceRoot":"","sources":["../../src/lexicons/com.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.atproto = void 0;
|
|
40
|
+
exports.atproto = __importStar(require("./com/atproto.js"));
|
|
41
|
+
//# sourceMappingURL=com.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"com.js","sourceRoot":"","sources":["../../src/lexicons/com.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAA2C","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * as atproto from './com/atproto.js'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lexicons/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.com = void 0;
|
|
40
|
+
exports.com = __importStar(require("./com.js"));
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lexicons/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAA+B","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * as com from './com.js'\n"]}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const didAndSeqForEvt: (evt:
|
|
1
|
+
import { com } from './lexicons/index.js';
|
|
2
|
+
export declare const didAndSeqForEvt: (evt: com.atproto.sync.subscribeRepos.$Message) => {
|
|
3
3
|
did: string;
|
|
4
4
|
seq: number;
|
|
5
5
|
} | undefined;
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAEzC,eAAO,MAAM,eAAe,GAC1B,KAAK,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,KAC5C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAWjC,CAAA"}
|
package/dist/util.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.didAndSeqForEvt = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_js_1 = require("./lexicons/index.js");
|
|
5
5
|
const didAndSeqForEvt = (evt) => {
|
|
6
|
-
if (
|
|
6
|
+
if (index_js_1.com.atproto.sync.subscribeRepos.commit.$isTypeOf(evt)) {
|
|
7
7
|
return { seq: evt.seq, did: evt.repo };
|
|
8
|
-
|
|
8
|
+
}
|
|
9
|
+
else if (index_js_1.com.atproto.sync.subscribeRepos.account.$isTypeOf(evt) ||
|
|
10
|
+
index_js_1.com.atproto.sync.subscribeRepos.identity.$isTypeOf(evt) ||
|
|
11
|
+
index_js_1.com.atproto.sync.subscribeRepos.sync.$isTypeOf(evt)) {
|
|
9
12
|
return { seq: evt.seq, did: evt.did };
|
|
13
|
+
}
|
|
10
14
|
return undefined;
|
|
11
15
|
};
|
|
12
16
|
exports.didAndSeqForEvt = didAndSeqForEvt;
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,kDAAyC;AAElC,MAAM,eAAe,GAAG,CAC7B,GAA6C,EACH,EAAE;IAC5C,IAAI,cAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAA;IACxC,CAAC;SAAM,IACL,cAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC;QACtD,cAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;QACvD,cAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EACnD,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAA;IACvC,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAbY,QAAA,eAAe,mBAa3B","sourcesContent":["import { com } from './lexicons/index.js'\n\nexport const didAndSeqForEvt = (\n evt: com.atproto.sync.subscribeRepos.$Message,\n): { did: string; seq: number } | undefined => {\n if (com.atproto.sync.subscribeRepos.commit.$isTypeOf(evt)) {\n return { seq: evt.seq, did: evt.repo }\n } else if (\n com.atproto.sync.subscribeRepos.account.$isTypeOf(evt) ||\n com.atproto.sync.subscribeRepos.identity.$isTypeOf(evt) ||\n com.atproto.sync.subscribeRepos.sync.$isTypeOf(evt)\n ) {\n return { seq: evt.seq, did: evt.did }\n }\n return undefined\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/sync",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "atproto sync library",
|
|
6
6
|
"keywords": [
|
|
@@ -21,15 +21,14 @@
|
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"multiformats": "^9.9.0",
|
|
25
24
|
"p-queue": "^6.6.2",
|
|
26
25
|
"ws": "^8.12.0",
|
|
27
|
-
"@atproto/common": "^0.5.
|
|
26
|
+
"@atproto/common": "^0.5.16",
|
|
28
27
|
"@atproto/identity": "^0.4.12",
|
|
29
|
-
"@atproto/
|
|
30
|
-
"@atproto/
|
|
31
|
-
"@atproto/
|
|
32
|
-
"@atproto/xrpc-server": "^0.10.
|
|
28
|
+
"@atproto/lex": "^0.0.24",
|
|
29
|
+
"@atproto/repo": "^0.9.1",
|
|
30
|
+
"@atproto/syntax": "^0.5.3",
|
|
31
|
+
"@atproto/xrpc-server": "^0.10.19"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@types/ws": "^8.5.4",
|
|
@@ -37,6 +36,8 @@
|
|
|
37
36
|
"typescript": "^5.6.3"
|
|
38
37
|
},
|
|
39
38
|
"scripts": {
|
|
39
|
+
"codegen": "lex build --override --indexFile --lexicons ../../lexicons --include com.atproto.sync.subscribeRepos",
|
|
40
|
+
"prebuild": "pnpm run codegen",
|
|
40
41
|
"build": "tsc --build tsconfig.build.json",
|
|
41
42
|
"test": "../dev-infra/with-test-redis-and-db.sh jest"
|
|
42
43
|
}
|
package/src/events.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import type { CID } from 'multiformats/cid'
|
|
2
1
|
import { DidDocument } from '@atproto/identity'
|
|
3
|
-
import
|
|
2
|
+
import { Cid, LexMap } from '@atproto/lex'
|
|
4
3
|
import { BlockMap } from '@atproto/repo'
|
|
5
|
-
import { AtUri } from '@atproto/syntax'
|
|
4
|
+
import { AtUri, DidString } from '@atproto/syntax'
|
|
6
5
|
|
|
7
6
|
export type Event = CommitEvt | SyncEvt | IdentityEvt | AccountEvt
|
|
8
7
|
|
|
9
8
|
export type CommitMeta = {
|
|
10
9
|
seq: number
|
|
11
10
|
time: string
|
|
12
|
-
commit:
|
|
11
|
+
commit: Cid
|
|
13
12
|
blocks: BlockMap
|
|
14
13
|
rev: string
|
|
15
14
|
uri: AtUri
|
|
16
|
-
did:
|
|
15
|
+
did: DidString
|
|
17
16
|
collection: string
|
|
18
17
|
rkey: string
|
|
19
18
|
}
|
|
@@ -22,14 +21,14 @@ export type CommitEvt = Create | Update | Delete
|
|
|
22
21
|
|
|
23
22
|
export type Create = CommitMeta & {
|
|
24
23
|
event: 'create'
|
|
25
|
-
record:
|
|
26
|
-
cid:
|
|
24
|
+
record: LexMap
|
|
25
|
+
cid: Cid
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
export type Update = CommitMeta & {
|
|
30
29
|
event: 'update'
|
|
31
|
-
record:
|
|
32
|
-
cid:
|
|
30
|
+
record: LexMap
|
|
31
|
+
cid: Cid
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
export type Delete = CommitMeta & {
|
|
@@ -40,8 +39,8 @@ export type SyncEvt = {
|
|
|
40
39
|
seq: number
|
|
41
40
|
time: string
|
|
42
41
|
event: 'sync'
|
|
43
|
-
did:
|
|
44
|
-
cid:
|
|
42
|
+
did: DidString
|
|
43
|
+
cid: Cid
|
|
45
44
|
rev: string
|
|
46
45
|
blocks: BlockMap
|
|
47
46
|
}
|
|
@@ -50,7 +49,7 @@ export type IdentityEvt = {
|
|
|
50
49
|
seq: number
|
|
51
50
|
time: string
|
|
52
51
|
event: 'identity'
|
|
53
|
-
did:
|
|
52
|
+
did: DidString
|
|
54
53
|
handle?: string
|
|
55
54
|
didDocument?: DidDocument
|
|
56
55
|
}
|
|
@@ -59,7 +58,7 @@ export type AccountEvt = {
|
|
|
59
58
|
seq: number
|
|
60
59
|
time: string
|
|
61
60
|
event: 'account'
|
|
62
|
-
did:
|
|
61
|
+
did: DidString
|
|
63
62
|
active: boolean
|
|
64
63
|
status?: AccountStatus
|
|
65
64
|
}
|