@tearleads/client-sdk 0.1.39 → 0.1.41
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/client/organizations/organizationGroupPresentation.d.ts +1 -12
- package/data/documents/shared/syncResponses.js +5 -7
- package/data/documents/shared/syncResponses.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelGrantPersistence.js +2 -1
- package/data/persistence/organizations/organizationReadModelGrantPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelMemberLoad.d.ts +9 -0
- package/data/persistence/organizations/organizationReadModelMemberLoad.js +29 -21
- package/data/persistence/organizations/organizationReadModelMemberLoad.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelMembershipPersistence.js +91 -46
- package/data/persistence/organizations/organizationReadModelMembershipPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelPersistence.js +95 -73
- package/data/persistence/organizations/organizationReadModelPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelProjection.js +78 -89
- package/data/persistence/organizations/organizationReadModelProjection.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelPurge.js +14 -15
- package/data/persistence/organizations/organizationReadModelPurge.js.map +1 -1
- package/data/sqlite/organizationReadModelSchema.js +23 -28
- package/data/sqlite/organizationReadModelSchema.js.map +1 -1
- package/data/sqlite/organizationReadModelTableRegistry.d.ts +116 -263
- package/data/sqlite/organizationReadModelTableRegistry.js +10 -7
- package/data/sqlite/organizationReadModelTableRegistry.js.map +1 -1
- package/data/sqlite/schema.d.ts +116 -263
- package/data/sqlite/sqliteBindBudget.js +30 -0
- package/data/sqlite/sqliteBindBudget.js.map +1 -0
- package/internal/validators/documentSyncRefinements.js +5 -0
- package/internal/validators/documentSyncRefinements.js.map +1 -1
- package/internal/validators/operation/documentSync.d.ts +3 -0
- package/internal/validators/operation/organizations.d.ts +0 -16
- package/internal/validators/response/documentSyncSchema.js +35 -1
- package/internal/validators/response/documentSyncSchema.js.map +1 -1
- package/internal/validators/response/index.d.ts +1 -1
- package/internal/validators/response/index.js.map +1 -1
- package/internal/validators/response/organizationReadModel.d.ts +10 -48
- package/internal/validators/response/organizationReadModel.js +9 -1
- package/internal/validators/response/organizationReadModel.js.map +1 -1
- package/package.json +1 -1
- package/workflows/documents/syncContentKeys.js +4 -9
- package/workflows/documents/syncContentKeys.js.map +1 -1
- package/workflows/organizations/readModel.d.ts +8 -3
- package/workflows/organizations/readModel.js.map +1 -1
- package/workflows/organizations/readModelProjection.d.ts +2 -12
- package/workflows/organizations/readModelProjection.js +1 -1
- package/workflows/organizations/readModelProjection.js.map +1 -1
- package/workflows/sync/remoteReset.js +1 -3
- package/workflows/sync/remoteReset.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelPolicyHeadPersistence.js +0 -64
- package/data/persistence/organizations/organizationReadModelPolicyHeadPersistence.js.map +0 -1
package/data/sqlite/schema.d.ts
CHANGED
|
@@ -2905,6 +2905,114 @@ export declare const clientSQLiteSchema: {
|
|
|
2905
2905
|
}, {}, {
|
|
2906
2906
|
length: number | undefined;
|
|
2907
2907
|
}>;
|
|
2908
|
+
memberGroupStateHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2909
|
+
name: "member_group_state_hash";
|
|
2910
|
+
tableName: "organization_read_model_state";
|
|
2911
|
+
dataType: "string";
|
|
2912
|
+
columnType: "SQLiteText";
|
|
2913
|
+
data: string;
|
|
2914
|
+
driverParam: string;
|
|
2915
|
+
notNull: true;
|
|
2916
|
+
hasDefault: false;
|
|
2917
|
+
isPrimaryKey: false;
|
|
2918
|
+
isAutoincrement: false;
|
|
2919
|
+
hasRuntimeDefault: false;
|
|
2920
|
+
enumValues: [string, ...string[]];
|
|
2921
|
+
baseColumn: never;
|
|
2922
|
+
identity: undefined;
|
|
2923
|
+
generated: undefined;
|
|
2924
|
+
}, {}, {
|
|
2925
|
+
length: number | undefined;
|
|
2926
|
+
}>;
|
|
2927
|
+
organizationStateHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2928
|
+
name: "organization_state_hash";
|
|
2929
|
+
tableName: "organization_read_model_state";
|
|
2930
|
+
dataType: "string";
|
|
2931
|
+
columnType: "SQLiteText";
|
|
2932
|
+
data: string;
|
|
2933
|
+
driverParam: string;
|
|
2934
|
+
notNull: true;
|
|
2935
|
+
hasDefault: false;
|
|
2936
|
+
isPrimaryKey: false;
|
|
2937
|
+
isAutoincrement: false;
|
|
2938
|
+
hasRuntimeDefault: false;
|
|
2939
|
+
enumValues: [string, ...string[]];
|
|
2940
|
+
baseColumn: never;
|
|
2941
|
+
identity: undefined;
|
|
2942
|
+
generated: undefined;
|
|
2943
|
+
}, {}, {
|
|
2944
|
+
length: number | undefined;
|
|
2945
|
+
}>;
|
|
2946
|
+
organizationStateVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2947
|
+
name: "organization_state_version";
|
|
2948
|
+
tableName: "organization_read_model_state";
|
|
2949
|
+
dataType: "number";
|
|
2950
|
+
columnType: "SQLiteInteger";
|
|
2951
|
+
data: number;
|
|
2952
|
+
driverParam: number;
|
|
2953
|
+
notNull: true;
|
|
2954
|
+
hasDefault: false;
|
|
2955
|
+
isPrimaryKey: false;
|
|
2956
|
+
isAutoincrement: false;
|
|
2957
|
+
hasRuntimeDefault: false;
|
|
2958
|
+
enumValues: undefined;
|
|
2959
|
+
baseColumn: never;
|
|
2960
|
+
identity: undefined;
|
|
2961
|
+
generated: undefined;
|
|
2962
|
+
}, {}, {}>;
|
|
2963
|
+
organizationKeyEpoch: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2964
|
+
name: "organization_key_epoch";
|
|
2965
|
+
tableName: "organization_read_model_state";
|
|
2966
|
+
dataType: "number";
|
|
2967
|
+
columnType: "SQLiteInteger";
|
|
2968
|
+
data: number;
|
|
2969
|
+
driverParam: number;
|
|
2970
|
+
notNull: true;
|
|
2971
|
+
hasDefault: false;
|
|
2972
|
+
isPrimaryKey: false;
|
|
2973
|
+
isAutoincrement: false;
|
|
2974
|
+
hasRuntimeDefault: false;
|
|
2975
|
+
enumValues: undefined;
|
|
2976
|
+
baseColumn: never;
|
|
2977
|
+
identity: undefined;
|
|
2978
|
+
generated: undefined;
|
|
2979
|
+
}, {}, {}>;
|
|
2980
|
+
organizationKeyFingerprint: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2981
|
+
name: "organization_key_fingerprint";
|
|
2982
|
+
tableName: "organization_read_model_state";
|
|
2983
|
+
dataType: "string";
|
|
2984
|
+
columnType: "SQLiteText";
|
|
2985
|
+
data: string;
|
|
2986
|
+
driverParam: string;
|
|
2987
|
+
notNull: true;
|
|
2988
|
+
hasDefault: false;
|
|
2989
|
+
isPrimaryKey: false;
|
|
2990
|
+
isAutoincrement: false;
|
|
2991
|
+
hasRuntimeDefault: false;
|
|
2992
|
+
enumValues: [string, ...string[]];
|
|
2993
|
+
baseColumn: never;
|
|
2994
|
+
identity: undefined;
|
|
2995
|
+
generated: undefined;
|
|
2996
|
+
}, {}, {
|
|
2997
|
+
length: number | undefined;
|
|
2998
|
+
}>;
|
|
2999
|
+
organizationMemberCount: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3000
|
+
name: "organization_member_count";
|
|
3001
|
+
tableName: "organization_read_model_state";
|
|
3002
|
+
dataType: "number";
|
|
3003
|
+
columnType: "SQLiteInteger";
|
|
3004
|
+
data: number;
|
|
3005
|
+
driverParam: number;
|
|
3006
|
+
notNull: true;
|
|
3007
|
+
hasDefault: false;
|
|
3008
|
+
isPrimaryKey: false;
|
|
3009
|
+
isAutoincrement: false;
|
|
3010
|
+
hasRuntimeDefault: false;
|
|
3011
|
+
enumValues: undefined;
|
|
3012
|
+
baseColumn: never;
|
|
3013
|
+
identity: undefined;
|
|
3014
|
+
generated: undefined;
|
|
3015
|
+
}, {}, {}>;
|
|
2908
3016
|
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2909
3017
|
name: "updated_at";
|
|
2910
3018
|
tableName: "organization_read_model_state";
|
|
@@ -3463,148 +3571,14 @@ export declare const clientSQLiteSchema: {
|
|
|
3463
3571
|
identity: undefined;
|
|
3464
3572
|
generated: undefined;
|
|
3465
3573
|
}, {}, {}>;
|
|
3466
|
-
memberCount: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3467
|
-
name: "member_count";
|
|
3468
|
-
tableName: "organization_read_model_groups";
|
|
3469
|
-
dataType: "number";
|
|
3470
|
-
columnType: "SQLiteInteger";
|
|
3471
|
-
data: number;
|
|
3472
|
-
driverParam: number;
|
|
3473
|
-
notNull: false;
|
|
3474
|
-
hasDefault: false;
|
|
3475
|
-
isPrimaryKey: false;
|
|
3476
|
-
isAutoincrement: false;
|
|
3477
|
-
hasRuntimeDefault: false;
|
|
3478
|
-
enumValues: undefined;
|
|
3479
|
-
baseColumn: never;
|
|
3480
|
-
identity: undefined;
|
|
3481
|
-
generated: undefined;
|
|
3482
|
-
}, {}, {}>;
|
|
3483
|
-
};
|
|
3484
|
-
dialect: "sqlite";
|
|
3485
|
-
}>;
|
|
3486
|
-
organizationReadModelPolicyHeads: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
3487
|
-
name: "organization_read_model_policy_heads";
|
|
3488
|
-
schema: undefined;
|
|
3489
|
-
columns: {
|
|
3490
|
-
organizationId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3491
|
-
name: "organization_id";
|
|
3492
|
-
tableName: "organization_read_model_policy_heads";
|
|
3493
|
-
dataType: "string";
|
|
3494
|
-
columnType: "SQLiteText";
|
|
3495
|
-
data: string;
|
|
3496
|
-
driverParam: string;
|
|
3497
|
-
notNull: true;
|
|
3498
|
-
hasDefault: false;
|
|
3499
|
-
isPrimaryKey: false;
|
|
3500
|
-
isAutoincrement: false;
|
|
3501
|
-
hasRuntimeDefault: false;
|
|
3502
|
-
enumValues: [string, ...string[]];
|
|
3503
|
-
baseColumn: never;
|
|
3504
|
-
identity: undefined;
|
|
3505
|
-
generated: undefined;
|
|
3506
|
-
}, {}, {
|
|
3507
|
-
length: number | undefined;
|
|
3508
|
-
}>;
|
|
3509
|
-
principalType: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3510
|
-
name: "principal_type";
|
|
3511
|
-
tableName: "organization_read_model_policy_heads";
|
|
3512
|
-
dataType: "string";
|
|
3513
|
-
columnType: "SQLiteText";
|
|
3514
|
-
data: string;
|
|
3515
|
-
driverParam: string;
|
|
3516
|
-
notNull: true;
|
|
3517
|
-
hasDefault: false;
|
|
3518
|
-
isPrimaryKey: false;
|
|
3519
|
-
isAutoincrement: false;
|
|
3520
|
-
hasRuntimeDefault: false;
|
|
3521
|
-
enumValues: [string, ...string[]];
|
|
3522
|
-
baseColumn: never;
|
|
3523
|
-
identity: undefined;
|
|
3524
|
-
generated: undefined;
|
|
3525
|
-
}, {}, {
|
|
3526
|
-
length: number | undefined;
|
|
3527
|
-
}>;
|
|
3528
|
-
principalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3529
|
-
name: "principal_id";
|
|
3530
|
-
tableName: "organization_read_model_policy_heads";
|
|
3531
|
-
dataType: "string";
|
|
3532
|
-
columnType: "SQLiteText";
|
|
3533
|
-
data: string;
|
|
3534
|
-
driverParam: string;
|
|
3535
|
-
notNull: true;
|
|
3536
|
-
hasDefault: false;
|
|
3537
|
-
isPrimaryKey: false;
|
|
3538
|
-
isAutoincrement: false;
|
|
3539
|
-
hasRuntimeDefault: false;
|
|
3540
|
-
enumValues: [string, ...string[]];
|
|
3541
|
-
baseColumn: never;
|
|
3542
|
-
identity: undefined;
|
|
3543
|
-
generated: undefined;
|
|
3544
|
-
}, {}, {
|
|
3545
|
-
length: number | undefined;
|
|
3546
|
-
}>;
|
|
3547
|
-
stateHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3548
|
-
name: "state_hash";
|
|
3549
|
-
tableName: "organization_read_model_policy_heads";
|
|
3550
|
-
dataType: "string";
|
|
3551
|
-
columnType: "SQLiteText";
|
|
3552
|
-
data: string;
|
|
3553
|
-
driverParam: string;
|
|
3554
|
-
notNull: true;
|
|
3555
|
-
hasDefault: false;
|
|
3556
|
-
isPrimaryKey: false;
|
|
3557
|
-
isAutoincrement: false;
|
|
3558
|
-
hasRuntimeDefault: false;
|
|
3559
|
-
enumValues: [string, ...string[]];
|
|
3560
|
-
baseColumn: never;
|
|
3561
|
-
identity: undefined;
|
|
3562
|
-
generated: undefined;
|
|
3563
|
-
}, {}, {
|
|
3564
|
-
length: number | undefined;
|
|
3565
|
-
}>;
|
|
3566
|
-
stateVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3567
|
-
name: "state_version";
|
|
3568
|
-
tableName: "organization_read_model_policy_heads";
|
|
3569
|
-
dataType: "number";
|
|
3570
|
-
columnType: "SQLiteInteger";
|
|
3571
|
-
data: number;
|
|
3572
|
-
driverParam: number;
|
|
3573
|
-
notNull: true;
|
|
3574
|
-
hasDefault: false;
|
|
3575
|
-
isPrimaryKey: false;
|
|
3576
|
-
isAutoincrement: false;
|
|
3577
|
-
hasRuntimeDefault: false;
|
|
3578
|
-
enumValues: undefined;
|
|
3579
|
-
baseColumn: never;
|
|
3580
|
-
identity: undefined;
|
|
3581
|
-
generated: undefined;
|
|
3582
|
-
}, {}, {}>;
|
|
3583
|
-
keyEpoch: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3584
|
-
name: "key_epoch";
|
|
3585
|
-
tableName: "organization_read_model_policy_heads";
|
|
3586
|
-
dataType: "number";
|
|
3587
|
-
columnType: "SQLiteInteger";
|
|
3588
|
-
data: number;
|
|
3589
|
-
driverParam: number;
|
|
3590
|
-
notNull: true;
|
|
3591
|
-
hasDefault: false;
|
|
3592
|
-
isPrimaryKey: false;
|
|
3593
|
-
isAutoincrement: false;
|
|
3594
|
-
hasRuntimeDefault: false;
|
|
3595
|
-
enumValues: undefined;
|
|
3596
|
-
baseColumn: never;
|
|
3597
|
-
identity: undefined;
|
|
3598
|
-
generated: undefined;
|
|
3599
|
-
}, {}, {}>;
|
|
3600
3574
|
keyFingerprint: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3601
3575
|
name: "key_fingerprint";
|
|
3602
|
-
tableName: "
|
|
3576
|
+
tableName: "organization_read_model_groups";
|
|
3603
3577
|
dataType: "string";
|
|
3604
3578
|
columnType: "SQLiteText";
|
|
3605
3579
|
data: string;
|
|
3606
3580
|
driverParam: string;
|
|
3607
|
-
notNull:
|
|
3581
|
+
notNull: false;
|
|
3608
3582
|
hasDefault: false;
|
|
3609
3583
|
isPrimaryKey: false;
|
|
3610
3584
|
isAutoincrement: false;
|
|
@@ -3618,12 +3592,12 @@ export declare const clientSQLiteSchema: {
|
|
|
3618
3592
|
}>;
|
|
3619
3593
|
memberCount: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3620
3594
|
name: "member_count";
|
|
3621
|
-
tableName: "
|
|
3595
|
+
tableName: "organization_read_model_groups";
|
|
3622
3596
|
dataType: "number";
|
|
3623
3597
|
columnType: "SQLiteInteger";
|
|
3624
3598
|
data: number;
|
|
3625
3599
|
driverParam: number;
|
|
3626
|
-
notNull:
|
|
3600
|
+
notNull: false;
|
|
3627
3601
|
hasDefault: false;
|
|
3628
3602
|
isPrimaryKey: false;
|
|
3629
3603
|
isAutoincrement: false;
|
|
@@ -3633,59 +3607,14 @@ export declare const clientSQLiteSchema: {
|
|
|
3633
3607
|
identity: undefined;
|
|
3634
3608
|
generated: undefined;
|
|
3635
3609
|
}, {}, {}>;
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
organizationReadModelGroupMemberships: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
3640
|
-
name: "organization_read_model_group_memberships";
|
|
3641
|
-
schema: undefined;
|
|
3642
|
-
columns: {
|
|
3643
|
-
organizationId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3644
|
-
name: "organization_id";
|
|
3645
|
-
tableName: "organization_read_model_group_memberships";
|
|
3646
|
-
dataType: "string";
|
|
3647
|
-
columnType: "SQLiteText";
|
|
3648
|
-
data: string;
|
|
3649
|
-
driverParam: string;
|
|
3650
|
-
notNull: true;
|
|
3651
|
-
hasDefault: false;
|
|
3652
|
-
isPrimaryKey: false;
|
|
3653
|
-
isAutoincrement: false;
|
|
3654
|
-
hasRuntimeDefault: false;
|
|
3655
|
-
enumValues: [string, ...string[]];
|
|
3656
|
-
baseColumn: never;
|
|
3657
|
-
identity: undefined;
|
|
3658
|
-
generated: undefined;
|
|
3659
|
-
}, {}, {
|
|
3660
|
-
length: number | undefined;
|
|
3661
|
-
}>;
|
|
3662
|
-
groupId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3663
|
-
name: "group_id";
|
|
3664
|
-
tableName: "organization_read_model_group_memberships";
|
|
3665
|
-
dataType: "string";
|
|
3666
|
-
columnType: "SQLiteText";
|
|
3667
|
-
data: string;
|
|
3668
|
-
driverParam: string;
|
|
3669
|
-
notNull: true;
|
|
3670
|
-
hasDefault: false;
|
|
3671
|
-
isPrimaryKey: false;
|
|
3672
|
-
isAutoincrement: false;
|
|
3673
|
-
hasRuntimeDefault: false;
|
|
3674
|
-
enumValues: [string, ...string[]];
|
|
3675
|
-
baseColumn: never;
|
|
3676
|
-
identity: undefined;
|
|
3677
|
-
generated: undefined;
|
|
3678
|
-
}, {}, {
|
|
3679
|
-
length: number | undefined;
|
|
3680
|
-
}>;
|
|
3681
|
-
stateHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3682
|
-
name: "state_hash";
|
|
3683
|
-
tableName: "organization_read_model_group_memberships";
|
|
3610
|
+
membersStateHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3611
|
+
name: "members_state_hash";
|
|
3612
|
+
tableName: "organization_read_model_groups";
|
|
3684
3613
|
dataType: "string";
|
|
3685
3614
|
columnType: "SQLiteText";
|
|
3686
3615
|
data: string;
|
|
3687
3616
|
driverParam: string;
|
|
3688
|
-
notNull:
|
|
3617
|
+
notNull: false;
|
|
3689
3618
|
hasDefault: false;
|
|
3690
3619
|
isPrimaryKey: false;
|
|
3691
3620
|
isAutoincrement: false;
|
|
@@ -3816,82 +3745,6 @@ export declare const clientSQLiteSchema: {
|
|
|
3816
3745
|
}, {}, {
|
|
3817
3746
|
length: number | undefined;
|
|
3818
3747
|
}>;
|
|
3819
|
-
signingKeyFingerprint: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3820
|
-
name: "signing_key_fingerprint";
|
|
3821
|
-
tableName: "organization_read_model_group_members";
|
|
3822
|
-
dataType: "string";
|
|
3823
|
-
columnType: "SQLiteText";
|
|
3824
|
-
data: string;
|
|
3825
|
-
driverParam: string;
|
|
3826
|
-
notNull: false;
|
|
3827
|
-
hasDefault: false;
|
|
3828
|
-
isPrimaryKey: false;
|
|
3829
|
-
isAutoincrement: false;
|
|
3830
|
-
hasRuntimeDefault: false;
|
|
3831
|
-
enumValues: [string, ...string[]];
|
|
3832
|
-
baseColumn: never;
|
|
3833
|
-
identity: undefined;
|
|
3834
|
-
generated: undefined;
|
|
3835
|
-
}, {}, {
|
|
3836
|
-
length: number | undefined;
|
|
3837
|
-
}>;
|
|
3838
|
-
signingPublicKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3839
|
-
name: "signing_public_key";
|
|
3840
|
-
tableName: "organization_read_model_group_members";
|
|
3841
|
-
dataType: "string";
|
|
3842
|
-
columnType: "SQLiteText";
|
|
3843
|
-
data: string;
|
|
3844
|
-
driverParam: string;
|
|
3845
|
-
notNull: false;
|
|
3846
|
-
hasDefault: false;
|
|
3847
|
-
isPrimaryKey: false;
|
|
3848
|
-
isAutoincrement: false;
|
|
3849
|
-
hasRuntimeDefault: false;
|
|
3850
|
-
enumValues: [string, ...string[]];
|
|
3851
|
-
baseColumn: never;
|
|
3852
|
-
identity: undefined;
|
|
3853
|
-
generated: undefined;
|
|
3854
|
-
}, {}, {
|
|
3855
|
-
length: number | undefined;
|
|
3856
|
-
}>;
|
|
3857
|
-
encapsulationPublicKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3858
|
-
name: "encapsulation_public_key";
|
|
3859
|
-
tableName: "organization_read_model_group_members";
|
|
3860
|
-
dataType: "string";
|
|
3861
|
-
columnType: "SQLiteText";
|
|
3862
|
-
data: string;
|
|
3863
|
-
driverParam: string;
|
|
3864
|
-
notNull: false;
|
|
3865
|
-
hasDefault: false;
|
|
3866
|
-
isPrimaryKey: false;
|
|
3867
|
-
isAutoincrement: false;
|
|
3868
|
-
hasRuntimeDefault: false;
|
|
3869
|
-
enumValues: [string, ...string[]];
|
|
3870
|
-
baseColumn: never;
|
|
3871
|
-
identity: undefined;
|
|
3872
|
-
generated: undefined;
|
|
3873
|
-
}, {}, {
|
|
3874
|
-
length: number | undefined;
|
|
3875
|
-
}>;
|
|
3876
|
-
encapsulationKeyFingerprint: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3877
|
-
name: "encapsulation_key_fingerprint";
|
|
3878
|
-
tableName: "organization_read_model_group_members";
|
|
3879
|
-
dataType: "string";
|
|
3880
|
-
columnType: "SQLiteText";
|
|
3881
|
-
data: string;
|
|
3882
|
-
driverParam: string;
|
|
3883
|
-
notNull: false;
|
|
3884
|
-
hasDefault: false;
|
|
3885
|
-
isPrimaryKey: false;
|
|
3886
|
-
isAutoincrement: false;
|
|
3887
|
-
hasRuntimeDefault: false;
|
|
3888
|
-
enumValues: [string, ...string[]];
|
|
3889
|
-
baseColumn: never;
|
|
3890
|
-
identity: undefined;
|
|
3891
|
-
generated: undefined;
|
|
3892
|
-
}, {}, {
|
|
3893
|
-
length: number | undefined;
|
|
3894
|
-
}>;
|
|
3895
3748
|
};
|
|
3896
3749
|
dialect: "sqlite";
|
|
3897
3750
|
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getTableColumns } from "drizzle-orm";
|
|
2
|
+
/**
|
|
3
|
+
* SQLite's historical default `SQLITE_MAX_VARIABLE_NUMBER`. Some hosts raise
|
|
4
|
+
* it, but the SDK runs on several SQLite builds, so every statement it batches
|
|
5
|
+
* stays within this budget.
|
|
6
|
+
*/
|
|
7
|
+
export const SQLITE_BOUND_VARIABLE_BUDGET = 999;
|
|
8
|
+
/**
|
|
9
|
+
* Rows (or list entries) one statement may carry when each binds
|
|
10
|
+
* `variablesPerRow` values on top of `fixedVariables` shared ones.
|
|
11
|
+
*/
|
|
12
|
+
export function sqliteRowsPerStatement(variablesPerRow, fixedVariables = 0) {
|
|
13
|
+
const rows = Math.floor((SQLITE_BOUND_VARIABLE_BUDGET - fixedVariables) / variablesPerRow);
|
|
14
|
+
if (!Number.isInteger(variablesPerRow) ||
|
|
15
|
+
variablesPerRow < 1 ||
|
|
16
|
+
!Number.isInteger(fixedVariables) ||
|
|
17
|
+
fixedVariables < 0 ||
|
|
18
|
+
rows < 1) {
|
|
19
|
+
throw new Error("SQLite statement cannot fit its bound variables");
|
|
20
|
+
}
|
|
21
|
+
return rows;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Rows per multi-row INSERT into `table`. Every column may bind one value,
|
|
25
|
+
* including explicit nulls, so the column count is the per-row ceiling.
|
|
26
|
+
*/
|
|
27
|
+
export function sqliteInsertBatchSize(table) {
|
|
28
|
+
return sqliteRowsPerStatement(Object.keys(getTableColumns(table)).length);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=sqliteBindBudget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqliteBindBudget.js","sourceRoot":"","sources":["sqliteBindBudget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,eAAuB,EACvB,cAAc,GAAG,CAAC;IAElB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CACrB,CAAC,4BAA4B,GAAG,cAAc,CAAC,GAAG,eAAe,CAClE,CAAC;IACF,IACE,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;QAClC,eAAe,GAAG,CAAC;QACnB,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;QACjC,cAAc,GAAG,CAAC;QAClB,IAAI,GAAG,CAAC,EACR,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAkB;IACtD,OAAO,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { getTableColumns } from \"drizzle-orm\";\nimport type { SQLiteTable } from \"drizzle-orm/sqlite-core\";\n\n/**\n * SQLite's historical default `SQLITE_MAX_VARIABLE_NUMBER`. Some hosts raise\n * it, but the SDK runs on several SQLite builds, so every statement it batches\n * stays within this budget.\n */\nexport const SQLITE_BOUND_VARIABLE_BUDGET = 999;\n\n/**\n * Rows (or list entries) one statement may carry when each binds\n * `variablesPerRow` values on top of `fixedVariables` shared ones.\n */\nexport function sqliteRowsPerStatement(\n variablesPerRow: number,\n fixedVariables = 0,\n): number {\n const rows = Math.floor(\n (SQLITE_BOUND_VARIABLE_BUDGET - fixedVariables) / variablesPerRow,\n );\n if (\n !Number.isInteger(variablesPerRow) ||\n variablesPerRow < 1 ||\n !Number.isInteger(fixedVariables) ||\n fixedVariables < 0 ||\n rows < 1\n ) {\n throw new Error(\"SQLite statement cannot fit its bound variables\");\n }\n return rows;\n}\n\n/**\n * Rows per multi-row INSERT into `table`. Every column may bind one value,\n * including explicit nulls, so the column count is the per-row ceiling.\n */\nexport function sqliteInsertBatchSize(table: SQLiteTable): number {\n return sqliteRowsPerStatement(Object.keys(getTableColumns(table)).length);\n}\n"]}
|
|
@@ -60,10 +60,15 @@ export const documentSyncResponsePullPageRefinement = {
|
|
|
60
60
|
description: "pullPage.hasMore is true exactly when pullPage.nextCursor is non-null",
|
|
61
61
|
id: "response.pull-page-continuation",
|
|
62
62
|
};
|
|
63
|
+
export const documentSyncResponseHistoricalBundlesRefinement = {
|
|
64
|
+
description: "contentKeyBundles carries each content-key epoch at most once, and only epochs older than contentKeyBundle.contentKeyEpoch",
|
|
65
|
+
id: "response.historical-content-key-bundles",
|
|
66
|
+
};
|
|
63
67
|
export const documentSyncResponseRuntimeRefinements = [
|
|
64
68
|
documentSyncResponseRotationRefinement,
|
|
65
69
|
documentSyncResponseCommitLsnModeRefinement,
|
|
66
70
|
documentSyncResponseCommitLsnSentinelRefinement,
|
|
67
71
|
documentSyncResponsePullPageRefinement,
|
|
72
|
+
documentSyncResponseHistoricalBundlesRefinement,
|
|
68
73
|
];
|
|
69
74
|
//# sourceMappingURL=documentSyncRefinements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentSyncRefinements.js","sourceRoot":"","sources":["documentSyncRefinements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yCAAyC,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD;QACE,WAAW,EACT,+EAA+E;QACjF,EAAE,EAAE,oCAAoC;KACzC;IACD;QACE,WAAW,EACT,4EAA4E;QAC9E,EAAE,EAAE,sCAAsC;KAC3C;IACD;QACE,WAAW,EACT,yEAAyE;QAC3E,EAAE,EAAE,wCAAwC;KAC7C;IACD;QACE,WAAW,EAAE,uDAAuD;QACpE,EAAE,EAAE,oCAAoC;KACzC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD;QACE,WAAW,EACT,+HAA+H;QACjI,EAAE,EAAE,qCAAqC;KAC1C;IACD;QACE,WAAW,EACT,4HAA4H;QAC9H,EAAE,EAAE,+BAA+B;KACpC;IACD;QACE,WAAW,EACT,wGAAwG;QAC1G,EAAE,EAAE,mCAAmC;KACxC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,GAAG,sCAAsC;IACzC,GAAG,kCAAkC;IACrC,qCAAqC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,WAAW,EAAE,gFAAgF,yCAAyC,sBAAsB;IAC5J,EAAE,EAAE,uDAAuD;CACnD,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,qCAAqC;CACjC,CAAC;AAEX,MAAM,CAAC,MAAM,2CAA2C,GAAG;IACzD,WAAW,EACT,iEAAiE;IACnE,EAAE,EAAE,wCAAwC;CACpC,CAAC;AAEX,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,WAAW,EACT,yEAAyE;IAC3E,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,uEAAuE;IACzE,EAAE,EAAE,iCAAiC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,sCAAsC;IACtC,2CAA2C;IAC3C,+CAA+C;IAC/C,sCAAsC;
|
|
1
|
+
{"version":3,"file":"documentSyncRefinements.js","sourceRoot":"","sources":["documentSyncRefinements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yCAAyC,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD;QACE,WAAW,EACT,+EAA+E;QACjF,EAAE,EAAE,oCAAoC;KACzC;IACD;QACE,WAAW,EACT,4EAA4E;QAC9E,EAAE,EAAE,sCAAsC;KAC3C;IACD;QACE,WAAW,EACT,yEAAyE;QAC3E,EAAE,EAAE,wCAAwC;KAC7C;IACD;QACE,WAAW,EAAE,uDAAuD;QACpE,EAAE,EAAE,oCAAoC;KACzC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD;QACE,WAAW,EACT,+HAA+H;QACjI,EAAE,EAAE,qCAAqC;KAC1C;IACD;QACE,WAAW,EACT,4HAA4H;QAC9H,EAAE,EAAE,+BAA+B;KACpC;IACD;QACE,WAAW,EACT,wGAAwG;QAC1G,EAAE,EAAE,mCAAmC;KACxC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,GAAG,sCAAsC;IACzC,GAAG,kCAAkC;IACrC,qCAAqC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,WAAW,EAAE,gFAAgF,yCAAyC,sBAAsB;IAC5J,EAAE,EAAE,uDAAuD;CACnD,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,qCAAqC;CACjC,CAAC;AAEX,MAAM,CAAC,MAAM,2CAA2C,GAAG;IACzD,WAAW,EACT,iEAAiE;IACnE,EAAE,EAAE,wCAAwC;CACpC,CAAC;AAEX,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,WAAW,EACT,yEAAyE;IAC3E,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,uEAAuE;IACzE,EAAE,EAAE,iCAAiC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,WAAW,EACT,4HAA4H;IAC9H,EAAE,EAAE,yCAAyC;CACrC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,sCAAsC;IACtC,2CAA2C;IAC3C,+CAA+C;IAC/C,sCAAsC;IACtC,+CAA+C;CACvC,CAAC","sourcesContent":["import { MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS } from \"./util/documentSyncLimits\";\n\nexport const documentSyncRequestRotationRefinement = {\n description:\n \"checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline\",\n id: \"request.rotation-checkpoint-fields\",\n} as const;\n\nexport const documentSyncRequestEnvelopeRefinements = [\n {\n description:\n \"inlineRekeyCommitId must be present exactly when containerRekeys is non-empty\",\n id: \"request.inline-rekey-commit-marker\",\n },\n {\n description:\n \"authorizingContainerPathRefs is required when outgoingUpdates is non-empty\",\n id: \"request.authorizing-paths-for-writes\",\n },\n {\n description:\n \"containerRekeys may be non-empty only when outgoingUpdates is non-empty\",\n id: \"request.container-rekeys-require-write\",\n },\n {\n description: \"outgoing update ids must be unique within the request\",\n id: \"request.unique-outgoing-update-ids\",\n },\n] as const;\n\nexport const documentSyncRequestPullRefinements = [\n {\n description:\n \"a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths\",\n id: \"request.pull-continuation-read-only\",\n },\n {\n description:\n 'historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths',\n id: \"request.raw-history-read-only\",\n },\n {\n description:\n 'historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested',\n id: \"request.raw-history-null-frontier\",\n },\n] as const;\n\nexport const documentSyncRequestRuntimeRefinements = [\n ...documentSyncRequestEnvelopeRefinements,\n ...documentSyncRequestPullRefinements,\n documentSyncRequestRotationRefinement,\n] as const;\n\nexport const documentLinkSetPathRefinement = {\n description: `authorizingContainerPathRefs and targetContainerPathRefs may contain at most ${MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS} references in total`,\n id: \"request.post-link-authorization-path-total-references\",\n} as const;\n\nexport const documentSyncResponseRotationRefinement = {\n description:\n \"checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline\",\n id: \"response.rotation-checkpoint-fields\",\n} as const;\n\nexport const documentSyncResponseCommitLsnModeRefinement = {\n description:\n 'commitLsnMode \"untracked\" requires the commitLsn \"0/0\" sentinel',\n id: \"response.untracked-commit-lsn-sentinel\",\n} as const;\n\nexport const documentSyncResponseCommitLsnSentinelRefinement = {\n description:\n 'commitLsn \"0/0\" requires commitLsnMode \"untracked\" in the same response',\n id: \"response.untracked-commit-lsn-mode\",\n} as const;\n\nexport const documentSyncResponsePullPageRefinement = {\n description:\n \"pullPage.hasMore is true exactly when pullPage.nextCursor is non-null\",\n id: \"response.pull-page-continuation\",\n} as const;\n\nexport const documentSyncResponseHistoricalBundlesRefinement = {\n description:\n \"contentKeyBundles carries each content-key epoch at most once, and only epochs older than contentKeyBundle.contentKeyEpoch\",\n id: \"response.historical-content-key-bundles\",\n} as const;\n\nexport const documentSyncResponseRuntimeRefinements = [\n documentSyncResponseRotationRefinement,\n documentSyncResponseCommitLsnModeRefinement,\n documentSyncResponseCommitLsnSentinelRefinement,\n documentSyncResponsePullPageRefinement,\n documentSyncResponseHistoricalBundlesRefinement,\n] as const;\n"]}
|
|
@@ -746,6 +746,9 @@ export declare const documentSyncOperation: Omit<{
|
|
|
746
746
|
}, {
|
|
747
747
|
readonly description: "pullPage.hasMore is true exactly when pullPage.nextCursor is non-null";
|
|
748
748
|
readonly id: "response.pull-page-continuation";
|
|
749
|
+
}, {
|
|
750
|
+
readonly description: "contentKeyBundles carries each content-key epoch at most once, and only epochs older than contentKeyBundle.contentKeyEpoch";
|
|
751
|
+
readonly id: "response.historical-content-key-bundles";
|
|
749
752
|
}];
|
|
750
753
|
}, "failureResponses" | "failureStatuses"> & {
|
|
751
754
|
readonly failureResponses: {
|
|
@@ -7922,22 +7922,14 @@ export declare const getOrganizationReadModelOperation: Omit<{
|
|
|
7922
7922
|
groups: z.ZodCustom<{
|
|
7923
7923
|
groupId: string;
|
|
7924
7924
|
members: {
|
|
7925
|
-
encapsulationKeyFingerprint: string | null;
|
|
7926
|
-
encapsulationPublicKey: string | null;
|
|
7927
7925
|
role: "member" | "admin";
|
|
7928
|
-
signingKeyFingerprint: string | null;
|
|
7929
|
-
signingPublicKey: string | null;
|
|
7930
7926
|
userId: string;
|
|
7931
7927
|
}[];
|
|
7932
7928
|
stateHash: string;
|
|
7933
7929
|
}[], {
|
|
7934
7930
|
groupId: string;
|
|
7935
7931
|
members: {
|
|
7936
|
-
encapsulationKeyFingerprint: string | null;
|
|
7937
|
-
encapsulationPublicKey: string | null;
|
|
7938
7932
|
role: "member" | "admin";
|
|
7939
|
-
signingKeyFingerprint: string | null;
|
|
7940
|
-
signingPublicKey: string | null;
|
|
7941
7933
|
userId: string;
|
|
7942
7934
|
}[];
|
|
7943
7935
|
stateHash: string;
|
|
@@ -8071,22 +8063,14 @@ export declare const getOrganizationReadModelOperation: Omit<{
|
|
|
8071
8063
|
groups: z.ZodCustom<{
|
|
8072
8064
|
groupId: string;
|
|
8073
8065
|
members: {
|
|
8074
|
-
encapsulationKeyFingerprint: string | null;
|
|
8075
|
-
encapsulationPublicKey: string | null;
|
|
8076
8066
|
role: "member" | "admin";
|
|
8077
|
-
signingKeyFingerprint: string | null;
|
|
8078
|
-
signingPublicKey: string | null;
|
|
8079
8067
|
userId: string;
|
|
8080
8068
|
}[];
|
|
8081
8069
|
stateHash: string;
|
|
8082
8070
|
}[], {
|
|
8083
8071
|
groupId: string;
|
|
8084
8072
|
members: {
|
|
8085
|
-
encapsulationKeyFingerprint: string | null;
|
|
8086
|
-
encapsulationPublicKey: string | null;
|
|
8087
8073
|
role: "member" | "admin";
|
|
8088
|
-
signingKeyFingerprint: string | null;
|
|
8089
|
-
signingPublicKey: string | null;
|
|
8090
8074
|
userId: string;
|
|
8091
8075
|
}[];
|
|
8092
8076
|
stateHash: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { classifyDocumentSyncCheckpointFields, DOCUMENT_SYNC_CHECKPOINT_FIELD_SET_ISSUE_MESSAGE, DOCUMENT_SYNC_ROTATION_CHECKPOINT_KIND, DOCUMENT_SYNC_ROTATION_CHECKPOINT_PAYLOAD_KIND, } from "../documentSyncCheckpoint.js";
|
|
3
|
-
import { documentSyncResponseCommitLsnModeRefinement, documentSyncResponseCommitLsnSentinelRefinement, documentSyncResponsePullPageRefinement, documentSyncResponseRotationRefinement, } from "../documentSyncRefinements.js";
|
|
3
|
+
import { documentSyncResponseCommitLsnModeRefinement, documentSyncResponseCommitLsnSentinelRefinement, documentSyncResponseHistoricalBundlesRefinement, documentSyncResponsePullPageRefinement, documentSyncResponseRotationRefinement, } from "../documentSyncRefinements.js";
|
|
4
4
|
import { registerJsonSchemaRuntimeRefinements } from "../jsonSchema.js";
|
|
5
5
|
import { arraySchema, boundedNonEmptyStringSchema, loosePlainObject, nonEmptyArraySchema, nonEmptyStringSchema, plainObjectSchema, positiveIntegerSchema, } from "../schema.js";
|
|
6
6
|
import { MAX_DOCUMENT_SYNC_OUTGOING_UPDATES, MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH, MAX_DOCUMENT_SYNC_RESPONSE_PAGE_UPDATES, } from "../util/documentSyncLimits.js";
|
|
@@ -64,6 +64,38 @@ export const DocumentSyncPullPageResponseSchema = loosePlainObject({
|
|
|
64
64
|
hasMore: z.boolean(),
|
|
65
65
|
nextCursor: boundedNonEmptyStringSchema(MAX_DOCUMENT_SYNC_PULL_CURSOR_LENGTH).nullable(),
|
|
66
66
|
});
|
|
67
|
+
function contentKeyEpochOf(bundle) {
|
|
68
|
+
if (typeof bundle !== "object" || bundle === null)
|
|
69
|
+
return null;
|
|
70
|
+
const contentKeyEpoch = Reflect.get(bundle, "contentKeyEpoch");
|
|
71
|
+
return typeof contentKeyEpoch === "number" ? contentKeyEpoch : null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The current epoch's bundle travels only as `contentKeyBundle`, so the array
|
|
75
|
+
* holds the distinct older epochs that served updates cite. Field issues do not
|
|
76
|
+
* stop this object refinement, so it judges only epochs that parsed.
|
|
77
|
+
*/
|
|
78
|
+
function addHistoricalContentKeyBundleIssues(response, context) {
|
|
79
|
+
const currentEpoch = contentKeyEpochOf(response.contentKeyBundle);
|
|
80
|
+
if (currentEpoch === null || !Array.isArray(response.contentKeyBundles)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const seenEpochs = new Set();
|
|
84
|
+
// forEach skips holes exactly as arraySchema's item validation does.
|
|
85
|
+
response.contentKeyBundles.forEach((bundle, index) => {
|
|
86
|
+
const contentKeyEpoch = contentKeyEpochOf(bundle);
|
|
87
|
+
if (contentKeyEpoch === null)
|
|
88
|
+
return;
|
|
89
|
+
if (contentKeyEpoch >= currentEpoch || seenEpochs.has(contentKeyEpoch)) {
|
|
90
|
+
context.addIssue({
|
|
91
|
+
code: "custom",
|
|
92
|
+
message: "content-key bundles must be distinct epochs older than contentKeyBundle",
|
|
93
|
+
path: ["contentKeyBundles", index, "contentKeyEpoch"],
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
seenEpochs.add(contentKeyEpoch);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
67
99
|
export const DocumentSyncResponseSchema = registerJsonSchemaRuntimeRefinements(loosePlainObject({
|
|
68
100
|
acceptedOutgoingUpdateIds: arraySchema(z.string(), MAX_DOCUMENT_SYNC_OUTGOING_UPDATES),
|
|
69
101
|
commitLsn: z.string().nullable(),
|
|
@@ -99,9 +131,11 @@ export const DocumentSyncResponseSchema = registerJsonSchemaRuntimeRefinements(l
|
|
|
99
131
|
path: ["commitLsnMode"],
|
|
100
132
|
});
|
|
101
133
|
}
|
|
134
|
+
addHistoricalContentKeyBundleIssues(response, context);
|
|
102
135
|
}), [
|
|
103
136
|
documentSyncResponseCommitLsnModeRefinement,
|
|
104
137
|
documentSyncResponseCommitLsnSentinelRefinement,
|
|
105
138
|
documentSyncResponsePullPageRefinement,
|
|
139
|
+
documentSyncResponseHistoricalBundlesRefinement,
|
|
106
140
|
]);
|
|
107
141
|
//# sourceMappingURL=documentSyncSchema.js.map
|