From 84e2d4d2b6694f344d80c18672c78b650189d423 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Thu, 2 Nov 2023 00:45:13 -0700 Subject: [PATCH 1/9] Update atproto source license to MIT/Apache2 (#1788) * update LICENSE files to MIT/Apache2 * README: update top-level license * update package-level READMEs with license * changeset: license update --- .changeset/warm-lions-occur.md | 18 +++ LICENSE-APACHE.txt | 202 +++++++++++++++++++++++++++++++++ LICENSE => LICENSE-MIT.txt | 2 - LICENSE.txt | 7 ++ README.md | 7 +- packages/api/README.md | 7 +- packages/bsky/README.md | 7 +- packages/common-web/README.md | 7 +- packages/common/README.md | 7 +- packages/crypto/README.md | 7 +- packages/dev-env/README.md | 7 +- packages/identity/README.md | 7 +- packages/lex-cli/README.md | 7 +- packages/lexicon/README.md | 7 +- packages/pds/README.md | 7 +- packages/repo/README.md | 7 +- packages/syntax/README.md | 7 +- packages/xrpc-server/README.md | 7 +- packages/xrpc/README.md | 7 +- 19 files changed, 317 insertions(+), 17 deletions(-) create mode 100644 .changeset/warm-lions-occur.md create mode 100644 LICENSE-APACHE.txt rename LICENSE => LICENSE-MIT.txt (96%) create mode 100644 LICENSE.txt diff --git a/.changeset/warm-lions-occur.md b/.changeset/warm-lions-occur.md new file mode 100644 index 00000000000..3e86a4d3d2f --- /dev/null +++ b/.changeset/warm-lions-occur.md @@ -0,0 +1,18 @@ +--- +'@atproto/xrpc-server': patch +'@atproto/common-web': patch +'@atproto/identity': patch +'@atproto/dev-env': patch +'@atproto/lex-cli': patch +'@atproto/lexicon': patch +'@atproto/common': patch +'@atproto/crypto': patch +'@atproto/syntax': patch +'@atproto/bsky': patch +'@atproto/repo': patch +'@atproto/xrpc': patch +'@atproto/api': patch +'@atproto/pds': patch +--- + +update license to "MIT or Apache2" diff --git a/LICENSE-APACHE.txt b/LICENSE-APACHE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/LICENSE-APACHE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE b/LICENSE-MIT.txt similarity index 96% rename from LICENSE rename to LICENSE-MIT.txt index 042cffe65ef..9cf106272ac 100644 --- a/LICENSE +++ b/LICENSE-MIT.txt @@ -1,7 +1,5 @@ MIT License -Copyright (c) 2022-2023 Bluesky PBC - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000000..36f42cf81d0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,7 @@ +Dual MIT/Apache-2.0 License + +Copyright (c) 2022-2023 Bluesky PBC, and Contributors + +Except as otherwise noted in individual files, this software is licensed under the MIT license (), or the Apache License, Version 2.0 (). + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/README.md b/README.md index 0fe2bdade63..5a0a18ce853 100644 --- a/README.md +++ b/README.md @@ -108,4 +108,9 @@ If you discover any security issues, please send an email to security@bsky.app. ## License -MIT License. See [LICENSE](./LICENSE) for full text. +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/api/README.md b/packages/api/README.md index 9f59f3fbc9b..4d1cfb5f35f 100644 --- a/packages/api/README.md +++ b/packages/api/README.md @@ -335,4 +335,9 @@ BskyAgent.configure({ ## License -MIT +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/bsky/README.md b/packages/bsky/README.md index 8066ae30e1f..8849ae34de3 100644 --- a/packages/bsky/README.md +++ b/packages/bsky/README.md @@ -7,4 +7,9 @@ TypeScript implementation of the `app.bsky` Lexicons backing the https://bsky.ap ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/common-web/README.md b/packages/common-web/README.md index 74426aebe37..9dec61b4373 100644 --- a/packages/common-web/README.md +++ b/packages/common-web/README.md @@ -7,4 +7,9 @@ Shared TypeScript code for other `@atproto/*` packages, which is web-friendly (r ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/common/README.md b/packages/common/README.md index c08104cebe1..2cd3e74b23a 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -7,4 +7,9 @@ Shared TypeScript code for other `@atproto/*` packages. This package is oriented ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/crypto/README.md b/packages/crypto/README.md index 0b610bf7f6f..f92c5cbfb1f 100644 --- a/packages/crypto/README.md +++ b/packages/crypto/README.md @@ -43,4 +43,9 @@ if (!ok) { ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/dev-env/README.md b/packages/dev-env/README.md index 60befbe44ca..6c2fbae1f3a 100644 --- a/packages/dev-env/README.md +++ b/packages/dev-env/README.md @@ -31,4 +31,9 @@ Get the `ServiceClient` for the given user. ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/identity/README.md b/packages/identity/README.md index 874fe23570e..9806a3c5f67 100644 --- a/packages/identity/README.md +++ b/packages/identity/README.md @@ -37,4 +37,9 @@ if (data.handle != handle) { ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/lex-cli/README.md b/packages/lex-cli/README.md index 1eee8f0c5ac..a7fef9e3a2a 100644 --- a/packages/lex-cli/README.md +++ b/packages/lex-cli/README.md @@ -36,4 +36,9 @@ $ lex gen-server ./server/src/xrpc ./schemas/com/service/*.json ./schemas/com/an ## License -MIT +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/lexicon/README.md b/packages/lexicon/README.md index 33fd777ce7f..697abd97d03 100644 --- a/packages/lexicon/README.md +++ b/packages/lexicon/README.md @@ -31,4 +31,9 @@ lex.assertValidXrpcOutput('com.example.query', {...}) ## License -MIT +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/pds/README.md b/packages/pds/README.md index b70d99cb780..e99e2b42965 100644 --- a/packages/pds/README.md +++ b/packages/pds/README.md @@ -9,4 +9,9 @@ If you are interested in self-hosting a PDS, you probably want this repository i ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/repo/README.md b/packages/repo/README.md index e018cf76ff8..a972e547124 100644 --- a/packages/repo/README.md +++ b/packages/repo/README.md @@ -9,4 +9,9 @@ Repositories in atproto are signed key/value stores containing CBOR-encoded data ## License -MIT License +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/syntax/README.md b/packages/syntax/README.md index 0658b64d59c..c27205580b8 100644 --- a/packages/syntax/README.md +++ b/packages/syntax/README.md @@ -69,4 +69,9 @@ uri.rkey // => '1234' ## License -MIT +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/xrpc-server/README.md b/packages/xrpc-server/README.md index 03314c342a6..7c53339bc12 100644 --- a/packages/xrpc-server/README.md +++ b/packages/xrpc-server/README.md @@ -51,4 +51,9 @@ app.listen(8080) ## License -MIT +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. diff --git a/packages/xrpc/README.md b/packages/xrpc/README.md index 5789302658e..31b66e7f32c 100644 --- a/packages/xrpc/README.md +++ b/packages/xrpc/README.md @@ -71,4 +71,9 @@ const res3 = await xrpc.service('https://example.com').call( ## License -MIT +This project is dual-licensed under MIT and Apache 2.0 terms: + +- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) + +Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0. From b5a77babdb6229a29488e839c762ce4e8b835d64 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 2 Nov 2023 19:51:40 +0000 Subject: [PATCH 2/9] Adjust types to use LexiconDoc (#1807) --- packages/xrpc-server/README.md | 9 ++++++--- packages/xrpc-server/tests/auth.test.ts | 3 ++- packages/xrpc-server/tests/bodies.test.ts | 3 ++- packages/xrpc-server/tests/errors.test.ts | 3 ++- packages/xrpc-server/tests/ipld.test.ts | 3 ++- packages/xrpc-server/tests/parameters.test.ts | 3 ++- packages/xrpc-server/tests/procedures.test.ts | 3 ++- packages/xrpc-server/tests/queries.test.ts | 3 ++- packages/xrpc-server/tests/rate-limiter.test.ts | 3 ++- packages/xrpc-server/tests/responses.test.ts | 3 ++- packages/xrpc-server/tests/subscriptions.test.ts | 3 ++- packages/xrpc/README.md | 11 +++++++---- 12 files changed, 33 insertions(+), 17 deletions(-) diff --git a/packages/xrpc-server/README.md b/packages/xrpc-server/README.md index 7c53339bc12..1228b425d2d 100644 --- a/packages/xrpc-server/README.md +++ b/packages/xrpc-server/README.md @@ -8,11 +8,11 @@ TypeScript library for implementing [atproto](https://atproto.com) HTTP API serv ## Usage ```typescript +import { LexiconDoc } from '@atproto/lexicon' import * as xrpc from '@atproto/xrpc-server' import express from 'express' -// create xrpc server -const server = xrpc.createServer([ +const lexicons: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.ping', @@ -29,7 +29,10 @@ const server = xrpc.createServer([ }, }, }, -]) +] + +// create xrpc server +const server = xrpc.createServer(lexicons) function ping(ctx: { auth: xrpc.HandlerAuth | undefined diff --git a/packages/xrpc-server/tests/auth.test.ts b/packages/xrpc-server/tests/auth.test.ts index 53f3a6c6d24..bbd202d1024 100644 --- a/packages/xrpc-server/tests/auth.test.ts +++ b/packages/xrpc-server/tests/auth.test.ts @@ -6,6 +6,7 @@ import KeyEncoder from 'key-encoder' import * as ui8 from 'uint8arrays' import { MINUTE } from '@atproto/common' import { Secp256k1Keypair } from '@atproto/crypto' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient, XRPCError } from '@atproto/xrpc' import * as xrpcServer from '../src' import { @@ -15,7 +16,7 @@ import { basicAuthHeaders, } from './_util' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.authTest', diff --git a/packages/xrpc-server/tests/bodies.test.ts b/packages/xrpc-server/tests/bodies.test.ts index 725146907e2..072299cdcd7 100644 --- a/packages/xrpc-server/tests/bodies.test.ts +++ b/packages/xrpc-server/tests/bodies.test.ts @@ -2,6 +2,7 @@ import * as http from 'http' import { Readable } from 'stream' import { gzipSync } from 'zlib' import getPort from 'get-port' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient } from '@atproto/xrpc' import { bytesToStream, cidForCbor } from '@atproto/common' import { randomBytes } from '@atproto/crypto' @@ -9,7 +10,7 @@ import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' import logger from '../src/logger' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.validationTest', diff --git a/packages/xrpc-server/tests/errors.test.ts b/packages/xrpc-server/tests/errors.test.ts index 4703c5231f0..c7781e71907 100644 --- a/packages/xrpc-server/tests/errors.test.ts +++ b/packages/xrpc-server/tests/errors.test.ts @@ -1,5 +1,6 @@ import * as http from 'http' import getPort from 'get-port' +import { LexiconDoc } from '@atproto/lexicon' import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' import xrpc, { @@ -9,7 +10,7 @@ import xrpc, { XRPCInvalidResponseError, } from '@atproto/xrpc' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.error', diff --git a/packages/xrpc-server/tests/ipld.test.ts b/packages/xrpc-server/tests/ipld.test.ts index 2c84e8ed5dc..4ba1fec867e 100644 --- a/packages/xrpc-server/tests/ipld.test.ts +++ b/packages/xrpc-server/tests/ipld.test.ts @@ -1,11 +1,12 @@ import * as http from 'http' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient } from '@atproto/xrpc' import { CID } from 'multiformats/cid' import getPort from 'get-port' import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.ipld', diff --git a/packages/xrpc-server/tests/parameters.test.ts b/packages/xrpc-server/tests/parameters.test.ts index a6575f121da..6ab2066ae8f 100644 --- a/packages/xrpc-server/tests/parameters.test.ts +++ b/packages/xrpc-server/tests/parameters.test.ts @@ -1,10 +1,11 @@ import * as http from 'http' import getPort from 'get-port' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient } from '@atproto/xrpc' import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.paramTest', diff --git a/packages/xrpc-server/tests/procedures.test.ts b/packages/xrpc-server/tests/procedures.test.ts index 6d4cef19d02..df38fc855f9 100644 --- a/packages/xrpc-server/tests/procedures.test.ts +++ b/packages/xrpc-server/tests/procedures.test.ts @@ -1,11 +1,12 @@ import * as http from 'http' import { Readable } from 'stream' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient } from '@atproto/xrpc' import getPort from 'get-port' import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.pingOne', diff --git a/packages/xrpc-server/tests/queries.test.ts b/packages/xrpc-server/tests/queries.test.ts index a80e813ec4e..fd45d812e00 100644 --- a/packages/xrpc-server/tests/queries.test.ts +++ b/packages/xrpc-server/tests/queries.test.ts @@ -1,10 +1,11 @@ import * as http from 'http' import getPort from 'get-port' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient } from '@atproto/xrpc' import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.pingOne', diff --git a/packages/xrpc-server/tests/rate-limiter.test.ts b/packages/xrpc-server/tests/rate-limiter.test.ts index 09a235a38b9..20610c95688 100644 --- a/packages/xrpc-server/tests/rate-limiter.test.ts +++ b/packages/xrpc-server/tests/rate-limiter.test.ts @@ -1,12 +1,13 @@ import * as http from 'http' import getPort from 'get-port' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient } from '@atproto/xrpc' import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' import { RateLimiter } from '../src' import { MINUTE } from '@atproto/common' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.routeLimit', diff --git a/packages/xrpc-server/tests/responses.test.ts b/packages/xrpc-server/tests/responses.test.ts index 0eaccba0633..b61467dca22 100644 --- a/packages/xrpc-server/tests/responses.test.ts +++ b/packages/xrpc-server/tests/responses.test.ts @@ -1,11 +1,12 @@ import * as http from 'http' import getPort from 'get-port' +import { LexiconDoc } from '@atproto/lexicon' import xrpc, { ServiceClient } from '@atproto/xrpc' import { byteIterableToStream } from '@atproto/common' import { createServer, closeServer } from './_util' import * as xrpcServer from '../src' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.readableStream', diff --git a/packages/xrpc-server/tests/subscriptions.test.ts b/packages/xrpc-server/tests/subscriptions.test.ts index 13b0301ca87..e23cef5e3d4 100644 --- a/packages/xrpc-server/tests/subscriptions.test.ts +++ b/packages/xrpc-server/tests/subscriptions.test.ts @@ -2,6 +2,7 @@ import * as http from 'http' import { WebSocket, WebSocketServer, createWebSocketStream } from 'ws' import getPort from 'get-port' import { wait } from '@atproto/common' +import { LexiconDoc } from '@atproto/lexicon' import { byFrame, MessageFrame, ErrorFrame, Frame, Subscription } from '../src' import { createServer, @@ -11,7 +12,7 @@ import { } from './_util' import * as xrpcServer from '../src' -const LEXICONS = [ +const LEXICONS: LexiconDoc[] = [ { lexicon: 1, id: 'io.example.streamOne', diff --git a/packages/xrpc/README.md b/packages/xrpc/README.md index 31b66e7f32c..17c48c93735 100644 --- a/packages/xrpc/README.md +++ b/packages/xrpc/README.md @@ -8,9 +8,10 @@ TypeScript client library for talking to [atproto](https://atproto.com) services ## Usage ```typescript +import { LexiconDoc } from '@atproto/lexicon' import xrpc from '@atproto/xrpc' -xrpc.addLexicon({ +const pingLexicon: LexiconDoc = { lexicon: 1, id: 'io.example.ping', defs: { @@ -31,7 +32,8 @@ xrpc.addLexicon({ }, }, }, -}) +} +xrpc.addLexicon(pingLexicon) const res1 = await xrpc.call('https://example.com', 'io.example.ping', { message: 'hello world', @@ -44,7 +46,7 @@ const res2 = await xrpc res2.encoding // => 'application/json' res2.body // => {message: 'hello world'} -xrpc.addLexicon({ +const writeJsonLexicon: LexiconDoc = { lexicon: 1, id: 'io.example.writeJsonFile', defs: { @@ -60,7 +62,8 @@ xrpc.addLexicon({ }, }, }, -}) +} +xrpc.addLexicon(writeJsonLexicon) const res3 = await xrpc.service('https://example.com').call( 'io.example.writeJsonFile', From ce49743d7f8800d33116b88001d7b512553c2c89 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 2 Nov 2023 19:52:36 +0000 Subject: [PATCH 3/9] Add changeset for #1790 (#1801) --- .changeset/dry-cameras-hang.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/dry-cameras-hang.md diff --git a/.changeset/dry-cameras-hang.md b/.changeset/dry-cameras-hang.md new file mode 100644 index 00000000000..5c511c3766f --- /dev/null +++ b/.changeset/dry-cameras-hang.md @@ -0,0 +1,7 @@ +--- +'@atproto/lexicon': minor +'@atproto/xrpc': minor +'@atproto/xrpc-server': minor +--- + +Methods that accepts lexicons now take `LexiconDoc` type instead of `unknown` From 3598898c031c268cec2ce3bf5b67d1bbb73bf849 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 19:58:57 +0000 Subject: [PATCH 4/9] Version packages (#1802) Co-authored-by: github-actions[bot] --- .changeset/dry-cameras-hang.md | 7 ------- .changeset/warm-lions-occur.md | 18 ------------------ packages/api/CHANGELOG.md | 12 ++++++++++++ packages/api/package.json | 2 +- packages/aws/CHANGELOG.md | 9 +++++++++ packages/aws/package.json | 2 +- packages/bsky/CHANGELOG.md | 16 ++++++++++++++++ packages/bsky/package.json | 2 +- packages/common-web/CHANGELOG.md | 6 ++++++ packages/common-web/package.json | 2 +- packages/common/CHANGELOG.md | 9 +++++++++ packages/common/package.json | 2 +- packages/crypto/CHANGELOG.md | 7 +++++++ packages/crypto/package.json | 2 +- packages/dev-env/CHANGELOG.md | 17 +++++++++++++++++ packages/dev-env/package.json | 2 +- packages/identity/CHANGELOG.md | 10 ++++++++++ packages/identity/package.json | 2 +- packages/lex-cli/CHANGELOG.md | 10 ++++++++++ packages/lex-cli/package.json | 2 +- packages/lexicon/CHANGELOG.md | 14 ++++++++++++++ packages/lexicon/package.json | 2 +- packages/pds/CHANGELOG.md | 18 ++++++++++++++++++ packages/pds/package.json | 2 +- packages/repo/CHANGELOG.md | 14 ++++++++++++++ packages/repo/package.json | 2 +- packages/syntax/CHANGELOG.md | 9 +++++++++ packages/syntax/package.json | 2 +- packages/xrpc-server/CHANGELOG.md | 15 +++++++++++++++ packages/xrpc-server/package.json | 2 +- packages/xrpc/CHANGELOG.md | 13 +++++++++++++ packages/xrpc/package.json | 2 +- 32 files changed, 194 insertions(+), 40 deletions(-) delete mode 100644 .changeset/dry-cameras-hang.md delete mode 100644 .changeset/warm-lions-occur.md create mode 100644 packages/crypto/CHANGELOG.md diff --git a/.changeset/dry-cameras-hang.md b/.changeset/dry-cameras-hang.md deleted file mode 100644 index 5c511c3766f..00000000000 --- a/.changeset/dry-cameras-hang.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@atproto/lexicon': minor -'@atproto/xrpc': minor -'@atproto/xrpc-server': minor ---- - -Methods that accepts lexicons now take `LexiconDoc` type instead of `unknown` diff --git a/.changeset/warm-lions-occur.md b/.changeset/warm-lions-occur.md deleted file mode 100644 index 3e86a4d3d2f..00000000000 --- a/.changeset/warm-lions-occur.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -'@atproto/xrpc-server': patch -'@atproto/common-web': patch -'@atproto/identity': patch -'@atproto/dev-env': patch -'@atproto/lex-cli': patch -'@atproto/lexicon': patch -'@atproto/common': patch -'@atproto/crypto': patch -'@atproto/syntax': patch -'@atproto/bsky': patch -'@atproto/repo': patch -'@atproto/xrpc': patch -'@atproto/api': patch -'@atproto/pds': patch ---- - -update license to "MIT or Apache2" diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index d3c3a00c131..2cbffc45b04 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/CHANGELOG.md @@ -1,5 +1,17 @@ # @atproto/api +## 0.6.22 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + - @atproto/xrpc@0.4.0 + - @atproto/common-web@0.2.3 + - @atproto/syntax@0.1.4 + ## 0.6.21 ### Patch Changes diff --git a/packages/api/package.json b/packages/api/package.json index ed373c472c4..7f32b02ce0d 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/api", - "version": "0.6.21", + "version": "0.6.22", "license": "MIT", "description": "Client library for atproto and Bluesky", "keywords": [ diff --git a/packages/aws/CHANGELOG.md b/packages/aws/CHANGELOG.md index a587c2e8e26..43ada7d9e0f 100644 --- a/packages/aws/CHANGELOG.md +++ b/packages/aws/CHANGELOG.md @@ -1,5 +1,14 @@ # @atproto/aws +## 0.1.4 + +### Patch Changes + +- Updated dependencies [[`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/common@0.3.3 + - @atproto/crypto@0.2.3 + - @atproto/repo@0.3.4 + ## 0.1.3 ### Patch Changes diff --git a/packages/aws/package.json b/packages/aws/package.json index b370a69f5f4..40eaba51d83 100644 --- a/packages/aws/package.json +++ b/packages/aws/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/aws", - "version": "0.1.3", + "version": "0.1.4", "license": "MIT", "description": "Shared AWS cloud API helpers for atproto services", "keywords": [ diff --git a/packages/bsky/CHANGELOG.md b/packages/bsky/CHANGELOG.md index 867c1b62660..7a0a3664202 100644 --- a/packages/bsky/CHANGELOG.md +++ b/packages/bsky/CHANGELOG.md @@ -1,5 +1,21 @@ # @atproto/bsky +## 0.0.13 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + - @atproto/xrpc-server@0.4.0 + - @atproto/identity@0.3.1 + - @atproto/common@0.3.3 + - @atproto/crypto@0.2.3 + - @atproto/syntax@0.1.4 + - @atproto/repo@0.3.4 + - @atproto/api@0.6.22 + ## 0.0.12 ### Patch Changes diff --git a/packages/bsky/package.json b/packages/bsky/package.json index ab2b69cb5a6..1129c038bbd 100644 --- a/packages/bsky/package.json +++ b/packages/bsky/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/bsky", - "version": "0.0.12", + "version": "0.0.13", "license": "MIT", "description": "Reference implementation of app.bsky App View (Bluesky API)", "keywords": [ diff --git a/packages/common-web/CHANGELOG.md b/packages/common-web/CHANGELOG.md index 28bc7f04df7..57a602b2267 100644 --- a/packages/common-web/CHANGELOG.md +++ b/packages/common-web/CHANGELOG.md @@ -1,5 +1,11 @@ # @atproto/common-web +## 0.2.3 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + ## 0.2.2 ### Patch Changes diff --git a/packages/common-web/package.json b/packages/common-web/package.json index 01d5768f91e..1df7806ab51 100644 --- a/packages/common-web/package.json +++ b/packages/common-web/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/common-web", - "version": "0.2.2", + "version": "0.2.3", "license": "MIT", "description": "Shared web-platform-friendly code for atproto libraries", "keywords": [ diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 8c9ff1b090a..4d70c2a117c 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,14 @@ # @atproto/common +## 0.3.3 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/common-web@0.2.3 + ## 0.3.2 ### Patch Changes diff --git a/packages/common/package.json b/packages/common/package.json index beef7fe7fa4..c9aaa9293e2 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/common", - "version": "0.3.2", + "version": "0.3.3", "license": "MIT", "description": "Shared web-platform-friendly code for atproto libraries", "keywords": [ diff --git a/packages/crypto/CHANGELOG.md b/packages/crypto/CHANGELOG.md new file mode 100644 index 00000000000..c023f142e7a --- /dev/null +++ b/packages/crypto/CHANGELOG.md @@ -0,0 +1,7 @@ +# @atproto/crypto + +## 0.2.3 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 7b552ca6b43..b5b9773c077 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/crypto", - "version": "0.2.2", + "version": "0.2.3", "license": "MIT", "description": "Library for cryptographic keys and signing in atproto", "keywords": [ diff --git a/packages/dev-env/CHANGELOG.md b/packages/dev-env/CHANGELOG.md index 3f00886dded..01cbddbf2f4 100644 --- a/packages/dev-env/CHANGELOG.md +++ b/packages/dev-env/CHANGELOG.md @@ -1,5 +1,22 @@ # @atproto/dev-env +## 0.2.13 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + - @atproto/xrpc-server@0.4.0 + - @atproto/common-web@0.2.3 + - @atproto/identity@0.3.1 + - @atproto/crypto@0.2.3 + - @atproto/syntax@0.1.4 + - @atproto/bsky@0.0.13 + - @atproto/api@0.6.22 + - @atproto/pds@0.3.1 + ## 0.2.12 ### Patch Changes diff --git a/packages/dev-env/package.json b/packages/dev-env/package.json index 7cf3dbb2ade..362cc960a37 100644 --- a/packages/dev-env/package.json +++ b/packages/dev-env/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/dev-env", - "version": "0.2.12", + "version": "0.2.13", "license": "MIT", "description": "Local development environment helper for atproto development", "keywords": [ diff --git a/packages/identity/CHANGELOG.md b/packages/identity/CHANGELOG.md index 321025853e2..ac49fc13f1a 100644 --- a/packages/identity/CHANGELOG.md +++ b/packages/identity/CHANGELOG.md @@ -1,5 +1,15 @@ # @atproto/identity +## 0.3.1 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/common-web@0.2.3 + - @atproto/crypto@0.2.3 + ## 0.3.0 ### Minor Changes diff --git a/packages/identity/package.json b/packages/identity/package.json index 119017e77d0..e4f39c24ecd 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/identity", - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "description": "Library for decentralized identities in atproto using DIDs and handles", "keywords": [ diff --git a/packages/lex-cli/CHANGELOG.md b/packages/lex-cli/CHANGELOG.md index 02f8d6e9a8e..b9c617f9a9d 100644 --- a/packages/lex-cli/CHANGELOG.md +++ b/packages/lex-cli/CHANGELOG.md @@ -1,5 +1,15 @@ # @atproto/lex-cli +## 0.2.4 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + - @atproto/syntax@0.1.4 + ## 0.2.3 ### Patch Changes diff --git a/packages/lex-cli/package.json b/packages/lex-cli/package.json index ee8d7b47184..2f57a55b3cb 100644 --- a/packages/lex-cli/package.json +++ b/packages/lex-cli/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/lex-cli", - "version": "0.2.3", + "version": "0.2.4", "license": "MIT", "description": "TypeScript codegen tool for atproto Lexicon schemas", "keywords": [ diff --git a/packages/lexicon/CHANGELOG.md b/packages/lexicon/CHANGELOG.md index a5efe153f5c..7194b0258ba 100644 --- a/packages/lexicon/CHANGELOG.md +++ b/packages/lexicon/CHANGELOG.md @@ -1,5 +1,19 @@ # @atproto/lexicon +## 0.3.0 + +### Minor Changes + +- [#1801](https://github.com/bluesky-social/atproto/pull/1801) [`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89) Thanks [@gaearon](https://github.com/gaearon)! - Methods that accepts lexicons now take `LexiconDoc` type instead of `unknown` + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/common-web@0.2.3 + - @atproto/syntax@0.1.4 + ## 0.2.3 ### Patch Changes diff --git a/packages/lexicon/package.json b/packages/lexicon/package.json index b4eaeeedf85..fc776e7c273 100644 --- a/packages/lexicon/package.json +++ b/packages/lexicon/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/lexicon", - "version": "0.2.3", + "version": "0.3.0", "license": "MIT", "description": "atproto Lexicon schema language library", "keywords": [ diff --git a/packages/pds/CHANGELOG.md b/packages/pds/CHANGELOG.md index bd333402677..74eebe5cd1e 100644 --- a/packages/pds/CHANGELOG.md +++ b/packages/pds/CHANGELOG.md @@ -1,5 +1,23 @@ # @atproto/pds +## 0.3.1 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + - @atproto/xrpc@0.4.0 + - @atproto/xrpc-server@0.4.0 + - @atproto/identity@0.3.1 + - @atproto/common@0.3.3 + - @atproto/crypto@0.2.3 + - @atproto/syntax@0.1.4 + - @atproto/repo@0.3.4 + - @atproto/api@0.6.22 + - @atproto/aws@0.1.4 + ## 0.3.0 ### Patch Changes diff --git a/packages/pds/package.json b/packages/pds/package.json index a7a61e86ea2..a2d1d454156 100644 --- a/packages/pds/package.json +++ b/packages/pds/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/pds", - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "description": "Reference implementation of atproto Personal Data Server (PDS)", "keywords": [ diff --git a/packages/repo/CHANGELOG.md b/packages/repo/CHANGELOG.md index 05258506fe9..753b8f39811 100644 --- a/packages/repo/CHANGELOG.md +++ b/packages/repo/CHANGELOG.md @@ -1,5 +1,19 @@ # @atproto/repo +## 0.3.4 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + - @atproto/common-web@0.2.3 + - @atproto/identity@0.3.1 + - @atproto/common@0.3.3 + - @atproto/crypto@0.2.3 + - @atproto/syntax@0.1.4 + ## 0.3.3 ### Patch Changes diff --git a/packages/repo/package.json b/packages/repo/package.json index b8839ed9f6a..23022149653 100644 --- a/packages/repo/package.json +++ b/packages/repo/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/repo", - "version": "0.3.3", + "version": "0.3.4", "license": "MIT", "description": "atproto repo and MST implementation", "keywords": [ diff --git a/packages/syntax/CHANGELOG.md b/packages/syntax/CHANGELOG.md index 4df89fb53a1..bc243559bbf 100644 --- a/packages/syntax/CHANGELOG.md +++ b/packages/syntax/CHANGELOG.md @@ -1,5 +1,14 @@ # @atproto/syntax +## 0.1.4 + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/common-web@0.2.3 + ## 0.1.3 ### Patch Changes diff --git a/packages/syntax/package.json b/packages/syntax/package.json index ff59423f8eb..645926886f5 100644 --- a/packages/syntax/package.json +++ b/packages/syntax/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/syntax", - "version": "0.1.3", + "version": "0.1.4", "license": "MIT", "description": "Validation for atproto identifiers and formats: DID, handle, NSID, AT URI, etc", "keywords": [ diff --git a/packages/xrpc-server/CHANGELOG.md b/packages/xrpc-server/CHANGELOG.md index 4be9b022bea..1a0f2ab8279 100644 --- a/packages/xrpc-server/CHANGELOG.md +++ b/packages/xrpc-server/CHANGELOG.md @@ -1,5 +1,20 @@ # @atproto/xrpc-server +## 0.4.0 + +### Minor Changes + +- [#1801](https://github.com/bluesky-social/atproto/pull/1801) [`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89) Thanks [@gaearon](https://github.com/gaearon)! - Methods that accepts lexicons now take `LexiconDoc` type instead of `unknown` + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + - @atproto/common@0.3.3 + - @atproto/crypto@0.2.3 + ## 0.3.3 ### Patch Changes diff --git a/packages/xrpc-server/package.json b/packages/xrpc-server/package.json index 21589c26f6b..fae70972446 100644 --- a/packages/xrpc-server/package.json +++ b/packages/xrpc-server/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/xrpc-server", - "version": "0.3.3", + "version": "0.4.0", "license": "MIT", "description": "atproto HTTP API (XRPC) server library", "keywords": [ diff --git a/packages/xrpc/CHANGELOG.md b/packages/xrpc/CHANGELOG.md index 2d37c765ead..76ffea62682 100644 --- a/packages/xrpc/CHANGELOG.md +++ b/packages/xrpc/CHANGELOG.md @@ -1,5 +1,18 @@ # @atproto/xrpc +## 0.4.0 + +### Minor Changes + +- [#1801](https://github.com/bluesky-social/atproto/pull/1801) [`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89) Thanks [@gaearon](https://github.com/gaearon)! - Methods that accepts lexicons now take `LexiconDoc` type instead of `unknown` + +### Patch Changes + +- [#1788](https://github.com/bluesky-social/atproto/pull/1788) [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423) Thanks [@bnewbold](https://github.com/bnewbold)! - update license to "MIT or Apache2" + +- Updated dependencies [[`ce49743d`](https://github.com/bluesky-social/atproto/commit/ce49743d7f8800d33116b88001d7b512553c2c89), [`84e2d4d2`](https://github.com/bluesky-social/atproto/commit/84e2d4d2b6694f344d80c18672c78b650189d423)]: + - @atproto/lexicon@0.3.0 + ## 0.3.3 ### Patch Changes diff --git a/packages/xrpc/package.json b/packages/xrpc/package.json index f9845c7fcfb..49cf7a06aa3 100644 --- a/packages/xrpc/package.json +++ b/packages/xrpc/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/xrpc", - "version": "0.3.3", + "version": "0.4.0", "license": "MIT", "description": "atproto HTTP API (XRPC) client library", "keywords": [ From 772736a01081f39504e1b19a1b3687783bb78f07 Mon Sep 17 00:00:00 2001 From: devin ivy Date: Thu, 2 Nov 2023 16:16:26 -0400 Subject: [PATCH 5/9] Add did doc output to getSession for session resumption (#1806) * add optional did doc output to getSession lexicon * add did doc output to getSession on pds, update client to use it * api test fixes * api changeset * tidy --- .changeset/thick-apples-invite.md | 5 +++++ lexicons/com/atproto/server/getSession.json | 3 ++- packages/api/src/agent.ts | 1 + packages/api/src/client/lexicons.ts | 3 +++ .../types/com/atproto/server/getSession.ts | 1 + packages/api/src/moderation/accumulator.ts | 1 - packages/api/tests/agent.test.ts | 17 ++++++++++++++--- packages/bsky/src/lexicon/lexicons.ts | 3 +++ .../types/com/atproto/server/getSession.ts | 1 + .../src/api/com/atproto/server/getSession.ts | 7 ++++++- packages/pds/src/lexicon/lexicons.ts | 3 +++ .../types/com/atproto/server/getSession.ts | 1 + 12 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .changeset/thick-apples-invite.md diff --git a/.changeset/thick-apples-invite.md b/.changeset/thick-apples-invite.md new file mode 100644 index 00000000000..6f30f88d83e --- /dev/null +++ b/.changeset/thick-apples-invite.md @@ -0,0 +1,5 @@ +--- +'@atproto/api': patch +--- + +respect pds endpoint during session resumption diff --git a/lexicons/com/atproto/server/getSession.json b/lexicons/com/atproto/server/getSession.json index 7ff5569eb1b..5f7700882da 100644 --- a/lexicons/com/atproto/server/getSession.json +++ b/lexicons/com/atproto/server/getSession.json @@ -14,7 +14,8 @@ "handle": { "type": "string", "format": "handle" }, "did": { "type": "string", "format": "did" }, "email": { "type": "string" }, - "emailConfirmed": { "type": "boolean" } + "emailConfirmed": { "type": "boolean" }, + "didDoc": { "type": "unknown" } } } } diff --git a/packages/api/src/agent.ts b/packages/api/src/agent.ts index ce34865c189..aea3cce9d4b 100644 --- a/packages/api/src/agent.ts +++ b/packages/api/src/agent.ts @@ -165,6 +165,7 @@ export class AtpAgent { this.session.email = res.data.email this.session.handle = res.data.handle this.session.emailConfirmed = res.data.emailConfirmed + this._updateApiEndpoint(res.data.didDoc) return res } catch (e) { this.session = undefined diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index d9de1551bcc..f17885819a0 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -3007,6 +3007,9 @@ export const schemaDict = { emailConfirmed: { type: 'boolean', }, + didDoc: { + type: 'unknown', + }, }, }, }, diff --git a/packages/api/src/client/types/com/atproto/server/getSession.ts b/packages/api/src/client/types/com/atproto/server/getSession.ts index 91d51860982..6b82781f081 100644 --- a/packages/api/src/client/types/com/atproto/server/getSession.ts +++ b/packages/api/src/client/types/com/atproto/server/getSession.ts @@ -16,6 +16,7 @@ export interface OutputSchema { did: string email?: string emailConfirmed?: boolean + didDoc?: {} [k: string]: unknown } diff --git a/packages/api/src/moderation/accumulator.ts b/packages/api/src/moderation/accumulator.ts index 53180023934..716647ee772 100644 --- a/packages/api/src/moderation/accumulator.ts +++ b/packages/api/src/moderation/accumulator.ts @@ -1,5 +1,4 @@ import { AppBskyGraphDefs } from '../client/index' -import { AtUri } from '@atproto/syntax' import { Label, LabelPreference, diff --git a/packages/api/tests/agent.test.ts b/packages/api/tests/agent.test.ts index 7f85f3079af..807046deb00 100644 --- a/packages/api/tests/agent.test.ts +++ b/packages/api/tests/agent.test.ts @@ -1,3 +1,4 @@ +import assert from 'assert' import { defaultFetchHandler } from '@atproto/xrpc' import { AtpAgent, @@ -6,6 +7,7 @@ import { AtpSessionData, } from '..' import { TestNetworkNoAppView } from '@atproto/dev-env' +import { getPdsEndpoint, isValidDidDoc } from '@atproto/common-web' describe('agent', () => { let network: TestNetworkNoAppView @@ -46,16 +48,19 @@ describe('agent', () => { expect(agent.session?.did).toEqual(res.data.did) expect(agent.session?.email).toEqual('user1@test.com') expect(agent.session?.emailConfirmed).toEqual(false) + assert(isValidDidDoc(res.data.didDoc)) + expect(agent.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res.data.didDoc)) const { data: sessionInfo } = await agent.api.com.atproto.server.getSession( {}, ) - expect(sessionInfo).toEqual({ + expect(sessionInfo).toMatchObject({ did: res.data.did, handle: res.data.handle, email: 'user1@test.com', emailConfirmed: false, }) + expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true) expect(events.length).toEqual(1) expect(events[0]).toEqual('create') @@ -93,15 +98,18 @@ describe('agent', () => { expect(agent2.session?.did).toEqual(res1.data.did) expect(agent2.session?.email).toEqual('user2@test.com') expect(agent2.session?.emailConfirmed).toEqual(false) + assert(isValidDidDoc(res1.data.didDoc)) + expect(agent2.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res1.data.didDoc)) const { data: sessionInfo } = await agent2.api.com.atproto.server.getSession({}) - expect(sessionInfo).toEqual({ + expect(sessionInfo).toMatchObject({ did: res1.data.did, handle: res1.data.handle, email, emailConfirmed: false, }) + expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true) expect(events.length).toEqual(2) expect(events[0]).toEqual('create') @@ -136,15 +144,18 @@ describe('agent', () => { expect(agent2.hasSession).toEqual(true) expect(agent2.session?.handle).toEqual(res1.data.handle) expect(agent2.session?.did).toEqual(res1.data.did) + assert(isValidDidDoc(res1.data.didDoc)) + expect(agent2.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res1.data.didDoc)) const { data: sessionInfo } = await agent2.api.com.atproto.server.getSession({}) - expect(sessionInfo).toEqual({ + expect(sessionInfo).toMatchObject({ did: res1.data.did, handle: res1.data.handle, email: res1.data.email, emailConfirmed: false, }) + expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true) expect(events.length).toEqual(2) expect(events[0]).toEqual('create') diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index d9de1551bcc..f17885819a0 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -3007,6 +3007,9 @@ export const schemaDict = { emailConfirmed: { type: 'boolean', }, + didDoc: { + type: 'unknown', + }, }, }, }, diff --git a/packages/bsky/src/lexicon/types/com/atproto/server/getSession.ts b/packages/bsky/src/lexicon/types/com/atproto/server/getSession.ts index 7f066a500bf..4f95acf523d 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/server/getSession.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/server/getSession.ts @@ -17,6 +17,7 @@ export interface OutputSchema { did: string email?: string emailConfirmed?: boolean + didDoc?: {} [k: string]: unknown } diff --git a/packages/pds/src/api/com/atproto/server/getSession.ts b/packages/pds/src/api/com/atproto/server/getSession.ts index fa192f0057f..bf271a9c02e 100644 --- a/packages/pds/src/api/com/atproto/server/getSession.ts +++ b/packages/pds/src/api/com/atproto/server/getSession.ts @@ -1,13 +1,17 @@ import { InvalidRequestError } from '@atproto/xrpc-server' import AppContext from '../../../../context' import { Server } from '../../../../lexicon' +import { didDocForSession } from './util' export default function (server: Server, ctx: AppContext) { server.com.atproto.server.getSession({ auth: ctx.authVerifier.access, handler: async ({ auth }) => { const did = auth.credentials.did - const user = await ctx.services.account(ctx.db).getAccount(did) + const [user, didDoc] = await Promise.all([ + ctx.services.account(ctx.db).getAccount(did), + didDocForSession(ctx, did), + ]) if (!user) { throw new InvalidRequestError( `Could not find user info for account: ${did}`, @@ -18,6 +22,7 @@ export default function (server: Server, ctx: AppContext) { body: { handle: user.handle, did: user.did, + didDoc, email: user.email, emailConfirmed: !!user.emailConfirmedAt, }, diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index d9de1551bcc..f17885819a0 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -3007,6 +3007,9 @@ export const schemaDict = { emailConfirmed: { type: 'boolean', }, + didDoc: { + type: 'unknown', + }, }, }, }, diff --git a/packages/pds/src/lexicon/types/com/atproto/server/getSession.ts b/packages/pds/src/lexicon/types/com/atproto/server/getSession.ts index 7f066a500bf..4f95acf523d 100644 --- a/packages/pds/src/lexicon/types/com/atproto/server/getSession.ts +++ b/packages/pds/src/lexicon/types/com/atproto/server/getSession.ts @@ -17,6 +17,7 @@ export interface OutputSchema { did: string email?: string emailConfirmed?: boolean + didDoc?: {} [k: string]: unknown } From b90f2c4ef82560d35e2f2dfae0c7ae6a7e2b893f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:30:44 -0400 Subject: [PATCH 6/9] Version packages (#1808) Co-authored-by: github-actions[bot] --- .changeset/thick-apples-invite.md | 5 ----- packages/api/CHANGELOG.md | 6 ++++++ packages/api/package.json | 2 +- packages/bsky/CHANGELOG.md | 7 +++++++ packages/bsky/package.json | 2 +- packages/dev-env/CHANGELOG.md | 9 +++++++++ packages/dev-env/package.json | 2 +- packages/pds/CHANGELOG.md | 7 +++++++ packages/pds/package.json | 2 +- 9 files changed, 33 insertions(+), 9 deletions(-) delete mode 100644 .changeset/thick-apples-invite.md diff --git a/.changeset/thick-apples-invite.md b/.changeset/thick-apples-invite.md deleted file mode 100644 index 6f30f88d83e..00000000000 --- a/.changeset/thick-apples-invite.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@atproto/api': patch ---- - -respect pds endpoint during session resumption diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index 2cbffc45b04..ca4ed16617b 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/CHANGELOG.md @@ -1,5 +1,11 @@ # @atproto/api +## 0.6.23 + +### Patch Changes + +- [#1806](https://github.com/bluesky-social/atproto/pull/1806) [`772736a0`](https://github.com/bluesky-social/atproto/commit/772736a01081f39504e1b19a1b3687783bb78f07) Thanks [@devinivy](https://github.com/devinivy)! - respect pds endpoint during session resumption + ## 0.6.22 ### Patch Changes diff --git a/packages/api/package.json b/packages/api/package.json index 7f32b02ce0d..4267152e641 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/api", - "version": "0.6.22", + "version": "0.6.23", "license": "MIT", "description": "Client library for atproto and Bluesky", "keywords": [ diff --git a/packages/bsky/CHANGELOG.md b/packages/bsky/CHANGELOG.md index 7a0a3664202..fb715a89591 100644 --- a/packages/bsky/CHANGELOG.md +++ b/packages/bsky/CHANGELOG.md @@ -1,5 +1,12 @@ # @atproto/bsky +## 0.0.14 + +### Patch Changes + +- Updated dependencies [[`772736a0`](https://github.com/bluesky-social/atproto/commit/772736a01081f39504e1b19a1b3687783bb78f07)]: + - @atproto/api@0.6.23 + ## 0.0.13 ### Patch Changes diff --git a/packages/bsky/package.json b/packages/bsky/package.json index 1129c038bbd..60991c5f791 100644 --- a/packages/bsky/package.json +++ b/packages/bsky/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/bsky", - "version": "0.0.13", + "version": "0.0.14", "license": "MIT", "description": "Reference implementation of app.bsky App View (Bluesky API)", "keywords": [ diff --git a/packages/dev-env/CHANGELOG.md b/packages/dev-env/CHANGELOG.md index 01cbddbf2f4..97b9eac682c 100644 --- a/packages/dev-env/CHANGELOG.md +++ b/packages/dev-env/CHANGELOG.md @@ -1,5 +1,14 @@ # @atproto/dev-env +## 0.2.14 + +### Patch Changes + +- Updated dependencies [[`772736a0`](https://github.com/bluesky-social/atproto/commit/772736a01081f39504e1b19a1b3687783bb78f07)]: + - @atproto/api@0.6.23 + - @atproto/bsky@0.0.14 + - @atproto/pds@0.3.2 + ## 0.2.13 ### Patch Changes diff --git a/packages/dev-env/package.json b/packages/dev-env/package.json index 362cc960a37..3140d8ff189 100644 --- a/packages/dev-env/package.json +++ b/packages/dev-env/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/dev-env", - "version": "0.2.13", + "version": "0.2.14", "license": "MIT", "description": "Local development environment helper for atproto development", "keywords": [ diff --git a/packages/pds/CHANGELOG.md b/packages/pds/CHANGELOG.md index 74eebe5cd1e..aca0e381ad4 100644 --- a/packages/pds/CHANGELOG.md +++ b/packages/pds/CHANGELOG.md @@ -1,5 +1,12 @@ # @atproto/pds +## 0.3.2 + +### Patch Changes + +- Updated dependencies [[`772736a0`](https://github.com/bluesky-social/atproto/commit/772736a01081f39504e1b19a1b3687783bb78f07)]: + - @atproto/api@0.6.23 + ## 0.3.1 ### Patch Changes diff --git a/packages/pds/package.json b/packages/pds/package.json index a2d1d454156..adc0ed9e508 100644 --- a/packages/pds/package.json +++ b/packages/pds/package.json @@ -1,6 +1,6 @@ { "name": "@atproto/pds", - "version": "0.3.1", + "version": "0.3.2", "license": "MIT", "description": "Reference implementation of atproto Personal Data Server (PDS)", "keywords": [ From bba9388ea95dd17c3aeb92c3415063bc7fb25918 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 2 Nov 2023 17:29:27 -0500 Subject: [PATCH 7/9] Add a test for links that end in .php (#1810) --- packages/api/tests/rich-text-detection.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/api/tests/rich-text-detection.test.ts b/packages/api/tests/rich-text-detection.test.ts index 64a53d1131c..88f2940c59e 100644 --- a/packages/api/tests/rich-text-detection.test.ts +++ b/packages/api/tests/rich-text-detection.test.ts @@ -40,6 +40,7 @@ describe('detectFacets', () => { 'start.com/foo/bar?baz=bux#hash middle end', 'start middle end.com/foo/bar?baz=bux#hash', 'newline1.com\nnewline2.com', + 'a example.com/index.php php link', 'not.. a..url ..here', 'e.g.', @@ -156,6 +157,11 @@ describe('detectFacets', () => { ['\n'], ['newline2.com', 'https://newline2.com'], ], + [ + ['a '], + ['example.com/index.php', 'https://example.com/index.php'], + [' php link'], + ], [['not.. a..url ..here']], [['e.g.']], From a3d81dd911b39877dc07d993912c14a2271646aa Mon Sep 17 00:00:00 2001 From: Daniel Holmgren Date: Fri, 3 Nov 2023 16:55:50 -0500 Subject: [PATCH 8/9] Prevent thread loops (#1813) * prevent thread loops * include original uri * tidy * tweak * last tweak * last tweak i swear * wording --- .../src/api/app/bsky/feed/getPostThread.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/bsky/src/api/app/bsky/feed/getPostThread.ts b/packages/bsky/src/api/app/bsky/feed/getPostThread.ts index 1480e54ac1a..0e31107d052 100644 --- a/packages/bsky/src/api/app/bsky/feed/getPostThread.ts +++ b/packages/bsky/src/api/app/bsky/feed/getPostThread.ts @@ -255,11 +255,15 @@ const getThreadData = async ( .orderBy('sortAt', 'desc') .execute(), ]) - const parentsByUri = parents.reduce((acc, parent) => { - return Object.assign(acc, { [parent.postUri]: parent }) + // prevent self-referential loops + const includedPosts = new Set([uri]) + const parentsByUri = parents.reduce((acc, post) => { + return Object.assign(acc, { [post.uri]: post }) }, {} as Record) const childrenByParentUri = children.reduce((acc, child) => { if (!child.replyParent) return acc + if (includedPosts.has(child.uri)) return acc + includedPosts.add(child.uri) acc[child.replyParent] ??= [] acc[child.replyParent].push(child) return acc @@ -269,7 +273,12 @@ const getThreadData = async ( return { post, parent: post.replyParent - ? getParentData(parentsByUri, post.replyParent, parentHeight) + ? getParentData( + parentsByUri, + includedPosts, + post.replyParent, + parentHeight, + ) : undefined, replies: getChildrenData(childrenByParentUri, uri, depth), } @@ -277,16 +286,19 @@ const getThreadData = async ( const getParentData = ( postsByUri: Record, + includedPosts: Set, uri: string, depth: number, ): PostThread | ParentNotFoundError | undefined => { if (depth < 1) return undefined + if (includedPosts.has(uri)) return undefined + includedPosts.add(uri) const post = postsByUri[uri] if (!post) return new ParentNotFoundError(uri) return { post, parent: post.replyParent - ? getParentData(postsByUri, post.replyParent, depth - 1) + ? getParentData(postsByUri, includedPosts, post.replyParent, depth - 1) : undefined, replies: [], } From bebc4bac8c42a97e91a8272e7deffcc6f46ceba0 Mon Sep 17 00:00:00 2001 From: devin ivy Date: Sun, 5 Nov 2023 00:33:14 -0400 Subject: [PATCH 9/9] Simplify moderation fanout to configured url (#1804) * simplify moderation fanout to configured url * fix bsky mod fanout tests --- .../atproto/admin/reverseModerationAction.ts | 6 +++--- .../com/atproto/admin/takeModerationAction.ts | 4 ++-- .../bsky/src/api/com/atproto/admin/util.ts | 3 ++- packages/bsky/src/config.ts | 12 +++++------ packages/bsky/src/context.ts | 20 ++++++++++--------- .../db/periodic-moderation-action-reversal.ts | 10 +--------- packages/dev-env/src/network.ts | 1 + 7 files changed, 26 insertions(+), 30 deletions(-) diff --git a/packages/bsky/src/api/com/atproto/admin/reverseModerationAction.ts b/packages/bsky/src/api/com/atproto/admin/reverseModerationAction.ts index ae76df5b0c7..a441d2b934c 100644 --- a/packages/bsky/src/api/com/atproto/admin/reverseModerationAction.ts +++ b/packages/bsky/src/api/com/atproto/admin/reverseModerationAction.ts @@ -85,9 +85,9 @@ export default function (server: Server, ctx: AppContext) { return { result, restored } }) - if (restored) { - const { did, subjects } = restored - const agent = await ctx.pdsAdminAgent(did) + if (restored && ctx.moderationPushAgent) { + const agent = ctx.moderationPushAgent + const { subjects } = restored const results = await Promise.allSettled( subjects.map((subject) => retryHttp(() => diff --git a/packages/bsky/src/api/com/atproto/admin/takeModerationAction.ts b/packages/bsky/src/api/com/atproto/admin/takeModerationAction.ts index a8d67fced9f..5239ddec42d 100644 --- a/packages/bsky/src/api/com/atproto/admin/takeModerationAction.ts +++ b/packages/bsky/src/api/com/atproto/admin/takeModerationAction.ts @@ -111,10 +111,10 @@ export default function (server: Server, ctx: AppContext) { return { result, takenDown } }) - if (takenDown) { + if (takenDown && ctx.moderationPushAgent) { + const agent = ctx.moderationPushAgent const { did, subjects } = takenDown if (did && subjects.length > 0) { - const agent = await ctx.pdsAdminAgent(did) const results = await Promise.allSettled( subjects.map((subject) => retryHttp(() => diff --git a/packages/bsky/src/api/com/atproto/admin/util.ts b/packages/bsky/src/api/com/atproto/admin/util.ts index eba3eaa1d1e..6217e71eb0f 100644 --- a/packages/bsky/src/api/com/atproto/admin/util.ts +++ b/packages/bsky/src/api/com/atproto/admin/util.ts @@ -9,8 +9,9 @@ export const getPdsAccountInfo = async ( ctx: AppContext, did: string, ): Promise => { + const agent = ctx.moderationPushAgent + if (!agent) return null try { - const agent = await ctx.pdsAdminAgent(did) const res = await agent.api.com.atproto.admin.getAccountInfo({ did }) return res.data } catch (err) { diff --git a/packages/bsky/src/config.ts b/packages/bsky/src/config.ts index 38d9c883760..679f99c59a4 100644 --- a/packages/bsky/src/config.ts +++ b/packages/bsky/src/config.ts @@ -23,7 +23,7 @@ export interface ServerConfigValues { adminPassword: string moderatorPassword?: string triagePassword?: string - moderationActionReverseUrl?: string + moderationPushUrl?: string } export class ServerConfig { @@ -78,8 +78,8 @@ export class ServerConfig { const moderatorPassword = process.env.MODERATOR_PASSWORD || undefined const triagePassword = process.env.TRIAGE_PASSWORD || undefined const labelerDid = process.env.LABELER_DID || 'did:example:labeler' - const moderationActionReverseUrl = - overrides?.moderationActionReverseUrl || + const moderationPushUrl = + overrides?.moderationPushUrl || process.env.MODERATION_PUSH_URL || undefined return new ServerConfig({ @@ -104,7 +104,7 @@ export class ServerConfig { adminPassword, moderatorPassword, triagePassword, - moderationActionReverseUrl, + moderationPushUrl, ...stripUndefineds(overrides ?? {}), }) } @@ -206,8 +206,8 @@ export class ServerConfig { return this.cfg.triagePassword } - get moderationActionReverseUrl() { - return this.cfg.moderationActionReverseUrl + get moderationPushUrl() { + return this.cfg.moderationPushUrl } } diff --git a/packages/bsky/src/context.ts b/packages/bsky/src/context.ts index 90e6cf60014..21c01c38fbd 100644 --- a/packages/bsky/src/context.ts +++ b/packages/bsky/src/context.ts @@ -15,6 +15,7 @@ import { LabelCache } from './label-cache' import { NotificationServer } from './notifications' export class AppContext { + public moderationPushAgent: AtpAgent | undefined constructor( private opts: { db: DatabaseCoordinator @@ -30,7 +31,16 @@ export class AppContext { algos: MountedAlgos notifServer: NotificationServer }, - ) {} + ) { + if (opts.cfg.moderationPushUrl) { + const url = new URL(opts.cfg.moderationPushUrl) + this.moderationPushAgent = new AtpAgent({ service: url.origin }) + this.moderationPushAgent.api.setHeader( + 'authorization', + auth.buildBasicAuth(url.username, url.password), + ) + } + } get db(): DatabaseCoordinator { return this.opts.db @@ -107,14 +117,6 @@ export class AppContext { }) } - async pdsAdminAgent(did: string): Promise { - const data = await this.idResolver.did.resolveAtprotoData(did) - const agent = new AtpAgent({ service: data.pds }) - const jwt = await this.serviceAuthJwt(did) - agent.api.setHeader('authorization', `Bearer ${jwt}`) - return agent - } - get backgroundQueue(): BackgroundQueue { return this.opts.backgroundQueue } diff --git a/packages/bsky/src/db/periodic-moderation-action-reversal.ts b/packages/bsky/src/db/periodic-moderation-action-reversal.ts index d15cef91afb..c148c408efe 100644 --- a/packages/bsky/src/db/periodic-moderation-action-reversal.ts +++ b/packages/bsky/src/db/periodic-moderation-action-reversal.ts @@ -3,7 +3,6 @@ import { Leader } from './leader' import { dbLogger } from '../logger' import AppContext from '../context' import AtpAgent from '@atproto/api' -import { buildBasicAuth } from '../auth' import { LabelService } from '../services/label' import { ModerationActionRow } from '../services/moderation' @@ -18,14 +17,7 @@ export class PeriodicModerationActionReversal { pushAgent?: AtpAgent constructor(private appContext: AppContext) { - if (appContext.cfg.moderationActionReverseUrl) { - const url = new URL(appContext.cfg.moderationActionReverseUrl) - this.pushAgent = new AtpAgent({ service: url.origin }) - this.pushAgent.api.setHeader( - 'authorization', - buildBasicAuth(url.username, url.password), - ) - } + this.pushAgent = appContext.moderationPushAgent } // invert label creation & negations diff --git a/packages/dev-env/src/network.ts b/packages/dev-env/src/network.ts index a6c150f0353..e1666935de7 100644 --- a/packages/dev-env/src/network.ts +++ b/packages/dev-env/src/network.ts @@ -40,6 +40,7 @@ export class TestNetwork extends TestNetworkNoAppView { dbPostgresSchema: `appview_${dbPostgresSchema}`, dbPrimaryPostgresUrl: dbPostgresUrl, redisHost, + moderationPushUrl: `http://admin:${ADMIN_PASSWORD}@localhost:${pdsPort}`, ...params.bsky, }) const pds = await TestPds.create({