@atproto/bsync 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # @atproto/bsync
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`0c815b964`](https://github.com/bluesky-social/atproto/commit/0c815b964c030aa0f277c40bf9786f130dc320f4)]:
8
+ - @atproto/syntax@0.2.0
package/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  Dual MIT/Apache-2.0 License
2
2
 
3
- Copyright (c) 2022-2023 Bluesky PBC, and Contributors
3
+ Copyright (c) 2022-2024 Bluesky PBC, and Contributors
4
4
 
5
5
  Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
6
6
 
package/buf.gen.yaml CHANGED
@@ -4,10 +4,9 @@ plugins:
4
4
  opt:
5
5
  - target=ts
6
6
  - import_extension=.ts
7
-
8
- out: src/gen
7
+ out: src/proto
9
8
  - plugin: connect-es
10
9
  opt:
11
10
  - target=ts
12
11
  - import_extension=.ts
13
- out: src/gen
12
+ out: src/proto
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Interceptor, PromiseClient } from '@connectrpc/connect';
2
2
  import { ConnectTransportOptions } from '@connectrpc/connect-node';
3
- import { Service } from './gen/bsync_connect';
3
+ import { Service } from './proto/bsync_connect';
4
4
  export type BsyncClient = PromiseClient<typeof Service>;
5
5
  export declare const createClient: (opts: ConnectTransportOptions) => BsyncClient;
6
6
  export declare const authWithApiKey: (apiKey: string) => Interceptor;
@@ -1,5 +1,5 @@
1
1
  import { GeneratedAlways, Selectable } from 'kysely';
2
- import { MuteOperation_Type } from '../../gen/bsync_pb';
2
+ import { MuteOperation_Type } from '../../proto/bsync_pb';
3
3
  export interface MuteOp {
4
4
  id: GeneratedAlways<number>;
5
5
  type: MuteOperation_Type;
package/dist/index.js CHANGED
@@ -54988,30 +54988,292 @@ var require_dist2 = __commonJS({
54988
54988
  }
54989
54989
  });
54990
54990
 
