@atproto/bsync 0.0.25 → 0.0.26-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/bin/migration-create.ts +1 -1
  3. package/dist/client.d.ts +1 -1
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +7 -12
  6. package/dist/client.js.map +1 -1
  7. package/dist/config.js +16 -24
  8. package/dist/config.js.map +1 -1
  9. package/dist/context.d.ts +6 -6
  10. package/dist/context.d.ts.map +1 -1
  11. package/dist/context.js +8 -36
  12. package/dist/context.js.map +1 -1
  13. package/dist/db/index.d.ts +6 -4
  14. package/dist/db/index.d.ts.map +1 -1
  15. package/dist/db/index.js +26 -101
  16. package/dist/db/index.js.map +1 -1
  17. package/dist/db/migrations/20240108T220751294Z-init.js +4 -8
  18. package/dist/db/migrations/20240108T220751294Z-init.js.map +1 -1
  19. package/dist/db/migrations/20240717T224303472Z-notif-ops.js +4 -8
  20. package/dist/db/migrations/20240717T224303472Z-notif-ops.js.map +1 -1
  21. package/dist/db/migrations/20250527T022203400Z-add-operation.js +5 -9
  22. package/dist/db/migrations/20250527T022203400Z-add-operation.js.map +1 -1
  23. package/dist/db/migrations/20250603T163446567Z-alter-operation.js +2 -6
  24. package/dist/db/migrations/20250603T163446567Z-alter-operation.js.map +1 -1
  25. package/dist/db/migrations/index.d.ts +4 -4
  26. package/dist/db/migrations/index.d.ts.map +1 -1
  27. package/dist/db/migrations/index.js +4 -40
  28. package/dist/db/migrations/index.js.map +1 -1
  29. package/dist/db/migrations/provider.js +2 -11
  30. package/dist/db/migrations/provider.js.map +1 -1
  31. package/dist/db/schema/index.d.ts +5 -5
  32. package/dist/db/schema/index.d.ts.map +1 -1
  33. package/dist/db/schema/index.js +1 -2
  34. package/dist/db/schema/index.js.map +1 -1
  35. package/dist/db/schema/mute_item.js +1 -4
  36. package/dist/db/schema/mute_item.js.map +1 -1
  37. package/dist/db/schema/mute_op.d.ts +1 -1
  38. package/dist/db/schema/mute_op.d.ts.map +1 -1
  39. package/dist/db/schema/mute_op.js +2 -5
  40. package/dist/db/schema/mute_op.js.map +1 -1
  41. package/dist/db/schema/notif_item.js +1 -4
  42. package/dist/db/schema/notif_item.js.map +1 -1
  43. package/dist/db/schema/notif_op.js +2 -5
  44. package/dist/db/schema/notif_op.js.map +1 -1
  45. package/dist/db/schema/operation.d.ts +2 -2
  46. package/dist/db/schema/operation.d.ts.map +1 -1
  47. package/dist/db/schema/operation.js +2 -5
  48. package/dist/db/schema/operation.js.map +1 -1
  49. package/dist/db/types.d.ts +3 -1
  50. package/dist/db/types.d.ts.map +1 -1
  51. package/dist/db/types.js +1 -2
  52. package/dist/db/types.js.map +1 -1
  53. package/dist/index.d.ts +7 -7
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +37 -88
  56. package/dist/index.js.map +1 -1
  57. package/dist/logger.js +8 -11
  58. package/dist/logger.js.map +1 -1
  59. package/dist/proto/bsync_connect.d.ts +1 -1
  60. package/dist/proto/bsync_connect.d.ts.map +1 -1
  61. package/dist/proto/bsync_connect.js +27 -30
  62. package/dist/proto/bsync_connect.js.map +1 -1
  63. package/dist/proto/bsync_pb.js +215 -747
  64. package/dist/proto/bsync_pb.js.map +1 -1
  65. package/dist/routes/add-mute-operation.d.ts +2 -2
  66. package/dist/routes/add-mute-operation.d.ts.map +1 -1
  67. package/dist/routes/add-mute-operation.js +28 -30
  68. package/dist/routes/add-mute-operation.js.map +1 -1
  69. package/dist/routes/add-notif-operation.d.ts +2 -2
  70. package/dist/routes/add-notif-operation.d.ts.map +1 -1
  71. package/dist/routes/add-notif-operation.js +14 -16
  72. package/dist/routes/add-notif-operation.js.map +1 -1
  73. package/dist/routes/auth.d.ts +1 -1
  74. package/dist/routes/auth.d.ts.map +1 -1
  75. package/dist/routes/auth.js +4 -8
  76. package/dist/routes/auth.js.map +1 -1
  77. package/dist/routes/delete-operations.d.ts +2 -2
  78. package/dist/routes/delete-operations.d.ts.map +1 -1
  79. package/dist/routes/delete-operations.js +11 -13
  80. package/dist/routes/delete-operations.js.map +1 -1
  81. package/dist/routes/index.d.ts +1 -1
  82. package/dist/routes/index.d.ts.map +1 -1
  83. package/dist/routes/index.js +19 -24
  84. package/dist/routes/index.js.map +1 -1
  85. package/dist/routes/put-operation.d.ts +2 -2
  86. package/dist/routes/put-operation.d.ts.map +1 -1
  87. package/dist/routes/put-operation.js +25 -27
  88. package/dist/routes/put-operation.js.map +1 -1
  89. package/dist/routes/scan-mute-operations.d.ts +2 -2
  90. package/dist/routes/scan-mute-operations.d.ts.map +1 -1
  91. package/dist/routes/scan-mute-operations.js +13 -15
  92. package/dist/routes/scan-mute-operations.js.map +1 -1
  93. package/dist/routes/scan-notif-operations.d.ts +2 -2
  94. package/dist/routes/scan-notif-operations.d.ts.map +1 -1
  95. package/dist/routes/scan-notif-operations.js +13 -15
  96. package/dist/routes/scan-notif-operations.js.map +1 -1
  97. package/dist/routes/scan-operations.d.ts +2 -2
  98. package/dist/routes/scan-operations.d.ts.map +1 -1
  99. package/dist/routes/scan-operations.js +13 -15
  100. package/dist/routes/scan-operations.js.map +1 -1
  101. package/dist/routes/util.js +12 -20
  102. package/dist/routes/util.js.map +1 -1
  103. package/{jest.config.js → jest.config.cjs} +8 -1
  104. package/package.json +14 -9
  105. package/src/client.ts +1 -1
  106. package/src/context.ts +7 -7
  107. package/src/db/index.ts +12 -8
  108. package/src/db/migrations/index.ts +4 -4
  109. package/src/db/schema/index.ts +5 -5
  110. package/src/db/schema/mute_op.ts +1 -1
  111. package/src/db/schema/operation.ts +2 -2
  112. package/src/db/types.ts +3 -1
  113. package/src/index.ts +17 -13
  114. package/src/proto/bsync_connect.ts +1 -1
  115. package/src/routes/add-mute-operation.ts +10 -7
  116. package/src/routes/add-notif-operation.ts +7 -7
  117. package/src/routes/auth.ts +1 -1
  118. package/src/routes/delete-operations.ts +5 -5
  119. package/src/routes/index.ts +9 -9
  120. package/src/routes/put-operation.ts +11 -8
  121. package/src/routes/scan-mute-operations.ts +6 -6
  122. package/src/routes/scan-notif-operations.ts +6 -6
  123. package/src/routes/scan-operations.ts +6 -6
  124. package/tests/delete-operations.test.ts +2 -2
  125. package/tests/mutes.test.ts +2 -2
  126. package/tests/notifications.test.ts +2 -2
  127. package/tests/operations.test.ts +2 -2
  128. package/tsconfig.build.json +1 -1
  129. package/tsconfig.build.tsbuildinfo +1 -1
  130. package/tsconfig.tests.json +1 -1
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.up = up;
4
- exports.down = down;
5
- const kysely_1 = require("kysely");
6
- async function up(db) {
1
+ import { sql } from 'kysely';
2
+ export async function up(db) {
7
3
  await db.schema
8
4
  .createTable('operation')
9
5
  .addColumn('id', 'bigserial', (col) => col.primaryKey())
@@ -11,11 +7,11 @@ async function up(db) {
11
7
  .addColumn('actorDid', 'varchar', (col) => col.notNull())
12
8
  .addColumn('rkey', 'varchar', (col) => col.notNull())
13
9
  .addColumn('method', 'int2', (col) => col.notNull())
14
- .addColumn('payload', (0, kysely_1.sql) `bytea`)
15
- .addColumn('createdAt', 'timestamptz', (col) => col.notNull().defaultTo((0, kysely_1.sql) `CURRENT_TIMESTAMP`))
10
+ .addColumn('payload', sql `bytea`)
11
+ .addColumn('createdAt', 'timestamptz', (col) => col.notNull().defaultTo(sql `CURRENT_TIMESTAMP`))
16
12
  .execute();
17
13
  }
18
- async function down(db) {
14
+ export async function down(db) {
19
15
  await db.schema.dropTable('operation').execute();
20
16
  }
21
17
  //# sourceMappingURL=20250527T022203400Z-add-operation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"20250527T022203400Z-add-operation.js","sourceRoot":"","sources":["../../../src/db/migrations/20250527T022203400Z-add-operation.ts"],"names":[],"mappings":";;AAEA,gBAaC;AAED,oBAEC;AAnBD,mCAAoC;AAE7B,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,MAAM,EAAE,CAAC,MAAM;SACZ,WAAW,CAAC,WAAW,CAAC;SACxB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;SACvD,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SAC1D,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACxD,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACpD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACnD,SAAS,CAAC,SAAS,EAAE,IAAA,YAAG,EAAA,OAAO,CAAC;SAChC,SAAS,CAAC,WAAW,EAAE,aAAa,EAAE,CAAC,GAAG,EAAE,EAAE,CAC7C,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,IAAA,YAAG,EAAA,mBAAmB,CAAC,CAChD;SACA,OAAO,EAAE,CAAA;AACd,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAA;AAClD,CAAC","sourcesContent":["import { Kysely, sql } from 'kysely'\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .createTable('operation')\n .addColumn('id', 'bigserial', (col) => col.primaryKey())\n .addColumn('collection', 'varchar', (col) => col.notNull())\n .addColumn('actorDid', 'varchar', (col) => col.notNull())\n .addColumn('rkey', 'varchar', (col) => col.notNull())\n .addColumn('method', 'int2', (col) => col.notNull())\n .addColumn('payload', sql`bytea`)\n .addColumn('createdAt', 'timestamptz', (col) =>\n col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`),\n )\n .execute()\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.schema.dropTable('operation').execute()\n}\n"]}
1
+ {"version":3,"file":"20250527T022203400Z-add-operation.js","sourceRoot":"","sources":["../../../src/db/migrations/20250527T022203400Z-add-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEpC,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,MAAM,EAAE,CAAC,MAAM;SACZ,WAAW,CAAC,WAAW,CAAC;SACxB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;SACvD,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SAC1D,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACxD,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACpD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACnD,SAAS,CAAC,SAAS,EAAE,GAAG,CAAA,OAAO,CAAC;SAChC,SAAS,CAAC,WAAW,EAAE,aAAa,EAAE,CAAC,GAAG,EAAE,EAAE,CAC7C,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,GAAG,CAAA,mBAAmB,CAAC,CAChD;SACA,OAAO,EAAE,CAAA;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAA;AAClD,CAAC","sourcesContent":["import { Kysely, sql } from 'kysely'\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .createTable('operation')\n .addColumn('id', 'bigserial', (col) => col.primaryKey())\n .addColumn('collection', 'varchar', (col) => col.notNull())\n .addColumn('actorDid', 'varchar', (col) => col.notNull())\n .addColumn('rkey', 'varchar', (col) => col.notNull())\n .addColumn('method', 'int2', (col) => col.notNull())\n .addColumn('payload', sql`bytea`)\n .addColumn('createdAt', 'timestamptz', (col) =>\n col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`),\n )\n .execute()\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.schema.dropTable('operation').execute()\n}\n"]}
@@ -1,15 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.up = up;
4
- exports.down = down;
5
- async function up(db) {
1
+ export async function up(db) {
6
2
  await db.schema
7
3
  .alterTable('operation')
8
4
  .renameColumn('collection', 'namespace')
9
5
  .execute();
10
6
  await db.schema.alterTable('operation').renameColumn('rkey', 'key').execute();
11
7
  }
12
- async function down(db) {
8
+ export async function down(db) {
13
9
  await db.schema
14
10
  .alterTable('operation')
15
11
  .renameColumn('namespace', 'collection')
@@ -1 +1 @@
1
- {"version":3,"file":"20250603T163446567Z-alter-operation.js","sourceRoot":"","sources":["../../../src/db/migrations/20250603T163446567Z-alter-operation.ts"],"names":[],"mappings":";;AAEA,gBAOC;AAED,oBAOC;AAhBM,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,WAAW,CAAC;SACvB,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC;SACvC,OAAO,EAAE,CAAA;IAEZ,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAA;AAC/E,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,WAAW,CAAC;SACvB,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC;SACvC,OAAO,EAAE,CAAA;IAEZ,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;AAC/E,CAAC","sourcesContent":["import { Kysely } from 'kysely'\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .alterTable('operation')\n .renameColumn('collection', 'namespace')\n .execute()\n\n await db.schema.alterTable('operation').renameColumn('rkey', 'key').execute()\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .alterTable('operation')\n .renameColumn('namespace', 'collection')\n .execute()\n\n await db.schema.alterTable('operation').renameColumn('key', 'rkey').execute()\n}\n"]}
1
+ {"version":3,"file":"20250603T163446567Z-alter-operation.js","sourceRoot":"","sources":["../../../src/db/migrations/20250603T163446567Z-alter-operation.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,WAAW,CAAC;SACvB,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC;SACvC,OAAO,EAAE,CAAA;IAEZ,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAA;AAC/E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,WAAW,CAAC;SACvB,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC;SACvC,OAAO,EAAE,CAAA;IAEZ,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;AAC/E,CAAC","sourcesContent":["import { Kysely } from 'kysely'\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .alterTable('operation')\n .renameColumn('collection', 'namespace')\n .execute()\n\n await db.schema.alterTable('operation').renameColumn('rkey', 'key').execute()\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .alterTable('operation')\n .renameColumn('namespace', 'collection')\n .execute()\n\n await db.schema.alterTable('operation').renameColumn('key', 'rkey').execute()\n}\n"]}
@@ -1,5 +1,5 @@
1
- export * as _20240108T220751294Z from './20240108T220751294Z-init';
2
- export * as _20240717T224303472Z from './20240717T224303472Z-notif-ops';
3
- export * as _20250527T022203400Z from './20250527T022203400Z-add-operation';
4
- export * as _20250603T163446567Z from './20250603T163446567Z-alter-operation';
1
+ export * as _20240108T220751294Z from './20240108T220751294Z-init.js';
2
+ export * as _20240717T224303472Z from './20240717T224303472Z-notif-ops.js';
3
+ export * as _20250527T022203400Z from './20250527T022203400Z-add-operation.js';
4
+ export * as _20250603T163446567Z from './20250603T163446567Z-alter-operation.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/migrations/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,oBAAoB,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,oBAAoB,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,oBAAoB,MAAM,qCAAqC,CAAA;AAC3E,OAAO,KAAK,oBAAoB,MAAM,uCAAuC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/migrations/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,oBAAoB,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,oBAAoB,MAAM,oCAAoC,CAAA;AAC1E,OAAO,KAAK,oBAAoB,MAAM,wCAAwC,CAAA;AAC9E,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA"}
@@ -1,44 +1,8 @@
1
- "use strict";
2
1
  // NOTE this file can be edited by hand, but it is also appended to by the migration:create command.
3
2
  // It's important that every migration is exported from here with the proper name. We'd simplify
4
3
  // this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process.
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports._20250603T163446567Z = exports._20250527T022203400Z = exports._20240717T224303472Z = exports._20240108T220751294Z = void 0;
40
- exports._20240108T220751294Z = __importStar(require("./20240108T220751294Z-init"));
41
- exports._20240717T224303472Z = __importStar(require("./20240717T224303472Z-notif-ops"));
42
- exports._20250527T022203400Z = __importStar(require("./20250527T022203400Z-add-operation"));
43
- exports._20250603T163446567Z = __importStar(require("./20250603T163446567Z-alter-operation"));
4
+ export * as _20240108T220751294Z from './20240108T220751294Z-init.js';
5
+ export * as _20240717T224303472Z from './20240717T224303472Z-notif-ops.js';
6
+ export * as _20250527T022203400Z from './20250527T022203400Z-add-operation.js';
7
+ export * as _20250603T163446567Z from './20250603T163446567Z-alter-operation.js';
44
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/migrations/index.ts"],"names":[],"mappings":";AAAA,oGAAoG;AACpG,gGAAgG;AAChG,+FAA+F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/F,mFAAkE;AAClE,wFAAuE;AACvE,4FAA2E;AAC3E,8FAA6E","sourcesContent":["// NOTE this file can be edited by hand, but it is also appended to by the migration:create command.\n// It's important that every migration is exported from here with the proper name. We'd simplify\n// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process.\n\nexport * as _20240108T220751294Z from './20240108T220751294Z-init'\nexport * as _20240717T224303472Z from './20240717T224303472Z-notif-ops'\nexport * as _20250527T022203400Z from './20250527T022203400Z-add-operation'\nexport * as _20250603T163446567Z from './20250603T163446567Z-alter-operation'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/migrations/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,gGAAgG;AAChG,+FAA+F;AAE/F,OAAO,KAAK,oBAAoB,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,oBAAoB,MAAM,oCAAoC,CAAA;AAC1E,OAAO,KAAK,oBAAoB,MAAM,wCAAwC,CAAA;AAC9E,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA","sourcesContent":["// NOTE this file can be edited by hand, but it is also appended to by the migration:create command.\n// It's important that every migration is exported from here with the proper name. We'd simplify\n// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process.\n\nexport * as _20240108T220751294Z from './20240108T220751294Z-init.js'\nexport * as _20240717T224303472Z from './20240717T224303472Z-notif-ops.js'\nexport * as _20250527T022203400Z from './20250527T022203400Z-add-operation.js'\nexport * as _20250603T163446567Z from './20250603T163446567Z-alter-operation.js'\n"]}
@@ -1,18 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DbMigrationProvider = void 0;
4
- class DbMigrationProvider {
1
+ export class DbMigrationProvider {
5
2
  constructor(migrations) {
6
- Object.defineProperty(this, "migrations", {
7
- enumerable: true,
8
- configurable: true,
9
- writable: true,
10
- value: migrations
11
- });
3
+ this.migrations = migrations;
12
4
  }
13
5
  async getMigrations() {
14
6
  return this.migrations;
15
7
  }
16
8
  }
17
- exports.DbMigrationProvider = DbMigrationProvider;
18
9
  //# sourceMappingURL=provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/db/migrations/provider.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IAC9B,YAAoB,UAAqC;QAA7C;;;;mBAAQ,UAAU;WAA2B;IAAG,CAAC;IAC7D,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;CACF;AALD,kDAKC","sourcesContent":["import { Migration, MigrationProvider } from 'kysely'\n\nexport class DbMigrationProvider implements MigrationProvider {\n constructor(private migrations: Record<string, Migration>) {}\n async getMigrations(): Promise<Record<string, Migration>> {\n return this.migrations\n }\n}\n"]}
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/db/migrations/provider.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,mBAAmB;IAC9B,YAAoB,UAAqC;QAArC,eAAU,GAAV,UAAU,CAA2B;IAAG,CAAC;IAC7D,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;CACF","sourcesContent":["import { Migration, MigrationProvider } from 'kysely'\n\nexport class DbMigrationProvider implements MigrationProvider {\n constructor(private migrations: Record<string, Migration>) {}\n async getMigrations(): Promise<Record<string, Migration>> {\n return this.migrations\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { Kysely } from 'kysely';
2
- import * as muteItem from './mute_item';
3
- import * as muteOp from './mute_op';
4
- import * as notifItem from './notif_item';
5
- import * as notifOp from './notif_op';
6
- import * as op from './operation';
2
+ import * as muteItem from './mute_item.js';
3
+ import * as muteOp from './mute_op.js';
4
+ import * as notifItem from './notif_item.js';
5
+ import * as notifOp from './notif_op.js';
6
+ import * as op from './operation.js';
7
7
  export type DatabaseSchemaType = muteItem.PartialDB & muteOp.PartialDB & notifItem.PartialDB & notifOp.PartialDB & op.PartialDB;
8
8
  export type DatabaseSchema = Kysely<DatabaseSchemaType>;
9
9
  export default DatabaseSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AAEjC,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,SAAS,GACjD,MAAM,CAAC,SAAS,GAChB,SAAS,CAAC,SAAS,GACnB,OAAO,CAAC,SAAS,GACjB,EAAE,CAAC,SAAS,CAAA;AAEd,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAEvD,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEpC,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,SAAS,GACjD,MAAM,CAAC,SAAS,GAChB,SAAS,CAAC,SAAS,GACnB,OAAO,CAAC,SAAS,GACjB,EAAE,CAAC,SAAS,CAAA;AAEd,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAEvD,eAAe,cAAc,CAAA"}
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"","sourcesContent":["import { Kysely } from 'kysely'\nimport * as muteItem from './mute_item'\nimport * as muteOp from './mute_op'\nimport * as notifItem from './notif_item'\nimport * as notifOp from './notif_op'\nimport * as op from './operation'\n\nexport type DatabaseSchemaType = muteItem.PartialDB &\n muteOp.PartialDB &\n notifItem.PartialDB &\n notifOp.PartialDB &\n op.PartialDB\n\nexport type DatabaseSchema = Kysely<DatabaseSchemaType>\n\nexport default DatabaseSchema\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"","sourcesContent":["import { Kysely } from 'kysely'\nimport * as muteItem from './mute_item.js'\nimport * as muteOp from './mute_op.js'\nimport * as notifItem from './notif_item.js'\nimport * as notifOp from './notif_op.js'\nimport * as op from './operation.js'\n\nexport type DatabaseSchemaType = muteItem.PartialDB &\n muteOp.PartialDB &\n notifItem.PartialDB &\n notifOp.PartialDB &\n op.PartialDB\n\nexport type DatabaseSchema = Kysely<DatabaseSchemaType>\n\nexport default DatabaseSchema\n"]}
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tableName = void 0;
4
- exports.tableName = 'mute_item';
1
+ export const tableName = 'mute_item';
5
2
  //# sourceMappingURL=mute_item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mute_item.js","sourceRoot":"","sources":["../../../src/db/schema/mute_item.ts"],"names":[],"mappings":";;;AAUa,QAAA,SAAS,GAAG,WAAW,CAAA","sourcesContent":["import { Selectable } from 'kysely'\n\nexport interface MuteItem {\n actorDid: string\n subject: string // did or aturi for list\n fromId: number\n}\n\nexport type MuteItemEntry = Selectable<MuteItem>\n\nexport const tableName = 'mute_item'\n\nexport type PartialDB = { [tableName]: MuteItem }\n"]}
1
+ {"version":3,"file":"mute_item.js","sourceRoot":"","sources":["../../../src/db/schema/mute_item.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA","sourcesContent":["import { Selectable } from 'kysely'\n\nexport interface MuteItem {\n actorDid: string\n subject: string // did or aturi for list\n fromId: number\n}\n\nexport type MuteItemEntry = Selectable<MuteItem>\n\nexport const tableName = 'mute_item'\n\nexport type PartialDB = { [tableName]: MuteItem }\n"]}
@@ -1,5 +1,5 @@
1
1
  import { GeneratedAlways, Selectable } from 'kysely';
2
- import { MuteOperation_Type } from '../../proto/bsync_pb';
2
+ import { MuteOperation_Type } from '../../proto/bsync_pb.js';
3
3
  export interface MuteOp {
4
4
  id: GeneratedAlways<number>;
5
5
  type: MuteOperation_Type;
@@ -1 +1 @@
1
- {"version":3,"file":"mute_op.d.ts","sourceRoot":"","sources":["../../../src/db/schema/mute_op.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,kBAAkB,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;CACjC;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;AAE5C,eAAO,MAAM,SAAS,YAAY,CAAA;AAElC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/C,eAAO,MAAM,mBAAmB,mBAAmB,CAAA"}
1
+ {"version":3,"file":"mute_op.d.ts","sourceRoot":"","sources":["../../../src/db/schema/mute_op.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,EAAE,kBAAkB,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;CACjC;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;AAE5C,eAAO,MAAM,SAAS,YAAY,CAAA;AAElC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/C,eAAO,MAAM,mBAAmB,mBAAmB,CAAA"}
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMuteOpChannel = exports.tableName = void 0;
4
- exports.tableName = 'mute_op';
5
- exports.createMuteOpChannel = 'mute_op_create'; // used with listen/notify
1
+ export const tableName = 'mute_op';
2
+ export const createMuteOpChannel = 'mute_op_create'; // used with listen/notify
6
3
  //# sourceMappingURL=mute_op.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mute_op.js","sourceRoot":"","sources":["../../../src/db/schema/mute_op.ts"],"names":[],"mappings":";;;AAaa,QAAA,SAAS,GAAG,SAAS,CAAA;AAIrB,QAAA,mBAAmB,GAAG,gBAAgB,CAAA,CAAC,0BAA0B","sourcesContent":["import { GeneratedAlways, Selectable } from 'kysely'\nimport { MuteOperation_Type } from '../../proto/bsync_pb'\n\nexport interface MuteOp {\n id: GeneratedAlways<number>\n type: MuteOperation_Type // integer enum: 0->add, 1->remove, 2->clear\n actorDid: string\n subject: string // did or aturi for list\n createdAt: GeneratedAlways<Date>\n}\n\nexport type MuteOpEntry = Selectable<MuteOp>\n\nexport const tableName = 'mute_op'\n\nexport type PartialDB = { [tableName]: MuteOp }\n\nexport const createMuteOpChannel = 'mute_op_create' // used with listen/notify\n"]}
1
+ {"version":3,"file":"mute_op.js","sourceRoot":"","sources":["../../../src/db/schema/mute_op.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAA;AAIlC,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAA,CAAC,0BAA0B","sourcesContent":["import { GeneratedAlways, Selectable } from 'kysely'\nimport { MuteOperation_Type } from '../../proto/bsync_pb.js'\n\nexport interface MuteOp {\n id: GeneratedAlways<number>\n type: MuteOperation_Type // integer enum: 0->add, 1->remove, 2->clear\n actorDid: string\n subject: string // did or aturi for list\n createdAt: GeneratedAlways<Date>\n}\n\nexport type MuteOpEntry = Selectable<MuteOp>\n\nexport const tableName = 'mute_op'\n\nexport type PartialDB = { [tableName]: MuteOp }\n\nexport const createMuteOpChannel = 'mute_op_create' // used with listen/notify\n"]}
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tableName = void 0;
4
- exports.tableName = 'notif_item';
1
+ export const tableName = 'notif_item';
5
2
  //# sourceMappingURL=notif_item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notif_item.js","sourceRoot":"","sources":["../../../src/db/schema/notif_item.ts"],"names":[],"mappings":";;;AAUa,QAAA,SAAS,GAAG,YAAY,CAAA","sourcesContent":["import { Selectable } from 'kysely'\n\nexport interface NotifItem {\n actorDid: string\n priority: boolean\n fromId: number\n}\n\nexport type NotifItemEntry = Selectable<NotifItem>\n\nexport const tableName = 'notif_item'\n\nexport type PartialDB = { [tableName]: NotifItem }\n"]}
1
+ {"version":3,"file":"notif_item.js","sourceRoot":"","sources":["../../../src/db/schema/notif_item.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAA","sourcesContent":["import { Selectable } from 'kysely'\n\nexport interface NotifItem {\n actorDid: string\n priority: boolean\n fromId: number\n}\n\nexport type NotifItemEntry = Selectable<NotifItem>\n\nexport const tableName = 'notif_item'\n\nexport type PartialDB = { [tableName]: NotifItem }\n"]}
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNotifOpChannel = exports.tableName = void 0;
4
- exports.tableName = 'notif_op';
5
- exports.createNotifOpChannel = 'notif_op_create'; // used with listen/notify
1
+ export const tableName = 'notif_op';
2
+ export const createNotifOpChannel = 'notif_op_create'; // used with listen/notify
6
3
  //# sourceMappingURL=notif_op.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notif_op.js","sourceRoot":"","sources":["../../../src/db/schema/notif_op.ts"],"names":[],"mappings":";;;AAWa,QAAA,SAAS,GAAG,UAAU,CAAA;AAItB,QAAA,oBAAoB,GAAG,iBAAiB,CAAA,CAAC,0BAA0B","sourcesContent":["import { GeneratedAlways, Selectable } from 'kysely'\n\nexport interface NotifOp {\n id: GeneratedAlways<number>\n actorDid: string\n priority: boolean | null\n createdAt: GeneratedAlways<Date>\n}\n\nexport type NotifOpEntry = Selectable<NotifOp>\n\nexport const tableName = 'notif_op'\n\nexport type PartialDB = { [tableName]: NotifOp }\n\nexport const createNotifOpChannel = 'notif_op_create' // used with listen/notify\n"]}
1
+ {"version":3,"file":"notif_op.js","sourceRoot":"","sources":["../../../src/db/schema/notif_op.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAA;AAInC,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAA,CAAC,0BAA0B","sourcesContent":["import { GeneratedAlways, Selectable } from 'kysely'\n\nexport interface NotifOp {\n id: GeneratedAlways<number>\n actorDid: string\n priority: boolean | null\n createdAt: GeneratedAlways<Date>\n}\n\nexport type NotifOpEntry = Selectable<NotifOp>\n\nexport const tableName = 'notif_op'\n\nexport type PartialDB = { [tableName]: NotifOp }\n\nexport const createNotifOpChannel = 'notif_op_create' // used with listen/notify\n"]}
@@ -1,5 +1,5 @@
1
1
  import { GeneratedAlways } from 'kysely';
2
- import { Method } from '../../proto/bsync_pb';
2
+ import { Method } from '../../proto/bsync_pb.js';
3
3
  export type OperationMethod = Method.CREATE | Method.UPDATE | Method.DELETE;
4
4
  export interface Operation {
5
5
  id: GeneratedAlways<number>;
@@ -7,7 +7,7 @@ export interface Operation {
7
7
  namespace: string;
8
8
  key: string;
9
9
  method: OperationMethod;
10
- payload: Uint8Array;
10
+ payload: Uint8Array<ArrayBuffer>;
11
11
  createdAt: GeneratedAlways<Date>;
12
12
  }
13
13
  export declare const tableName = "operation";
@@ -1 +1 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/db/schema/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7C,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;AAE3E,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;CACjC;AAED,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AAElD,eAAO,MAAM,sBAAsB,qBAAqB,CAAA"}
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/db/schema/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;AAE3E,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAChC,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;CACjC;AAED,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AAElD,eAAO,MAAM,sBAAsB,qBAAqB,CAAA"}
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createOperationChannel = exports.tableName = void 0;
4
- exports.tableName = 'operation';
5
- exports.createOperationChannel = 'operation_create'; // used with listen/notify
1
+ export const tableName = 'operation';
2
+ export const createOperationChannel = 'operation_create'; // used with listen/notify
6
3
  //# sourceMappingURL=operation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/db/schema/operation.ts"],"names":[],"mappings":";;;AAea,QAAA,SAAS,GAAG,WAAW,CAAA;AAIvB,QAAA,sBAAsB,GAAG,kBAAkB,CAAA,CAAC,0BAA0B","sourcesContent":["import { GeneratedAlways } from 'kysely'\nimport { Method } from '../../proto/bsync_pb'\n\nexport type OperationMethod = Method.CREATE | Method.UPDATE | Method.DELETE\n\nexport interface Operation {\n id: GeneratedAlways<number>\n actorDid: string\n namespace: string\n key: string\n method: OperationMethod\n payload: Uint8Array\n createdAt: GeneratedAlways<Date>\n}\n\nexport const tableName = 'operation'\n\nexport type PartialDB = { [tableName]: Operation }\n\nexport const createOperationChannel = 'operation_create' // used with listen/notify\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/db/schema/operation.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AAIpC,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAA,CAAC,0BAA0B","sourcesContent":["import { GeneratedAlways } from 'kysely'\nimport { Method } from '../../proto/bsync_pb.js'\n\nexport type OperationMethod = Method.CREATE | Method.UPDATE | Method.DELETE\n\nexport interface Operation {\n id: GeneratedAlways<number>\n actorDid: string\n namespace: string\n key: string\n method: OperationMethod\n payload: Uint8Array<ArrayBuffer>\n createdAt: GeneratedAlways<Date>\n}\n\nexport const tableName = 'operation'\n\nexport type PartialDB = { [tableName]: Operation }\n\nexport const createOperationChannel = 'operation_create' // used with listen/notify\n"]}
@@ -1,5 +1,6 @@
1
1
  import { DynamicModule, RawBuilder, SelectQueryBuilder } from 'kysely';
2
- import { Pool as PgPool } from 'pg';
2
+ import pg from 'pg';
3
+ type PgPool = pg.Pool;
3
4
  export type DbRef = RawBuilder | ReturnType<DynamicModule['ref']>;
4
5
  export type AnyQb = SelectQueryBuilder<any, any, any>;
5
6
  export type PgOptions = {
@@ -10,4 +11,5 @@ export type PgOptions = {
10
11
  poolMaxUses?: number;
11
12
  poolIdleTimeoutMs?: number;
12
13
  };
14
+ export {};
13
15
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/db/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AACtE,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,IAAI,CAAA;AAEnC,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;AAEjE,MAAM,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAErD,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/db/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAEtE,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,KAAK,MAAM,GAAG,EAAE,CAAC,IAAI,CAAA;AAErB,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;AAEjE,MAAM,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAErD,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA"}
package/dist/db/types.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/db/types.ts"],"names":[],"mappings":"","sourcesContent":["import { DynamicModule, RawBuilder, SelectQueryBuilder } from 'kysely'\nimport { Pool as PgPool } from 'pg'\n\nexport type DbRef = RawBuilder | ReturnType<DynamicModule['ref']>\n\nexport type AnyQb = SelectQueryBuilder<any, any, any>\n\nexport type PgOptions = {\n url: string\n pool?: PgPool\n schema?: string\n poolSize?: number\n poolMaxUses?: number\n poolIdleTimeoutMs?: number\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/db/types.ts"],"names":[],"mappings":"","sourcesContent":["import { DynamicModule, RawBuilder, SelectQueryBuilder } from 'kysely'\n// eslint-disable-next-line import/default\nimport pg from 'pg'\ntype PgPool = pg.Pool\n\nexport type DbRef = RawBuilder | ReturnType<DynamicModule['ref']>\n\nexport type AnyQb = SelectQueryBuilder<any, any, any>\n\nexport type PgOptions = {\n url: string\n pool?: PgPool\n schema?: string\n poolSize?: number\n poolMaxUses?: number\n poolIdleTimeoutMs?: number\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import http from 'node:http';
2
- import { ServerConfig } from './config';
3
- import { AppContext, AppContextOptions } from './context';
4
- export * from './config';
5
- export * from './client';
6
- export { Database } from './db';
7
- export { AppContext } from './context';
8
- export { httpLogger } from './logger';
2
+ import { ServerConfig } from './config.js';
3
+ import { AppContext, AppContextOptions } from './context.js';
4
+ export * from './config.js';
5
+ export * from './client.js';
6
+ export { Database } from './db/index.js';
7
+ export { AppContext } from './context.js';
8
+ export { httpLogger } from './logger.js';
9
9
  export declare class BsyncService {
10
10
  ctx: AppContext;
11
11
  server: http.Server;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAA;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAOzD,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,qBAAa,YAAY;IAChB,GAAG,EAAE,UAAU,CAAA;IACf,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;IAC1B,OAAO,CAAC,EAAE,CAAiB;IAC3B,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,eAAe,CAAC,CAAgB;gBAE5B,IAAI,EAAE;QAChB,GAAG,EAAE,UAAU,CAAA;QACf,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;QACnB,EAAE,EAAE,eAAe,CAAA;KACpB;WAOY,MAAM,CACjB,GAAG,EAAE,YAAY,EACjB,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACrC,OAAO,CAAC,YAAY,CAAC;IAmBlB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IAqB7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,cAAc;CAqBrB;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAA;AAO5B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAO5D,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,qBAAa,YAAY;IAChB,GAAG,EAAE,UAAU,CAAA;IACf,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;IAC1B,OAAO,CAAC,EAAE,CAAiB;IAC3B,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,eAAe,CAAC,CAAgB;gBAE5B,IAAI,EAAE;QAChB,GAAG,EAAE,UAAU,CAAA;QACf,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;QACnB,EAAE,EAAE,eAAe,CAAA;KACpB;WAOY,MAAM,CACjB,GAAG,EAAE,YAAY,EACjB,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACrC,OAAO,CAAC,YAAY,CAAC;IAmBlB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IAqB7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,cAAc;CAqBrB;AAED,eAAe,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -1,87 +1,37 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.BsyncService = exports.httpLogger = exports.AppContext = exports.Database = void 0;
21
- const node_events_1 = __importDefault(require("node:events"));
22
- const node_http_1 = __importDefault(require("node:http"));
23
- const connect_node_1 = require("@connectrpc/connect-node");
24
- const http_terminator_1 = require("http-terminator");
25
- const context_1 = require("./context");
26
- const mute_op_1 = require("./db/schema/mute_op");
27
- const notif_op_1 = require("./db/schema/notif_op");
28
- const operation_1 = require("./db/schema/operation");
29
- const logger_1 = require("./logger");
30
- const routes_1 = __importDefault(require("./routes"));
31
- __exportStar(require("./config"), exports);
32
- __exportStar(require("./client"), exports);
33
- var db_1 = require("./db");
34
- Object.defineProperty(exports, "Database", { enumerable: true, get: function () { return db_1.Database; } });
35
- var context_2 = require("./context");
36
- Object.defineProperty(exports, "AppContext", { enumerable: true, get: function () { return context_2.AppContext; } });
37
- var logger_2 = require("./logger");
38
- Object.defineProperty(exports, "httpLogger", { enumerable: true, get: function () { return logger_2.httpLogger; } });
39
- class BsyncService {
1
+ import events from 'node:events';
2
+ import http from 'node:http';
3
+ import { connectNodeAdapter } from '@connectrpc/connect-node';
4
+ // eslint-disable-next-line import/default, import/no-named-as-default-member
5
+ import httpTerminator from 'http-terminator';
6
+ // eslint-disable-next-line import/no-named-as-default-member
7
+ const { createHttpTerminator } = httpTerminator;
8
+ import { AppContext } from './context.js';
9
+ import { createMuteOpChannel } from './db/schema/mute_op.js';
10
+ import { createNotifOpChannel } from './db/schema/notif_op.js';
11
+ import { createOperationChannel } from './db/schema/operation.js';
12
+ import { dbLogger, loggerMiddleware } from './logger.js';
13
+ import routes from './routes/index.js';
14
+ export * from './config.js';
15
+ export * from './client.js';
16
+ export { Database } from './db/index.js';
17
+ export { AppContext } from './context.js';
18
+ export { httpLogger } from './logger.js';
19
+ export class BsyncService {
40
20
  constructor(opts) {
41
- Object.defineProperty(this, "ctx", {
42
- enumerable: true,
43
- configurable: true,
44
- writable: true,
45
- value: void 0
46
- });
47
- Object.defineProperty(this, "server", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: void 0
52
- });
53
- Object.defineProperty(this, "ac", {
54
- enumerable: true,
55
- configurable: true,
56
- writable: true,
57
- value: void 0
58
- });
59
- Object.defineProperty(this, "terminator", {
60
- enumerable: true,
61
- configurable: true,
62
- writable: true,
63
- value: void 0
64
- });
65
- Object.defineProperty(this, "dbStatsInterval", {
66
- enumerable: true,
67
- configurable: true,
68
- writable: true,
69
- value: void 0
70
- });
71
21
  this.ctx = opts.ctx;
72
22
  this.server = opts.server;
73
23
  this.ac = opts.ac;
74
- this.terminator = (0, http_terminator_1.createHttpTerminator)({ server: this.server });
24
+ this.terminator = createHttpTerminator({ server: this.server });
75
25
  }
76
26
  static async create(cfg, overrides) {
77
27
  const ac = new AbortController();
78
- const ctx = await context_1.AppContext.fromConfig(cfg, ac.signal, overrides);
79
- const handler = (0, connect_node_1.connectNodeAdapter)({
80
- routes: (0, routes_1.default)(ctx),
28
+ const ctx = await AppContext.fromConfig(cfg, ac.signal, overrides);
29
+ const handler = connectNodeAdapter({
30
+ routes: routes(ctx),
81
31
  shutdownSignal: ac.signal,
82
32
  });
83
- const server = node_http_1.default.createServer((req, res) => {
84
- (0, logger_1.loggerMiddleware)(req, res);
33
+ const server = http.createServer((req, res) => {
34
+ loggerMiddleware(req, res);
85
35
  if (isHealth(req.url)) {
86
36
  res.statusCode = 200;
87
37
  res.setHeader('content-type', 'application/json');
@@ -96,7 +46,7 @@ class BsyncService {
96
46
  throw new Error(`${this.constructor.name} already started`);
97
47
  }
98
48
  this.dbStatsInterval = setInterval(() => {
99
- logger_1.dbLogger.info({
49
+ dbLogger.info({
100
50
  idleCount: this.ctx.db.pool.idleCount,
101
51
  totalCount: this.ctx.db.pool.totalCount,
102
52
  waitingCount: this.ctx.db.pool.waitingCount,
@@ -105,7 +55,7 @@ class BsyncService {
105
55
  await this.setupAppEvents();
106
56
  this.server.listen(this.ctx.cfg.service.port);
107
57
  this.server.keepAliveTimeout = 90000;
108
- await node_events_1.default.once(this.server, 'listening');
58
+ await events.once(this.server, 'listening');
109
59
  return this.server;
110
60
  }
111
61
  async destroy() {
@@ -121,24 +71,23 @@ class BsyncService {
121
71
  once: true,
122
72
  });
123
73
  // if these error, unhandled rejection should cause process to exit
124
- conn.query(`listen ${mute_op_1.createMuteOpChannel}`);
125
- conn.query(`listen ${notif_op_1.createNotifOpChannel}`);
126
- conn.query(`listen ${operation_1.createOperationChannel}`);
74
+ conn.query(`listen ${createMuteOpChannel}`);
75
+ conn.query(`listen ${createNotifOpChannel}`);
76
+ conn.query(`listen ${createOperationChannel}`);
127
77
  conn.on('notification', (notif) => {
128
- if (notif.channel === mute_op_1.createMuteOpChannel) {
129
- this.ctx.events.emit(mute_op_1.createMuteOpChannel);
78
+ if (notif.channel === createMuteOpChannel) {
79
+ this.ctx.events.emit(createMuteOpChannel);
130
80
  }
131
- if (notif.channel === notif_op_1.createNotifOpChannel) {
132
- this.ctx.events.emit(notif_op_1.createNotifOpChannel);
81
+ if (notif.channel === createNotifOpChannel) {
82
+ this.ctx.events.emit(createNotifOpChannel);
133
83
  }
134
- if (notif.channel === operation_1.createOperationChannel) {
135
- this.ctx.events.emit(operation_1.createOperationChannel);
84
+ if (notif.channel === createOperationChannel) {
85
+ this.ctx.events.emit(createOperationChannel);
136
86
  }
137
87
  });
138
88
  }
139
89
  }
140
- exports.BsyncService = BsyncService;
141
- exports.default = BsyncService;
90
+ export default BsyncService;
142
91
  const isHealth = (urlStr) => {
143
92
  if (!urlStr)
144
93
  return false;