document-drive 6.0.0-dev.105 → 6.0.0-dev.107
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/dist/chunk-CX61OkwL.mjs +16 -0
- package/dist/index-HOJm2mt2.d.mts +205 -0
- package/dist/index-HOJm2mt2.d.mts.map +1 -0
- package/dist/index.d.ts +1944 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5170 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/filesystem.d.mts +49 -0
- package/dist/storage/filesystem.d.mts.map +1 -0
- package/dist/storage/filesystem.mjs +371 -0
- package/dist/storage/filesystem.mjs.map +1 -0
- package/dist/storage/prisma.d.mts +11508 -0
- package/dist/storage/prisma.d.mts.map +1 -0
- package/dist/storage/prisma.mjs +7582 -0
- package/dist/storage/prisma.mjs.map +1 -0
- package/dist/utils-BI7cwVSp.mjs +74 -0
- package/dist/utils-BI7cwVSp.mjs.map +1 -0
- package/package.json +21 -38
- package/dist/prisma/schema.prisma +0 -93
- package/dist/src/cache/index.d.ts +0 -4
- package/dist/src/cache/index.d.ts.map +0 -1
- package/dist/src/cache/index.js +0 -4
- package/dist/src/cache/index.js.map +0 -1
- package/dist/src/cache/lru.d.ts +0 -22
- package/dist/src/cache/lru.d.ts.map +0 -1
- package/dist/src/cache/lru.js +0 -40
- package/dist/src/cache/lru.js.map +0 -1
- package/dist/src/cache/memory.d.ts +0 -27
- package/dist/src/cache/memory.d.ts.map +0 -1
- package/dist/src/cache/memory.js +0 -104
- package/dist/src/cache/memory.js.map +0 -1
- package/dist/src/cache/redis.d.ts +0 -22
- package/dist/src/cache/redis.d.ts.map +0 -1
- package/dist/src/cache/redis.js +0 -91
- package/dist/src/cache/redis.js.map +0 -1
- package/dist/src/cache/types.d.ts +0 -37
- package/dist/src/cache/types.d.ts.map +0 -1
- package/dist/src/cache/types.js +0 -2
- package/dist/src/cache/types.js.map +0 -1
- package/dist/src/cache/util.d.ts +0 -3
- package/dist/src/cache/util.d.ts.map +0 -1
- package/dist/src/cache/util.js +0 -16
- package/dist/src/cache/util.js.map +0 -1
- package/dist/src/drive-document-model/constants.d.ts +0 -2
- package/dist/src/drive-document-model/constants.d.ts.map +0 -1
- package/dist/src/drive-document-model/constants.js +0 -2
- package/dist/src/drive-document-model/constants.js.map +0 -1
- package/dist/src/drive-document-model/gen/creators.d.ts +0 -3
- package/dist/src/drive-document-model/gen/creators.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/creators.js +0 -3
- package/dist/src/drive-document-model/gen/creators.js.map +0 -1
- package/dist/src/drive-document-model/gen/document-model.d.ts +0 -3
- package/dist/src/drive-document-model/gen/document-model.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/document-model.js +0 -210
- package/dist/src/drive-document-model/gen/document-model.js.map +0 -1
- package/dist/src/drive-document-model/gen/document-schema.d.ts +0 -68
- package/dist/src/drive-document-model/gen/document-schema.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/document-schema.js +0 -35
- package/dist/src/drive-document-model/gen/document-schema.js.map +0 -1
- package/dist/src/drive-document-model/gen/document-type.d.ts +0 -2
- package/dist/src/drive-document-model/gen/document-type.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/document-type.js +0 -2
- package/dist/src/drive-document-model/gen/document-type.js.map +0 -1
- package/dist/src/drive-document-model/gen/drive/actions.d.ts +0 -46
- package/dist/src/drive-document-model/gen/drive/actions.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/drive/actions.js +0 -2
- package/dist/src/drive-document-model/gen/drive/actions.js.map +0 -1
- package/dist/src/drive-document-model/gen/drive/creators.d.ts +0 -10
- package/dist/src/drive-document-model/gen/drive/creators.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/drive/creators.js +0 -11
- package/dist/src/drive-document-model/gen/drive/creators.js.map +0 -1
- package/dist/src/drive-document-model/gen/drive/error.d.ts +0 -2
- package/dist/src/drive-document-model/gen/drive/error.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/drive/error.js +0 -2
- package/dist/src/drive-document-model/gen/drive/error.js.map +0 -1
- package/dist/src/drive-document-model/gen/drive/index.d.ts +0 -2
- package/dist/src/drive-document-model/gen/drive/index.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/drive/index.js +0 -2
- package/dist/src/drive-document-model/gen/drive/index.js.map +0 -1
- package/dist/src/drive-document-model/gen/drive/types.d.ts +0 -2
- package/dist/src/drive-document-model/gen/drive/types.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/drive/types.js +0 -2
- package/dist/src/drive-document-model/gen/drive/types.js.map +0 -1
- package/dist/src/drive-document-model/gen/index.d.ts +0 -10
- package/dist/src/drive-document-model/gen/index.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/index.js +0 -10
- package/dist/src/drive-document-model/gen/index.js.map +0 -1
- package/dist/src/drive-document-model/gen/node/actions.d.ts +0 -41
- package/dist/src/drive-document-model/gen/node/actions.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/node/actions.js +0 -2
- package/dist/src/drive-document-model/gen/node/actions.js.map +0 -1
- package/dist/src/drive-document-model/gen/node/creators.d.ts +0 -13
- package/dist/src/drive-document-model/gen/node/creators.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/node/creators.js +0 -17
- package/dist/src/drive-document-model/gen/node/creators.js.map +0 -1
- package/dist/src/drive-document-model/gen/node/error.d.ts +0 -2
- package/dist/src/drive-document-model/gen/node/error.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/node/error.js +0 -2
- package/dist/src/drive-document-model/gen/node/error.js.map +0 -1
- package/dist/src/drive-document-model/gen/node/index.d.ts +0 -2
- package/dist/src/drive-document-model/gen/node/index.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/node/index.js +0 -2
- package/dist/src/drive-document-model/gen/node/index.js.map +0 -1
- package/dist/src/drive-document-model/gen/node/types.d.ts +0 -2
- package/dist/src/drive-document-model/gen/node/types.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/node/types.js +0 -2
- package/dist/src/drive-document-model/gen/node/types.js.map +0 -1
- package/dist/src/drive-document-model/gen/ph-factories.d.ts +0 -12
- package/dist/src/drive-document-model/gen/ph-factories.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/ph-factories.js +0 -46
- package/dist/src/drive-document-model/gen/ph-factories.js.map +0 -1
- package/dist/src/drive-document-model/gen/reducer.d.ts +0 -4
- package/dist/src/drive-document-model/gen/reducer.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/reducer.js +0 -76
- package/dist/src/drive-document-model/gen/reducer.js.map +0 -1
- package/dist/src/drive-document-model/gen/schema/index.d.ts +0 -2
- package/dist/src/drive-document-model/gen/schema/index.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/schema/index.js +0 -2
- package/dist/src/drive-document-model/gen/schema/index.js.map +0 -1
- package/dist/src/drive-document-model/gen/schema/types.d.ts +0 -283
- package/dist/src/drive-document-model/gen/schema/types.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/schema/types.js +0 -2
- package/dist/src/drive-document-model/gen/schema/types.js.map +0 -1
- package/dist/src/drive-document-model/gen/schema/zod.d.ts +0 -67
- package/dist/src/drive-document-model/gen/schema/zod.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/schema/zod.js +0 -229
- package/dist/src/drive-document-model/gen/schema/zod.js.map +0 -1
- package/dist/src/drive-document-model/gen/types.d.ts +0 -21
- package/dist/src/drive-document-model/gen/types.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/types.js +0 -4
- package/dist/src/drive-document-model/gen/types.js.map +0 -1
- package/dist/src/drive-document-model/gen/utils.d.ts +0 -13
- package/dist/src/drive-document-model/gen/utils.d.ts.map +0 -1
- package/dist/src/drive-document-model/gen/utils.js +0 -48
- package/dist/src/drive-document-model/gen/utils.js.map +0 -1
- package/dist/src/drive-document-model/index.d.ts +0 -5
- package/dist/src/drive-document-model/index.d.ts.map +0 -1
- package/dist/src/drive-document-model/index.js +0 -5
- package/dist/src/drive-document-model/index.js.map +0 -1
- package/dist/src/drive-document-model/module.d.ts +0 -3
- package/dist/src/drive-document-model/module.d.ts.map +0 -1
- package/dist/src/drive-document-model/module.js +0 -24
- package/dist/src/drive-document-model/module.js.map +0 -1
- package/dist/src/drive-document-model/src/index.d.ts +0 -3
- package/dist/src/drive-document-model/src/index.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/index.js +0 -3
- package/dist/src/drive-document-model/src/index.js.map +0 -1
- package/dist/src/drive-document-model/src/reducers/drive.d.ts +0 -8
- package/dist/src/drive-document-model/src/reducers/drive.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/reducers/drive.js +0 -66
- package/dist/src/drive-document-model/src/reducers/drive.js.map +0 -1
- package/dist/src/drive-document-model/src/reducers/index.d.ts +0 -3
- package/dist/src/drive-document-model/src/reducers/index.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/reducers/index.js +0 -3
- package/dist/src/drive-document-model/src/reducers/index.js.map +0 -1
- package/dist/src/drive-document-model/src/reducers/node.d.ts +0 -8
- package/dist/src/drive-document-model/src/reducers/node.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/reducers/node.js +0 -187
- package/dist/src/drive-document-model/src/reducers/node.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/actions.test.d.ts +0 -2
- package/dist/src/drive-document-model/src/tests/actions.test.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/actions.test.js +0 -197
- package/dist/src/drive-document-model/src/tests/actions.test.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/base.test.d.ts +0 -2
- package/dist/src/drive-document-model/src/tests/base.test.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/base.test.js +0 -44
- package/dist/src/drive-document-model/src/tests/base.test.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/document-model.test.d.ts +0 -6
- package/dist/src/drive-document-model/src/tests/document-model.test.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/document-model.test.js +0 -19
- package/dist/src/drive-document-model/src/tests/document-model.test.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/drive.test.d.ts +0 -6
- package/dist/src/drive-document-model/src/tests/drive.test.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/drive.test.js +0 -38
- package/dist/src/drive-document-model/src/tests/drive.test.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/generate-mock.d.ts +0 -3
- package/dist/src/drive-document-model/src/tests/generate-mock.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/generate-mock.js +0 -5
- package/dist/src/drive-document-model/src/tests/generate-mock.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/node.test.d.ts +0 -6
- package/dist/src/drive-document-model/src/tests/node.test.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/node.test.js +0 -343
- package/dist/src/drive-document-model/src/tests/node.test.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/test-factories.d.ts +0 -9
- package/dist/src/drive-document-model/src/tests/test-factories.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/test-factories.js +0 -17
- package/dist/src/drive-document-model/src/tests/test-factories.js.map +0 -1
- package/dist/src/drive-document-model/src/tests/utils.test.d.ts +0 -2
- package/dist/src/drive-document-model/src/tests/utils.test.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/tests/utils.test.js +0 -232
- package/dist/src/drive-document-model/src/tests/utils.test.js.map +0 -1
- package/dist/src/drive-document-model/src/types.d.ts +0 -8
- package/dist/src/drive-document-model/src/types.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/types.js +0 -2
- package/dist/src/drive-document-model/src/types.js.map +0 -1
- package/dist/src/drive-document-model/src/utils.d.ts +0 -23
- package/dist/src/drive-document-model/src/utils.d.ts.map +0 -1
- package/dist/src/drive-document-model/src/utils.js +0 -102
- package/dist/src/drive-document-model/src/utils.js.map +0 -1
- package/dist/src/drive-document-model/types.d.ts +0 -10
- package/dist/src/drive-document-model/types.d.ts.map +0 -1
- package/dist/src/drive-document-model/types.js +0 -3
- package/dist/src/drive-document-model/types.js.map +0 -1
- package/dist/src/index.d.ts +0 -17
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -17
- package/dist/src/index.js.map +0 -1
- package/dist/src/processors/index.d.ts +0 -4
- package/dist/src/processors/index.d.ts.map +0 -1
- package/dist/src/processors/index.js +0 -4
- package/dist/src/processors/index.js.map +0 -1
- package/dist/src/processors/processor-manager.d.ts +0 -21
- package/dist/src/processors/processor-manager.d.ts.map +0 -1
- package/dist/src/processors/processor-manager.js +0 -104
- package/dist/src/processors/processor-manager.js.map +0 -1
- package/dist/src/processors/relational.d.ts +0 -49
- package/dist/src/processors/relational.d.ts.map +0 -1
- package/dist/src/processors/relational.js +0 -57
- package/dist/src/processors/relational.js.map +0 -1
- package/dist/src/processors/types.d.ts +0 -94
- package/dist/src/processors/types.d.ts.map +0 -1
- package/dist/src/processors/types.js +0 -2
- package/dist/src/processors/types.js.map +0 -1
- package/dist/src/processors/utils.d.ts +0 -29
- package/dist/src/processors/utils.d.ts.map +0 -1
- package/dist/src/processors/utils.js +0 -72
- package/dist/src/processors/utils.js.map +0 -1
- package/dist/src/queue/base.d.ts +0 -22
- package/dist/src/queue/base.d.ts.map +0 -1
- package/dist/src/queue/base.js +0 -54
- package/dist/src/queue/base.js.map +0 -1
- package/dist/src/queue/event.d.ts +0 -40
- package/dist/src/queue/event.d.ts.map +0 -1
- package/dist/src/queue/event.js +0 -226
- package/dist/src/queue/event.js.map +0 -1
- package/dist/src/queue/index.d.ts +0 -5
- package/dist/src/queue/index.d.ts.map +0 -1
- package/dist/src/queue/index.js +0 -5
- package/dist/src/queue/index.js.map +0 -1
- package/dist/src/queue/redis.d.ts +0 -2
- package/dist/src/queue/redis.d.ts.map +0 -1
- package/dist/src/queue/redis.js +0 -123
- package/dist/src/queue/redis.js.map +0 -1
- package/dist/src/queue/types.d.ts +0 -59
- package/dist/src/queue/types.d.ts.map +0 -1
- package/dist/src/queue/types.js +0 -2
- package/dist/src/queue/types.js.map +0 -1
- package/dist/src/queue/utils.d.ts +0 -5
- package/dist/src/queue/utils.d.ts.map +0 -1
- package/dist/src/queue/utils.js +0 -10
- package/dist/src/queue/utils.js.map +0 -1
- package/dist/src/read-mode/errors.d.ts +0 -12
- package/dist/src/read-mode/errors.d.ts.map +0 -1
- package/dist/src/read-mode/errors.js +0 -18
- package/dist/src/read-mode/errors.js.map +0 -1
- package/dist/src/read-mode/index.d.ts +0 -4
- package/dist/src/read-mode/index.d.ts.map +0 -1
- package/dist/src/read-mode/index.js +0 -4
- package/dist/src/read-mode/index.js.map +0 -1
- package/dist/src/read-mode/server.d.ts +0 -3
- package/dist/src/read-mode/server.d.ts.map +0 -1
- package/dist/src/read-mode/server.js +0 -78
- package/dist/src/read-mode/server.js.map +0 -1
- package/dist/src/read-mode/service.d.ts +0 -17
- package/dist/src/read-mode/service.d.ts.map +0 -1
- package/dist/src/read-mode/service.js +0 -119
- package/dist/src/read-mode/service.js.map +0 -1
- package/dist/src/read-mode/types.d.ts +0 -31
- package/dist/src/read-mode/types.d.ts.map +0 -1
- package/dist/src/read-mode/types.js +0 -2
- package/dist/src/read-mode/types.js.map +0 -1
- package/dist/src/server/base-server.d.ts +0 -177
- package/dist/src/server/base-server.d.ts.map +0 -1
- package/dist/src/server/base-server.js +0 -2000
- package/dist/src/server/base-server.js.map +0 -1
- package/dist/src/server/builder.d.ts +0 -27
- package/dist/src/server/builder.d.ts.map +0 -1
- package/dist/src/server/builder.js +0 -97
- package/dist/src/server/builder.js.map +0 -1
- package/dist/src/server/error.d.ts +0 -34
- package/dist/src/server/error.d.ts.map +0 -1
- package/dist/src/server/error.js +0 -56
- package/dist/src/server/error.js.map +0 -1
- package/dist/src/server/event-emitter.d.ts +0 -8
- package/dist/src/server/event-emitter.d.ts.map +0 -1
- package/dist/src/server/event-emitter.js +0 -11
- package/dist/src/server/event-emitter.js.map +0 -1
- package/dist/src/server/index.d.ts +0 -10
- package/dist/src/server/index.d.ts.map +0 -1
- package/dist/src/server/index.js +0 -10
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/server/listener/constants.d.ts +0 -4
- package/dist/src/server/listener/constants.d.ts.map +0 -1
- package/dist/src/server/listener/constants.js +0 -4
- package/dist/src/server/listener/constants.js.map +0 -1
- package/dist/src/server/listener/index.d.ts +0 -4
- package/dist/src/server/listener/index.d.ts.map +0 -1
- package/dist/src/server/listener/index.js +0 -4
- package/dist/src/server/listener/index.js.map +0 -1
- package/dist/src/server/listener/listener-manager.d.ts +0 -28
- package/dist/src/server/listener/listener-manager.d.ts.map +0 -1
- package/dist/src/server/listener/listener-manager.js +0 -415
- package/dist/src/server/listener/listener-manager.js.map +0 -1
- package/dist/src/server/listener/util.d.ts +0 -2
- package/dist/src/server/listener/util.d.ts.map +0 -1
- package/dist/src/server/listener/util.js +0 -23
- package/dist/src/server/listener/util.js.map +0 -1
- package/dist/src/server/sync-manager.d.ts +0 -28
- package/dist/src/server/sync-manager.d.ts.map +0 -1
- package/dist/src/server/sync-manager.js +0 -222
- package/dist/src/server/sync-manager.js.map +0 -1
- package/dist/src/server/sync-unit-map.d.ts +0 -116
- package/dist/src/server/sync-unit-map.d.ts.map +0 -1
- package/dist/src/server/sync-unit-map.js +0 -233
- package/dist/src/server/sync-unit-map.js.map +0 -1
- package/dist/src/server/transmitter/constants.d.ts +0 -2
- package/dist/src/server/transmitter/constants.d.ts.map +0 -1
- package/dist/src/server/transmitter/constants.js +0 -2
- package/dist/src/server/transmitter/constants.js.map +0 -1
- package/dist/src/server/transmitter/factory.d.ts +0 -7
- package/dist/src/server/transmitter/factory.d.ts.map +0 -1
- package/dist/src/server/transmitter/factory.js +0 -25
- package/dist/src/server/transmitter/factory.js.map +0 -1
- package/dist/src/server/transmitter/index.d.ts +0 -6
- package/dist/src/server/transmitter/index.d.ts.map +0 -1
- package/dist/src/server/transmitter/index.js +0 -5
- package/dist/src/server/transmitter/index.js.map +0 -1
- package/dist/src/server/transmitter/internal.d.ts +0 -12
- package/dist/src/server/transmitter/internal.d.ts.map +0 -1
- package/dist/src/server/transmitter/internal.js +0 -113
- package/dist/src/server/transmitter/internal.js.map +0 -1
- package/dist/src/server/transmitter/pull-responder.d.ts +0 -30
- package/dist/src/server/transmitter/pull-responder.d.ts.map +0 -1
- package/dist/src/server/transmitter/pull-responder.js +0 -543
- package/dist/src/server/transmitter/pull-responder.js.map +0 -1
- package/dist/src/server/transmitter/switchboard-push.d.ts +0 -11
- package/dist/src/server/transmitter/switchboard-push.d.ts.map +0 -1
- package/dist/src/server/transmitter/switchboard-push.js +0 -130
- package/dist/src/server/transmitter/switchboard-push.js.map +0 -1
- package/dist/src/server/transmitter/types.d.ts +0 -53
- package/dist/src/server/transmitter/types.d.ts.map +0 -1
- package/dist/src/server/transmitter/types.js +0 -2
- package/dist/src/server/transmitter/types.js.map +0 -1
- package/dist/src/server/types.d.ts +0 -419
- package/dist/src/server/types.d.ts.map +0 -1
- package/dist/src/server/types.js +0 -10
- package/dist/src/server/types.js.map +0 -1
- package/dist/src/server/utils.d.ts +0 -19
- package/dist/src/server/utils.d.ts.map +0 -1
- package/dist/src/server/utils.js +0 -110
- package/dist/src/server/utils.js.map +0 -1
- package/dist/src/storage/browser.d.ts +0 -52
- package/dist/src/storage/browser.d.ts.map +0 -1
- package/dist/src/storage/browser.js +0 -430
- package/dist/src/storage/browser.js.map +0 -1
- package/dist/src/storage/filesystem.d.ts +0 -45
- package/dist/src/storage/filesystem.d.ts.map +0 -1
- package/dist/src/storage/filesystem.js +0 -457
- package/dist/src/storage/filesystem.js.map +0 -1
- package/dist/src/storage/index.d.ts +0 -5
- package/dist/src/storage/index.d.ts.map +0 -1
- package/dist/src/storage/index.js +0 -5
- package/dist/src/storage/index.js.map +0 -1
- package/dist/src/storage/ipfs.d.ts +0 -2
- package/dist/src/storage/ipfs.d.ts.map +0 -1
- package/dist/src/storage/ipfs.js +0 -491
- package/dist/src/storage/ipfs.js.map +0 -1
- package/dist/src/storage/memory.d.ts +0 -42
- package/dist/src/storage/memory.d.ts.map +0 -1
- package/dist/src/storage/memory.js +0 -355
- package/dist/src/storage/memory.js.map +0 -1
- package/dist/src/storage/path-encoding.d.ts +0 -21
- package/dist/src/storage/path-encoding.d.ts.map +0 -1
- package/dist/src/storage/path-encoding.js +0 -53
- package/dist/src/storage/path-encoding.js.map +0 -1
- package/dist/src/storage/prisma/client/default.d.ts +0 -1
- package/dist/src/storage/prisma/client/default.js +0 -1
- package/dist/src/storage/prisma/client/edge.d.ts +0 -1
- package/dist/src/storage/prisma/client/edge.js +0 -263
- package/dist/src/storage/prisma/client/index-browser.js +0 -246
- package/dist/src/storage/prisma/client/index.d.ts +0 -10318
- package/dist/src/storage/prisma/client/index.js +0 -292
- package/dist/src/storage/prisma/client/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/dist/src/storage/prisma/client/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/dist/src/storage/prisma/client/libquery_engine-linux-musl.so.node +0 -0
- package/dist/src/storage/prisma/client/package.json +0 -84
- package/dist/src/storage/prisma/client/runtime/edge-esm.js +0 -31
- package/dist/src/storage/prisma/client/runtime/edge.js +0 -31
- package/dist/src/storage/prisma/client/runtime/index-browser.d.ts +0 -365
- package/dist/src/storage/prisma/client/runtime/index-browser.js +0 -13
- package/dist/src/storage/prisma/client/runtime/library.d.ts +0 -3273
- package/dist/src/storage/prisma/client/runtime/library.js +0 -143
- package/dist/src/storage/prisma/client/runtime/react-native.js +0 -80
- package/dist/src/storage/prisma/client/runtime/wasm.js +0 -32
- package/dist/src/storage/prisma/client/schema.prisma +0 -93
- package/dist/src/storage/prisma/client/wasm.d.ts +0 -1
- package/dist/src/storage/prisma/client/wasm.js +0 -246
- package/dist/src/storage/prisma/factory.d.ts +0 -10
- package/dist/src/storage/prisma/factory.d.ts.map +0 -1
- package/dist/src/storage/prisma/factory.js +0 -23
- package/dist/src/storage/prisma/factory.js.map +0 -1
- package/dist/src/storage/prisma/index.d.ts +0 -3
- package/dist/src/storage/prisma/index.d.ts.map +0 -1
- package/dist/src/storage/prisma/index.js +0 -3
- package/dist/src/storage/prisma/index.js.map +0 -1
- package/dist/src/storage/prisma/prisma.d.ts +0 -73
- package/dist/src/storage/prisma/prisma.d.ts.map +0 -1
- package/dist/src/storage/prisma/prisma.js +0 -760
- package/dist/src/storage/prisma/prisma.js.map +0 -1
- package/dist/src/storage/types.d.ts +0 -187
- package/dist/src/storage/types.d.ts.map +0 -1
- package/dist/src/storage/types.js +0 -2
- package/dist/src/storage/types.js.map +0 -1
- package/dist/src/storage/utils.d.ts +0 -6
- package/dist/src/storage/utils.d.ts.map +0 -1
- package/dist/src/storage/utils.js +0 -33
- package/dist/src/storage/utils.js.map +0 -1
- package/dist/src/utils/default-drives-manager.d.ts +0 -18
- package/dist/src/utils/default-drives-manager.d.ts.map +0 -1
- package/dist/src/utils/default-drives-manager.js +0 -208
- package/dist/src/utils/default-drives-manager.js.map +0 -1
- package/dist/src/utils/errors.d.ts +0 -5
- package/dist/src/utils/errors.d.ts.map +0 -1
- package/dist/src/utils/errors.js +0 -10
- package/dist/src/utils/errors.js.map +0 -1
- package/dist/src/utils/gql-transformations.d.ts +0 -32
- package/dist/src/utils/gql-transformations.d.ts.map +0 -1
- package/dist/src/utils/gql-transformations.js +0 -39
- package/dist/src/utils/gql-transformations.js.map +0 -1
- package/dist/src/utils/graphql.d.ts +0 -13
- package/dist/src/utils/graphql.d.ts.map +0 -1
- package/dist/src/utils/graphql.js +0 -196
- package/dist/src/utils/graphql.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -9
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js +0 -9
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/logger.d.ts +0 -3
- package/dist/src/utils/logger.d.ts.map +0 -1
- package/dist/src/utils/logger.js +0 -2
- package/dist/src/utils/logger.js.map +0 -1
- package/dist/src/utils/migrations.d.ts +0 -4
- package/dist/src/utils/migrations.d.ts.map +0 -1
- package/dist/src/utils/migrations.js +0 -112
- package/dist/src/utils/migrations.js.map +0 -1
- package/dist/src/utils/misc.d.ts +0 -21
- package/dist/src/utils/misc.d.ts.map +0 -1
- package/dist/src/utils/misc.js +0 -55
- package/dist/src/utils/misc.js.map +0 -1
- package/dist/src/utils/run-asap.d.ts +0 -8
- package/dist/src/utils/run-asap.d.ts.map +0 -1
- package/dist/src/utils/run-asap.js +0 -120
- package/dist/src/utils/run-asap.js.map +0 -1
- package/dist/src/utils/test.d.ts +0 -63
- package/dist/src/utils/test.d.ts.map +0 -1
- package/dist/src/utils/test.js +0 -161
- package/dist/src/utils/test.js.map +0 -1
- package/dist/src/utils/types.d.ts +0 -44
- package/dist/src/utils/types.d.ts.map +0 -1
- package/dist/src/utils/types.js +0 -2
- package/dist/src/utils/types.js.map +0 -1
- package/dist/test/benchmarks/getDrive.json +0 -10
- package/dist/test/benchmarks/processOperations.bench.d.ts +0 -2
- package/dist/test/benchmarks/processOperations.bench.d.ts.map +0 -1
- package/dist/test/benchmarks/processOperations.bench.js +0 -148
- package/dist/test/benchmarks/processOperations.bench.js.map +0 -1
- package/dist/test/benchmarks/queue.bench.d.ts +0 -2
- package/dist/test/benchmarks/queue.bench.d.ts.map +0 -1
- package/dist/test/benchmarks/queue.bench.js +0 -55
- package/dist/test/benchmarks/queue.bench.js.map +0 -1
- package/dist/test/benchmarks/strands.small.json +0 -37085
- package/dist/test/cache.test.d.ts +0 -2
- package/dist/test/cache.test.d.ts.map +0 -1
- package/dist/test/cache.test.js +0 -276
- package/dist/test/cache.test.js.map +0 -1
- package/dist/test/default-remote-drives.test.d.ts +0 -2
- package/dist/test/default-remote-drives.test.d.ts.map +0 -1
- package/dist/test/default-remote-drives.test.js +0 -445
- package/dist/test/default-remote-drives.test.js.map +0 -1
- package/dist/test/drive-operations.test.d.ts +0 -2
- package/dist/test/drive-operations.test.d.ts.map +0 -1
- package/dist/test/drive-operations.test.js +0 -134
- package/dist/test/drive-operations.test.js.map +0 -1
- package/dist/test/dual-action-create.test.d.ts +0 -2
- package/dist/test/dual-action-create.test.d.ts.map +0 -1
- package/dist/test/dual-action-create.test.js +0 -187
- package/dist/test/dual-action-create.test.js.map +0 -1
- package/dist/test/dual-action-migration.test.d.ts +0 -2
- package/dist/test/dual-action-migration.test.d.ts.map +0 -1
- package/dist/test/dual-action-migration.test.js +0 -348
- package/dist/test/dual-action-migration.test.js.map +0 -1
- package/dist/test/graphql.test.d.ts +0 -2
- package/dist/test/graphql.test.d.ts.map +0 -1
- package/dist/test/graphql.test.js +0 -9
- package/dist/test/graphql.test.js.map +0 -1
- package/dist/test/internal-listener.test.d.ts +0 -2
- package/dist/test/internal-listener.test.d.ts.map +0 -1
- package/dist/test/internal-listener.test.js +0 -262
- package/dist/test/internal-listener.test.js.map +0 -1
- package/dist/test/path-encoding.test.d.ts +0 -2
- package/dist/test/path-encoding.test.d.ts.map +0 -1
- package/dist/test/path-encoding.test.js +0 -116
- package/dist/test/path-encoding.test.js.map +0 -1
- package/dist/test/queue.test.d.ts +0 -2
- package/dist/test/queue.test.d.ts.map +0 -1
- package/dist/test/queue.test.js +0 -325
- package/dist/test/queue.test.js.map +0 -1
- package/dist/test/reactor.test.d.ts +0 -2
- package/dist/test/reactor.test.d.ts.map +0 -1
- package/dist/test/reactor.test.js +0 -32
- package/dist/test/reactor.test.js.map +0 -1
- package/dist/test/read-mode.test.d.ts +0 -2
- package/dist/test/read-mode.test.d.ts.map +0 -1
- package/dist/test/read-mode.test.js +0 -569
- package/dist/test/read-mode.test.js.map +0 -1
- package/dist/test/server/driveOperationsConflictResolution.test.d.ts +0 -2
- package/dist/test/server/driveOperationsConflictResolution.test.d.ts.map +0 -1
- package/dist/test/server/driveOperationsConflictResolution.test.js +0 -486
- package/dist/test/server/driveOperationsConflictResolution.test.js.map +0 -1
- package/dist/test/server/mergeOperations.test.d.ts +0 -2
- package/dist/test/server/mergeOperations.test.d.ts.map +0 -1
- package/dist/test/server/mergeOperations.test.js +0 -131
- package/dist/test/server/mergeOperations.test.js.map +0 -1
- package/dist/test/server/processOperations.test.d.ts +0 -2
- package/dist/test/server/processOperations.test.d.ts.map +0 -1
- package/dist/test/server/processOperations.test.js +0 -392
- package/dist/test/server/processOperations.test.js.map +0 -1
- package/dist/test/server.test.d.ts +0 -2
- package/dist/test/server.test.d.ts.map +0 -1
- package/dist/test/server.test.js +0 -957
- package/dist/test/server.test.js.map +0 -1
- package/dist/test/signature-migration.test.d.ts +0 -2
- package/dist/test/signature-migration.test.d.ts.map +0 -1
- package/dist/test/signature-migration.test.js +0 -241
- package/dist/test/signature-migration.test.js.map +0 -1
- package/dist/test/storage.test.d.ts +0 -2
- package/dist/test/storage.test.d.ts.map +0 -1
- package/dist/test/storage.test.js +0 -457
- package/dist/test/storage.test.js.map +0 -1
- package/dist/test/switchboard-push-listener.test.d.ts +0 -2
- package/dist/test/switchboard-push-listener.test.d.ts.map +0 -1
- package/dist/test/switchboard-push-listener.test.js +0 -133
- package/dist/test/switchboard-push-listener.test.js.map +0 -1
- package/dist/test/sync-manager.test.d.ts +0 -2
- package/dist/test/sync-manager.test.d.ts.map +0 -1
- package/dist/test/sync-manager.test.js +0 -354
- package/dist/test/sync-manager.test.js.map +0 -1
- package/dist/test/undo-redo-clipboard.test.d.ts +0 -2
- package/dist/test/undo-redo-clipboard.test.d.ts.map +0 -1
- package/dist/test/undo-redo-clipboard.test.js +0 -108
- package/dist/test/undo-redo-clipboard.test.js.map +0 -1
- package/dist/test/utils.test.d.ts +0 -2
- package/dist/test/utils.test.d.ts.map +0 -1
- package/dist/test/utils.test.js +0 -86
- package/dist/test/utils.test.js.map +0 -1
- package/dist/test/vitest-setup.d.ts +0 -2
- package/dist/test/vitest-setup.d.ts.map +0 -1
- package/dist/test/vitest-setup.js +0 -5
- package/dist/test/vitest-setup.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -28
- package/dist/vitest.config.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,1945 @@
|
|
|
1
|
-
|
|
1
|
+
import { DocumentDriveAction, DocumentDriveDocument, DocumentDriveLocalState, FileNode, FolderNode, LegacyAddFileAction, ListenerCallInfo, ListenerFilter, PullResponderTriggerData, Trigger } from "@powerhousedao/shared/document-drive";
|
|
2
|
+
import * as document_model0 from "document-model";
|
|
3
|
+
import { Action, ActionContext, DocumentModelGlobalState, DocumentModelModule, DocumentOperations, GetDocumentOptions as GetDocumentOptions$1, Operation, PHBaseState, PHDocument, PHDocumentHeader, PHDocumentMeta, Reducer, ReducerOptions, SignalResult } from "@powerhousedao/shared/document-model";
|
|
4
|
+
import { gql } from "graphql-request";
|
|
5
|
+
import * as nanoevents from "nanoevents";
|
|
6
|
+
import { Unsubscribe } from "nanoevents";
|
|
7
|
+
import { pascalCase } from "change-case";
|
|
8
|
+
import { BuildSchemaOptions, GraphQLError, ParseOptions } from "graphql";
|
|
9
|
+
import * as document_drive0 from "document-drive";
|
|
10
|
+
import { AbortTask as AbortTask$1, ActionJob as ActionJob$1, AddOperationOptions as AddOperationOptions$1, BaseDocumentDriveServer as BaseDocumentDriveServer$1, CancelPullLoop as CancelPullLoop$1, CreateDocumentInput as CreateDocumentInput$1, DefaultRemoteDriveInfo as DefaultRemoteDriveInfo$1, DocumentDriveServerConstructor as DocumentDriveServerConstructor$1, DocumentDriveServerMixin as DocumentDriveServerMixin$1, DocumentDriveServerOptions as DocumentDriveServerOptions$1, DocumentGraphQLResult as DocumentGraphQLResult$1, DocumentJob as DocumentJob$1, DocumentModelNotFoundError as DocumentModelNotFoundError$1, DriveEvents as DriveEvents$1, DriveInfo as DriveInfo$1, DriveUpdateErrorHandler as DriveUpdateErrorHandler$1, ErrorStatus as ErrorStatus$1, GetDocumentModelModule as GetDocumentModelModule$1, GetStrandsOptions as GetStrandsOptions$1, GraphQLResult as GraphQLResult$1, HashAlgorithmsLegacy as HashAlgorithmsLegacy$1, IBaseDocumentDriveServer as IBaseDocumentDriveServer$1, IBaseRelationalDbLegacy as IBaseRelationalDbLegacy$1, ICache as ICache$1, ICacheStorage as ICacheStorage$1, ICacheStorageManager as ICacheStorageManager$1, IDefaultDrivesManager as IDefaultDrivesManager$1, IDocumentAdminStorage as IDocumentAdminStorage$1, IDocumentDriveServer as IDocumentDriveServer$1, IDocumentStorage as IDocumentStorage$1, IDriveOperationStorage as IDriveOperationStorage$1, IEventEmitter as IEventEmitter$1, IJob as IJob$1, IJobQueue as IJobQueue$1, IListenerManager as IListenerManager$1, IOperationResult as IOperationResult$1, IProcessorLegacy as IProcessorLegacy$1, IProcessorManagerLegacy as IProcessorManagerLegacy$1, IPullResponderTransmitter as IPullResponderTransmitter$1, IQueue as IQueue$1, IQueueManager as IQueueManager$1, IReadModeDriveServer as IReadModeDriveServer$1, IReadModeDriveService as IReadModeDriveService$1, IRelationalDbLegacy as IRelationalDbLegacy$1, IRelationalDbProcessorLegacy as IRelationalDbProcessorLegacy$1, IRelationalQueryBuilderLegacy as IRelationalQueryBuilderLegacy$1, IServerDelegate as IServerDelegate$1, IServerDelegateDrivesManager as IServerDelegateDrivesManager$1, IStorageUnit as IStorageUnit$1, IStorageUnitFilter as IStorageUnitFilter$1, ISyncUnitMap as ISyncUnitMap$1, ISynchronizationManager as ISynchronizationManager$1, ITransmitter as ITransmitter$1, ITransmitterFactory as ITransmitterFactory$1, InternalTransmitterUpdate as InternalTransmitterUpdate$1, Job as Job$1, JobId as JobId$1, LRUCacheStorageOptions as LRUCacheStorageOptions$1, ListenerManagerOptions as ListenerManagerOptions$1, ListenerRevision as ListenerRevision$1, ListenerRevisionWithError as ListenerRevisionWithError$1, ListenerState as ListenerState$1, ListenerUpdate as ListenerUpdate$1, OperationJob as OperationJob$1, OperationUpdate as OperationUpdate$1, ProcessorFactoryLegacy as ProcessorFactoryLegacy$1, PullResponderTrigger as PullResponderTrigger$1, QueueEvents as QueueEvents$1, ReadDocumentNotFoundError as ReadDocumentNotFoundError$1, ReadDrive as ReadDrive$1, ReadDriveContext as ReadDriveContext$1, ReadDriveNotFoundError as ReadDriveNotFoundError$1, ReadDriveOptions as ReadDriveOptions$1, ReadDriveSlugNotFoundError as ReadDriveSlugNotFoundError$1, RelationalDbProcessorClassLegacy as RelationalDbProcessorClassLegacy$1, RelationalDbProcessorFilterLegacy as RelationalDbProcessorFilterLegacy$1, RelationalDbProcessorLegacy as RelationalDbProcessorLegacy$1, RemoteDriveAccessLevel as RemoteDriveAccessLevel$1, RemoteDriveOptions as RemoteDriveOptions$1, ResolvedStorageUnitFilter as ResolvedStorageUnitFilter$1, RevisionsFilter as RevisionsFilter$1, RunAsap as RunAsap$1, ServerListener as ServerListener$1, SharingType as SharingType$1, StrandUpdate as StrandUpdate$1, StrandUpdateSource as StrandUpdateSource$1, SyncStatus as SyncStatus$1, SyncUnitStatusObject as SyncUnitStatusObject$1, SynchronizationUnit as SynchronizationUnit$1, SynchronizationUnitId as SynchronizationUnitId$1, SynchronizationUnitQuery as SynchronizationUnitQuery$1, Task as Task$1 } from "document-drive";
|
|
11
|
+
import { RedisClientType } from "redis";
|
|
12
|
+
import { IAnalyticsStore } from "@powerhousedao/analytics-engine-core";
|
|
13
|
+
import { ProcessorApp } from "@powerhousedao/shared/processors";
|
|
14
|
+
import { Kysely, QueryCreator } from "kysely";
|
|
15
|
+
import { Operation as Operation$1, Pick as Pick$1 } from "@prisma/client/runtime/library";
|
|
16
|
+
import { ExpectStatic } from "vitest";
|
|
17
|
+
export * from "@powerhousedao/shared/document-drive";
|
|
18
|
+
|
|
19
|
+
//#region src/cache/lru.d.ts
|
|
20
|
+
/**
|
|
21
|
+
* An implementation of a Least Recently Used (LRU) cache storage that evicts items
|
|
22
|
+
* based on their total size in bytes. This cache storage is designed to work with
|
|
23
|
+
* the InMemoryCache class to provide size-limited caching of documents and drives.
|
|
24
|
+
*
|
|
25
|
+
* When the cache reaches its maximum size limit, it automatically removes the least
|
|
26
|
+
* recently accessed items to make space for new ones. The size of each cached item
|
|
27
|
+
* is calculated using the provided sizeCalculation function (defaults to object-sizeof).
|
|
28
|
+
*
|
|
29
|
+
* @template Value - The type of values stored in the cache.
|
|
30
|
+
*/
|
|
31
|
+
declare class LRUCacheStorage<Value extends {}> implements ICacheStorage$1 {
|
|
32
|
+
private cache;
|
|
33
|
+
private logger;
|
|
34
|
+
constructor(options: LRUCacheStorageOptions$1);
|
|
35
|
+
get(key: string): Value | undefined;
|
|
36
|
+
set(key: string, value: Value): this;
|
|
37
|
+
delete(key: string): boolean;
|
|
38
|
+
clear(): void;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/cache/memory.d.ts
|
|
42
|
+
declare class CacheStorageManager implements ICacheStorageManager$1 {
|
|
43
|
+
private index;
|
|
44
|
+
private cache;
|
|
45
|
+
constructor(cache: ICacheStorage$1);
|
|
46
|
+
createStorage<Value>(): ICacheStorage$1<Value>;
|
|
47
|
+
}
|
|
48
|
+
declare class InMemoryCache implements ICache$1 {
|
|
49
|
+
private cache;
|
|
50
|
+
private cacheStorageManager;
|
|
51
|
+
private idToDocument;
|
|
52
|
+
private idToDrive;
|
|
53
|
+
private slugToDriveId;
|
|
54
|
+
constructor(cache?: ICacheStorage$1);
|
|
55
|
+
clear(): void;
|
|
56
|
+
setDocument(documentId: string, document: PHDocument): Promise<void>;
|
|
57
|
+
getDocument<TDocument extends PHDocument>(documentId: string): Promise<TDocument | undefined>;
|
|
58
|
+
deleteDocument(documentId: string): Promise<boolean>;
|
|
59
|
+
setDrive(driveId: string, drive: DocumentDriveDocument): Promise<void>;
|
|
60
|
+
getDrive(driveId: string): Promise<DocumentDriveDocument | undefined>;
|
|
61
|
+
deleteDrive(driveId: string): Promise<boolean>;
|
|
62
|
+
setDriveBySlug(slug: string, drive: DocumentDriveDocument): Promise<void>;
|
|
63
|
+
getDriveBySlug(slug: string): Promise<DocumentDriveDocument | undefined>;
|
|
64
|
+
deleteDriveBySlug(slug: string): Promise<boolean>;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/cache/redis.d.ts
|
|
68
|
+
declare class RedisCache implements ICache$1 {
|
|
69
|
+
private logger;
|
|
70
|
+
private redis;
|
|
71
|
+
private timeoutInSeconds;
|
|
72
|
+
constructor(redis: RedisClientType, timeoutInSeconds?: number | undefined);
|
|
73
|
+
private static _getDocumentKey;
|
|
74
|
+
private static _getDriveKey;
|
|
75
|
+
private static _getDriveBySlugKey;
|
|
76
|
+
setDocument(documentId: string, document: PHDocument): Promise<void>;
|
|
77
|
+
getDocument<TDocument extends PHDocument>(documentId: string): Promise<TDocument | undefined>;
|
|
78
|
+
deleteDocument(documentId: string): Promise<boolean>;
|
|
79
|
+
setDrive(driveId: string, drive: DocumentDriveDocument): Promise<void>;
|
|
80
|
+
getDrive(driveId: string): Promise<DocumentDriveDocument | undefined>;
|
|
81
|
+
deleteDrive(driveId: string): Promise<boolean>;
|
|
82
|
+
setDriveBySlug(slug: string, drive: DocumentDriveDocument): Promise<void>;
|
|
83
|
+
getDriveBySlug(slug: string): Promise<DocumentDriveDocument | undefined>;
|
|
84
|
+
deleteDriveBySlug(slug: string): Promise<boolean>;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/cache/types.d.ts
|
|
88
|
+
interface IDocumentCache {}
|
|
89
|
+
interface ICache {
|
|
90
|
+
setDocument(documentId: string, document: PHDocument): Promise<void>;
|
|
91
|
+
getDocument<TDocument extends PHDocument>(documentId: string): Promise<TDocument | undefined>;
|
|
92
|
+
deleteDocument(documentId: string): Promise<boolean>;
|
|
93
|
+
setDrive(driveId: string, drive: DocumentDriveDocument): Promise<void>;
|
|
94
|
+
setDriveBySlug(slug: string, drive: DocumentDriveDocument): Promise<void>;
|
|
95
|
+
getDrive(driveId: string): Promise<DocumentDriveDocument | undefined>;
|
|
96
|
+
getDriveBySlug(slug: string): Promise<DocumentDriveDocument | undefined>;
|
|
97
|
+
deleteDrive(driveId: string): Promise<boolean>;
|
|
98
|
+
deleteDriveBySlug(slug: string): Promise<boolean>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Options for configuring an LRU (Least Recently Used) cache storage.
|
|
102
|
+
*
|
|
103
|
+
* @property maxSize - The maximum size of the cache in bytes. This defines the upper limit
|
|
104
|
+
* on the total size of objects that can be stored in the cache.
|
|
105
|
+
* @property sizeCalculation - An optional function to calculate the size of an object in bytes.
|
|
106
|
+
* If not provided, a default method will be used to determine the size.
|
|
107
|
+
*/
|
|
108
|
+
interface LRUCacheStorageOptions {
|
|
109
|
+
maxSize: number;
|
|
110
|
+
sizeCalculation?: (object: unknown) => number;
|
|
111
|
+
}
|
|
112
|
+
interface ICacheStorage<Value = unknown> {
|
|
113
|
+
get(key: string): Value | undefined;
|
|
114
|
+
set(key: string, value: Value): this;
|
|
115
|
+
delete(key: string): boolean;
|
|
116
|
+
clear(): void;
|
|
117
|
+
}
|
|
118
|
+
interface ICacheStorageManager {
|
|
119
|
+
createStorage<Value extends {}>(): ICacheStorage<Value>;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/cache/util.d.ts
|
|
123
|
+
declare const trimResultingState: <TDocument extends PHDocument>(document: TDocument) => TDocument;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/processors/processor-manager.d.ts
|
|
126
|
+
declare class ProcessorManagerLegacy implements IProcessorManagerLegacy$1 {
|
|
127
|
+
private listeners;
|
|
128
|
+
private drive;
|
|
129
|
+
private readonly logger;
|
|
130
|
+
private processorsByDrive;
|
|
131
|
+
private idToFactory;
|
|
132
|
+
private identifierToListeners;
|
|
133
|
+
constructor(listeners: IListenerManager$1, drive: IDocumentDriveServer$1);
|
|
134
|
+
registerFactory(identifier: string, factory: ProcessorFactoryLegacy$1): Promise<void>;
|
|
135
|
+
unregisterFactory(identifier: string): Promise<void>;
|
|
136
|
+
registerDrive(driveId: string): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Creates processors for a specific (drive, identifier) pair.
|
|
139
|
+
*
|
|
140
|
+
* This should be called once and only once for each (drive, identifier),
|
|
141
|
+
* unless unregisterFactory is called, which will remove them.
|
|
142
|
+
*/
|
|
143
|
+
createProcessors(driveId: string, identifier: string, factory: ProcessorFactoryLegacy$1): Promise<void>;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/processors/relational.d.ts
|
|
147
|
+
declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
|
|
148
|
+
/**
|
|
149
|
+
* Base class for relational db processors that require a relational database storage.
|
|
150
|
+
* This class abstracts database initialization, migration management, and resource cleanup,
|
|
151
|
+
* allowing derived classes to focus on business logic.
|
|
152
|
+
*/
|
|
153
|
+
declare abstract class RelationalDbProcessorLegacy<TDatabaseSchema = unknown> implements IRelationalDbProcessorLegacy$1<TDatabaseSchema> {
|
|
154
|
+
protected _namespace: string;
|
|
155
|
+
protected _filter: RelationalDbProcessorFilterLegacy$1;
|
|
156
|
+
protected relationalDb: IRelationalDbLegacy$1<TDatabaseSchema>;
|
|
157
|
+
constructor(_namespace: string, _filter: RelationalDbProcessorFilterLegacy$1, relationalDb: IRelationalDbLegacy$1<TDatabaseSchema>);
|
|
158
|
+
static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
|
|
159
|
+
static is(p: unknown): p is RelationalDbProcessorLegacy;
|
|
160
|
+
/**
|
|
161
|
+
* Returns the namespace for a given drive id.
|
|
162
|
+
* This method can be overridden by derived classes to provide a custom namespace.
|
|
163
|
+
*/
|
|
164
|
+
static getNamespace(driveId: string): string;
|
|
165
|
+
static query<Schema>(this: RelationalDbProcessorClassLegacy$1<Schema>, driveId: string, db: IRelationalDbLegacy$1<any>): IRelationalQueryBuilderLegacy$1<Schema>;
|
|
166
|
+
/**
|
|
167
|
+
* Returns the filter for the processor.
|
|
168
|
+
* This method can be overridden by derived classes to provide a custom filter.
|
|
169
|
+
*/
|
|
170
|
+
get filter(): RelationalDbProcessorFilterLegacy$1;
|
|
171
|
+
/**
|
|
172
|
+
* Returns the namespace used by the processor.
|
|
173
|
+
*/
|
|
174
|
+
get namespace(): string;
|
|
175
|
+
get query(): IRelationalQueryBuilderLegacy$1<TDatabaseSchema>;
|
|
176
|
+
/**
|
|
177
|
+
* Abstract method that derived classes must implement.
|
|
178
|
+
* This method is meant to be called on subclasses to initialize and upgrade the database.
|
|
179
|
+
*/
|
|
180
|
+
abstract initAndUpgrade(): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Abstract method that derived classes must implement.
|
|
183
|
+
* This is where the business logic for processing document operations should be implemented.
|
|
184
|
+
*/
|
|
185
|
+
abstract onStrands(strands: InternalTransmitterUpdate$1[]): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Called when the processor is disconnected.
|
|
188
|
+
* This method is meant to be overridden by subclasses to clean up resources.
|
|
189
|
+
*/
|
|
190
|
+
abstract onDisconnect(): Promise<void>;
|
|
191
|
+
}
|
|
192
|
+
declare function isRelationalDbProcessor(p: IProcessorLegacy$1): p is IRelationalDbProcessorLegacy$1;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/processors/utils.d.ts
|
|
195
|
+
/**
|
|
196
|
+
* Hashes a string to a lowercase base-26 string.
|
|
197
|
+
* @param str The string to hash.
|
|
198
|
+
* @param length The length of the hash. Defaults to 10.
|
|
199
|
+
* @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
|
|
200
|
+
* @returns The hashed string.
|
|
201
|
+
*/
|
|
202
|
+
declare function hashNamespaceLegacy(str: string, length?: number, algorithm?: HashAlgorithmsLegacy$1): string;
|
|
203
|
+
/**
|
|
204
|
+
* Creates a RelationalDb instance with namespace support.
|
|
205
|
+
* @param baseDb The base RelationalDb instance to enhance.
|
|
206
|
+
* @param baseOptions The default options for namespace creation. Hashes namespace by default.
|
|
207
|
+
* @returns The enhanced RelationalDb instance.
|
|
208
|
+
*/
|
|
209
|
+
declare function createRelationalDbLegacy<Schema>(baseDb: IBaseRelationalDbLegacy$1<Schema>, baseOptions?: NamespaceOptions): IRelationalDbLegacy$1<Schema>;
|
|
210
|
+
type NamespaceOptions = {
|
|
211
|
+
hashNamespace?: boolean;
|
|
212
|
+
};
|
|
213
|
+
declare function createNamespacedDbLegacy<Schema>(db: IBaseRelationalDbLegacy$1<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDbLegacy$1<Schema>>;
|
|
214
|
+
declare function createNamespacedQueryBuilderLegacy<Schema>(db: IBaseRelationalDbLegacy$1<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilderLegacy$1<Schema>;
|
|
215
|
+
/**
|
|
216
|
+
* Returns a query builder for a RelationalDb instance.
|
|
217
|
+
* @param query The RelationalDb instance to convert.
|
|
218
|
+
* @returns The IRelationalQueryBuilder instance.
|
|
219
|
+
*/
|
|
220
|
+
declare function relationalDbToQueryBuilderLegacy<TSchema>(query: IBaseRelationalDbLegacy$1<TSchema>): IRelationalQueryBuilderLegacy$1<TSchema>;
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/processors/types.d.ts
|
|
223
|
+
type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
|
|
224
|
+
type IRelationalQueryBuilderLegacy<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
|
|
225
|
+
withSchema: (schema: string) => IRelationalQueryBuilderLegacy<Schema>;
|
|
226
|
+
};
|
|
227
|
+
type IBaseRelationalDbLegacy<Schema = unknown> = Kysely<Schema>;
|
|
228
|
+
/**
|
|
229
|
+
* The standardized relational database interface for relational db processors.
|
|
230
|
+
* This abstraction provides type-safe database operations while hiding the underlying
|
|
231
|
+
* database framework implementation details.
|
|
232
|
+
**/
|
|
233
|
+
type IRelationalDbLegacy<Schema = unknown> = IBaseRelationalDbLegacy<Schema> & {
|
|
234
|
+
createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDbLegacy<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
|
|
235
|
+
queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilderLegacy<NamespaceSchema>;
|
|
236
|
+
};
|
|
237
|
+
interface IProcessorHostModuleLegacy {
|
|
238
|
+
analyticsStore: IAnalyticsStore;
|
|
239
|
+
relationalDb: IRelationalDbLegacy;
|
|
240
|
+
processorApp: ProcessorApp;
|
|
241
|
+
config?: Map<string, unknown>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Describes an object that can process strands.
|
|
245
|
+
*/
|
|
246
|
+
interface IProcessorLegacy {
|
|
247
|
+
/**
|
|
248
|
+
* Processes a list of strands.
|
|
249
|
+
*
|
|
250
|
+
* @param strands The strands to process.
|
|
251
|
+
*/
|
|
252
|
+
onStrands(strands: InternalTransmitterUpdate$1[]): Promise<void>;
|
|
253
|
+
/**
|
|
254
|
+
* Called when the processor is disconnected. This is generally meant to
|
|
255
|
+
* clean up any resources that were allocated when the processor was created.
|
|
256
|
+
*/
|
|
257
|
+
onDisconnect(): Promise<void>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Relates a processor to a listener filter.
|
|
261
|
+
*/
|
|
262
|
+
type ProcessorRecordLegacy = {
|
|
263
|
+
processor: IProcessorLegacy;
|
|
264
|
+
filter: ListenerFilter;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* A factory function that returns a list of processor records for a given drive.
|
|
268
|
+
*
|
|
269
|
+
* @param driveHeader The drive header to create processors for.
|
|
270
|
+
* @returns A list of processor records.
|
|
271
|
+
*/
|
|
272
|
+
type ProcessorFactoryLegacy = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => ProcessorRecordLegacy[] | Promise<ProcessorRecordLegacy[]>;
|
|
273
|
+
/**
|
|
274
|
+
* Manages processor creation and destruction.
|
|
275
|
+
*/
|
|
276
|
+
interface IProcessorManagerLegacy {
|
|
277
|
+
/**
|
|
278
|
+
* Registers a processor factory for a given identifier. This will create
|
|
279
|
+
* processors for all drives that have already been registered.
|
|
280
|
+
*
|
|
281
|
+
* @param identifier Any identifier to associate with the factory.
|
|
282
|
+
* @param factory The factory to register.
|
|
283
|
+
*/
|
|
284
|
+
registerFactory(identifier: string, factory: ProcessorFactoryLegacy): Promise<void>;
|
|
285
|
+
/**
|
|
286
|
+
* Unregisters a processor factory for a given identifier. This will remove
|
|
287
|
+
* all listeners that were created by the factory.
|
|
288
|
+
*
|
|
289
|
+
* @param identifier The identifier to unregister.
|
|
290
|
+
*/
|
|
291
|
+
unregisterFactory(identifier: string): Promise<void>;
|
|
292
|
+
/**
|
|
293
|
+
* Registers a drive with the processor manager. This will create processors
|
|
294
|
+
* for the drive for all factories that have already been registered.
|
|
295
|
+
*
|
|
296
|
+
* @param driveId The drive to register.
|
|
297
|
+
*/
|
|
298
|
+
registerDrive(driveId: string): Promise<void>;
|
|
299
|
+
}
|
|
300
|
+
type RelationalDbProcessorFilterLegacy = ListenerFilter;
|
|
301
|
+
interface IRelationalDbProcessorLegacy<TDatabaseSchema = unknown> extends IProcessorLegacy {
|
|
302
|
+
namespace: string;
|
|
303
|
+
query: IRelationalQueryBuilderLegacy<TDatabaseSchema>;
|
|
304
|
+
filter: RelationalDbProcessorFilterLegacy;
|
|
305
|
+
initAndUpgrade(): Promise<void>;
|
|
306
|
+
}
|
|
307
|
+
type ExtractProcessorSchema<TProcessor> = TProcessor extends RelationalDbProcessorLegacy$1<infer TSchema> ? TSchema : never;
|
|
308
|
+
type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessorLegacy$1<infer TSchema> ? TSchema : TProcessor;
|
|
309
|
+
type RelationalDbProcessorClassLegacy<TSchema> = typeof RelationalDbProcessorLegacy$1<TSchema>;
|
|
310
|
+
type HashAlgorithmsLegacy = "fnv1a";
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/queue/base.d.ts
|
|
313
|
+
declare class MemoryQueue<T> implements IQueue$1<T> {
|
|
314
|
+
private id;
|
|
315
|
+
private running;
|
|
316
|
+
private deleted;
|
|
317
|
+
private items;
|
|
318
|
+
private dependencies;
|
|
319
|
+
constructor(id: string);
|
|
320
|
+
isRunning(): Promise<boolean>;
|
|
321
|
+
setRunning(running: boolean): Promise<void>;
|
|
322
|
+
setDeleted(deleted: boolean): Promise<void>;
|
|
323
|
+
isDeleted(): Promise<boolean>;
|
|
324
|
+
addJob(data: IJob$1<T>): Promise<void>;
|
|
325
|
+
getNextJob(): Promise<IJob$1<T> | undefined>;
|
|
326
|
+
amountOfJobs(): Promise<number>;
|
|
327
|
+
getId(): string;
|
|
328
|
+
isBlocked(): Promise<boolean>;
|
|
329
|
+
getJobs(): Promise<IJob$1<T>[]>;
|
|
330
|
+
addDependency(job: IJob$1<Job$1>): Promise<void>;
|
|
331
|
+
removeDependency(job: IJob$1<Job$1>): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/queue/event.d.ts
|
|
335
|
+
interface EnqueuedJob {
|
|
336
|
+
jobId: string;
|
|
337
|
+
documentId: string;
|
|
338
|
+
scope: string;
|
|
339
|
+
timestampUtcMs: string;
|
|
340
|
+
}
|
|
341
|
+
declare class EventQueueManager implements IQueueManager$1 {
|
|
342
|
+
protected logger: document_model0.ILogger;
|
|
343
|
+
protected emitter: nanoevents.Emitter<QueueEvents$1>;
|
|
344
|
+
protected queues: Map<string, Map<string, IJobQueue$1>>;
|
|
345
|
+
protected globalQueue: EnqueuedJob[];
|
|
346
|
+
protected isFindingJob: boolean;
|
|
347
|
+
protected maxWorkers: number;
|
|
348
|
+
protected workers: number;
|
|
349
|
+
protected runningJobs: IJob$1<Job$1>[];
|
|
350
|
+
protected timeout: number;
|
|
351
|
+
protected delegate: IServerDelegate$1 | undefined;
|
|
352
|
+
protected onError: ((error: Error) => void) | undefined;
|
|
353
|
+
constructor(maxWorkers?: number, timeout?: number);
|
|
354
|
+
init(delegate: IServerDelegate$1, onError: (error: Error) => void): Promise<void>;
|
|
355
|
+
addJob(job: Job$1): Promise<JobId$1>;
|
|
356
|
+
getQueue(documentId: string, scope: string): IJobQueue$1;
|
|
357
|
+
getDocumentQueues(documentId: string): Map<string, IJobQueue$1> | undefined;
|
|
358
|
+
removeQueue(documentId: string, scope: string): boolean | undefined;
|
|
359
|
+
removeDocumentQueues(documentId: string): void;
|
|
360
|
+
protected removeJob(job: IJob$1<Job$1>): void;
|
|
361
|
+
protected handleJobCompleted(job: IJob$1<Job$1>, result: IOperationResult$1): Promise<void>;
|
|
362
|
+
protected isBusy(): boolean;
|
|
363
|
+
protected processNextJob(): Promise<void>;
|
|
364
|
+
protected findNextJob(): Promise<{
|
|
365
|
+
queue: IJobQueue$1;
|
|
366
|
+
job: IJob$1<Job$1>;
|
|
367
|
+
} | undefined>;
|
|
368
|
+
protected emit<K extends keyof QueueEvents$1>(event: K, ...args: Parameters<QueueEvents$1[K]>): void;
|
|
369
|
+
on<K extends keyof QueueEvents$1>(event: K, cb: QueueEvents$1[K]): Unsubscribe;
|
|
370
|
+
}
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/queue/utils.d.ts
|
|
373
|
+
declare function isDocumentJob(job: Job$1): job is DocumentJob$1;
|
|
374
|
+
declare function isOperationJob(job: Job$1): job is OperationJob$1;
|
|
375
|
+
declare function isActionJob(job: Job$1): job is ActionJob$1;
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/queue/types.d.ts
|
|
378
|
+
interface BaseJob {
|
|
379
|
+
documentId: string;
|
|
380
|
+
actions?: Action[];
|
|
381
|
+
options?: AddOperationOptions$1;
|
|
382
|
+
}
|
|
383
|
+
interface DocumentJob extends Omit<BaseJob, "actions"> {
|
|
384
|
+
documentType: string;
|
|
385
|
+
header?: Partial<PHDocumentHeader>;
|
|
386
|
+
initialState?: Partial<PHBaseState>;
|
|
387
|
+
}
|
|
388
|
+
interface OperationJob extends BaseJob {
|
|
389
|
+
operations: Operation[];
|
|
390
|
+
}
|
|
391
|
+
interface ActionJob extends BaseJob {
|
|
392
|
+
actions: Action[];
|
|
393
|
+
}
|
|
394
|
+
type Job = DocumentJob | OperationJob | ActionJob;
|
|
395
|
+
type JobId = string;
|
|
396
|
+
interface QueueEvents {
|
|
397
|
+
jobAdded: (job: IJob<Job>) => void;
|
|
398
|
+
jobStarted: (job: IJob<Job>) => void;
|
|
399
|
+
jobCompleted: (job: IJob<Job>, result: IOperationResult$1) => void;
|
|
400
|
+
jobFailed: (job: IJob<Job>, error: Error) => void;
|
|
401
|
+
queueRemoved: (queue: {
|
|
402
|
+
documentId: string;
|
|
403
|
+
scope: string;
|
|
404
|
+
}) => void;
|
|
405
|
+
}
|
|
406
|
+
interface IServerDelegate {
|
|
407
|
+
exists: (documentId: string) => Promise<boolean>;
|
|
408
|
+
processJob: (job: Job) => Promise<IOperationResult$1>;
|
|
409
|
+
}
|
|
410
|
+
interface IQueueManager {
|
|
411
|
+
addJob: (job: Job) => Promise<JobId>;
|
|
412
|
+
init: (delegate: IServerDelegate, onError: (error: Error) => void) => Promise<void>;
|
|
413
|
+
on: <K extends keyof QueueEvents>(this: this, event: K, cb: QueueEvents[K]) => Unsubscribe;
|
|
414
|
+
}
|
|
415
|
+
type IJob<T> = {
|
|
416
|
+
jobId: JobId;
|
|
417
|
+
} & T;
|
|
418
|
+
interface IQueue<T> {
|
|
419
|
+
addJob(data: IJob<T>): Promise<void>;
|
|
420
|
+
getNextJob(): Promise<IJob<T> | undefined>;
|
|
421
|
+
amountOfJobs(): Promise<number>;
|
|
422
|
+
getId(): string;
|
|
423
|
+
isBlocked(): Promise<boolean>;
|
|
424
|
+
isDeleted(): Promise<boolean>;
|
|
425
|
+
isRunning(): Promise<boolean>;
|
|
426
|
+
setDeleted(deleted: boolean): Promise<void>;
|
|
427
|
+
setRunning(running: boolean): Promise<void>;
|
|
428
|
+
getJobs(): Promise<IJob<T>[]>;
|
|
429
|
+
addDependency: (job: IJob<Job>) => Promise<void>;
|
|
430
|
+
removeDependency: (job: IJob<Job>) => Promise<void>;
|
|
431
|
+
}
|
|
432
|
+
type IJobQueue = IQueue<Job>;
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region src/read-mode/errors.d.ts
|
|
435
|
+
declare abstract class ReadDriveError extends Error {}
|
|
436
|
+
declare class ReadDriveNotFoundError extends ReadDriveError {
|
|
437
|
+
constructor(driveId: string);
|
|
438
|
+
}
|
|
439
|
+
declare class ReadDriveSlugNotFoundError extends ReadDriveError {
|
|
440
|
+
constructor(slug: string);
|
|
441
|
+
}
|
|
442
|
+
declare class ReadDocumentNotFoundError extends ReadDriveError {
|
|
443
|
+
constructor(drive: string, id: string);
|
|
444
|
+
}
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/read-mode/server.d.ts
|
|
447
|
+
declare function ReadModeServer(Base: DocumentDriveServerConstructor$1): new (...args: ConstructorParameters<typeof Base>) => InstanceType<typeof Base> & IReadModeDriveServer$1;
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/read-mode/types.d.ts
|
|
450
|
+
type ReadModeDriveServerMixin = DocumentDriveServerMixin$1<IReadModeDriveServer>;
|
|
451
|
+
type ReadDrivesListener = (drives: ReadDrive[], operation: "add" | "delete") => void;
|
|
452
|
+
type ReadDrivesListenerUnsubscribe = () => void;
|
|
453
|
+
interface IReadModeDriveServer extends IReadModeDriveService {
|
|
454
|
+
migrateReadDrive(id: string, options: RemoteDriveOptions$1): Promise<DocumentDriveDocument | ReadDriveNotFoundError$1>;
|
|
455
|
+
onReadDrivesUpdate(listener: ReadDrivesListener): Promise<ReadDrivesListenerUnsubscribe>;
|
|
456
|
+
}
|
|
457
|
+
type ReadDriveOptions = {
|
|
458
|
+
expectedDriveInfo?: DriveInfo$1;
|
|
459
|
+
filter?: ListenerFilter;
|
|
460
|
+
};
|
|
461
|
+
type ReadDriveContext = {
|
|
462
|
+
url: string;
|
|
463
|
+
} & ReadDriveOptions;
|
|
464
|
+
type ReadDrive = DocumentDriveDocument & {
|
|
465
|
+
readContext: ReadDriveContext;
|
|
466
|
+
};
|
|
467
|
+
interface IReadModeDriveService {
|
|
468
|
+
addReadDrive(url: string, options?: ReadDriveOptions): Promise<void>;
|
|
469
|
+
getReadDrives(): Promise<string[]>;
|
|
470
|
+
getReadDriveBySlug(slug: string): Promise<ReadDrive | ReadDriveSlugNotFoundError$1>;
|
|
471
|
+
getReadDrive(id: string): Promise<ReadDrive | ReadDriveNotFoundError$1>;
|
|
472
|
+
getReadDriveContext(id: string): Promise<ReadDriveContext | ReadDriveNotFoundError$1>;
|
|
473
|
+
fetchDrive(id: string): Promise<ReadDrive | ReadDriveNotFoundError$1>;
|
|
474
|
+
fetchDocument<TState extends PHBaseState = PHBaseState>(driveId: string, documentId: string, documentType: string): Promise<PHDocument<TState> | DocumentModelNotFoundError$1 | ReadDriveNotFoundError$1 | ReadDocumentNotFoundError$1>;
|
|
475
|
+
deleteReadDrive(id: string): Promise<ReadDriveNotFoundError$1 | undefined>;
|
|
476
|
+
}
|
|
477
|
+
type GetDocumentModelModule = (documentType: string) => DocumentModelModule<any>;
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/utils/types.d.ts
|
|
480
|
+
type DriveState = DriveInfo & Pick$1<DocumentDriveLocalState, "availableOffline" | "sharingType"> & {
|
|
481
|
+
nodes: Array<FolderNode | Omit<FileNode, "synchronizationUnits">>;
|
|
482
|
+
};
|
|
483
|
+
type DocumentGraphQLResult<TState extends PHBaseState = PHBaseState> = PHDocument<TState> & {
|
|
484
|
+
revision: number;
|
|
485
|
+
state: TState;
|
|
486
|
+
initialState: TState;
|
|
487
|
+
operations: (Operation$1 & {
|
|
488
|
+
inputText: string;
|
|
489
|
+
})[];
|
|
490
|
+
};
|
|
491
|
+
type GraphQLResult<T> = { [K in keyof T]: T[K] | null } & {
|
|
492
|
+
errors?: GraphQLError[];
|
|
493
|
+
};
|
|
494
|
+
type DriveInfo = {
|
|
495
|
+
id: string;
|
|
496
|
+
name: string;
|
|
497
|
+
slug: string;
|
|
498
|
+
icon?: string;
|
|
499
|
+
meta?: {
|
|
500
|
+
preferredEditor?: string;
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
interface IServerDelegateDrivesManager {
|
|
504
|
+
emit: (...args: Parameters<DriveEvents$1["defaultRemoteDrive"]>) => void;
|
|
505
|
+
detachDrive: (driveId: string) => Promise<void>;
|
|
506
|
+
}
|
|
507
|
+
interface IDefaultDrivesManager {
|
|
508
|
+
initializeDefaultRemoteDrives(): Promise<void>;
|
|
509
|
+
getDefaultRemoteDrives(): Map<string, DefaultRemoteDriveInfo$1>;
|
|
510
|
+
setDefaultDriveAccessLevel(url: string, level: RemoteDriveAccessLevel$1): Promise<void>;
|
|
511
|
+
setAllDefaultDrivesAccessLevel(level: RemoteDriveAccessLevel$1): Promise<void>;
|
|
512
|
+
}
|
|
513
|
+
type Task<T = void> = () => T;
|
|
514
|
+
type AbortTask = () => void;
|
|
515
|
+
type RunAsap<T> = (task: Task<T>) => AbortTask;
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/server/error.d.ts
|
|
518
|
+
declare class DocumentModelNotFoundError extends Error {
|
|
519
|
+
id: string;
|
|
520
|
+
constructor(id: string, cause?: unknown);
|
|
521
|
+
}
|
|
522
|
+
declare class OperationError extends Error {
|
|
523
|
+
status: ErrorStatus$1;
|
|
524
|
+
operation: Operation | undefined;
|
|
525
|
+
constructor(status: ErrorStatus$1, operation?: Operation, message?: string, cause?: unknown);
|
|
526
|
+
}
|
|
527
|
+
declare class ConflictOperationError extends OperationError {
|
|
528
|
+
constructor(existingOperation: Operation, newOperation: Operation);
|
|
529
|
+
}
|
|
530
|
+
declare class MissingOperationError extends OperationError {
|
|
531
|
+
constructor(index: number, operation: Operation);
|
|
532
|
+
}
|
|
533
|
+
declare enum DocumentAlreadyExistsReason {
|
|
534
|
+
ID = "id",
|
|
535
|
+
SLUG = "slug"
|
|
536
|
+
}
|
|
537
|
+
declare class DocumentAlreadyExistsError extends Error {
|
|
538
|
+
documentId: string;
|
|
539
|
+
constructor(documentId: string, reason?: DocumentAlreadyExistsReason);
|
|
540
|
+
}
|
|
541
|
+
declare class DocumentNotFoundError extends Error {
|
|
542
|
+
documentId: string;
|
|
543
|
+
constructor(documentId: string);
|
|
544
|
+
}
|
|
545
|
+
declare class SynchronizationUnitNotFoundError extends Error {
|
|
546
|
+
syncUnitId: SynchronizationUnitId$1;
|
|
547
|
+
constructor(syncUnitId: SynchronizationUnitId$1);
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/server/transmitter/types.d.ts
|
|
551
|
+
type StrandUpdateSource = {
|
|
552
|
+
type: "local";
|
|
553
|
+
} | {
|
|
554
|
+
type: "trigger";
|
|
555
|
+
trigger: Trigger;
|
|
556
|
+
};
|
|
557
|
+
interface ITransmitter {
|
|
558
|
+
transmit?(strands: StrandUpdate$1[], source: StrandUpdateSource): Promise<ListenerRevision$1[]>;
|
|
559
|
+
disconnect?(): Promise<void>;
|
|
560
|
+
}
|
|
561
|
+
interface InternalTransmitterService extends ITransmitter {
|
|
562
|
+
getName(): string;
|
|
563
|
+
}
|
|
564
|
+
type PullResponderTrigger = Omit<Trigger, "data" | "type"> & {
|
|
565
|
+
driveId: string;
|
|
566
|
+
filter: ListenerFilter;
|
|
567
|
+
data: PullResponderTriggerData;
|
|
568
|
+
type: "PullResponder";
|
|
569
|
+
};
|
|
570
|
+
type InternalOperationUpdate<TState extends PHBaseState = PHBaseState> = Omit<Operation, "scope"> & {
|
|
571
|
+
state: TState;
|
|
572
|
+
previousState: TState;
|
|
573
|
+
};
|
|
574
|
+
type InternalTransmitterUpdate = {
|
|
575
|
+
document: PHDocument;
|
|
576
|
+
driveId: string;
|
|
577
|
+
documentId: string;
|
|
578
|
+
documentType: string;
|
|
579
|
+
scope: string;
|
|
580
|
+
branch: string;
|
|
581
|
+
operations: InternalOperationUpdate[];
|
|
582
|
+
state: any;
|
|
583
|
+
};
|
|
584
|
+
type OperationUpdateGraphQL = Omit<OperationUpdate$1, "input"> & {
|
|
585
|
+
input: string;
|
|
586
|
+
};
|
|
587
|
+
type PullStrandsGraphQL = {
|
|
588
|
+
system: {
|
|
589
|
+
sync: {
|
|
590
|
+
strands: StrandUpdateGraphQL[];
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
type CancelPullLoop = () => void;
|
|
595
|
+
type StrandUpdateGraphQL = Omit<StrandUpdate$1, "operations"> & {
|
|
596
|
+
operations: OperationUpdateGraphQL[];
|
|
597
|
+
};
|
|
598
|
+
interface IPullResponderTransmitter extends ITransmitter {
|
|
599
|
+
getStrands(options?: GetStrandsOptions$1): Promise<StrandUpdate$1[]>;
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/server/types.d.ts
|
|
603
|
+
type Constructor<T = object> = new (...args: any[]) => T;
|
|
604
|
+
type Mixin<T extends Constructor, I> = T & Constructor<InstanceType<T> & I>;
|
|
605
|
+
type DriveInput = {
|
|
606
|
+
global: {
|
|
607
|
+
name: string;
|
|
608
|
+
icon?: string | null;
|
|
609
|
+
};
|
|
610
|
+
id?: string;
|
|
611
|
+
slug?: string;
|
|
612
|
+
preferredEditor?: string;
|
|
613
|
+
local?: Partial<DocumentDriveLocalState>;
|
|
614
|
+
};
|
|
615
|
+
type RemoteDriveAccessLevel = "READ" | "WRITE";
|
|
616
|
+
type RemoteDriveOptions = DocumentDriveLocalState & {
|
|
617
|
+
pullFilter?: ListenerFilter;
|
|
618
|
+
pullInterval?: number;
|
|
619
|
+
expectedDriveInfo?: DriveInfo;
|
|
620
|
+
accessLevel?: RemoteDriveAccessLevel;
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* @deprecated In the future we will disallow this. Use the header field instead.
|
|
624
|
+
*/
|
|
625
|
+
type LegacyCreateDocumentInput = {
|
|
626
|
+
/**
|
|
627
|
+
* @deprecated In the future we will disallow this. Use the header field instead.
|
|
628
|
+
*/
|
|
629
|
+
id: string;
|
|
630
|
+
documentType: string;
|
|
631
|
+
};
|
|
632
|
+
type CreateDocumentInputWithDocument<TDocument extends PHDocument> = {
|
|
633
|
+
document: TDocument;
|
|
634
|
+
};
|
|
635
|
+
type CreateDocumentInputWithHeader = {
|
|
636
|
+
header: PHDocumentHeader;
|
|
637
|
+
};
|
|
638
|
+
type CreateDocumentInputWithDocumentType = {
|
|
639
|
+
documentType: string;
|
|
640
|
+
};
|
|
641
|
+
type CreateDocumentInput<TDocument extends PHDocument> = LegacyCreateDocumentInput | CreateDocumentInputWithDocument<TDocument> | CreateDocumentInputWithHeader | CreateDocumentInputWithDocumentType;
|
|
642
|
+
type IOperationResult<TDocument extends PHDocument = PHDocument> = {
|
|
643
|
+
status: UpdateStatus;
|
|
644
|
+
error?: OperationError;
|
|
645
|
+
operations: Operation[];
|
|
646
|
+
document: TDocument | undefined;
|
|
647
|
+
signals: SignalResult[];
|
|
648
|
+
};
|
|
649
|
+
type DriveOperationResult = IOperationResult<DocumentDriveDocument>;
|
|
650
|
+
type SynchronizationUnitId = {
|
|
651
|
+
documentId: string;
|
|
652
|
+
scope: string;
|
|
653
|
+
branch: string;
|
|
654
|
+
};
|
|
655
|
+
type SynchronizationUnit = SynchronizationUnitId & {
|
|
656
|
+
documentType: string;
|
|
657
|
+
lastUpdated: string;
|
|
658
|
+
revision: number;
|
|
659
|
+
};
|
|
660
|
+
type SynchronizationUnitQuery = Omit<SynchronizationUnit, "revision" | "lastUpdated">;
|
|
661
|
+
type ServerListener = {
|
|
662
|
+
driveId: string;
|
|
663
|
+
listenerId: string;
|
|
664
|
+
label?: string;
|
|
665
|
+
block: boolean;
|
|
666
|
+
system: boolean;
|
|
667
|
+
filter: ListenerFilter;
|
|
668
|
+
callInfo?: ListenerCallInfo;
|
|
669
|
+
transmitter?: ITransmitter;
|
|
670
|
+
};
|
|
671
|
+
type CreateListenerInput = {
|
|
672
|
+
driveId: string;
|
|
673
|
+
label?: string;
|
|
674
|
+
block: boolean;
|
|
675
|
+
system: boolean;
|
|
676
|
+
filter: ListenerFilter;
|
|
677
|
+
callInfo?: ListenerCallInfo;
|
|
678
|
+
};
|
|
679
|
+
declare enum ServerTransmitterType {
|
|
680
|
+
Internal = 0,
|
|
681
|
+
SwitchboardPush = 1,
|
|
682
|
+
PullResponder = 2,
|
|
683
|
+
SecureConnect = 3,
|
|
684
|
+
MatrixConnect = 4,
|
|
685
|
+
RESTWebhook = 5
|
|
686
|
+
}
|
|
687
|
+
type ListenerRevision = {
|
|
688
|
+
driveId: string;
|
|
689
|
+
documentId: string;
|
|
690
|
+
documentType: string;
|
|
691
|
+
scope: string;
|
|
692
|
+
branch: string;
|
|
693
|
+
status: UpdateStatus;
|
|
694
|
+
revision: number;
|
|
695
|
+
error?: string;
|
|
696
|
+
};
|
|
697
|
+
type ListenerRevisionWithError = Omit<ListenerRevision, "error"> & {
|
|
698
|
+
error?: Error;
|
|
699
|
+
};
|
|
700
|
+
type ListenerUpdate = {
|
|
701
|
+
listenerId: string;
|
|
702
|
+
listenerRevisions: ListenerRevision[];
|
|
703
|
+
};
|
|
704
|
+
type UpdateStatus = "SUCCESS" | "CONFLICT" | "MISSING" | "ERROR";
|
|
705
|
+
type ErrorStatus = Exclude<UpdateStatus, "SUCCESS">;
|
|
706
|
+
type OperationUpdate = {
|
|
707
|
+
actionId: string;
|
|
708
|
+
timestampUtcMs: string;
|
|
709
|
+
index: number;
|
|
710
|
+
skip: number;
|
|
711
|
+
type: string;
|
|
712
|
+
input: object;
|
|
713
|
+
hash: string;
|
|
714
|
+
context?: ActionContext;
|
|
715
|
+
id?: string;
|
|
716
|
+
};
|
|
717
|
+
type StrandUpdate = {
|
|
718
|
+
driveId: string;
|
|
719
|
+
documentId: string;
|
|
720
|
+
documentType: string;
|
|
721
|
+
scope: string;
|
|
722
|
+
branch: string;
|
|
723
|
+
operations: OperationUpdate[];
|
|
724
|
+
};
|
|
725
|
+
type SyncStatus = "INITIAL_SYNC" | "SYNCING" | UpdateStatus;
|
|
726
|
+
type PullSyncStatus = SyncStatus;
|
|
727
|
+
type PushSyncStatus = SyncStatus;
|
|
728
|
+
type SyncUnitStatusObject = {
|
|
729
|
+
push?: PushSyncStatus;
|
|
730
|
+
pull?: PullSyncStatus;
|
|
731
|
+
};
|
|
732
|
+
type AddRemoteDriveStatus = "SUCCESS" | "ERROR" | "PENDING" | "ADDING" | "ALREADY_ADDED";
|
|
733
|
+
interface DriveEvents {
|
|
734
|
+
syncStatus: (driveId: string, status: SyncStatus, error?: Error, syncUnitStatus?: SyncUnitStatusObject, scope?: string, branch?: string) => void;
|
|
735
|
+
defaultRemoteDrive: (status: AddRemoteDriveStatus, defaultDrives: Map<string, DefaultRemoteDriveInfo>, driveInput: DefaultRemoteDriveInput, driveId?: string, driveName?: string, error?: Error) => void;
|
|
736
|
+
strandUpdate: (update: StrandUpdate) => void;
|
|
737
|
+
clientStrandsError: (driveId: string, trigger: Trigger, status: number, errorMessage: string) => void;
|
|
738
|
+
documentModelModules: (documentModelModules: DocumentModelModule[]) => void;
|
|
739
|
+
driveAdded: (drive: DocumentDriveDocument) => void;
|
|
740
|
+
driveDeleted: (driveId: string) => void;
|
|
741
|
+
documentAdded: (document: PHDocument) => void;
|
|
742
|
+
documentDeleted: (documentId: string) => void;
|
|
743
|
+
documentOperationsAdded: (documentId: string, operations: Operation[]) => void;
|
|
744
|
+
driveOperationsAdded: (driveId: string, operations: Operation[]) => void;
|
|
745
|
+
operationsAdded: (documentId: string, operations: Operation[]) => void;
|
|
746
|
+
}
|
|
747
|
+
type PartialRecord<K extends keyof any, T> = { [P in K]?: T };
|
|
748
|
+
type RevisionsFilter = PartialRecord<string, number>;
|
|
749
|
+
type GetDocumentOptions = ReducerOptions & {
|
|
750
|
+
revisions?: RevisionsFilter;
|
|
751
|
+
checkHashes?: boolean;
|
|
752
|
+
};
|
|
753
|
+
type AddOperationOptions = {
|
|
754
|
+
forceSync?: boolean;
|
|
755
|
+
source?: StrandUpdateSource;
|
|
756
|
+
};
|
|
757
|
+
type DefaultRemoteDriveInput = {
|
|
758
|
+
url: string;
|
|
759
|
+
options: RemoteDriveOptions;
|
|
760
|
+
};
|
|
761
|
+
type DefaultRemoteDriveInfo = DefaultRemoteDriveInput & {
|
|
762
|
+
status: AddRemoteDriveStatus;
|
|
763
|
+
metadata?: DriveInfo;
|
|
764
|
+
};
|
|
765
|
+
type RemoveDriveStrategy = "remove" | "detach";
|
|
766
|
+
/**
|
|
767
|
+
* Options for removing old remote drives.
|
|
768
|
+
*
|
|
769
|
+
* Allows specifying different strategies for handling old remote drives:
|
|
770
|
+
*
|
|
771
|
+
* - `remove-all`: Remove all remote drives.
|
|
772
|
+
* - `preserve-all`: Preserve all remote drives (this is the default behavior).
|
|
773
|
+
* - `remove-by-id`: Remove the remote drives specified by their IDs.
|
|
774
|
+
* - `remove-by-url`: Remove the remote drives specified by their URLs.
|
|
775
|
+
* - `preserve-by-id`: Preserve remote drives by their IDs and remove the rest.
|
|
776
|
+
* - `preserve-by-url`: Preserve remote drives by their URLs and remove the rest.
|
|
777
|
+
* - `detach-by-id`: Detach remote drives by their IDs (changes the remote drive to a local drive).
|
|
778
|
+
* - `detach-by-url`: Detach remote drives by their URLs (changes the remote drive to a local drive).
|
|
779
|
+
* - `preserve-by-id-and-detach`: Preserve the remote drives specified by their IDs and detach the rest.
|
|
780
|
+
* - `preserve-by-url-and-detach`: Preserve the remote drives specified by their URLs and detach the rest.
|
|
781
|
+
*
|
|
782
|
+
* Each strategy is represented by an object with a `strategy` property and,
|
|
783
|
+
* depending on the strategy, additional properties such as `ids` or `urls`.
|
|
784
|
+
*/
|
|
785
|
+
type RemoveOldRemoteDrivesOption = {
|
|
786
|
+
strategy: "remove-all";
|
|
787
|
+
} | {
|
|
788
|
+
strategy: "preserve-all";
|
|
789
|
+
} | {
|
|
790
|
+
strategy: "remove-by-id";
|
|
791
|
+
ids: string[];
|
|
792
|
+
} | {
|
|
793
|
+
strategy: "remove-by-url";
|
|
794
|
+
urls: string[];
|
|
795
|
+
} | {
|
|
796
|
+
strategy: "preserve-by-id";
|
|
797
|
+
ids: string[];
|
|
798
|
+
} | {
|
|
799
|
+
strategy: "preserve-by-url";
|
|
800
|
+
urls: string[];
|
|
801
|
+
} | {
|
|
802
|
+
strategy: "detach-by-id";
|
|
803
|
+
ids: string[];
|
|
804
|
+
} | {
|
|
805
|
+
strategy: "detach-by-url";
|
|
806
|
+
urls: string[];
|
|
807
|
+
} | {
|
|
808
|
+
strategy: "preserve-by-id-and-detach";
|
|
809
|
+
ids: string[];
|
|
810
|
+
} | {
|
|
811
|
+
strategy: "preserve-by-url-and-detach";
|
|
812
|
+
urls: string[];
|
|
813
|
+
};
|
|
814
|
+
type DocumentDriveServerOptions = {
|
|
815
|
+
defaultDrives?: {
|
|
816
|
+
loadOnInit?: boolean;
|
|
817
|
+
remoteDrives?: Array<DefaultRemoteDriveInput>;
|
|
818
|
+
removeOldRemoteDrives?: RemoveOldRemoteDrivesOption;
|
|
819
|
+
};
|
|
820
|
+
taskQueueMethod?: RunAsap<unknown> | null;
|
|
821
|
+
listenerManager?: ListenerManagerOptions;
|
|
822
|
+
jwtHandler?: (driveUrl: string, address: string | undefined, refresh?: boolean) => Promise<string>;
|
|
823
|
+
featureFlags?: {
|
|
824
|
+
enableDualActionCreate?: boolean;
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
type GetStrandsOptions = {
|
|
828
|
+
limit?: number;
|
|
829
|
+
since?: string;
|
|
830
|
+
fromRevision?: number;
|
|
831
|
+
};
|
|
832
|
+
type ListenerManagerOptions = {
|
|
833
|
+
sequentialUpdates?: boolean;
|
|
834
|
+
};
|
|
835
|
+
interface IBaseDocumentDriveServer {
|
|
836
|
+
initialize(): Promise<Error[] | null>;
|
|
837
|
+
get listeners(): IListenerManager;
|
|
838
|
+
setDocumentModelModules(models: DocumentModelModule<any>[]): void;
|
|
839
|
+
getDrives(): Promise<string[]>;
|
|
840
|
+
getDrivesSlugs(): Promise<string[]>;
|
|
841
|
+
addDrive(input: DriveInput, preferredEditor?: string): Promise<DocumentDriveDocument>;
|
|
842
|
+
addRemoteDrive(url: string, options: RemoteDriveOptions): Promise<DocumentDriveDocument>;
|
|
843
|
+
deleteDrive(driveId: string): Promise<void>;
|
|
844
|
+
getDrive(driveId: string, options?: GetDocumentOptions): Promise<DocumentDriveDocument>;
|
|
845
|
+
getDriveBySlug(slug: string): Promise<DocumentDriveDocument>;
|
|
846
|
+
getDriveIdBySlug(slug: string): Promise<DocumentDriveDocument["header"]["id"]>;
|
|
847
|
+
addDocument<TDocument extends PHDocument>(input: TDocument, meta?: PHDocumentMeta): Promise<TDocument>;
|
|
848
|
+
addDocument<TDocument extends PHDocument>(documentType: string, meta?: PHDocumentMeta): Promise<TDocument>;
|
|
849
|
+
deleteDocument(documentId: string): Promise<void>;
|
|
850
|
+
getDocuments(parentId: string): Promise<string[]>;
|
|
851
|
+
getDocument<TDocument extends PHDocument>(documentId: string, options?: GetDocumentOptions): Promise<TDocument>;
|
|
852
|
+
/**
|
|
853
|
+
* @deprecated Use getDocument(documentId, options) instead. This method will be removed in the future.
|
|
854
|
+
*/
|
|
855
|
+
getDocument<TDocument extends PHDocument>(driveId: string, documentId: string, options?: GetDocumentOptions): Promise<TDocument>;
|
|
856
|
+
queueDocument<TDocument extends PHDocument>(input: CreateDocumentInput<TDocument>, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
857
|
+
addOperation(documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
858
|
+
/**
|
|
859
|
+
* @deprecated Use addOperation(documentId, operation, options) instead. This method will be removed in the future.
|
|
860
|
+
*/
|
|
861
|
+
addOperation(driveId: string, documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
862
|
+
addOperations(documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
863
|
+
/**
|
|
864
|
+
* @deprecated Use addOperations(documentId, operations, options) instead. This method will be removed in the future.
|
|
865
|
+
*/
|
|
866
|
+
addOperations(driveId: string, documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
867
|
+
queueOperation(documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
868
|
+
/**
|
|
869
|
+
* @deprecated Use queueOperation(documentId, operation, options) instead. This method will be removed in the future.
|
|
870
|
+
*/
|
|
871
|
+
queueOperation(driveId: string, documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
872
|
+
queueOperations(documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
873
|
+
/**
|
|
874
|
+
* @deprecated Use queueOperations(documentId, operations, options) instead. This method will be removed in the future.
|
|
875
|
+
*/
|
|
876
|
+
queueOperations(driveId: string, documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
877
|
+
queueAction(documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
878
|
+
/**
|
|
879
|
+
* @deprecated Use queueAction(documentId, action, options) instead. This method will be removed in the future.
|
|
880
|
+
*/
|
|
881
|
+
queueAction(driveId: string, documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
882
|
+
queueActions(documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
883
|
+
/**
|
|
884
|
+
* @deprecated Use queueActions(documentId, actions, options) instead. This method will be removed in the future.
|
|
885
|
+
*/
|
|
886
|
+
queueActions(driveId: string, documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
887
|
+
/**
|
|
888
|
+
* @deprecated Use the {@link addOperation} method instead.
|
|
889
|
+
*/
|
|
890
|
+
addDriveOperation(driveId: string, operation: Operation, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
891
|
+
/**
|
|
892
|
+
* @deprecated Use the {@link addOperations} method instead.
|
|
893
|
+
*/
|
|
894
|
+
addDriveOperations(driveId: string, operations: Operation[], options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
895
|
+
/**
|
|
896
|
+
* @deprecated Use the {@link queueOperation} method instead.
|
|
897
|
+
*/
|
|
898
|
+
queueDriveOperation(driveId: string, operation: Operation, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
899
|
+
/**
|
|
900
|
+
* @deprecated Use the {@link queueOperations} method instead.
|
|
901
|
+
*/
|
|
902
|
+
queueDriveOperations(driveId: string, operations: Operation[], options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
903
|
+
/**
|
|
904
|
+
* @deprecated Use the {@link queueAction} method instead.
|
|
905
|
+
*/
|
|
906
|
+
queueDriveAction(driveId: string, action: DocumentDriveAction, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
907
|
+
/**
|
|
908
|
+
* @deprecated Use the {@link queueActions} method instead.
|
|
909
|
+
*/
|
|
910
|
+
queueDriveActions(driveId: string, actions: DocumentDriveAction[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
911
|
+
addAction(documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
912
|
+
/**
|
|
913
|
+
* @deprecated Use addAction(documentId, action, options) method instead. This method will be removed in the future.
|
|
914
|
+
*/
|
|
915
|
+
addAction(driveId: string, documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
916
|
+
addActions(documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
917
|
+
/**
|
|
918
|
+
* @deprecated Use addActions(documentId, actions, options) instead. This method will be removed in the future.
|
|
919
|
+
*/
|
|
920
|
+
addActions(driveId: string, documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
921
|
+
/**
|
|
922
|
+
* @deprecated Use the {@link addAction} method with a {@link AddFileAction} and call {@link addDocument} if the document needs to be created.
|
|
923
|
+
*/
|
|
924
|
+
addDriveAction(driveId: string, action: LegacyAddFileAction, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
925
|
+
/**
|
|
926
|
+
* @deprecated Use the {@link addAction} method instead.
|
|
927
|
+
*/
|
|
928
|
+
addDriveAction(driveId: string, action: DocumentDriveAction, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
929
|
+
/**
|
|
930
|
+
* @deprecated Use the {@link addActions} method instead.
|
|
931
|
+
*/
|
|
932
|
+
addDriveActions(driveId: string, actions: DocumentDriveAction[], options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
933
|
+
getSyncStatus(documentId: string, scope?: string, branch?: string): SyncStatus | SynchronizationUnitNotFoundError;
|
|
934
|
+
/** Internal methods **/
|
|
935
|
+
getDocumentModelModules(): DocumentModelModule[];
|
|
936
|
+
on<K extends keyof DriveEvents>(event: K, cb: DriveEvents[K]): Unsubscribe;
|
|
937
|
+
setGenerateJwtHandler(handler: (driveUrl: string) => Promise<string>): void;
|
|
938
|
+
removeJwtHandler(): void;
|
|
939
|
+
generateJwtHandler?: (driveUrl: string) => Promise<string>;
|
|
940
|
+
}
|
|
941
|
+
type IDocumentDriveServer = IBaseDocumentDriveServer & IDefaultDrivesManager & IReadModeDriveServer;
|
|
942
|
+
type DriveUpdateErrorHandler = (error: Error, driveId: string, listener: ListenerState) => void;
|
|
943
|
+
interface IListenerManager {
|
|
944
|
+
initialize(handler: DriveUpdateErrorHandler): Promise<void>;
|
|
945
|
+
removeDrive(driveId: DocumentDriveDocument["header"]["id"]): Promise<void>;
|
|
946
|
+
driveHasListeners(driveId: string): boolean;
|
|
947
|
+
setListener(driveId: string, listener: ServerListener): Promise<void>;
|
|
948
|
+
removeListener(driveId: string, listenerId: string): Promise<boolean>;
|
|
949
|
+
getListenerState(driveId: string, listenerId: string): ListenerState;
|
|
950
|
+
getStrands(driveId: string, listenerId: string, options?: GetStrandsOptions): Promise<StrandUpdate[]>;
|
|
951
|
+
updateSynchronizationRevisions(syncUnits: SynchronizationUnit[], source: StrandUpdateSource, willUpdate?: (listeners: ServerListener[]) => void, onError?: (error: Error, driveId: string, listener: ListenerState) => void, forceSync?: boolean): Promise<ListenerUpdate[]>;
|
|
952
|
+
updateListenerRevision(listenerId: string, driveId: string, syncUnitId: SynchronizationUnitId, listenerRev: number): Promise<void>;
|
|
953
|
+
removeSyncUnits(parentId: string, syncUnits: SynchronizationUnitId[]): Promise<void>;
|
|
954
|
+
setGenerateJwtHandler(handler: (driveUrl: string) => Promise<string>): void;
|
|
955
|
+
removeJwtHandler(): void;
|
|
956
|
+
generateJwtHandler?: (driveUrl: string) => Promise<string>;
|
|
957
|
+
}
|
|
958
|
+
type ListenerStatus = "CREATED" | "PENDING" | "SUCCESS" | "MISSING" | "CONFLICT" | "ERROR";
|
|
959
|
+
type SynchronizationUnitMap = ISyncUnitMap<SyncronizationUnitState>;
|
|
960
|
+
interface ListenerState {
|
|
961
|
+
driveId: string;
|
|
962
|
+
block: boolean;
|
|
963
|
+
pendingTimeout: string;
|
|
964
|
+
listener: ServerListener;
|
|
965
|
+
syncUnits: SynchronizationUnitMap;
|
|
966
|
+
listenerStatus: ListenerStatus;
|
|
967
|
+
}
|
|
968
|
+
interface SyncronizationUnitState {
|
|
969
|
+
listenerRev: number;
|
|
970
|
+
lastUpdated: string;
|
|
971
|
+
}
|
|
972
|
+
interface ITransmitterFactory {
|
|
973
|
+
instance(transmitterType: string, listener: ServerListener, driveServer: IBaseDocumentDriveServer): ITransmitter;
|
|
974
|
+
}
|
|
975
|
+
interface IEventEmitter {
|
|
976
|
+
emit<K extends keyof DriveEvents>(event: K, ...args: Parameters<DriveEvents[K]>): void;
|
|
977
|
+
on<K extends keyof DriveEvents>(event: K, cb: DriveEvents[K]): Unsubscribe;
|
|
978
|
+
}
|
|
979
|
+
interface ISynchronizationManager {
|
|
980
|
+
setDocumentModelModules(arg0: DocumentModelModule[]): void;
|
|
981
|
+
getSynchronizationUnits(parentId?: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnit[]>;
|
|
982
|
+
getSynchronizationUnitsIds(parentId?: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnitQuery[]>;
|
|
983
|
+
getSynchronizationUnit(syncId: SynchronizationUnitId): Promise<SynchronizationUnit | undefined>;
|
|
984
|
+
getOperationData(syncId: SynchronizationUnitId, filter: GetStrandsOptions): Promise<OperationUpdate[]>;
|
|
985
|
+
getSyncStatus(documentId: string, scope?: string, branch?: string): SyncStatus | SynchronizationUnitNotFoundError;
|
|
986
|
+
getSyncStatus(syncId: SynchronizationUnitId): SyncStatus | SynchronizationUnitNotFoundError;
|
|
987
|
+
updateSyncStatus(documentId: string, status: Partial<SyncUnitStatusObject> | null, error?: Error, scope?: string, branch?: string): void;
|
|
988
|
+
updateSyncStatus(syncId: SynchronizationUnitId, status: Partial<SyncUnitStatusObject> | null, error?: Error): void;
|
|
989
|
+
initializeDriveSyncStatus(driveId: string, drive: DocumentDriveDocument): Promise<void>;
|
|
990
|
+
getCombinedSyncUnitStatus(syncUnitStatus: SyncUnitStatusObject): SyncStatus;
|
|
991
|
+
}
|
|
992
|
+
type SharingType = "LOCAL" | "CLOUD" | "PUBLIC";
|
|
993
|
+
type DocumentDriveServerConstructor = Constructor<BaseDocumentDriveServer>;
|
|
994
|
+
type DocumentDriveServerMixin<I> = Mixin<typeof BaseDocumentDriveServer, I>;
|
|
995
|
+
/**
|
|
996
|
+
* Interface for a specialized Map implementation that manages synchronization units.
|
|
997
|
+
* Each unit is identified by a SynchronizationUnitId which consists of documentId, scope, and branch.
|
|
998
|
+
*/
|
|
999
|
+
interface ISyncUnitMap<Value> {
|
|
1000
|
+
set(id: SynchronizationUnitId, state: Value): this;
|
|
1001
|
+
get(id: SynchronizationUnitId): Value | undefined;
|
|
1002
|
+
has(id: SynchronizationUnitId): boolean;
|
|
1003
|
+
delete(id: SynchronizationUnitId): boolean;
|
|
1004
|
+
clear(): void;
|
|
1005
|
+
get size(): number;
|
|
1006
|
+
keys(): IterableIterator<SynchronizationUnitId>;
|
|
1007
|
+
values(): IterableIterator<Value>;
|
|
1008
|
+
entries(): IterableIterator<[SynchronizationUnitId, Value]>;
|
|
1009
|
+
[Symbol.iterator](): IterableIterator<[SynchronizationUnitId, Value]>;
|
|
1010
|
+
forEach(callbackfn: (value: Value, key: SynchronizationUnitId, map: ISyncUnitMap<Value>) => void, thisArg?: any): void;
|
|
1011
|
+
deleteByDocumentId(documentId: string): void;
|
|
1012
|
+
deleteByDocumentIdAndScope(documentId: string, scope: string): void;
|
|
1013
|
+
getAllByDocumentId(documentId: string): [SynchronizationUnitId, Value][];
|
|
1014
|
+
getAllByDocumentIdAndScope(documentId: string, scope: string): [SynchronizationUnitId, Value][];
|
|
1015
|
+
}
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region src/storage/browser.d.ts
|
|
1018
|
+
declare class BrowserStorage implements IDriveOperationStorage$1, IDocumentStorage$1, IDocumentAdminStorage$1 {
|
|
1019
|
+
private logger;
|
|
1020
|
+
private db;
|
|
1021
|
+
static DBName: string;
|
|
1022
|
+
static SEP: string;
|
|
1023
|
+
static DOCUMENT_KEY: string;
|
|
1024
|
+
static MANIFEST_KEY: string;
|
|
1025
|
+
static SLUG_MANIFEST_KEY: string;
|
|
1026
|
+
constructor(namespace?: string);
|
|
1027
|
+
findStorageUnitsBy(filter: IStorageUnitFilter$1, limit: number, cursor?: string): Promise<{
|
|
1028
|
+
units: IStorageUnit$1[];
|
|
1029
|
+
nextCursor?: string;
|
|
1030
|
+
}>;
|
|
1031
|
+
resolveIds(slugs: string[], signal?: AbortSignal): Promise<string[]>;
|
|
1032
|
+
resolveSlugs(ids: string[], signal?: AbortSignal): Promise<string[]>;
|
|
1033
|
+
clear(): Promise<void>;
|
|
1034
|
+
exists(documentId: string): Promise<boolean>;
|
|
1035
|
+
create(document: PHDocument): Promise<void>;
|
|
1036
|
+
get<TDocument extends PHDocument>(documentId: string): Promise<TDocument>;
|
|
1037
|
+
getBySlug<TDocument extends PHDocument>(slug: string): Promise<TDocument>;
|
|
1038
|
+
findByType(documentModelType: string, limit?: number, cursor?: string): Promise<{
|
|
1039
|
+
documents: string[];
|
|
1040
|
+
nextCursor: string | undefined;
|
|
1041
|
+
}>;
|
|
1042
|
+
delete(documentId: string): Promise<boolean>;
|
|
1043
|
+
removeChild(parentId: string, childId: string): Promise<boolean>;
|
|
1044
|
+
addChild(parentId: string, childId: string): Promise<void>;
|
|
1045
|
+
getChildren(parentId: string): Promise<string[]>;
|
|
1046
|
+
getParents(childId: string): Promise<string[]>;
|
|
1047
|
+
private getManifest;
|
|
1048
|
+
private updateDriveManifest;
|
|
1049
|
+
private getSlugManifest;
|
|
1050
|
+
private updateSlugManifest;
|
|
1051
|
+
addDocumentOperations(id: string, operations: Operation[], document: PHDocument): Promise<void>;
|
|
1052
|
+
addDriveOperations(id: string, operations: Operation[], document: PHDocument): Promise<void>;
|
|
1053
|
+
getSynchronizationUnitsRevision(units: SynchronizationUnitQuery$1[]): Promise<{
|
|
1054
|
+
documentId: string;
|
|
1055
|
+
documentType: string;
|
|
1056
|
+
scope: string;
|
|
1057
|
+
branch: string;
|
|
1058
|
+
lastUpdated: string;
|
|
1059
|
+
revision: number;
|
|
1060
|
+
}[]>;
|
|
1061
|
+
migrateOperationSignatures(): Promise<void>;
|
|
1062
|
+
private migrateDrive;
|
|
1063
|
+
private migrateDocument;
|
|
1064
|
+
buildDocumentKey(documentId: string): string;
|
|
1065
|
+
buildManifestKey(driveId: string): string;
|
|
1066
|
+
}
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region src/storage/memory.d.ts
|
|
1069
|
+
declare class MemoryStorage implements IDriveOperationStorage$1, IDocumentStorage$1, IDocumentAdminStorage$1 {
|
|
1070
|
+
private logger;
|
|
1071
|
+
private documents;
|
|
1072
|
+
private driveManifests;
|
|
1073
|
+
private slugToDocumentId;
|
|
1074
|
+
constructor();
|
|
1075
|
+
resolveIds(slugs: string[], signal?: AbortSignal): Promise<string[]>;
|
|
1076
|
+
resolveSlugs(ids: string[], signal?: AbortSignal): Promise<string[]>;
|
|
1077
|
+
exists(documentId: string): Promise<boolean>;
|
|
1078
|
+
create(document: PHDocument): Promise<void>;
|
|
1079
|
+
get<TDocument extends PHDocument>(documentId: string): Promise<TDocument>;
|
|
1080
|
+
getBySlug<TDocument extends PHDocument>(slug: string): Promise<TDocument>;
|
|
1081
|
+
findByType(documentModelType: string, limit?: number, cursor?: string): Promise<{
|
|
1082
|
+
documents: string[];
|
|
1083
|
+
nextCursor: string | undefined;
|
|
1084
|
+
}>;
|
|
1085
|
+
delete(documentId: string): Promise<boolean>;
|
|
1086
|
+
addChild(parentId: string, childId: string): Promise<void>;
|
|
1087
|
+
removeChild(parentId: string, childId: string): Promise<boolean>;
|
|
1088
|
+
getChildren(parentId: string): Promise<string[]>;
|
|
1089
|
+
getParents(childId: string): Promise<string[]>;
|
|
1090
|
+
clear(): Promise<void>;
|
|
1091
|
+
addDocumentOperations(id: string, operations: Operation[], document: PHDocument): Promise<void>;
|
|
1092
|
+
addDriveOperations(id: string, operations: Operation[], document: PHDocument): Promise<void>;
|
|
1093
|
+
getSynchronizationUnitsRevision(units: SynchronizationUnitQuery$1[]): Promise<{
|
|
1094
|
+
documentId: string;
|
|
1095
|
+
documentType: string;
|
|
1096
|
+
scope: string;
|
|
1097
|
+
branch: string;
|
|
1098
|
+
lastUpdated: string;
|
|
1099
|
+
revision: number;
|
|
1100
|
+
}[]>;
|
|
1101
|
+
findStorageUnitsBy(filter: IStorageUnitFilter$1, limit: number, cursor?: string): Promise<{
|
|
1102
|
+
units: IStorageUnit$1[];
|
|
1103
|
+
nextCursor?: string;
|
|
1104
|
+
}>;
|
|
1105
|
+
private getManifest;
|
|
1106
|
+
private updateDriveManifest;
|
|
1107
|
+
}
|
|
1108
|
+
//#endregion
|
|
1109
|
+
//#region src/storage/path-encoding.d.ts
|
|
1110
|
+
/**
|
|
1111
|
+
* Checks if a string is a UUID v4.
|
|
1112
|
+
*/
|
|
1113
|
+
declare function isUUID(id: string): boolean;
|
|
1114
|
+
/**
|
|
1115
|
+
* Checks if a string contains Base64 special characters that need encoding.
|
|
1116
|
+
*/
|
|
1117
|
+
declare function hasBase64SpecialChars(id: string): boolean;
|
|
1118
|
+
/**
|
|
1119
|
+
* Encodes a document ID to a filesystem-safe string.
|
|
1120
|
+
* - UUIDs pass through unchanged
|
|
1121
|
+
* - Base64 signatures are encoded to Base64url
|
|
1122
|
+
*/
|
|
1123
|
+
declare function encodeDocumentIdForPath(documentId: string): string;
|
|
1124
|
+
/**
|
|
1125
|
+
* Decodes a filesystem-safe string back to original document ID.
|
|
1126
|
+
* - UUIDs pass through unchanged
|
|
1127
|
+
* - Base64url is decoded back to Base64 (for signatures)
|
|
1128
|
+
*/
|
|
1129
|
+
declare function decodeDocumentIdFromPath(encodedId: string): string;
|
|
1130
|
+
//#endregion
|
|
1131
|
+
//#region src/storage/types.d.ts
|
|
1132
|
+
type IStorageUnit = {
|
|
1133
|
+
/** The id of the document. If '*' then select all. */documentId: string; /** The type of the document model. If '*' then select all. */
|
|
1134
|
+
documentModelType: string; /** The scope of the document. If '*' then select all. */
|
|
1135
|
+
scope: string; /** The branch of the document. If '*' then select all. */
|
|
1136
|
+
branch: string;
|
|
1137
|
+
};
|
|
1138
|
+
type IStorageUnitFilter = {
|
|
1139
|
+
/** The ids of the parent documents. If '*' then select all. */parentId?: string[]; /** The ids of the documents. If '*' then select all. */
|
|
1140
|
+
documentId?: string[]; /** The types of the document models. If '*' then select all. */
|
|
1141
|
+
documentModelType?: string[]; /** The scopes of the documents. If '*' then select all. */
|
|
1142
|
+
scope?: string[]; /** The branches of the documents. If '*' then select all. */
|
|
1143
|
+
branch?: string[];
|
|
1144
|
+
};
|
|
1145
|
+
type ResolvedStorageUnitFilter = Required<{ [K in keyof IStorageUnitFilter]: Set<string> | null }>;
|
|
1146
|
+
interface IStorageUnitStorage {
|
|
1147
|
+
/**
|
|
1148
|
+
* Finds storage units based on the provided filter.
|
|
1149
|
+
*
|
|
1150
|
+
* @param filter - The filter to apply.
|
|
1151
|
+
* @param limit - The maximum number of documents to return.
|
|
1152
|
+
* @param cursor - The cursor to start the search from.
|
|
1153
|
+
*/
|
|
1154
|
+
findStorageUnitsBy: (filter: IStorageUnitFilter, limit: number, cursor?: string) => Promise<{
|
|
1155
|
+
units: IStorageUnit[];
|
|
1156
|
+
nextCursor?: string;
|
|
1157
|
+
}>;
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Describes the storage interface for documents.
|
|
1161
|
+
*/
|
|
1162
|
+
interface IDocumentStorage extends IStorageUnitStorage {
|
|
1163
|
+
/**
|
|
1164
|
+
* Resolves a list of ids from a list of slugs.
|
|
1165
|
+
*
|
|
1166
|
+
* > TODO: This function is part of the future IDocumentView interface.
|
|
1167
|
+
*
|
|
1168
|
+
* @param slugs - Required, the list of document slugs
|
|
1169
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1170
|
+
* @returns The parallel list of slugs
|
|
1171
|
+
*/
|
|
1172
|
+
resolveIds(slugs: string[], signal?: AbortSignal): Promise<string[]>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Resolves a list of slugs from a list of ids.
|
|
1175
|
+
*
|
|
1176
|
+
* @param ids - Required, the list of document ids
|
|
1177
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1178
|
+
* @returns The parallel list of ids
|
|
1179
|
+
*/
|
|
1180
|
+
resolveSlugs(ids: string[], signal?: AbortSignal): Promise<string[]>;
|
|
1181
|
+
/**
|
|
1182
|
+
* Returns true if and only if the document exists.
|
|
1183
|
+
*
|
|
1184
|
+
* @param documentId - The id of the document to check.
|
|
1185
|
+
*/
|
|
1186
|
+
exists(documentId: string): Promise<boolean>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Creates a new document with the given id.
|
|
1189
|
+
*
|
|
1190
|
+
* @param documentId - The id of the document to create.
|
|
1191
|
+
* @param document - The document to create.
|
|
1192
|
+
*
|
|
1193
|
+
* @throws Error if the document with a matching id OR slug already exists.
|
|
1194
|
+
*/
|
|
1195
|
+
create(document: PHDocument): Promise<void>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Returns the document with the given id.
|
|
1198
|
+
*
|
|
1199
|
+
* @param documentId - The id of the document to get.
|
|
1200
|
+
*
|
|
1201
|
+
* @throws Error if the document does not exist.
|
|
1202
|
+
*/
|
|
1203
|
+
get<TDocument extends PHDocument>(documentId: string): Promise<TDocument>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Returns the document with the given slug.
|
|
1206
|
+
*
|
|
1207
|
+
* @param slug - The slug of the document to get.
|
|
1208
|
+
*
|
|
1209
|
+
* @throws Error if the document does not exist.
|
|
1210
|
+
*/
|
|
1211
|
+
getBySlug<TDocument extends PHDocument>(slug: string): Promise<TDocument>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Returns ids of all documents of the given document-model type.
|
|
1214
|
+
*
|
|
1215
|
+
* @param documentModelType - The type of the documents to get.
|
|
1216
|
+
* @param limit - The maximum number of documents to return.
|
|
1217
|
+
* @param cursor - The cursor to start the search from.
|
|
1218
|
+
*
|
|
1219
|
+
*/
|
|
1220
|
+
findByType(documentModelType: string, limit?: number, cursor?: string): Promise<{
|
|
1221
|
+
documents: string[];
|
|
1222
|
+
nextCursor: string | undefined;
|
|
1223
|
+
}>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Deletes the document with the given id. Also deletes any child documents
|
|
1226
|
+
* that are only children of this document.
|
|
1227
|
+
*
|
|
1228
|
+
* @param documentId - The id of the document to delete.
|
|
1229
|
+
*
|
|
1230
|
+
* @returns true if the document was deleted, false if it did not exist.
|
|
1231
|
+
*/
|
|
1232
|
+
delete(documentId: string): Promise<boolean>;
|
|
1233
|
+
/**
|
|
1234
|
+
* Associates a child document with a parent document.
|
|
1235
|
+
*
|
|
1236
|
+
* A child document can belong to many parent documents. However, a child
|
|
1237
|
+
* cannot be added to itself, or added as a child of a child of itself.
|
|
1238
|
+
*
|
|
1239
|
+
* @param parentId - The id of the parent document.
|
|
1240
|
+
* @param childId - The id of the child document to add.
|
|
1241
|
+
*/
|
|
1242
|
+
addChild(parentId: string, childId: string): Promise<void>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Removes a child document from a parent document.
|
|
1245
|
+
*
|
|
1246
|
+
* @param parentId - The id of the parent document.
|
|
1247
|
+
* @param childId - The id of the child document to remove.
|
|
1248
|
+
*
|
|
1249
|
+
* @returns true if the child document was removed from the parent document,
|
|
1250
|
+
* false if the child document was not a child of the parent document.
|
|
1251
|
+
*/
|
|
1252
|
+
removeChild(parentId: string, childId: string): Promise<boolean>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Returns all child documents of the parent document with the given id.
|
|
1255
|
+
*
|
|
1256
|
+
* @param parentId - The id of the parent document.
|
|
1257
|
+
*/
|
|
1258
|
+
getChildren(parentId: string): Promise<string[]>;
|
|
1259
|
+
/**
|
|
1260
|
+
* Returns all parent documents of the child document with the given id.
|
|
1261
|
+
*
|
|
1262
|
+
* @param childId - The id of the child document.
|
|
1263
|
+
*/
|
|
1264
|
+
getParents(childId: string): Promise<string[]>;
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Storage interface that allows for deletion.
|
|
1268
|
+
*/
|
|
1269
|
+
interface IDocumentAdminStorage extends IDocumentStorage {
|
|
1270
|
+
/**
|
|
1271
|
+
* Clears the storage.
|
|
1272
|
+
*/
|
|
1273
|
+
clear(): Promise<void>;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Describes the storage interface for document operations.
|
|
1277
|
+
*/
|
|
1278
|
+
interface IDocumentOperationStorage {
|
|
1279
|
+
addDocumentOperations<TDocument extends PHDocument>(id: string, operations: Operation[], document: PHDocument): Promise<void>;
|
|
1280
|
+
addDocumentOperationsWithTransaction?<TDocument extends PHDocument>(id: string, callback: (document: TDocument) => Promise<{
|
|
1281
|
+
operations: Operation[];
|
|
1282
|
+
document: PHDocument;
|
|
1283
|
+
}>): Promise<void>;
|
|
1284
|
+
getOperationResultingState?(id: string, index: number, scope: string, branch: string): Promise<string | undefined>;
|
|
1285
|
+
getSynchronizationUnitsRevision(units: SynchronizationUnitQuery$1[]): Promise<{
|
|
1286
|
+
documentId: string;
|
|
1287
|
+
documentType: string;
|
|
1288
|
+
scope: string;
|
|
1289
|
+
branch: string;
|
|
1290
|
+
lastUpdated: string;
|
|
1291
|
+
revision: number;
|
|
1292
|
+
}[]>;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Describes the storage interface for drive operations.
|
|
1296
|
+
*/
|
|
1297
|
+
interface IDriveOperationStorage extends IDocumentOperationStorage {
|
|
1298
|
+
addDriveOperations(id: string, operations: Operation[], document: PHDocument): Promise<void>;
|
|
1299
|
+
addDriveOperationsWithTransaction?(drive: string, callback: (document: DocumentDriveDocument) => Promise<{
|
|
1300
|
+
operations: Operation[];
|
|
1301
|
+
document: PHDocument;
|
|
1302
|
+
}>): Promise<void>;
|
|
1303
|
+
getDriveOperationResultingState?(drive: string, index: number, scope: string, branch: string): Promise<string | undefined>;
|
|
1304
|
+
}
|
|
1305
|
+
//#endregion
|
|
1306
|
+
//#region src/storage/utils.d.ts
|
|
1307
|
+
declare const resolveStorageUnitsFilterComponent: (component: string[] | undefined) => Set<string> | null;
|
|
1308
|
+
declare const resolveStorageUnitsFilter: (filter: IStorageUnitFilter$1) => ResolvedStorageUnitFilter$1;
|
|
1309
|
+
declare const setUnion: <T>(base: Set<T>, ...iterables: Iterable<T>[]) => Set<T>;
|
|
1310
|
+
declare const setIntersection: <T>(left: Set<T>, right: Set<T>) => Set<T>;
|
|
1311
|
+
//#endregion
|
|
1312
|
+
//#region src/server/base-server.d.ts
|
|
1313
|
+
declare class BaseDocumentDriveServer implements IBaseDocumentDriveServer, IDefaultDrivesManager {
|
|
1314
|
+
protected logger: document_model0.ILogger;
|
|
1315
|
+
private documentModelModules;
|
|
1316
|
+
private legacyStorage;
|
|
1317
|
+
private documentStorage;
|
|
1318
|
+
private cache;
|
|
1319
|
+
private queueManager;
|
|
1320
|
+
eventEmitter: IEventEmitter;
|
|
1321
|
+
protected options: Required<DocumentDriveServerOptions>;
|
|
1322
|
+
private listenerManager;
|
|
1323
|
+
private synchronizationManager;
|
|
1324
|
+
generateJwtHandler?: (driveUrl: string) => Promise<string>;
|
|
1325
|
+
private defaultDrivesManager;
|
|
1326
|
+
private defaultDrivesManagerDelegate;
|
|
1327
|
+
private queueDelegate;
|
|
1328
|
+
private triggerMap;
|
|
1329
|
+
private initializePromise;
|
|
1330
|
+
protected enableDualActionCreate: boolean;
|
|
1331
|
+
constructor(documentModelModules: DocumentModelModule[], storage: IDriveOperationStorage, documentStorage: IDocumentStorage, cache: ICache, queueManager: IQueueManager, eventEmitter: IEventEmitter, synchronizationManager: ISynchronizationManager, listenerManager: IListenerManager, options?: DocumentDriveServerOptions);
|
|
1332
|
+
get listeners(): IListenerManager;
|
|
1333
|
+
initialize(): Promise<Error[] | null>;
|
|
1334
|
+
private _initialize;
|
|
1335
|
+
setDocumentModelModules(modules: DocumentModelModule<any>[]): void;
|
|
1336
|
+
initializeDefaultRemoteDrives(): Promise<void>;
|
|
1337
|
+
getDefaultRemoteDrives(): Map<string, DefaultRemoteDriveInfo>;
|
|
1338
|
+
setDefaultDriveAccessLevel(url: string, level: RemoteDriveAccessLevel): Promise<void>;
|
|
1339
|
+
setAllDefaultDrivesAccessLevel(level: RemoteDriveAccessLevel): Promise<void>;
|
|
1340
|
+
private getOperationSource;
|
|
1341
|
+
private handleListenerError;
|
|
1342
|
+
private shouldSyncRemoteDrive;
|
|
1343
|
+
private startSyncRemoteDrive;
|
|
1344
|
+
private stopSyncRemoteDrive;
|
|
1345
|
+
private _initializeDrive;
|
|
1346
|
+
protected getDocumentModelModule(documentType: string): DocumentModelModule;
|
|
1347
|
+
getDocumentModelModules(): DocumentModelModule[];
|
|
1348
|
+
addDocument<TDocument extends PHDocument>(document: TDocument, meta?: PHDocumentMeta): Promise<TDocument>;
|
|
1349
|
+
addDocument<TDocument extends PHDocument>(type: string, meta?: PHDocumentMeta): Promise<TDocument>;
|
|
1350
|
+
addDrive(input: DriveInput, preferredEditor?: string): Promise<DocumentDriveDocument>;
|
|
1351
|
+
addRemoteDrive(url: string, options: RemoteDriveOptions): Promise<DocumentDriveDocument>;
|
|
1352
|
+
deleteDrive(driveId: string): Promise<void>;
|
|
1353
|
+
getDrives(): Promise<string[]>;
|
|
1354
|
+
getDrivesSlugs(): Promise<string[]>;
|
|
1355
|
+
getDrive(driveId: string, options?: GetDocumentOptions$1): Promise<any>;
|
|
1356
|
+
getDriveBySlug(slug: string, options?: GetDocumentOptions$1): Promise<any>;
|
|
1357
|
+
getDriveIdBySlug(slug: string): Promise<string>;
|
|
1358
|
+
getDocument<TDocument extends PHDocument>(documentId: string, options?: GetDocumentOptions$1): Promise<TDocument>;
|
|
1359
|
+
/**
|
|
1360
|
+
* @deprecated Use getDocument(documentId, options) instead. This method will be removed in the future.
|
|
1361
|
+
*/
|
|
1362
|
+
getDocument<TDocument extends PHDocument>(driveId: string, documentId: string, options?: GetDocumentOptions$1): Promise<TDocument>;
|
|
1363
|
+
private _getDocument;
|
|
1364
|
+
getDocuments(driveId: string): Promise<string[]>;
|
|
1365
|
+
protected addChild(parentId: string, documentId: string): Promise<void>;
|
|
1366
|
+
protected removeChild(parentId: string, documentId: string): Promise<void>;
|
|
1367
|
+
protected createDocument<TDocument extends PHDocument>(input: CreateDocumentInput<TDocument>, source: StrandUpdateSource, meta?: PHDocumentMeta): Promise<TDocument>;
|
|
1368
|
+
private createDocumentLegacy;
|
|
1369
|
+
private createDocumentDualAction;
|
|
1370
|
+
deleteDocument(documentId: string): Promise<void>;
|
|
1371
|
+
_processOperations(documentId: string, documentStorage: PHDocument, operations: Operation[]): Promise<{
|
|
1372
|
+
readonly document: PHDocument;
|
|
1373
|
+
readonly operationsApplied: Operation[];
|
|
1374
|
+
readonly signals: SignalResult[];
|
|
1375
|
+
readonly error: OperationError | undefined;
|
|
1376
|
+
}>;
|
|
1377
|
+
private _addDocumentResultingStage;
|
|
1378
|
+
private _buildDocument;
|
|
1379
|
+
private _performOperation;
|
|
1380
|
+
addOperation(documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1381
|
+
/**
|
|
1382
|
+
* @deprecated Use addOperation(documentId, operation, options) instead. This method will be removed in the future.
|
|
1383
|
+
*/
|
|
1384
|
+
addOperation(driveId: string, documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1385
|
+
private _addOperations;
|
|
1386
|
+
queueDocument<TDocument extends PHDocument>(input: CreateDocumentInput<TDocument>, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1387
|
+
queueOperation(documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1388
|
+
/**
|
|
1389
|
+
* @deprecated Use queueOperation(documentId, operation, options) instead. This method will be removed in the future.
|
|
1390
|
+
*/
|
|
1391
|
+
queueOperation(driveId: string, documentId: string, operation: Operation, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1392
|
+
private resultIfExistingOperations;
|
|
1393
|
+
queueOperations(documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1394
|
+
/**
|
|
1395
|
+
* @deprecated Use queueOperations(documentId, operations, options) instead. This method will be removed in the future.
|
|
1396
|
+
*/
|
|
1397
|
+
queueOperations(driveId: string, documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1398
|
+
private _queueOperations;
|
|
1399
|
+
queueAction(documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1400
|
+
/**
|
|
1401
|
+
* @deprecated Use queueAction(documentId, action, options) instead. This method will be removed in the future.
|
|
1402
|
+
*/
|
|
1403
|
+
queueAction(driveId: string, documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1404
|
+
queueActions(documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1405
|
+
/**
|
|
1406
|
+
* @deprecated Use queueActions(documentId, actions, options) instead. This method will be removed in the future.
|
|
1407
|
+
*/
|
|
1408
|
+
queueActions(driveId: string, documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1409
|
+
private _queueActions;
|
|
1410
|
+
/**
|
|
1411
|
+
* @deprecated Use the {@link queueAction} method instead.
|
|
1412
|
+
*/
|
|
1413
|
+
queueDriveAction(driveId: string, action: DocumentDriveAction | Action, options?: AddOperationOptions): Promise<IOperationResult<DocumentDriveDocument>>;
|
|
1414
|
+
/**
|
|
1415
|
+
* @deprecated Use the {@link queueActions} method instead.
|
|
1416
|
+
*/
|
|
1417
|
+
queueDriveActions(driveId: string, actions: (DocumentDriveAction | Action)[], options?: AddOperationOptions): Promise<IOperationResult<DocumentDriveDocument>>;
|
|
1418
|
+
addOperations(documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1419
|
+
/**
|
|
1420
|
+
* @deprecated Use addOperations(documentId, operations, options) instead. This method will be removed in the future.
|
|
1421
|
+
*/
|
|
1422
|
+
addOperations(driveId: string, documentId: string, operations: Operation[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1423
|
+
private processOperations;
|
|
1424
|
+
/**
|
|
1425
|
+
* @deprecated Use the {@link addOperation} method instead.
|
|
1426
|
+
*/
|
|
1427
|
+
addDriveOperation(driveId: string, operation: Operation, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
1428
|
+
private _addDriveOperations;
|
|
1429
|
+
/**
|
|
1430
|
+
* @deprecated Use the {@link queueOperation} method instead.
|
|
1431
|
+
*/
|
|
1432
|
+
queueDriveOperation(driveId: string, operation: Operation, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
1433
|
+
private resultIfExistingDriveOperations;
|
|
1434
|
+
/**
|
|
1435
|
+
* @deprecated Use the {@link queueOperations} method instead.
|
|
1436
|
+
*/
|
|
1437
|
+
queueDriveOperations(driveId: string, operations: Operation[], options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
1438
|
+
/**
|
|
1439
|
+
* @deprecated Use the {@link addOperations} method instead.
|
|
1440
|
+
*/
|
|
1441
|
+
addDriveOperations(driveId: string, operations: Operation[], options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
1442
|
+
private processDriveOperations;
|
|
1443
|
+
private _buildOperations;
|
|
1444
|
+
addAction(documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1445
|
+
/**
|
|
1446
|
+
* @deprecated Use addAction(documentId, action, options) instead. This method will be removed in the future.
|
|
1447
|
+
*/
|
|
1448
|
+
addAction(driveId: string, documentId: string, action: Action, options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1449
|
+
private _addAction;
|
|
1450
|
+
addActions(documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1451
|
+
/**
|
|
1452
|
+
* @deprecated Use addActions(documentId, actions, options) instead. This method will be removed in the future.
|
|
1453
|
+
*/
|
|
1454
|
+
addActions(driveId: string, documentId: string, actions: Action[], options?: AddOperationOptions): Promise<IOperationResult>;
|
|
1455
|
+
private processActions;
|
|
1456
|
+
/**
|
|
1457
|
+
* @deprecated Use the {@link addAction} method instead with a {@link AddFileAction} and call {@link addDocument} if the document needs to be created.
|
|
1458
|
+
*/
|
|
1459
|
+
/**
|
|
1460
|
+
* @deprecated Use the {@link addAction} method instead with a {@link AddFileAction} and call {@link addDocument} if the document needs to be created.
|
|
1461
|
+
*/
|
|
1462
|
+
addDriveAction(driveId: string, action: LegacyAddFileAction, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
1463
|
+
/**
|
|
1464
|
+
* @deprecated Use the {@link addAction} method instead.
|
|
1465
|
+
*/
|
|
1466
|
+
addDriveAction(driveId: string, action: DocumentDriveAction | Action, options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
1467
|
+
private _legacyAddFileAction;
|
|
1468
|
+
/**
|
|
1469
|
+
* @deprecated Use the {@link addActions} method instead.
|
|
1470
|
+
*/
|
|
1471
|
+
addDriveActions(driveId: string, actions: (DocumentDriveAction | Action)[], options?: AddOperationOptions): Promise<DriveOperationResult>;
|
|
1472
|
+
private processDriveActions;
|
|
1473
|
+
detachDrive(driveId: string): Promise<void>;
|
|
1474
|
+
getSyncStatus(documentId: string, scope?: string, branch?: string): SyncStatus | SynchronizationUnitNotFoundError;
|
|
1475
|
+
on<K extends keyof DriveEvents>(event: K, cb: DriveEvents[K]): Unsubscribe;
|
|
1476
|
+
private emit;
|
|
1477
|
+
updateSyncStatus(syncUnitId: string, status: Partial<SyncUnitStatusObject> | null, error?: Error): void;
|
|
1478
|
+
initializeDriveSyncStatus(driveId: string, drive: DocumentDriveDocument): Promise<void>;
|
|
1479
|
+
getCombinedSyncUnitStatus(syncUnitStatus: SyncUnitStatusObject): SyncStatus;
|
|
1480
|
+
private saveStrand;
|
|
1481
|
+
setGenerateJwtHandler(handler: (driveUrl: string) => Promise<string>): void;
|
|
1482
|
+
removeJwtHandler(): void;
|
|
1483
|
+
}
|
|
1484
|
+
declare const DocumentDriveServer: new (...args: ConstructorParameters<DocumentDriveServerConstructor>) => InstanceType<DocumentDriveServerConstructor> & IReadModeDriveServer;
|
|
1485
|
+
//#endregion
|
|
1486
|
+
//#region src/server/builder.d.ts
|
|
1487
|
+
/**
|
|
1488
|
+
* Builder class for constructing Reactor instances with proper configuration
|
|
1489
|
+
*/
|
|
1490
|
+
declare class ReactorBuilder {
|
|
1491
|
+
documentModelModules: DocumentModelModule<any>[];
|
|
1492
|
+
storage?: IDriveOperationStorage$1;
|
|
1493
|
+
cache?: ICache$1;
|
|
1494
|
+
queueManager?: IQueueManager$1;
|
|
1495
|
+
eventEmitter?: IEventEmitter$1;
|
|
1496
|
+
options?: DocumentDriveServerOptions$1;
|
|
1497
|
+
synchronizationManager?: ISynchronizationManager$1;
|
|
1498
|
+
listenerManager?: IListenerManager$1;
|
|
1499
|
+
transmitterFactory?: ITransmitterFactory$1;
|
|
1500
|
+
constructor(documentModelModules: DocumentModelModule<any>[]);
|
|
1501
|
+
withStorage(storage: IDriveOperationStorage$1): this;
|
|
1502
|
+
withCache(cache: ICache$1): this;
|
|
1503
|
+
withQueueManager(queueManager: IQueueManager$1): this;
|
|
1504
|
+
withEventEmitter(eventEmitter: IEventEmitter$1): this;
|
|
1505
|
+
withSynchronizationManager(synchronizationManager: ISynchronizationManager$1): this;
|
|
1506
|
+
withListenerManager(listenerManager: IListenerManager$1): this;
|
|
1507
|
+
withTransmitterFactory(transmitterFactory: ITransmitterFactory$1): this;
|
|
1508
|
+
withOptions(options: DocumentDriveServerOptions$1): this;
|
|
1509
|
+
build(): IDocumentDriveServer$1;
|
|
1510
|
+
}
|
|
1511
|
+
//#endregion
|
|
1512
|
+
//#region src/server/event-emitter.d.ts
|
|
1513
|
+
declare class DefaultEventEmitter implements IEventEmitter$1 {
|
|
1514
|
+
private emitter;
|
|
1515
|
+
emit<K extends keyof DriveEvents$1>(event: K, ...args: Parameters<DriveEvents$1[K]>): void;
|
|
1516
|
+
on<K extends keyof DriveEvents$1>(event: K, cb: DriveEvents$1[K]): Unsubscribe;
|
|
1517
|
+
}
|
|
1518
|
+
//#endregion
|
|
1519
|
+
//#region src/server/listener/constants.d.ts
|
|
1520
|
+
declare const DefaultListenerManagerOptions: {
|
|
1521
|
+
sequentialUpdates: boolean;
|
|
1522
|
+
};
|
|
1523
|
+
//#endregion
|
|
1524
|
+
//#region src/server/listener/listener-manager.d.ts
|
|
1525
|
+
declare class ListenerManager implements IListenerManager$1 {
|
|
1526
|
+
static LISTENER_UPDATE_DELAY: number;
|
|
1527
|
+
protected logger: document_model0.ILogger;
|
|
1528
|
+
protected syncManager: ISynchronizationManager$1;
|
|
1529
|
+
protected options: ListenerManagerOptions$1;
|
|
1530
|
+
generateJwtHandler?: (driveUrl: string) => Promise<string>;
|
|
1531
|
+
protected listenerStateByDriveId: Map<string, Map<string, ListenerState$1>>;
|
|
1532
|
+
constructor(syncManager: ISynchronizationManager$1, options?: ListenerManagerOptions$1);
|
|
1533
|
+
setGenerateJwtHandler(handler: (driveUrl: string) => Promise<string>): void;
|
|
1534
|
+
removeJwtHandler(): void;
|
|
1535
|
+
initialize(handler: DriveUpdateErrorHandler$1): Promise<void>;
|
|
1536
|
+
driveHasListeners(driveId: string): boolean;
|
|
1537
|
+
setListener(driveId: string, listener: ServerListener$1): Promise<void>;
|
|
1538
|
+
removeListener(driveId: string, listenerId: string): Promise<boolean>;
|
|
1539
|
+
removeSyncUnits(parentId: string, syncUnits: SynchronizationUnitId$1[]): Promise<void>;
|
|
1540
|
+
updateSynchronizationRevisions(syncUnits: SynchronizationUnit$1[], source: StrandUpdateSource$1, willUpdate?: (listeners: ServerListener$1[]) => void, onError?: (error: Error, driveId: string, listener: ListenerState$1) => void, forceSync?: boolean): Promise<ListenerUpdate$1[]>;
|
|
1541
|
+
updateListenerRevision(listenerId: string, driveId: string, syncId: SynchronizationUnitId$1, listenerRev: number): Promise<void>;
|
|
1542
|
+
triggerUpdate: (immediate?: boolean, source: StrandUpdateSource$1, willUpdate?: ((listeners: ServerListener$1[]) => void) | undefined, onError?: ((error: Error, driveId: string, listener: ListenerState$1) => void) | undefined, maxContinues?: number | undefined) => Promise<ListenerUpdate$1[]>;
|
|
1543
|
+
private _triggerUpdate;
|
|
1544
|
+
private _checkFilter;
|
|
1545
|
+
getListenerSyncUnits(driveId: string, listenerId: string): never[] | Promise<SynchronizationUnit$1[]>;
|
|
1546
|
+
removeDrive(driveId: string): Promise<void>;
|
|
1547
|
+
getStrands(driveId: string, listenerId: string, options?: GetStrandsOptions$1): Promise<StrandUpdate$1[]>;
|
|
1548
|
+
getListenerState(driveId: string, listenerId: string): ListenerState$1;
|
|
1549
|
+
setListenerState(driveId: string, listenerId: string, listenerState: ListenerState$1): void;
|
|
1550
|
+
}
|
|
1551
|
+
//#endregion
|
|
1552
|
+
//#region src/server/listener/util.d.ts
|
|
1553
|
+
declare function debounce<T extends unknown[], R>(func: (...args: T) => Promise<R>, delay?: number): (immediate?: boolean, ...args: T) => Promise<R>;
|
|
1554
|
+
//#endregion
|
|
1555
|
+
//#region src/server/sync-manager.d.ts
|
|
1556
|
+
declare class SynchronizationManager implements ISynchronizationManager$1 {
|
|
1557
|
+
private readonly storage;
|
|
1558
|
+
private readonly documentStorage;
|
|
1559
|
+
private readonly cache;
|
|
1560
|
+
private documentModelModules;
|
|
1561
|
+
private readonly eventEmitter?;
|
|
1562
|
+
private syncStatus;
|
|
1563
|
+
private logger;
|
|
1564
|
+
constructor(storage: IDriveOperationStorage$1, documentStorage: IDocumentStorage$1, cache: ICache$1, documentModelModules: DocumentModelModule[], eventEmitter?: IEventEmitter$1 | undefined);
|
|
1565
|
+
getSynchronizationUnits(parentId: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnit$1[]>;
|
|
1566
|
+
private getSynchronizationUnitsRevision;
|
|
1567
|
+
getSynchronizationUnitsIds(parentId?: string, documentId?: string[], scope?: string[], branch?: string[], documentType?: string[]): Promise<SynchronizationUnitQuery$1[]>;
|
|
1568
|
+
getSynchronizationUnit(syncId: SynchronizationUnitId$1): Promise<SynchronizationUnit$1 | undefined>;
|
|
1569
|
+
getOperationData(syncId: SynchronizationUnitId$1, filter: GetStrandsOptions$1): Promise<OperationUpdate$1[]>;
|
|
1570
|
+
private getDocument;
|
|
1571
|
+
private _buildDocument;
|
|
1572
|
+
setDocumentModelModules(modules: DocumentModelModule[]): void;
|
|
1573
|
+
private getDocumentModelModule;
|
|
1574
|
+
getCombinedSyncUnitStatus(syncUnitStatus: SyncUnitStatusObject$1): SyncStatus$1;
|
|
1575
|
+
getSyncStatus(input: string | SynchronizationUnitId$1, scope?: string, branch?: string): SyncStatus$1 | SynchronizationUnitNotFoundError;
|
|
1576
|
+
updateSyncStatus(input: string | SynchronizationUnitId$1, status: Partial<SyncUnitStatusObject$1> | null, error?: Error, scope?: string, branch?: string): void;
|
|
1577
|
+
private initSyncStatus;
|
|
1578
|
+
initializeDriveSyncStatus(driveId: string, drive: DocumentDriveDocument): Promise<void>;
|
|
1579
|
+
}
|
|
1580
|
+
//#endregion
|
|
1581
|
+
//#region src/server/sync-unit-map.d.ts
|
|
1582
|
+
/** Separator character used to join synchronization unit key parts */
|
|
1583
|
+
type SyncUnitKeySeparator = "|";
|
|
1584
|
+
/**
|
|
1585
|
+
* Internal key format used to store synchronization units.
|
|
1586
|
+
* Composed of documentId, scope, and branch joined by the separator.
|
|
1587
|
+
*/
|
|
1588
|
+
type SyncUnitKey = `${SynchronizationUnitId$1["documentId"]}${SyncUnitKeySeparator}${SynchronizationUnitId$1["scope"]}${SyncUnitKeySeparator}${SynchronizationUnitId$1["branch"]}`;
|
|
1589
|
+
/**
|
|
1590
|
+
* A specialized Map implementation for managing synchronization units that uses a "documentId - scope - branch" tuple as key.
|
|
1591
|
+
* It provides methods to store, retrieve, and delete synchronization units of a certain documentId, optionally a scope and a branch.
|
|
1592
|
+
* The implementation uses an internal Map with string keys created by combining documentId, scope, and branch with a separator character.
|
|
1593
|
+
*/
|
|
1594
|
+
declare class SyncUnitMap<Value> implements ISyncUnitMap$1<Value> {
|
|
1595
|
+
/** Internal storage using concatenated string keys */
|
|
1596
|
+
private internalMap;
|
|
1597
|
+
/** Character used to separate key components */
|
|
1598
|
+
static keySeparator: SyncUnitKeySeparator;
|
|
1599
|
+
/**
|
|
1600
|
+
* Escapes the separator character in a string by prefixing it with a backslash
|
|
1601
|
+
* @param str String to escape
|
|
1602
|
+
*/
|
|
1603
|
+
private static escape;
|
|
1604
|
+
/**
|
|
1605
|
+
* Unescapes the separator character in a string by removing the prefix backslash
|
|
1606
|
+
* @param str String to unescape
|
|
1607
|
+
*/
|
|
1608
|
+
private static unescape;
|
|
1609
|
+
/**
|
|
1610
|
+
* Creates a composite key from a SynchronizationUnitId
|
|
1611
|
+
* Escapes any separator characters in the components
|
|
1612
|
+
* @param id The synchronization unit identifier
|
|
1613
|
+
* @returns A string key combining documentId, scope, and branch
|
|
1614
|
+
*/
|
|
1615
|
+
static buildKey(id: SynchronizationUnitId$1): SyncUnitKey;
|
|
1616
|
+
/**
|
|
1617
|
+
* Parses a composite key back into a SynchronizationUnitId
|
|
1618
|
+
* Unescapes any separator characters in the components
|
|
1619
|
+
* @param key The composite key string
|
|
1620
|
+
* @returns The parsed synchronization unit identifier
|
|
1621
|
+
*/
|
|
1622
|
+
static parseKey(key: SyncUnitKey): SynchronizationUnitId$1;
|
|
1623
|
+
/**
|
|
1624
|
+
* Stores a value with the given synchronization unit identifier
|
|
1625
|
+
* @throws Error if any part of the id contains the separator character
|
|
1626
|
+
*/
|
|
1627
|
+
set(id: SynchronizationUnitId$1, state: Value): this;
|
|
1628
|
+
/** Retrieves a value by its synchronization unit identifier */
|
|
1629
|
+
get(id: SynchronizationUnitId$1): Value | undefined;
|
|
1630
|
+
/** Checks if a value exists for the given synchronization unit identifier */
|
|
1631
|
+
has(id: SynchronizationUnitId$1): boolean;
|
|
1632
|
+
/** Removes a value by its synchronization unit identifier */
|
|
1633
|
+
delete(id: SynchronizationUnitId$1): boolean;
|
|
1634
|
+
/** Removes all entries from the map */
|
|
1635
|
+
clear(): void;
|
|
1636
|
+
/** Returns the number of entries in the map */
|
|
1637
|
+
get size(): number;
|
|
1638
|
+
/**
|
|
1639
|
+
* Returns an iterator of synchronization unit identifiers
|
|
1640
|
+
* @param filter Optional filter by documentId and scope
|
|
1641
|
+
*/
|
|
1642
|
+
keys(filter?: {
|
|
1643
|
+
documentId: string;
|
|
1644
|
+
scope?: string;
|
|
1645
|
+
}): IterableIterator<SynchronizationUnitId$1>;
|
|
1646
|
+
/**
|
|
1647
|
+
* Returns an iterator of stored values
|
|
1648
|
+
* @param filter Optional filter by documentId and scope
|
|
1649
|
+
*/
|
|
1650
|
+
values(filter?: {
|
|
1651
|
+
documentId: string;
|
|
1652
|
+
scope?: string;
|
|
1653
|
+
}): IterableIterator<Value>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Returns an iterator of [id, value] pairs
|
|
1656
|
+
* @param filter Optional filter by documentId and scope
|
|
1657
|
+
*/
|
|
1658
|
+
entries(filter?: {
|
|
1659
|
+
documentId: string;
|
|
1660
|
+
scope?: string;
|
|
1661
|
+
}): IterableIterator<[SynchronizationUnitId$1, Value]>;
|
|
1662
|
+
/** Makes the map iterable */
|
|
1663
|
+
[Symbol.iterator](): IterableIterator<[SynchronizationUnitId$1, Value]>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Executes a callback for each entry in the map
|
|
1666
|
+
* @param callbackfn Function to execute for each entry
|
|
1667
|
+
* @param thisArg Value to use as 'this' in the callback
|
|
1668
|
+
*/
|
|
1669
|
+
forEach(callbackfn: (value: Value, key: SynchronizationUnitId$1, map: ISyncUnitMap$1<Value>) => void, thisArg?: any): void;
|
|
1670
|
+
/**
|
|
1671
|
+
* Removes all entries associated with a specific document
|
|
1672
|
+
* @param documentId The document identifier
|
|
1673
|
+
*/
|
|
1674
|
+
deleteByDocumentId(documentId: string): void;
|
|
1675
|
+
/**
|
|
1676
|
+
* Removes all entries for a specific document and scope combination
|
|
1677
|
+
* @param documentId The document identifier
|
|
1678
|
+
* @param scope The scope identifier
|
|
1679
|
+
*/
|
|
1680
|
+
deleteByDocumentIdAndScope(documentId: string, scope: string): void;
|
|
1681
|
+
/**
|
|
1682
|
+
* Retrieves all entries associated with a specific document
|
|
1683
|
+
* @param documentId The document identifier
|
|
1684
|
+
* @returns Array of [id, value] pairs
|
|
1685
|
+
*/
|
|
1686
|
+
getAllByDocumentId(documentId: string): [SynchronizationUnitId$1, Value][];
|
|
1687
|
+
/**
|
|
1688
|
+
* Retrieves all entries for a specific document and scope combination
|
|
1689
|
+
* @param documentId The document identifier
|
|
1690
|
+
* @param scope The scope identifier
|
|
1691
|
+
* @returns Array of [id, value] pairs
|
|
1692
|
+
*/
|
|
1693
|
+
getAllByDocumentIdAndScope(documentId: string, scope: string): [SynchronizationUnitId$1, Value][];
|
|
1694
|
+
}
|
|
1695
|
+
//#endregion
|
|
1696
|
+
//#region src/server/transmitter/factory.d.ts
|
|
1697
|
+
declare class TransmitterFactory implements ITransmitterFactory$1 {
|
|
1698
|
+
private readonly listenerManager;
|
|
1699
|
+
constructor(listenerManager: IListenerManager$1);
|
|
1700
|
+
instance(transmitterType: string, listener: ServerListener$1, driveServer: IBaseDocumentDriveServer$1): ITransmitter$1;
|
|
1701
|
+
}
|
|
1702
|
+
//#endregion
|
|
1703
|
+
//#region src/server/transmitter/internal.d.ts
|
|
1704
|
+
declare class InternalTransmitter implements ITransmitter$1 {
|
|
1705
|
+
#private;
|
|
1706
|
+
protected drive: IBaseDocumentDriveServer$1;
|
|
1707
|
+
protected processor: IProcessorLegacy$1;
|
|
1708
|
+
protected taskQueueMethod: RunAsap$1<unknown> | null;
|
|
1709
|
+
protected transmitQueue: Promise<ListenerRevision$1[]> | undefined;
|
|
1710
|
+
constructor(drive: IDocumentDriveServer$1, processor: IProcessorLegacy$1, taskQueueMethod?: RunAsap$1<unknown> | null);
|
|
1711
|
+
transmit(strands: StrandUpdate$1[], _source: StrandUpdateSource$1): Promise<ListenerRevision$1[]>;
|
|
1712
|
+
disconnect(): Promise<void>;
|
|
1713
|
+
}
|
|
1714
|
+
//#endregion
|
|
1715
|
+
//#region src/server/transmitter/pull-responder.d.ts
|
|
1716
|
+
declare class PullResponderTransmitter implements IPullResponderTransmitter$1 {
|
|
1717
|
+
private logger;
|
|
1718
|
+
private listener;
|
|
1719
|
+
private manager;
|
|
1720
|
+
constructor(listener: ServerListener$1, manager: IListenerManager$1);
|
|
1721
|
+
private static getAuthHeaders;
|
|
1722
|
+
private requestWithAuth;
|
|
1723
|
+
getStrands(options?: GetStrandsOptions$1): Promise<StrandUpdate$1[]>;
|
|
1724
|
+
disconnect(): Promise<void>;
|
|
1725
|
+
processAcknowledge(driveId: string, listenerId: string, revisions: ListenerRevision$1[]): Promise<boolean>;
|
|
1726
|
+
static registerPullResponder(driveId: string, url: string, filter: ListenerFilter, listenerId?: string, manager?: IListenerManager$1): Promise<ServerListener$1["listenerId"]>;
|
|
1727
|
+
static pullStrands(driveId: string, url: string, listenerId: string, options?: GetStrandsOptions$1, manager?: IListenerManager$1): Promise<StrandUpdate$1[]>;
|
|
1728
|
+
static acknowledgeStrands(url: string, listenerId: string, revisions: ListenerRevision$1[], manager?: IListenerManager$1): Promise<void>;
|
|
1729
|
+
/**
|
|
1730
|
+
* This function will only throw if `onError` throws an error (or there is
|
|
1731
|
+
* an unintentionally unhandled error in the pull loop).
|
|
1732
|
+
*
|
|
1733
|
+
* All other errors are caught, logged, and passed to `onError`.
|
|
1734
|
+
*
|
|
1735
|
+
* Because of this, `onError` _may be called multiple times_.
|
|
1736
|
+
*
|
|
1737
|
+
* @returns boolean indicating whether there might be more data to pull
|
|
1738
|
+
*/
|
|
1739
|
+
private static executePull;
|
|
1740
|
+
static setupPull(driveId: string, trigger: PullResponderTrigger$1, onStrandUpdate: (strand: StrandUpdate$1, source: StrandUpdateSource$1) => Promise<IOperationResult$1>, onError: (error: Error) => void, onRevisions?: (revisions: ListenerRevisionWithError$1[]) => void, onAcknowledge?: (success: boolean) => void, manager?: IListenerManager$1): CancelPullLoop$1;
|
|
1741
|
+
static createPullResponderTrigger(driveId: string, url: string, options: Pick<RemoteDriveOptions$1, "pullInterval" | "pullFilter">, listenerManager: IListenerManager$1): Promise<PullResponderTrigger$1>;
|
|
1742
|
+
static isPullResponderTrigger(trigger: Trigger): trigger is PullResponderTrigger$1;
|
|
1743
|
+
}
|
|
1744
|
+
//#endregion
|
|
1745
|
+
//#region src/server/transmitter/switchboard-push.d.ts
|
|
1746
|
+
declare class SwitchboardPushTransmitter implements ITransmitter$1 {
|
|
1747
|
+
private targetURL;
|
|
1748
|
+
private manager?;
|
|
1749
|
+
private logger;
|
|
1750
|
+
constructor(targetURL: string, manager?: IListenerManager$1);
|
|
1751
|
+
private getAuthHeaders;
|
|
1752
|
+
private requestWithAuth;
|
|
1753
|
+
transmit(strands: StrandUpdate$1[], source: StrandUpdateSource$1): Promise<ListenerRevision$1[]>;
|
|
1754
|
+
}
|
|
1755
|
+
//#endregion
|
|
1756
|
+
//#region src/server/utils.d.ts
|
|
1757
|
+
declare function buildRevisionsFilter(strands: StrandUpdate$1[], driveId: string, documentId: string): RevisionsFilter$1;
|
|
1758
|
+
declare function buildDocumentRevisionsFilter(document: PHDocument): RevisionsFilter$1;
|
|
1759
|
+
declare function filterOperationsByRevision(operations: DocumentOperations, revisions?: RevisionsFilter$1): DocumentOperations;
|
|
1760
|
+
declare function isAtRevision(document: PHDocument, revisions?: RevisionsFilter$1): boolean;
|
|
1761
|
+
declare function isAfterRevision(document: PHDocument, revisions?: RevisionsFilter$1): boolean;
|
|
1762
|
+
declare function compareSyncUnits(a: SynchronizationUnitId$1, b: SynchronizationUnitId$1): boolean;
|
|
1763
|
+
declare function resolveCreateDocumentInput<TDocument extends PHDocument>(input: CreateDocumentInput$1<TDocument>): {
|
|
1764
|
+
id: string | undefined;
|
|
1765
|
+
documentType: string;
|
|
1766
|
+
document: TDocument | undefined;
|
|
1767
|
+
};
|
|
1768
|
+
declare function resolveCreateDocumentInputId(input: CreateDocumentInput$1<PHDocument>): string | undefined;
|
|
1769
|
+
declare function resolveCreateDocumentInputDocumentType(input: CreateDocumentInput$1<PHDocument>): string;
|
|
1770
|
+
declare function resolveCreateDocumentInputDocument<TDocument extends PHDocument>(input: CreateDocumentInput$1<TDocument>): TDocument | undefined;
|
|
1771
|
+
declare function isSharingType(value: string): value is SharingType$1;
|
|
1772
|
+
declare function getDriveSharingType(drive: DocumentDriveDocument): SharingType$1;
|
|
1773
|
+
//#endregion
|
|
1774
|
+
//#region src/read-mode/service.d.ts
|
|
1775
|
+
declare class ReadModeService implements IReadModeDriveService$1 {
|
|
1776
|
+
#private;
|
|
1777
|
+
constructor(getDocumentModelModule: GetDocumentModelModule$1);
|
|
1778
|
+
fetchDrive(id: string): Promise<ReadDrive$1 | ReadDriveNotFoundError>;
|
|
1779
|
+
fetchDocument<TState extends PHBaseState = PHBaseState>(driveId: string, documentId: string, documentType: string): Promise<PHDocument<TState> | DocumentModelNotFoundError | ReadDriveNotFoundError | ReadDocumentNotFoundError>;
|
|
1780
|
+
addReadDrive(url: string, options?: ReadDriveOptions$1): Promise<void>;
|
|
1781
|
+
getReadDrives(): Promise<string[]>;
|
|
1782
|
+
getReadDrive(id: string): Promise<ReadDrive$1 | ReadDriveNotFoundError>;
|
|
1783
|
+
getReadDriveBySlug(slug: string): Promise<ReadDrive$1 | ReadDriveSlugNotFoundError>;
|
|
1784
|
+
getReadDriveContext(id: string): Promise<ReadDriveNotFoundError | ReadDriveContext$1>;
|
|
1785
|
+
deleteReadDrive(id: string): Promise<ReadDriveNotFoundError | undefined>;
|
|
1786
|
+
}
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region src/utils/default-drives-manager.d.ts
|
|
1789
|
+
declare class DefaultDrivesManager implements IDefaultDrivesManager$1 {
|
|
1790
|
+
private server;
|
|
1791
|
+
private delegate;
|
|
1792
|
+
private defaultRemoteDrives;
|
|
1793
|
+
private removeOldRemoteDrivesConfig;
|
|
1794
|
+
constructor(server: IBaseDocumentDriveServer$1 | (IBaseDocumentDriveServer$1 & IReadModeDriveServer$1), delegate: IServerDelegateDrivesManager$1, options?: Pick<DocumentDriveServerOptions$1, "defaultDrives">);
|
|
1795
|
+
getDefaultRemoteDrives(): Map<string, DefaultRemoteDriveInfo$1>;
|
|
1796
|
+
private deleteDriveById;
|
|
1797
|
+
private preserveDrivesById;
|
|
1798
|
+
private removeDrivesById;
|
|
1799
|
+
private detachDrivesById;
|
|
1800
|
+
removeOldremoteDrives(): Promise<void>;
|
|
1801
|
+
setAllDefaultDrivesAccessLevel(level: RemoteDriveAccessLevel$1): Promise<void>;
|
|
1802
|
+
setDefaultDriveAccessLevel(url: string, level: RemoteDriveAccessLevel$1): Promise<void>;
|
|
1803
|
+
initializeDefaultRemoteDrives(defaultDrives?: DefaultRemoteDriveInfo$1[]): Promise<void>;
|
|
1804
|
+
}
|
|
1805
|
+
//#endregion
|
|
1806
|
+
//#region src/utils/errors.d.ts
|
|
1807
|
+
declare class AbortError extends Error {
|
|
1808
|
+
constructor(message?: string);
|
|
1809
|
+
}
|
|
1810
|
+
declare const isAbortError: (error: unknown) => boolean;
|
|
1811
|
+
//#endregion
|
|
1812
|
+
//#region src/utils/gql-transformations.d.ts
|
|
1813
|
+
type ResponseForDrive = {
|
|
1814
|
+
id: string;
|
|
1815
|
+
slug: string;
|
|
1816
|
+
meta: Record<string, unknown> | undefined;
|
|
1817
|
+
name: string;
|
|
1818
|
+
icon: string | undefined;
|
|
1819
|
+
graphqlEndpoint?: string;
|
|
1820
|
+
};
|
|
1821
|
+
declare function responseForDrive(drive: DocumentDriveDocument, graphqlEndpoint?: string): ResponseForDrive;
|
|
1822
|
+
type PHDocumentGQL = Omit<PHDocumentHeader, "revision"> & {
|
|
1823
|
+
id: string;
|
|
1824
|
+
revision: number;
|
|
1825
|
+
/**
|
|
1826
|
+
* @deprecated Use createdAtUtcIso instead
|
|
1827
|
+
*/
|
|
1828
|
+
createdAt: string;
|
|
1829
|
+
/**
|
|
1830
|
+
* @deprecated Use lastModifiedAtUtcIso instead
|
|
1831
|
+
*/
|
|
1832
|
+
lastModified: string;
|
|
1833
|
+
__typename: string;
|
|
1834
|
+
state: unknown;
|
|
1835
|
+
initialState: unknown;
|
|
1836
|
+
stateJSON: unknown;
|
|
1837
|
+
operations: Operation[];
|
|
1838
|
+
nodeName?: string;
|
|
1839
|
+
};
|
|
1840
|
+
declare function responseForDocument(document: PHDocument, typeName: string, nodeName?: string): PHDocumentGQL;
|
|
1841
|
+
//#endregion
|
|
1842
|
+
//#region src/utils/graphql.d.ts
|
|
1843
|
+
declare function requestGraphql<T>(url: string, document: string, variables?: Record<string, unknown>, headers?: Record<string, string>): Promise<GraphQLResult$1<T>>;
|
|
1844
|
+
declare function generateDocumentStateQueryFields(documentModelState: DocumentModelGlobalState, prefix: string, options?: BuildSchemaOptions & ParseOptions): string;
|
|
1845
|
+
declare function requestPublicDriveWithTokenFromReactor(url: string, server: IBaseDocumentDriveServer$1): Promise<DriveInfo$1>;
|
|
1846
|
+
declare function requestPublicDrive(url: string, headers?: Record<string, string>): Promise<DriveInfo$1>;
|
|
1847
|
+
declare function requestPublicDriveFromReactor(url: string, headers?: Record<string, string>): Promise<DriveInfo$1>;
|
|
1848
|
+
declare function fetchDocument<TState extends PHBaseState = PHBaseState>(url: string, documentId: string, documentModelModule: DocumentModelModule<TState>): Promise<GraphQLResult$1<{
|
|
1849
|
+
document: DocumentGraphQLResult$1<TState>;
|
|
1850
|
+
}>>;
|
|
1851
|
+
//#endregion
|
|
1852
|
+
//#region src/utils/migrations.d.ts
|
|
1853
|
+
declare function migrateDocumentOperationSignatures(document: PHDocument): PHDocument | undefined;
|
|
1854
|
+
declare function migrateLegacyOperationSignature<TGlobalState, TLocalState>(operation: Operation): Operation;
|
|
1855
|
+
//#endregion
|
|
1856
|
+
//#region src/utils/misc.d.ts
|
|
1857
|
+
declare function isDocumentDrive(document: PHDocument): document is DocumentDriveDocument;
|
|
1858
|
+
declare function mergeOperations(currentOperations: DocumentOperations, newOperations: Operation[]): DocumentOperations;
|
|
1859
|
+
declare function isNoopUpdate(operation: Operation, latestOperation?: Operation): boolean;
|
|
1860
|
+
declare function isBefore(dateA: Date | string, dateB: Date | string): boolean;
|
|
1861
|
+
declare function operationsToRevision(operations: Pick<Operation, "index">[] | undefined): ListenerRevision$1["revision"];
|
|
1862
|
+
/**
|
|
1863
|
+
* Converts a string to PascalCase
|
|
1864
|
+
* @param {string} str - The input string to convert
|
|
1865
|
+
* @returns {string} The string in PascalCase format
|
|
1866
|
+
*
|
|
1867
|
+
* Examples:
|
|
1868
|
+
* "hello world" -> "HelloWorld"
|
|
1869
|
+
* "hello-world" -> "HelloWorld"
|
|
1870
|
+
* "hello_world" -> "HelloWorld"
|
|
1871
|
+
* "helloWorld" -> "HelloWorld"
|
|
1872
|
+
*/
|
|
1873
|
+
declare const toPascalCase: typeof pascalCase;
|
|
1874
|
+
//#endregion
|
|
1875
|
+
//#region src/utils/run-asap.d.ts
|
|
1876
|
+
declare const useMessageChannel: Error | ((task: Task$1) => () => void);
|
|
1877
|
+
declare const usePostMessage: Error | ((task: Task$1) => () => void);
|
|
1878
|
+
declare const useSetImmediate: Error | ((task: Task$1) => () => void);
|
|
1879
|
+
declare const useSetTimeout: (task: Task$1) => () => void;
|
|
1880
|
+
declare function runAsap<T = void>(task: Task$1<T>): AbortTask$1;
|
|
1881
|
+
declare function runAsapAsync<T = void>(task: Task$1<Promise<T>>, queueMethod?: RunAsap$1<void>): Promise<T>;
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region src/utils/test.d.ts
|
|
1884
|
+
declare const baseDocumentModels: DocumentModelModule<any>[];
|
|
1885
|
+
declare function expectUUID(expect: ExpectStatic): unknown;
|
|
1886
|
+
declare function expectOperationId(expect: ExpectStatic): unknown;
|
|
1887
|
+
declare function expectUTCTimestamp(expect: ExpectStatic): unknown;
|
|
1888
|
+
declare function buildOperation<TDocument extends PHDocument>(reducer: Reducer<any>, document: TDocument, action: Action, index?: number): Operation;
|
|
1889
|
+
declare function buildOperations<TDocument extends PHDocument>(reducer: Reducer<any>, document: TDocument, actions: Array<Action>): Operation[];
|
|
1890
|
+
declare function buildOperationAndDocument<TDocument extends PHDocument>(reducer: Reducer<any>, document: TDocument, action: Action, index?: number): {
|
|
1891
|
+
document: TDocument;
|
|
1892
|
+
operation: Operation;
|
|
1893
|
+
};
|
|
1894
|
+
declare class BasicClient<TDocument extends PHDocument = PHDocument> {
|
|
1895
|
+
private server;
|
|
1896
|
+
private driveId;
|
|
1897
|
+
private documentId;
|
|
1898
|
+
private document;
|
|
1899
|
+
private reducer;
|
|
1900
|
+
private unsyncedOperations;
|
|
1901
|
+
constructor(server: BaseDocumentDriveServer$1, driveId: string, documentId: string, document: TDocument, reducer: Reducer<any>);
|
|
1902
|
+
getDocument(): TDocument;
|
|
1903
|
+
clearUnsyncedOperations(): void;
|
|
1904
|
+
pushOperationsToServer(): Promise<document_drive0.IOperationResult>;
|
|
1905
|
+
syncDocument(): Promise<TDocument>;
|
|
1906
|
+
dispatchDocumentAction(action: Action): {
|
|
1907
|
+
document: TDocument;
|
|
1908
|
+
operation: Operation;
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
declare class DriveBasicClient<TDocument extends PHDocument = PHDocument> {
|
|
1912
|
+
private server;
|
|
1913
|
+
private driveId;
|
|
1914
|
+
private document;
|
|
1915
|
+
private reducer;
|
|
1916
|
+
private unsyncedOperations;
|
|
1917
|
+
constructor(server: IDocumentDriveServer$1, driveId: string, document: TDocument, reducer: Reducer<any>);
|
|
1918
|
+
getDocument(): TDocument;
|
|
1919
|
+
getUnsyncedOperations(): Operation[];
|
|
1920
|
+
setUnsyncedOperations(operations: Operation[]): void;
|
|
1921
|
+
clearUnsyncedOperations(): void;
|
|
1922
|
+
pushOperationsToServer(): Promise<document_drive0.IOperationResult<PHDocument>>;
|
|
1923
|
+
syncDocument(): Promise<TDocument>;
|
|
1924
|
+
dispatchDriveAction(action: Action): {
|
|
1925
|
+
document: TDocument;
|
|
1926
|
+
operation: Operation;
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
declare const fakeAction: (params: Partial<Action> & {
|
|
1930
|
+
index?: number;
|
|
1931
|
+
hash?: string;
|
|
1932
|
+
skip?: number;
|
|
1933
|
+
}) => Action;
|
|
1934
|
+
/**
|
|
1935
|
+
* Creates a default base state with the required auth and document properties
|
|
1936
|
+
* @param global - The global state
|
|
1937
|
+
* @param local - The local state
|
|
1938
|
+
*/
|
|
1939
|
+
declare function createBaseState<TGlobal, TLocal>(global: TGlobal, local: TLocal): PHBaseState & {
|
|
1940
|
+
global: TGlobal;
|
|
1941
|
+
local: TLocal;
|
|
1942
|
+
};
|
|
1943
|
+
//#endregion
|
|
1944
|
+
export { AbortError, AbortTask, ActionJob, AddOperationOptions, AddRemoteDriveStatus, BaseDocumentDriveServer, BaseJob, BasicClient, BrowserStorage, CacheStorageManager, CancelPullLoop, ConflictOperationError, Constructor, CreateDocumentInput, CreateDocumentInputWithDocument, CreateDocumentInputWithDocumentType, CreateDocumentInputWithHeader, CreateListenerInput, DefaultDrivesManager, DefaultEventEmitter, DefaultListenerManagerOptions, DefaultRemoteDriveInfo, DefaultRemoteDriveInput, DocumentAlreadyExistsError, DocumentAlreadyExistsReason, DocumentDriveServer, DocumentDriveServerConstructor, DocumentDriveServerMixin, DocumentDriveServerOptions, DocumentGraphQLResult, DocumentJob, DocumentModelNotFoundError, DocumentNotFoundError, DriveBasicClient, DriveEvents, DriveInfo, DriveInput, DriveOperationResult, DriveState, DriveUpdateErrorHandler, ErrorStatus, EventQueueManager, ExtractProcessorSchema, ExtractProcessorSchemaOrSelf, GetDocumentModelModule, GetDocumentOptions, GetStrandsOptions, GraphQLResult, HashAlgorithmsLegacy, IBaseDocumentDriveServer, IBaseRelationalDbLegacy, ICache, ICacheStorage, ICacheStorageManager, IDefaultDrivesManager, IDocumentAdminStorage, IDocumentCache, IDocumentDriveServer, IDocumentOperationStorage, IDocumentStorage, IDriveOperationStorage, IEventEmitter, IJob, IJobQueue, IListenerManager, IOperationResult, IProcessorHostModuleLegacy, IProcessorLegacy, IProcessorManagerLegacy, IPullResponderTransmitter, IQueue, IQueueManager, IReadModeDriveServer, IReadModeDriveService, IRelationalDbLegacy, IRelationalDbProcessorLegacy, IRelationalQueryBuilderLegacy, IRelationalQueryMethods, IServerDelegate, IServerDelegateDrivesManager, IStorageUnit, IStorageUnitFilter, IStorageUnitStorage, ISyncUnitMap, ISynchronizationManager, ITransmitter, ITransmitterFactory, InMemoryCache, InternalOperationUpdate, InternalTransmitter, InternalTransmitterService, InternalTransmitterUpdate, Job, JobId, LRUCacheStorage, LRUCacheStorageOptions, LegacyCreateDocumentInput, ListenerManager, ListenerManagerOptions, ListenerRevision, ListenerRevisionWithError, ListenerState, ListenerStatus, ListenerUpdate, MemoryQueue, MemoryStorage, MissingOperationError, Mixin, OperationError, OperationJob, OperationUpdate, OperationUpdateGraphQL, PHDocumentGQL, PartialRecord, ProcessorFactoryLegacy, ProcessorManagerLegacy, ProcessorRecordLegacy, PullResponderTransmitter, PullResponderTrigger, PullStrandsGraphQL, PullSyncStatus, PushSyncStatus, QueueEvents, ReactorBuilder, ReadDocumentNotFoundError, ReadDrive, ReadDriveContext, ReadDriveError, ReadDriveNotFoundError, ReadDriveOptions, ReadDriveSlugNotFoundError, ReadDrivesListener, ReadDrivesListenerUnsubscribe, ReadModeDriveServerMixin, ReadModeServer, ReadModeService, RedisCache, RelationalDbProcessorClassLegacy, RelationalDbProcessorFilterLegacy, RelationalDbProcessorLegacy, RemoteDriveAccessLevel, RemoteDriveOptions, RemoveDriveStrategy, RemoveOldRemoteDrivesOption, ResolvedStorageUnitFilter, RevisionsFilter, RunAsap, ServerListener, ServerTransmitterType, SharingType, StrandUpdate, StrandUpdateGraphQL, StrandUpdateSource, SwitchboardPushTransmitter, SyncStatus, SyncUnitMap, SyncUnitStatusObject, SynchronizationManager, SynchronizationUnit, SynchronizationUnitId, SynchronizationUnitMap, SynchronizationUnitNotFoundError, SynchronizationUnitQuery, SyncronizationUnitState, Task, TransmitterFactory, UpdateStatus, baseDocumentModels, buildDocumentRevisionsFilter, buildOperation, buildOperationAndDocument, buildOperations, buildRevisionsFilter, compareSyncUnits, createBaseState, createNamespacedDbLegacy, createNamespacedQueryBuilderLegacy, createRelationalDbLegacy, debounce, decodeDocumentIdFromPath, encodeDocumentIdForPath, expectOperationId, expectUTCTimestamp, expectUUID, fakeAction, fetchDocument, filterOperationsByRevision, generateDocumentStateQueryFields, getDriveSharingType, gql, hasBase64SpecialChars, hashNamespaceLegacy, isAbortError, isActionJob, isAfterRevision, isAtRevision, isBefore, isDocumentDrive, isDocumentJob, isNoopUpdate, isOperationJob, isRelationalDbProcessor, isSharingType, isUUID, mergeOperations, migrateDocumentOperationSignatures, migrateLegacyOperationSignature, operationsToRevision, relationalDbToQueryBuilderLegacy, requestGraphql, requestPublicDrive, requestPublicDriveFromReactor, requestPublicDriveWithTokenFromReactor, resolveCreateDocumentInput, resolveCreateDocumentInputDocument, resolveCreateDocumentInputDocumentType, resolveCreateDocumentInputId, resolveStorageUnitsFilter, resolveStorageUnitsFilterComponent, responseForDocument, responseForDrive, runAsap, runAsapAsync, setIntersection, setUnion, toPascalCase, trimResultingState, useMessageChannel, usePostMessage, useSetImmediate, useSetTimeout };
|
|
2
1945
|
//# sourceMappingURL=index.d.ts.map
|