54991
- // ../../node_modules/.pnpm/node-gyp-build-optional-packages@5.0.3/node_modules/node-gyp-build-optional-packages/index.js
54991
+ // ../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/process.js
54992
+ var require_process = __commonJS({
54993
+ "../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/process.js"(exports, module2) {
54994
+ "use strict";
54995
+ var isLinux = () => process.platform === "linux";
54996
+ var report = null;
54997
+ var getReport = () => {
54998
+ if (!report) {
54999
+ report = isLinux() && process.report ? process.report.getReport() : {};
55000
+ }
55001
+ return report;
55002
+ };
55003
+ module2.exports = { isLinux, getReport };
55004
+ }
55005
+ });
55006
+
55007
+ // ../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/filesystem.js
55008
+ var require_filesystem = __commonJS({
55009
+ "../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/filesystem.js"(exports, module2) {
55010
+ "use strict";
55011
+ var fs = require("fs");
55012
+ var LDD_PATH = "/usr/bin/ldd";
55013
+ var readFileSync = (path) => fs.readFileSync(path, "utf-8");
55014
+ var readFile = (path) => new Promise((resolve, reject) => {
55015
+ fs.readFile(path, "utf-8", (err, data) => {
55016
+ if (err) {
55017
+ reject(err);
55018
+ } else {
55019
+ resolve(data);
55020
+ }
55021
+ });
55022
+ });
55023
+ module2.exports = {
55024
+ LDD_PATH,
55025
+ readFileSync,
55026
+ readFile
55027
+ };
55028
+ }
55029
+ });
55030
+
55031
+ // ../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/detect-libc.js
55032
+ var require_detect_libc = __commonJS({
55033
+ "../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/detect-libc.js"(exports, module2) {
55034
+ "use strict";
55035
+ var childProcess = require("child_process");
55036
+ var { isLinux, getReport } = require_process();
55037
+ var { LDD_PATH, readFile, readFileSync } = require_filesystem();
55038
+ var cachedFamilyFilesystem;
55039
+ var cachedVersionFilesystem;
55040
+ var command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
55041
+ var commandOut = "";
55042
+ var safeCommand = () => {
55043
+ if (!commandOut) {
55044
+ return new Promise((resolve) => {
55045
+ childProcess.exec(command, (err, out) => {
55046
+ commandOut = err ? " " : out;
55047
+ resolve(commandOut);
55048
+ });
55049
+ });
55050
+ }
55051
+ return commandOut;
55052
+ };
55053
+ var safeCommandSync = () => {
55054
+ if (!commandOut) {
55055
+ try {
55056
+ commandOut = childProcess.execSync(command, { encoding: "utf8" });
55057
+ } catch (_err) {
55058
+ commandOut = " ";
55059
+ }
55060
+ }
55061
+ return commandOut;
55062
+ };
55063
+ var GLIBC = "glibc";
55064
+ var RE_GLIBC_VERSION = /GLIBC\s(\d+\.\d+)/;
55065
+ var MUSL = "musl";
55066
+ var GLIBC_ON_LDD = GLIBC.toUpperCase();
55067
+ var MUSL_ON_LDD = MUSL.toLowerCase();
55068
+ var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
55069
+ var familyFromReport = () => {
55070
+ const report = getReport();
55071
+ if (report.header && report.header.glibcVersionRuntime) {
55072
+ return GLIBC;
55073
+ }
55074
+ if (Array.isArray(report.sharedObjects)) {
55075
+ if (report.sharedObjects.some(isFileMusl)) {
55076
+ return MUSL;
55077
+ }
55078
+ }
55079
+ return null;
55080
+ };
55081
+ var familyFromCommand = (out) => {
55082
+ const [getconf, ldd1] = out.split(/[\r\n]+/);
55083
+ if (getconf && getconf.includes(GLIBC)) {
55084
+ return GLIBC;
55085
+ }
55086
+ if (ldd1 && ldd1.includes(MUSL)) {
55087
+ return MUSL;
55088
+ }
55089
+ return null;
55090
+ };
55091
+ var getFamilyFromLddContent = (content) => {
55092
+ if (content.includes(MUSL_ON_LDD)) {
55093
+ return MUSL;
55094
+ }
55095
+ if (content.includes(GLIBC_ON_LDD)) {
55096
+ return GLIBC;
55097
+ }
55098
+ return null;
55099
+ };
55100
+ var familyFromFilesystem = async () => {
55101
+ if (cachedFamilyFilesystem !== void 0) {
55102
+ return cachedFamilyFilesystem;
55103
+ }
55104
+ cachedFamilyFilesystem = null;
55105
+ try {
55106
+ const lddContent = await readFile(LDD_PATH);
55107
+ cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
55108
+ } catch (e) {
55109
+ }
55110
+ return cachedFamilyFilesystem;
55111
+ };
55112
+ var familyFromFilesystemSync = () => {
55113
+ if (cachedFamilyFilesystem !== void 0) {
55114
+ return cachedFamilyFilesystem;
55115
+ }
55116
+ cachedFamilyFilesystem = null;
55117
+ try {
55118
+ const lddContent = readFileSync(LDD_PATH);
55119
+ cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
55120
+ } catch (e) {
55121
+ }
55122
+ return cachedFamilyFilesystem;
55123
+ };
55124
+ var family = async () => {
55125
+ let family2 = null;
55126
+ if (isLinux()) {
55127
+ family2 = await familyFromFilesystem();
55128
+ if (!family2) {
55129
+ family2 = familyFromReport();
55130
+ }
55131
+ if (!family2) {
55132
+ const out = await safeCommand();
55133
+ family2 = familyFromCommand(out);
55134
+ }
55135
+ }
55136
+ return family2;
55137
+ };
55138
+ var familySync = () => {
55139
+ let family2 = null;
55140
+ if (isLinux()) {
55141
+ family2 = familyFromFilesystemSync();
55142
+ if (!family2) {
55143
+ family2 = familyFromReport();
55144
+ }
55145
+ if (!family2) {
55146
+ const out = safeCommandSync();
55147
+ family2 = familyFromCommand(out);
55148
+ }
55149
+ }
55150
+ return family2;
55151
+ };
55152
+ var isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
55153
+ var isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
55154
+ var versionFromFilesystem = async () => {
55155
+ if (cachedVersionFilesystem !== void 0) {
55156
+ return cachedVersionFilesystem;
55157
+ }
55158
+ cachedVersionFilesystem = null;
55159
+ try {
55160
+ const lddContent = await readFile(LDD_PATH);
55161
+ const versionMatch = lddContent.match(RE_GLIBC_VERSION);
55162
+ if (versionMatch) {
55163
+ cachedVersionFilesystem = versionMatch[1];
55164
+ }
55165
+ } catch (e) {
55166
+ }
55167
+ return cachedVersionFilesystem;
55168
+ };
55169
+ var versionFromFilesystemSync = () => {
55170
+ if (cachedVersionFilesystem !== void 0) {
55171
+ return cachedVersionFilesystem;
55172
+ }
55173
+ cachedVersionFilesystem = null;
55174
+ try {
55175
+ const lddContent = readFileSync(LDD_PATH);
55176
+ const versionMatch = lddContent.match(RE_GLIBC_VERSION);
55177
+ if (versionMatch) {
55178
+ cachedVersionFilesystem = versionMatch[1];
55179
+ }
55180
+ } catch (e) {
55181
+ }
55182
+ return cachedVersionFilesystem;
55183
+ };
55184
+ var versionFromReport = () => {
55185
+ const report = getReport();
55186
+ if (report.header && report.header.glibcVersionRuntime) {
55187
+ return report.header.glibcVersionRuntime;
55188
+ }
55189
+ return null;
55190
+ };
55191
+ var versionSuffix = (s) => s.trim().split(/\s+/)[1];
55192
+ var versionFromCommand = (out) => {
55193
+ const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
55194
+ if (getconf && getconf.includes(GLIBC)) {
55195
+ return versionSuffix(getconf);
55196
+ }
55197
+ if (ldd1 && ldd2 && ldd1.includes(MUSL)) {
55198
+ return versionSuffix(ldd2);
55199
+ }
55200
+ return null;
55201
+ };
55202
+ var version2 = async () => {
55203
+ let version3 = null;
55204
+ if (isLinux()) {
55205
+ version3 = await versionFromFilesystem();
55206
+ if (!version3) {
55207
+ version3 = versionFromReport();
55208
+ }
55209
+ if (!version3) {
55210
+ const out = await safeCommand();
55211
+ version3 = versionFromCommand(out);
55212
+ }
55213
+ }
55214
+ return version3;
55215
+ };
55216
+ var versionSync = () => {
55217
+ let version3 = null;
55218
+ if (isLinux()) {
55219
+ version3 = versionFromFilesystemSync();
55220
+ if (!version3) {
55221
+ version3 = versionFromReport();
55222
+ }
55223
+ if (!version3) {
55224
+ const out = safeCommandSync();
55225
+ version3 = versionFromCommand(out);
55226
+ }
55227
+ }
55228
+ return version3;
55229
+ };
55230
+ module2.exports = {
55231
+ GLIBC,
55232
+ MUSL,
55233
+ family,
55234
+ familySync,
55235
+ isNonGlibcLinux,
55236
+ isNonGlibcLinuxSync,
55237
+ version: version2,
55238
+ versionSync
55239
+ };
55240
+ }
55241
+ });
55242
+
55243
+ // ../../node_modules/.pnpm/node-gyp-build-optional-packages@5.1.1/node_modules/node-gyp-build-optional-packages/index.js
54992
55244
  var require_node_gyp_build_optional_packages = __commonJS({
54993
- "../../node_modules/.pnpm/node-gyp-build-optional-packages@5.0.3/node_modules/node-gyp-build-optional-packages/index.js"(exports, module2) {
55245
+ "../../node_modules/.pnpm/node-gyp-build-optional-packages@5.1.1/node_modules/node-gyp-build-optional-packages/index.js"(exports, module2) {
54994
55246
  var fs = require("fs");
54995
55247
  var path = require("path");
54996
- var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
55248
+ var url = require("url");
54997
55249
  var vars = process.config && process.config.variables || {};
54998
55250
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
54999
- var abi = process.versions.modules;
55251
+ var versions = process.versions;
55252
+ var abi = versions.modules;
55253
+ if (versions.deno || process.isBun) {
55254
+ abi = "unsupported";
55255
+ }
55000
55256
  var runtime = isElectron() ? "electron" : "node";
55001
55257
  var arch = process.arch;
55002
55258
  var platform = process.platform;
55003
- var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc");
55259
+ var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
55004
55260
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
55005
- var uv = (process.versions.uv || "").split(".")[0];
55261
+ var uv = (versions.uv || "").split(".")[0];
55006
55262
  module2.exports = load;
55007
55263
  function load(dir) {
55008
- return runtimeRequire(load.path(dir));
55264
+ if (typeof __webpack_require__ === "function")
55265
+ return __non_webpack_require__(load.path(dir));
55266
+ else
55267
+ return require(load.path(dir));
55009
55268
  }
55010
55269
  load.path = function(dir) {
55011
55270
  dir = path.resolve(dir || ".");
55012
- var packageName;
55271
+ var packageName = "";
55013
55272
  try {
55014
- packageName = runtimeRequire(path.join(dir, "package.json")).name;
55273
+ if (typeof __webpack_require__ === "function")
55274
+ packageName = __non_webpack_require__(path.join(dir, "package.json")).name;
55275
+ else
55276
+ packageName = require(path.join(dir, "package.json")).name;
55015
55277
  var varName = packageName.toUpperCase().replace(/-/g, "_") + "_PREBUILD";
55016
55278
  if (process.env[varName])
55017
55279
  dir = process.env[varName];
@@ -55033,7 +55295,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
55033
55295
  return nearby;
55034
55296
  var platformPackage = (packageName[0] == "@" ? "" : "@" + packageName + "/") + packageName + "-" + platform + "-" + arch;
55035
55297
  try {
55036
- var prebuildPackage = path.dirname(require("module").createRequire(path.join(dir, "package.json")).resolve(platformPackage));
55298
+ var prebuildPackage = path.dirname(require("module").createRequire(url.pathToFileURL(path.join(dir, "package.json"))).resolve(platformPackage));
55037
55299
  return resolveFile(prebuildPackage);
55038
55300
  } catch (error) {
55039
55301
  }
@@ -55049,7 +55311,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
55049
55311
  process.versions.electron ? "electron=" + process.versions.electron : "",
55050
55312
  typeof __webpack_require__ === "function" ? "webpack=true" : ""
55051
55313
  ].filter(Boolean).join(" ");
55052
- throw new Error("No native build was found for " + target2 + "\n loaded from: " + dir + " and package: " + platformPackage + "\n");
55314
+ throw new Error("No native build was found for " + target2 + "\n attempted loading from: " + dir + " and package: " + platformPackage + "\n");
55053
55315
  function resolve(dir2) {
55054
55316
  var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
55055
55317
  var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
@@ -55172,8 +55434,11 @@ var require_node_gyp_build_optional_packages = __commonJS({
55172
55434
  return true;
55173
55435
  return typeof window !== "undefined" && window.process && window.process.type === "renderer";
55174
55436
  }
55175
- function isAlpine(platform2) {
55176
- return platform2 === "linux" && fs.existsSync("/etc/alpine-release");
55437
+ function isMusl(platform2) {
55438
+ if (platform2 !== "linux")
55439
+ return false;
55440
+ const { familySync, MUSL } = require_detect_libc();
55441
+ return familySync() === MUSL;
55177
55442
  }
55178
55443
  load.parseTags = parseTags;
55179
55444
  load.matchTags = matchTags;
@@ -55184,9 +55449,9 @@ var require_node_gyp_build_optional_packages = __commonJS({
55184
55449
  }
55185
55450
  });
55186
55451
 
55187
- // ../../node_modules/.pnpm/cbor-extract@2.1.1/node_modules/cbor-extract/index.js
55452
+ // ../../node_modules/.pnpm/cbor-extract@2.2.0/node_modules/cbor-extract/index.js
55188
55453
  var require_cbor_extract = __commonJS({
55189
- "../../node_modules/.pnpm/cbor-extract@2.1.1/node_modules/cbor-extract/index.js"(exports, module2) {
55454
+ "../../node_modules/.pnpm/cbor-extract@2.2.0/node_modules/cbor-extract/index.js"(exports, module2) {
55190
55455
  module2.exports = require_node_gyp_build_optional_packages()(__dirname);
55191
55456
  }
55192
55457
  });
@@ -75640,7 +75905,7 @@ var context_default = AppContext;
75640
75905
  var proxy_exports2 = {};
75641
75906
  __reExport(proxy_exports2, __toESM(require_cjs(), 1));
75642
75907
 
75643
- // src/gen/bsync_pb.ts
75908
+ // src/proto/bsync_pb.ts
75644
75909
  var _MuteOperation = class extends proxy_exports2.Message {
75645
75910
  constructor(data) {
75646
75911
  super();
@@ -75853,7 +76118,7 @@ PingResponse.runtime = proxy_exports2.proto3;
75853
76118
  PingResponse.typeName = "bsync.PingResponse";
75854
76119
  PingResponse.fields = proxy_exports2.proto3.util.newFieldList(() => []);
75855
76120
 
75856
- // src/gen/bsync_connect.ts
76121
+ // src/proto/bsync_connect.ts
75857
76122
  var Service = {
75858
76123
  typeName: "bsync.Service",
75859
76124
  methods: {
@@ -76400,6 +76665,11 @@ var BsyncService = class {
76400
76665
  });
76401
76666
  const server = import_node_http.default.createServer((req, res) => {
76402
76667
  loggerMiddleware(req, res);
76668
+ if (isHealth(req.url)) {
76669
+ res.statusCode = 200;
76670
+ res.setHeader("content-type", "application/json");
76671
+ return res.end(JSON.stringify({ version: cfg.service.version }));
76672
+ }
76403
76673
  handler(req, res);
76404
76674
  });
76405
76675
  return new BsyncService({ ctx, server, ac });
@@ -76438,6 +76708,12 @@ var BsyncService = class {
76438
76708
  }
76439
76709
  };
76440
76710
  var src_default = BsyncService;
76711
+ var isHealth = (urlStr) => {
76712
+ if (!urlStr)
76713
+ return false;
76714
+ const url = new URL(urlStr, "http://host");
76715
+ return url.pathname === "/_health";
76716
+ };
76441
76717
  // Annotate the CommonJS export names for ESM import in node:
76442
76718
  0 && (module.exports = {
76443
76719
  AppContext,