@atproto/sync 0.1.39 → 0.2.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 (52) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE.txt +1 -1
  3. package/dist/events.d.ts +12 -13
  4. package/dist/events.d.ts.map +1 -1
  5. package/dist/events.js +0 -1
  6. package/dist/events.js.map +1 -1
  7. package/dist/firehose/index.d.ts +8 -8
  8. package/dist/firehose/index.d.ts.map +1 -1
  9. package/dist/firehose/index.js +23 -13
  10. package/dist/firehose/index.js.map +1 -1
  11. package/dist/lexicons/com/atproto/sync/subscribeRepos.d.ts +3 -0
  12. package/dist/lexicons/com/atproto/sync/subscribeRepos.d.ts.map +1 -0
  13. package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.d.ts +152 -0
  14. package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.d.ts.map +1 -0
  15. package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.js +75 -0
  16. package/dist/lexicons/com/atproto/sync/subscribeRepos.defs.js.map +1 -0
  17. package/dist/lexicons/com/atproto/sync/subscribeRepos.js +45 -0
  18. package/dist/lexicons/com/atproto/sync/subscribeRepos.js.map +1 -0
  19. package/dist/lexicons/com/atproto/sync.d.ts +2 -0
  20. package/dist/lexicons/com/atproto/sync.d.ts.map +1 -0
  21. package/dist/lexicons/com/atproto/sync.js +41 -0
  22. package/dist/lexicons/com/atproto/sync.js.map +1 -0
  23. package/dist/lexicons/com/atproto.d.ts +2 -0
  24. package/dist/lexicons/com/atproto.d.ts.map +1 -0
  25. package/dist/lexicons/com/atproto.js +41 -0
  26. package/dist/lexicons/com/atproto.js.map +1 -0
  27. package/dist/lexicons/com.d.ts +2 -0
  28. package/dist/lexicons/com.d.ts.map +1 -0
  29. package/dist/lexicons/com.js +41 -0
  30. package/dist/lexicons/com.js.map +1 -0
  31. package/dist/lexicons/index.d.ts +2 -0
  32. package/dist/lexicons/index.d.ts.map +1 -0
  33. package/dist/lexicons/index.js +41 -0
  34. package/dist/lexicons/index.js.map +1 -0
  35. package/dist/util.d.ts +2 -2
  36. package/dist/util.d.ts.map +1 -1
  37. package/dist/util.js +7 -3
  38. package/dist/util.js.map +1 -1
  39. package/package.json +9 -8
  40. package/src/events.ts +12 -15
  41. package/src/firehose/index.ts +53 -45
  42. package/src/util.ts +10 -10
  43. package/tests/firehose.test.ts +11 -8
  44. package/tests/runner.test.ts +2 -2
  45. package/tsconfig.build.tsbuildinfo +1 -1
  46. package/tsconfig.json +4 -1
  47. package/tsconfig.tests.json +8 -0
  48. package/dist/firehose/lexicons.d.ts +0 -105
  49. package/dist/firehose/lexicons.d.ts.map +0 -1
  50. package/dist/firehose/lexicons.js +0 -299
  51. package/dist/firehose/lexicons.js.map +0 -1
  52. package/src/firehose/lexicons.ts +0 -446
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ /*
3
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.repoOp = exports.info = exports.account = exports.identity = exports.sync = exports.commit = exports.$message = exports.$params = exports.$lxm = exports.main = exports.$nsid = void 0;
7
+ const lex_1 = require("@atproto/lex");
8
+ const $nsid = 'com.atproto.sync.subscribeRepos';
9
+ exports.$nsid = $nsid;
10
+ /** 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. */
11
+ const main = lex_1.l.subscription($nsid, lex_1.l.params({ cursor: lex_1.l.optional(lex_1.l.integer()) }), lex_1.l.typedUnion([
12
+ lex_1.l.typedRef((() => commit)),
13
+ lex_1.l.typedRef((() => sync)),
14
+ lex_1.l.typedRef((() => identity)),
15
+ lex_1.l.typedRef((() => account)),
16
+ lex_1.l.typedRef((() => info)),
17
+ ], false), ['FutureCursor', 'ConsumerTooSlow']);
18
+ exports.main = main;
19
+ exports.$lxm = main.nsid, exports.$params = main.parameters, exports.$message = main.message;
20
+ /** 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. */
21
+ const commit = lex_1.l.typedObject($nsid, 'commit', lex_1.l.object({
22
+ seq: lex_1.l.integer(),
23
+ rebase: lex_1.l.boolean(),
24
+ tooBig: lex_1.l.boolean(),
25
+ repo: lex_1.l.string({ format: 'did' }),
26
+ commit: lex_1.l.cid(),
27
+ rev: lex_1.l.string({ format: 'tid' }),
28
+ since: lex_1.l.nullable(lex_1.l.string({ format: 'tid' })),
29
+ blocks: lex_1.l.bytes({ maxLength: 2000000 }),
30
+ ops: lex_1.l.array(lex_1.l.ref((() => repoOp)), { maxLength: 200 }),
31
+ blobs: lex_1.l.array(lex_1.l.cid()),
32
+ prevData: lex_1.l.optional(lex_1.l.cid()),
33
+ time: lex_1.l.string({ format: 'datetime' }),
34
+ }));
35
+ exports.commit = commit;
36
+ /** 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. */
37
+ const sync = lex_1.l.typedObject($nsid, 'sync', lex_1.l.object({
38
+ seq: lex_1.l.integer(),
39
+ did: lex_1.l.string({ format: 'did' }),
40
+ blocks: lex_1.l.bytes({ maxLength: 10000 }),
41
+ rev: lex_1.l.string(),
42
+ time: lex_1.l.string({ format: 'datetime' }),
43
+ }));
44
+ exports.sync = sync;
45
+ /** 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. */
46
+ const identity = lex_1.l.typedObject($nsid, 'identity', lex_1.l.object({
47
+ seq: lex_1.l.integer(),
48
+ did: lex_1.l.string({ format: 'did' }),
49
+ time: lex_1.l.string({ format: 'datetime' }),
50
+ handle: lex_1.l.optional(lex_1.l.string({ format: 'handle' })),
51
+ }));
52
+ exports.identity = identity;
53
+ /** 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. */
54
+ const account = lex_1.l.typedObject($nsid, 'account', lex_1.l.object({
55
+ seq: lex_1.l.integer(),
56
+ did: lex_1.l.string({ format: 'did' }),
57
+ time: lex_1.l.string({ format: 'datetime' }),
58
+ active: lex_1.l.boolean(),
59
+ status: lex_1.l.optional(lex_1.l.string()),
60
+ }));
61
+ exports.account = account;
62
+ const info = lex_1.l.typedObject($nsid, 'info', lex_1.l.object({
63
+ name: lex_1.l.string(),
64
+ message: lex_1.l.optional(lex_1.l.string()),
65
+ }));
66
+ exports.info = info;
67
+ /** A repo operation, ie a mutation of a single record. */
68
+ const repoOp = lex_1.l.typedObject($nsid, 'repoOp', lex_1.l.object({
69
+ action: lex_1.l.string(),
70
+ path: lex_1.l.string(),
71
+ cid: lex_1.l.nullable(lex_1.l.cid()),
72
+ prev: lex_1.l.optional(lex_1.l.cid()),
73
+ }));
74
+ exports.repoOp = repoOp;
75
+ //# sourceMappingURL=subscribeRepos.defs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribeRepos.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/subscribeRepos.defs.ts"],"names":[],"mappings":"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","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,2 @@
1
+ export * as subscribeRepos from './sync/subscribeRepos.js';
2
+ //# sourceMappingURL=sync.d.ts.map
@@ -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,2 @@
1
+ export * as sync from './atproto/sync.js';
2
+ //# sourceMappingURL=atproto.d.ts.map
@@ -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,2 @@
1
+ export * as atproto from './com/atproto.js';
2
+ //# sourceMappingURL=com.d.ts.map
@@ -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,2 @@
1
+ export * as com from './com.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -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 { RepoEvent } from './firehose/lexicons';
2
- export declare const didAndSeqForEvt: (evt: RepoEvent) => {
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;
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKV,MAAM,qBAAqB,CAAA;AAE5B,eAAO,MAAM,eAAe,GAC1B,KAAK,SAAS,KACb;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAKjC,CAAA"}
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 lexicons_1 = require("./firehose/lexicons");
4
+ const index_js_1 = require("./lexicons/index.js");
5
5
  const didAndSeqForEvt = (evt) => {
6
- if ((0, lexicons_1.isCommit)(evt))
6
+ if (index_js_1.com.atproto.sync.subscribeRepos.commit.$isTypeOf(evt)) {
7
7
  return { seq: evt.seq, did: evt.repo };
8
- else if ((0, lexicons_1.isAccount)(evt) || (0, lexicons_1.isIdentity)(evt) || (0, lexicons_1.isSync)(evt))
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,kDAM4B;AAErB,MAAM,eAAe,GAAG,CAC7B,GAAc,EAC4B,EAAE;IAC5C,IAAI,IAAA,mBAAQ,EAAC,GAAG,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAA;SACpD,IAAI,IAAA,oBAAS,EAAC,GAAG,CAAC,IAAI,IAAA,qBAAU,EAAC,GAAG,CAAC,IAAI,IAAA,iBAAM,EAAC,GAAG,CAAC;QACvD,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAA;IACvC,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAPY,QAAA,eAAe,mBAO3B","sourcesContent":["import {\n RepoEvent,\n isAccount,\n isCommit,\n isIdentity,\n isSync,\n} from './firehose/lexicons'\n\nexport const didAndSeqForEvt = (\n evt: RepoEvent,\n): { did: string; seq: number } | undefined => {\n if (isCommit(evt)) return { seq: evt.seq, did: evt.repo }\n else if (isAccount(evt) || isIdentity(evt) || isSync(evt))\n return { seq: evt.seq, did: evt.did }\n return undefined\n}\n"]}
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.39",
3
+ "version": "0.2.0",
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.3",
28
- "@atproto/identity": "^0.4.10",
29
- "@atproto/lexicon": "^0.6.0",
30
- "@atproto/repo": "^0.8.12",
31
- "@atproto/syntax": "^0.4.2",
32
- "@atproto/xrpc-server": "^0.10.3"
26
+ "@atproto/common": "^0.5.15",
27
+ "@atproto/identity": "^0.4.12",
28
+ "@atproto/lex": "^0.0.23",
29
+ "@atproto/repo": "^0.9.0",
30
+ "@atproto/syntax": "^0.5.2",
31
+ "@atproto/xrpc-server": "^0.10.18"
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,21 +1,18 @@
1
- /* eslint-disable import/no-deprecated */
2
-
3
- import type { CID } from 'multiformats/cid'
4
1
  import { DidDocument } from '@atproto/identity'
5
- import type { RepoRecord } from '@atproto/lexicon'
2
+ import { Cid, LexMap } from '@atproto/lex'
6
3
  import { BlockMap } from '@atproto/repo'
7
- import { AtUri } from '@atproto/syntax'
4
+ import { AtUri, DidString } from '@atproto/syntax'
8
5
 
9
6
  export type Event = CommitEvt | SyncEvt | IdentityEvt | AccountEvt
10
7
 
11
8
  export type CommitMeta = {
12
9
  seq: number
13
10
  time: string
14
- commit: CID
11
+ commit: Cid
15
12
  blocks: BlockMap
16
13
  rev: string
17
14
  uri: AtUri
18
- did: string
15
+ did: DidString
19
16
  collection: string
20
17
  rkey: string
21
18
  }
@@ -24,14 +21,14 @@ export type CommitEvt = Create | Update | Delete
24
21
 
25
22
  export type Create = CommitMeta & {
26
23
  event: 'create'
27
- record: RepoRecord
28
- cid: CID
24
+ record: LexMap
25
+ cid: Cid
29
26
  }
30
27
 
31
28
  export type Update = CommitMeta & {
32
29
  event: 'update'
33
- record: RepoRecord
34
- cid: CID
30
+ record: LexMap
31
+ cid: Cid
35
32
  }
36
33
 
37
34
  export type Delete = CommitMeta & {
@@ -42,8 +39,8 @@ export type SyncEvt = {
42
39
  seq: number
43
40
  time: string
44
41
  event: 'sync'
45
- did: string
46
- cid: CID
42
+ did: DidString
43
+ cid: Cid
47
44
  rev: string
48
45
  blocks: BlockMap
49
46
  }
@@ -52,7 +49,7 @@ export type IdentityEvt = {
52
49
  seq: number
53
50
  time: string
54
51
  event: 'identity'
55
- did: string
52
+ did: DidString
56
53
  handle?: string
57
54
  didDocument?: DidDocument
58
55
  }
@@ -61,7 +58,7 @@ export type AccountEvt = {
61
58
  seq: number
62
59
  time: string
63
60
  event: 'account'
64
- did: string
61
+ did: DidString
65
62
  active: boolean
66
63
  status?: AccountStatus
67
64
  }