@ai-matrx/sharing 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/access-react.cjs +17 -25
- package/dist/access-react.cjs.map +1 -1
- package/dist/access-react.js +19 -27
- package/dist/access-react.js.map +1 -1
- package/dist/core.cjs +31 -40
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +8 -11
- package/dist/core.d.ts +8 -11
- package/dist/core.js +36 -45
- package/dist/core.js.map +1 -1
- package/dist/react.cjs +224 -86
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +24 -3
- package/dist/react.d.ts +24 -3
- package/dist/react.js +225 -86
- package/dist/react.js.map +1 -1
- package/package.json +4 -4
package/dist/core.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _supabase_supabase_js from '@supabase/supabase-js';
|
|
2
2
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
3
3
|
import { DbPermissionLevel, PermissionLevel } from '@ai-matrx/data/access';
|
|
4
|
-
export { DB_PERMISSION_LEVELS, DbPermissionLevel, PERMISSION_LEVELS, PERMISSION_LEVEL_HINTS, PERMISSION_LEVEL_LABELS, PERMISSION_LEVEL_SHORT_LABELS, PermissionLevel, isDbPermissionLevel, isPermissionLevel, toDbPermissionLevel } from '@ai-matrx/data/access';
|
|
4
|
+
export { DB_PERMISSION_LEVELS, DbPermissionLevel, PERMISSION_LEVELS, PERMISSION_LEVEL_HINTS, PERMISSION_LEVEL_LABELS, PERMISSION_LEVEL_SHORT_LABELS, PermissionLevel, isDbPermissionLevel, isPermissionLevel, normalizePermissionLevel, parsePermissionLevel, toDbPermissionLevel } from '@ai-matrx/data/access';
|
|
5
5
|
import { EntityTypeToken } from '@ai-matrx/associations';
|
|
6
6
|
import * as _ai_matrx_api_account from '@ai-matrx/api/account';
|
|
7
7
|
import { components } from '@ai-matrx/api/types';
|
|
@@ -3426,15 +3426,12 @@ declare function getResourceSharePath(resourceType: string, resourceId: string):
|
|
|
3426
3426
|
* rank map, label map or ordered array omits a level.
|
|
3427
3427
|
*/
|
|
3428
3428
|
|
|
3429
|
-
/** Maps a stored/retired level onto the public ladder (a stray `edit_content` row reads as Edit). */
|
|
3430
|
-
declare function normalizePermissionLevel(raw: unknown): PermissionLevel | null;
|
|
3431
3429
|
/** The levels a picker may offer: what the database stores, never the retired `edit_content`. */
|
|
3432
3430
|
declare const OFFERED_DB_PERMISSION_LEVELS: readonly DbPermissionLevel[];
|
|
3433
3431
|
/** Rank of every level; a stray stored `edit_content` ranks as Edit so old data never crashes. */
|
|
3434
3432
|
declare const PERMISSION_LEVEL_RANK: Record<PermissionLevel, number> & {
|
|
3435
3433
|
edit_content: number;
|
|
3436
3434
|
};
|
|
3437
|
-
declare function parsePermissionLevel(raw: unknown, context: string): PermissionLevel | null;
|
|
3438
3435
|
declare function permissionLevelRank(level: PermissionLevel): number;
|
|
3439
3436
|
|
|
3440
3437
|
/**
|
|
@@ -3751,15 +3748,15 @@ interface CreateShareLinkOptions {
|
|
|
3751
3748
|
maxUses?: number | null | undefined;
|
|
3752
3749
|
label?: string | null | undefined;
|
|
3753
3750
|
}
|
|
3754
|
-
/** Build the absolute share URL for a token. */
|
|
3755
|
-
declare function shareLinkUrl(token: string): string;
|
|
3751
|
+
/** Build the absolute share URL for a token (on `origin` when given). */
|
|
3752
|
+
declare function shareLinkUrl(token: string, origin?: string | undefined): string;
|
|
3756
3753
|
/**
|
|
3757
3754
|
* The URL to hand a person for a share link — the short alias when one exists
|
|
3758
3755
|
* (auto-shorten-every-share-link, owner ruling 2026-08-29), the full /s/ URL
|
|
3759
3756
|
* otherwise. The alias is a redirect only; the 64-hex share token stays the
|
|
3760
3757
|
* one authorization either way.
|
|
3761
3758
|
*/
|
|
3762
|
-
declare function shareUrlForLink(link: Pick<ShareLink, "token" | "shortToken"
|
|
3759
|
+
declare function shareUrlForLink(link: Pick<ShareLink, "token" | "shortToken">, origin?: string | undefined): string;
|
|
3763
3760
|
/** Mint a share link for a resource (owner-only). Returns the token + URL. */
|
|
3764
3761
|
declare function createShareLink(options: CreateShareLinkOptions): Promise<{
|
|
3765
3762
|
success: boolean;
|
|
@@ -4065,7 +4062,7 @@ declare function resolveResourceOwnership(resourceType: ResourceType, resourceId
|
|
|
4065
4062
|
* record store it could not even be ASKED, because `custom.record` carries no
|
|
4066
4063
|
* client SELECT grant and the direct read above returns "Could not read Record".
|
|
4067
4064
|
*
|
|
4068
|
-
* So this asks the database's own predicate (`
|
|
4065
|
+
* So this asks the database's own predicate (`iam.may_manage_sharing`, lane
|
|
4069
4066
|
* SHARE 2026-09-19), which is the same one the six sharing RPCs enforce. The
|
|
4070
4067
|
* screen and the door cannot disagree, because there is one answer.
|
|
4071
4068
|
*
|
|
@@ -4674,10 +4671,10 @@ declare function setSearchEngineIndexed(resourceType: string, resourceId: string
|
|
|
4674
4671
|
|
|
4675
4672
|
type Database = any;
|
|
4676
4673
|
|
|
4677
|
-
type OrganizationMemberRow = Database["
|
|
4674
|
+
type OrganizationMemberRow = Database["iam"]["Functions"]["get_organization_members_with_users"]["Returns"][number];
|
|
4678
4675
|
/** How long a settled roster is kept: for the tab (a change made here forgets it). */
|
|
4679
4676
|
declare const MEMBER_ROWS_TTL_MS: number;
|
|
4680
|
-
type RosterClient = Pick<ReturnType<typeof createClient>, "rpc">;
|
|
4677
|
+
type RosterClient = Pick<ReturnType<typeof createClient>, "rpc" | "schema">;
|
|
4681
4678
|
declare function readOrganizationMemberRows(orgId: string, { now, fresh, client, }?: {
|
|
4682
4679
|
now?: number | undefined;
|
|
4683
4680
|
/** An explicit refresh: skip a settled answer (an in-flight read is still joined). */
|
|
@@ -4737,4 +4734,4 @@ interface HrDepartmentOption {
|
|
|
4737
4734
|
declare function listTeams(organizationId: string, includeArchived?: boolean): Promise<Team[]>;
|
|
4738
4735
|
declare function listTeamMembers(teamId: string): Promise<TeamMember[]>;
|
|
4739
4736
|
|
|
4740
|
-
export { ACCESS_SUMMARY_ERROR_HEADLINE, type AccessContainer, type AccessDirectGrant, type AccessGranteeType, type AccessKpis, type AccessNotice, type AccessPanelView, type AccessReasonRow, type AccessSummary, type AccessSummaryView, type ApiCallResult, type AppDispatch, type ChannelReadiness, type CheckPermissionOptions, type ForkResult, GRANT_LIST_SCOPE_NOTE, type GranteeKind, type HrDepartmentOption, type LaneChoice, MEMBER_ROWS_TTL_MS, type MakePublicOptions, type MyPendingTableInvitation, NOTHING_ELSE_GRANTS, NO_GRANTS_DETAIL, NO_GRANTS_HEADLINE, NO_GRANTS_YET_HEADLINE, OFFERED_DB_PERMISSION_LEVELS, type OrCapable, type OrgAvailabilityOptions, type OrganizationMemberRow, type OutsideInviteAnswer, type OutsideShareDelivery, type OutsideShareInvitation, type OutsideShareLevel, type OutsideShareState, type OwnedResource, type OwnerCheckResult, type OwnershipResolution, PERMISSION_LEVEL_RANK, PUBLIC_LANE_COLUMNS, PUBLIC_LANE_TYPES, type Permission, type PermissionCheckResult, PermissionError, PermissionErrorCode, type PermissionWithDetails, type PublishLane, RESOURCE_TYPES, type ResolvedShareToken, type ResourceType, type ResourceVisibility, type RevokeAccessOptions, SHAREABLE_RESOURCE_REGISTRY, SHOWN_TO_ORDER, SHOWN_TO_WORDS, type SearchEngineIndexedState, type SecureDeliveryCreate, type SecureDeliveryOptions, type SecureDeliveryPage, type SecureDeliveryReceipt, SecureDeliveryRefusal, type SentSecureDelivery, type ShareActionResult, type ShareCapabilities, type ShareDbClient, type ShareLink, type ShareNoticeAnswer, type ShareServerCall, type ShareServerResult, type ShareTargetType, type ShareWithUserOptions, type ShareableResourceEntry, type SharingCopyContext, type SharingHost, type SharingState, type ShownTo, type ShownToContext, type TableSharePeek, type Team, type TeamMember, type TeamRole, type UpdatePermissionOptions, type WhoCanSee, absoluteInviteUrl, acceptOutsideShare, accessKpis, accessReasonRows, accessSummaryView, appUrl, applyShownTo, batchShareWithUsers, callApi, checkPermission, configureSharing, containerDetail, containerTitle, createClient, createSafeShareMessage, createShareLink, describeAccessSummary, describeShareLinkAccess, describeShareLinkExpiry, ensureOrgAvailability, ensureOrgId, evaluateShareLinkHandoff, fetchAccessSummary, fetchEntityTitles, fetchRecipientPhoneOnFile, fetchSecureDeliveryOptions, fetchShownToContext, forgetOrganizationMemberRows, forkSharedResource, getActiveOrgId, getClaimsUser, getPermissionLevelLabel, getPermissionLevelsAtOrAbove, getResourcePermissions, getResourceSharePath, getResourceTypeLabel, getResourceVisibility, getSearchEngineIndexedState, getShareCapabilities, getShareableResource, getSharedWithMe, grantCsvRow, grantCsvRows, grantLevelLabel, grantOrgAvailability, granteeKind, granteeLabel, granteeSecondaryLabel, hasPublicPage, humanAccessPanel, humanAccessSummary, humanGrantList, humanGrantRow, humanNotices, isForkable, isJsonObject, isKnownEntity, isPrivateSummary, isResourceOwner, listPermissions, listSentSecureDeliveries, listShareLinks, listTeamMembers, listTeams, makePrivate, makePublic, myPendingTableInvitations,
|
|
4737
|
+
export { ACCESS_SUMMARY_ERROR_HEADLINE, type AccessContainer, type AccessDirectGrant, type AccessGranteeType, type AccessKpis, type AccessNotice, type AccessPanelView, type AccessReasonRow, type AccessSummary, type AccessSummaryView, type ApiCallResult, type AppDispatch, type ChannelReadiness, type CheckPermissionOptions, type ForkResult, GRANT_LIST_SCOPE_NOTE, type GranteeKind, type HrDepartmentOption, type LaneChoice, MEMBER_ROWS_TTL_MS, type MakePublicOptions, type MyPendingTableInvitation, NOTHING_ELSE_GRANTS, NO_GRANTS_DETAIL, NO_GRANTS_HEADLINE, NO_GRANTS_YET_HEADLINE, OFFERED_DB_PERMISSION_LEVELS, type OrCapable, type OrgAvailabilityOptions, type OrganizationMemberRow, type OutsideInviteAnswer, type OutsideShareDelivery, type OutsideShareInvitation, type OutsideShareLevel, type OutsideShareState, type OwnedResource, type OwnerCheckResult, type OwnershipResolution, PERMISSION_LEVEL_RANK, PUBLIC_LANE_COLUMNS, PUBLIC_LANE_TYPES, type Permission, type PermissionCheckResult, PermissionError, PermissionErrorCode, type PermissionWithDetails, type PublishLane, RESOURCE_TYPES, type ResolvedShareToken, type ResourceType, type ResourceVisibility, type RevokeAccessOptions, SHAREABLE_RESOURCE_REGISTRY, SHOWN_TO_ORDER, SHOWN_TO_WORDS, type SearchEngineIndexedState, type SecureDeliveryCreate, type SecureDeliveryOptions, type SecureDeliveryPage, type SecureDeliveryReceipt, SecureDeliveryRefusal, type SentSecureDelivery, type ShareActionResult, type ShareCapabilities, type ShareDbClient, type ShareLink, type ShareNoticeAnswer, type ShareServerCall, type ShareServerResult, type ShareTargetType, type ShareWithUserOptions, type ShareableResourceEntry, type SharingCopyContext, type SharingHost, type SharingState, type ShownTo, type ShownToContext, type TableSharePeek, type Team, type TeamMember, type TeamRole, type UpdatePermissionOptions, type WhoCanSee, absoluteInviteUrl, acceptOutsideShare, accessKpis, accessReasonRows, accessSummaryView, appUrl, applyShownTo, batchShareWithUsers, callApi, checkPermission, configureSharing, containerDetail, containerTitle, createClient, createSafeShareMessage, createShareLink, describeAccessSummary, describeShareLinkAccess, describeShareLinkExpiry, ensureOrgAvailability, ensureOrgId, evaluateShareLinkHandoff, fetchAccessSummary, fetchEntityTitles, fetchRecipientPhoneOnFile, fetchSecureDeliveryOptions, fetchShownToContext, forgetOrganizationMemberRows, forkSharedResource, getActiveOrgId, getClaimsUser, getPermissionLevelLabel, getPermissionLevelsAtOrAbove, getResourcePermissions, getResourceSharePath, getResourceTypeLabel, getResourceVisibility, getSearchEngineIndexedState, getShareCapabilities, getShareableResource, getSharedWithMe, grantCsvRow, grantCsvRows, grantLevelLabel, grantOrgAvailability, granteeKind, granteeLabel, granteeSecondaryLabel, hasPublicPage, humanAccessPanel, humanAccessSummary, humanGrantList, humanGrantRow, humanNotices, isForkable, isJsonObject, isKnownEntity, isPrivateSummary, isResourceOwner, listPermissions, listSentSecureDeliveries, listShareLinks, listTeamMembers, listTeams, makePrivate, makePublic, myPendingTableInvitations, onlyOpenOrganizations, openSecureDelivery, organizationDisambiguators, passThroughDispatch, peekTableShare, permissionLevelRank, publicLaneSelect, publicResourceUrl, readOrganizationMemberRows, readOutsideShare, reasonCsvRows, recordNoun, requestSecureDeliveryCode, resendOutside, resolveEntityHref, resolveResourceOwnership, resolveResourceToken, resolveShareToken, resolveSharingAuthority, resolveTableName, revokeAccess, revokeOrgAccess, revokeOutside, revokePublicAccess, revokeSecureDelivery, revokeShareLink, revokeUserAccess, satisfiesPermissionLevel, sendSecureDelivery, sendShareNotice, setResourceShownTo, setSearchEngineIndexed, setStoreLane, shareClient, shareLinkSecurityStateMatches, shareLinkUnavailableReason, shareLinkUrl, shareUrlForLink, shareWithOutsidePerson, shareWithUser, sharingHost, sharingLocation, shownToBlendedFilter, shownToFilter, shownToMyOrgsFilter, summaryReachLabel, supabase, updatePermissionLevel, validatePermission, viewSecureDelivery };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _supabase_supabase_js from '@supabase/supabase-js';
|
|
2
2
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
3
3
|
import { DbPermissionLevel, PermissionLevel } from '@ai-matrx/data/access';
|
|
4
|
-
export { DB_PERMISSION_LEVELS, DbPermissionLevel, PERMISSION_LEVELS, PERMISSION_LEVEL_HINTS, PERMISSION_LEVEL_LABELS, PERMISSION_LEVEL_SHORT_LABELS, PermissionLevel, isDbPermissionLevel, isPermissionLevel, toDbPermissionLevel } from '@ai-matrx/data/access';
|
|
4
|
+
export { DB_PERMISSION_LEVELS, DbPermissionLevel, PERMISSION_LEVELS, PERMISSION_LEVEL_HINTS, PERMISSION_LEVEL_LABELS, PERMISSION_LEVEL_SHORT_LABELS, PermissionLevel, isDbPermissionLevel, isPermissionLevel, normalizePermissionLevel, parsePermissionLevel, toDbPermissionLevel } from '@ai-matrx/data/access';
|
|
5
5
|
import { EntityTypeToken } from '@ai-matrx/associations';
|
|
6
6
|
import * as _ai_matrx_api_account from '@ai-matrx/api/account';
|
|
7
7
|
import { components } from '@ai-matrx/api/types';
|
|
@@ -3426,15 +3426,12 @@ declare function getResourceSharePath(resourceType: string, resourceId: string):
|
|
|
3426
3426
|
* rank map, label map or ordered array omits a level.
|
|
3427
3427
|
*/
|
|
3428
3428
|
|
|
3429
|
-
/** Maps a stored/retired level onto the public ladder (a stray `edit_content` row reads as Edit). */
|
|
3430
|
-
declare function normalizePermissionLevel(raw: unknown): PermissionLevel | null;
|
|
3431
3429
|
/** The levels a picker may offer: what the database stores, never the retired `edit_content`. */
|
|
3432
3430
|
declare const OFFERED_DB_PERMISSION_LEVELS: readonly DbPermissionLevel[];
|
|
3433
3431
|
/** Rank of every level; a stray stored `edit_content` ranks as Edit so old data never crashes. */
|
|
3434
3432
|
declare const PERMISSION_LEVEL_RANK: Record<PermissionLevel, number> & {
|
|
3435
3433
|
edit_content: number;
|
|
3436
3434
|
};
|
|
3437
|
-
declare function parsePermissionLevel(raw: unknown, context: string): PermissionLevel | null;
|
|
3438
3435
|
declare function permissionLevelRank(level: PermissionLevel): number;
|
|
3439
3436
|
|
|
3440
3437
|
/**
|
|
@@ -3751,15 +3748,15 @@ interface CreateShareLinkOptions {
|
|
|
3751
3748
|
maxUses?: number | null | undefined;
|
|
3752
3749
|
label?: string | null | undefined;
|
|
3753
3750
|
}
|
|
3754
|
-
/** Build the absolute share URL for a token. */
|
|
3755
|
-
declare function shareLinkUrl(token: string): string;
|
|
3751
|
+
/** Build the absolute share URL for a token (on `origin` when given). */
|
|
3752
|
+
declare function shareLinkUrl(token: string, origin?: string | undefined): string;
|
|
3756
3753
|
/**
|
|
3757
3754
|
* The URL to hand a person for a share link — the short alias when one exists
|
|
3758
3755
|
* (auto-shorten-every-share-link, owner ruling 2026-08-29), the full /s/ URL
|
|
3759
3756
|
* otherwise. The alias is a redirect only; the 64-hex share token stays the
|
|
3760
3757
|
* one authorization either way.
|
|
3761
3758
|
*/
|
|
3762
|
-
declare function shareUrlForLink(link: Pick<ShareLink, "token" | "shortToken"
|
|
3759
|
+
declare function shareUrlForLink(link: Pick<ShareLink, "token" | "shortToken">, origin?: string | undefined): string;
|
|
3763
3760
|
/** Mint a share link for a resource (owner-only). Returns the token + URL. */
|
|
3764
3761
|
declare function createShareLink(options: CreateShareLinkOptions): Promise<{
|
|
3765
3762
|
success: boolean;
|
|
@@ -4065,7 +4062,7 @@ declare function resolveResourceOwnership(resourceType: ResourceType, resourceId
|
|
|
4065
4062
|
* record store it could not even be ASKED, because `custom.record` carries no
|
|
4066
4063
|
* client SELECT grant and the direct read above returns "Could not read Record".
|
|
4067
4064
|
*
|
|
4068
|
-
* So this asks the database's own predicate (`
|
|
4065
|
+
* So this asks the database's own predicate (`iam.may_manage_sharing`, lane
|
|
4069
4066
|
* SHARE 2026-09-19), which is the same one the six sharing RPCs enforce. The
|
|
4070
4067
|
* screen and the door cannot disagree, because there is one answer.
|
|
4071
4068
|
*
|
|
@@ -4674,10 +4671,10 @@ declare function setSearchEngineIndexed(resourceType: string, resourceId: string
|
|
|
4674
4671
|
|
|
4675
4672
|
type Database = any;
|
|
4676
4673
|
|
|
4677
|
-
type OrganizationMemberRow = Database["
|
|
4674
|
+
type OrganizationMemberRow = Database["iam"]["Functions"]["get_organization_members_with_users"]["Returns"][number];
|
|
4678
4675
|
/** How long a settled roster is kept: for the tab (a change made here forgets it). */
|
|
4679
4676
|
declare const MEMBER_ROWS_TTL_MS: number;
|
|
4680
|
-
type RosterClient = Pick<ReturnType<typeof createClient>, "rpc">;
|
|
4677
|
+
type RosterClient = Pick<ReturnType<typeof createClient>, "rpc" | "schema">;
|
|
4681
4678
|
declare function readOrganizationMemberRows(orgId: string, { now, fresh, client, }?: {
|
|
4682
4679
|
now?: number | undefined;
|
|
4683
4680
|
/** An explicit refresh: skip a settled answer (an in-flight read is still joined). */
|
|
@@ -4737,4 +4734,4 @@ interface HrDepartmentOption {
|
|
|
4737
4734
|
declare function listTeams(organizationId: string, includeArchived?: boolean): Promise<Team[]>;
|
|
4738
4735
|
declare function listTeamMembers(teamId: string): Promise<TeamMember[]>;
|
|
4739
4736
|
|
|
4740
|
-
export { ACCESS_SUMMARY_ERROR_HEADLINE, type AccessContainer, type AccessDirectGrant, type AccessGranteeType, type AccessKpis, type AccessNotice, type AccessPanelView, type AccessReasonRow, type AccessSummary, type AccessSummaryView, type ApiCallResult, type AppDispatch, type ChannelReadiness, type CheckPermissionOptions, type ForkResult, GRANT_LIST_SCOPE_NOTE, type GranteeKind, type HrDepartmentOption, type LaneChoice, MEMBER_ROWS_TTL_MS, type MakePublicOptions, type MyPendingTableInvitation, NOTHING_ELSE_GRANTS, NO_GRANTS_DETAIL, NO_GRANTS_HEADLINE, NO_GRANTS_YET_HEADLINE, OFFERED_DB_PERMISSION_LEVELS, type OrCapable, type OrgAvailabilityOptions, type OrganizationMemberRow, type OutsideInviteAnswer, type OutsideShareDelivery, type OutsideShareInvitation, type OutsideShareLevel, type OutsideShareState, type OwnedResource, type OwnerCheckResult, type OwnershipResolution, PERMISSION_LEVEL_RANK, PUBLIC_LANE_COLUMNS, PUBLIC_LANE_TYPES, type Permission, type PermissionCheckResult, PermissionError, PermissionErrorCode, type PermissionWithDetails, type PublishLane, RESOURCE_TYPES, type ResolvedShareToken, type ResourceType, type ResourceVisibility, type RevokeAccessOptions, SHAREABLE_RESOURCE_REGISTRY, SHOWN_TO_ORDER, SHOWN_TO_WORDS, type SearchEngineIndexedState, type SecureDeliveryCreate, type SecureDeliveryOptions, type SecureDeliveryPage, type SecureDeliveryReceipt, SecureDeliveryRefusal, type SentSecureDelivery, type ShareActionResult, type ShareCapabilities, type ShareDbClient, type ShareLink, type ShareNoticeAnswer, type ShareServerCall, type ShareServerResult, type ShareTargetType, type ShareWithUserOptions, type ShareableResourceEntry, type SharingCopyContext, type SharingHost, type SharingState, type ShownTo, type ShownToContext, type TableSharePeek, type Team, type TeamMember, type TeamRole, type UpdatePermissionOptions, type WhoCanSee, absoluteInviteUrl, acceptOutsideShare, accessKpis, accessReasonRows, accessSummaryView, appUrl, applyShownTo, batchShareWithUsers, callApi, checkPermission, configureSharing, containerDetail, containerTitle, createClient, createSafeShareMessage, createShareLink, describeAccessSummary, describeShareLinkAccess, describeShareLinkExpiry, ensureOrgAvailability, ensureOrgId, evaluateShareLinkHandoff, fetchAccessSummary, fetchEntityTitles, fetchRecipientPhoneOnFile, fetchSecureDeliveryOptions, fetchShownToContext, forgetOrganizationMemberRows, forkSharedResource, getActiveOrgId, getClaimsUser, getPermissionLevelLabel, getPermissionLevelsAtOrAbove, getResourcePermissions, getResourceSharePath, getResourceTypeLabel, getResourceVisibility, getSearchEngineIndexedState, getShareCapabilities, getShareableResource, getSharedWithMe, grantCsvRow, grantCsvRows, grantLevelLabel, grantOrgAvailability, granteeKind, granteeLabel, granteeSecondaryLabel, hasPublicPage, humanAccessPanel, humanAccessSummary, humanGrantList, humanGrantRow, humanNotices, isForkable, isJsonObject, isKnownEntity, isPrivateSummary, isResourceOwner, listPermissions, listSentSecureDeliveries, listShareLinks, listTeamMembers, listTeams, makePrivate, makePublic, myPendingTableInvitations,
|
|
4737
|
+
export { ACCESS_SUMMARY_ERROR_HEADLINE, type AccessContainer, type AccessDirectGrant, type AccessGranteeType, type AccessKpis, type AccessNotice, type AccessPanelView, type AccessReasonRow, type AccessSummary, type AccessSummaryView, type ApiCallResult, type AppDispatch, type ChannelReadiness, type CheckPermissionOptions, type ForkResult, GRANT_LIST_SCOPE_NOTE, type GranteeKind, type HrDepartmentOption, type LaneChoice, MEMBER_ROWS_TTL_MS, type MakePublicOptions, type MyPendingTableInvitation, NOTHING_ELSE_GRANTS, NO_GRANTS_DETAIL, NO_GRANTS_HEADLINE, NO_GRANTS_YET_HEADLINE, OFFERED_DB_PERMISSION_LEVELS, type OrCapable, type OrgAvailabilityOptions, type OrganizationMemberRow, type OutsideInviteAnswer, type OutsideShareDelivery, type OutsideShareInvitation, type OutsideShareLevel, type OutsideShareState, type OwnedResource, type OwnerCheckResult, type OwnershipResolution, PERMISSION_LEVEL_RANK, PUBLIC_LANE_COLUMNS, PUBLIC_LANE_TYPES, type Permission, type PermissionCheckResult, PermissionError, PermissionErrorCode, type PermissionWithDetails, type PublishLane, RESOURCE_TYPES, type ResolvedShareToken, type ResourceType, type ResourceVisibility, type RevokeAccessOptions, SHAREABLE_RESOURCE_REGISTRY, SHOWN_TO_ORDER, SHOWN_TO_WORDS, type SearchEngineIndexedState, type SecureDeliveryCreate, type SecureDeliveryOptions, type SecureDeliveryPage, type SecureDeliveryReceipt, SecureDeliveryRefusal, type SentSecureDelivery, type ShareActionResult, type ShareCapabilities, type ShareDbClient, type ShareLink, type ShareNoticeAnswer, type ShareServerCall, type ShareServerResult, type ShareTargetType, type ShareWithUserOptions, type ShareableResourceEntry, type SharingCopyContext, type SharingHost, type SharingState, type ShownTo, type ShownToContext, type TableSharePeek, type Team, type TeamMember, type TeamRole, type UpdatePermissionOptions, type WhoCanSee, absoluteInviteUrl, acceptOutsideShare, accessKpis, accessReasonRows, accessSummaryView, appUrl, applyShownTo, batchShareWithUsers, callApi, checkPermission, configureSharing, containerDetail, containerTitle, createClient, createSafeShareMessage, createShareLink, describeAccessSummary, describeShareLinkAccess, describeShareLinkExpiry, ensureOrgAvailability, ensureOrgId, evaluateShareLinkHandoff, fetchAccessSummary, fetchEntityTitles, fetchRecipientPhoneOnFile, fetchSecureDeliveryOptions, fetchShownToContext, forgetOrganizationMemberRows, forkSharedResource, getActiveOrgId, getClaimsUser, getPermissionLevelLabel, getPermissionLevelsAtOrAbove, getResourcePermissions, getResourceSharePath, getResourceTypeLabel, getResourceVisibility, getSearchEngineIndexedState, getShareCapabilities, getShareableResource, getSharedWithMe, grantCsvRow, grantCsvRows, grantLevelLabel, grantOrgAvailability, granteeKind, granteeLabel, granteeSecondaryLabel, hasPublicPage, humanAccessPanel, humanAccessSummary, humanGrantList, humanGrantRow, humanNotices, isForkable, isJsonObject, isKnownEntity, isPrivateSummary, isResourceOwner, listPermissions, listSentSecureDeliveries, listShareLinks, listTeamMembers, listTeams, makePrivate, makePublic, myPendingTableInvitations, onlyOpenOrganizations, openSecureDelivery, organizationDisambiguators, passThroughDispatch, peekTableShare, permissionLevelRank, publicLaneSelect, publicResourceUrl, readOrganizationMemberRows, readOutsideShare, reasonCsvRows, recordNoun, requestSecureDeliveryCode, resendOutside, resolveEntityHref, resolveResourceOwnership, resolveResourceToken, resolveShareToken, resolveSharingAuthority, resolveTableName, revokeAccess, revokeOrgAccess, revokeOutside, revokePublicAccess, revokeSecureDelivery, revokeShareLink, revokeUserAccess, satisfiesPermissionLevel, sendSecureDelivery, sendShareNotice, setResourceShownTo, setSearchEngineIndexed, setStoreLane, shareClient, shareLinkSecurityStateMatches, shareLinkUnavailableReason, shareLinkUrl, shareUrlForLink, shareWithOutsidePerson, shareWithUser, sharingHost, sharingLocation, shownToBlendedFilter, shownToFilter, shownToMyOrgsFilter, summaryReachLabel, supabase, updatePermissionLevel, validatePermission, viewSecureDelivery };
|
package/dist/core.js
CHANGED
|
@@ -3376,10 +3376,10 @@ function getResourceSharePath(resourceType, resourceId) {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
|
|
3378
3378
|
// src/core/levels.ts
|
|
3379
|
-
import {
|
|
3379
|
+
import { DB_PERMISSION_LEVELS, PERMISSION_LEVEL_RANK as PACKAGE_RANK } from "@ai-matrx/data/access";
|
|
3380
3380
|
import {
|
|
3381
|
-
PERMISSION_LEVELS
|
|
3382
|
-
isPermissionLevel
|
|
3381
|
+
PERMISSION_LEVELS,
|
|
3382
|
+
isPermissionLevel,
|
|
3383
3383
|
PERMISSION_LEVEL_LABELS,
|
|
3384
3384
|
PERMISSION_LEVEL_HINTS,
|
|
3385
3385
|
PERMISSION_LEVEL_SHORT_LABELS,
|
|
@@ -3387,28 +3387,16 @@ import {
|
|
|
3387
3387
|
isDbPermissionLevel,
|
|
3388
3388
|
toDbPermissionLevel
|
|
3389
3389
|
} from "@ai-matrx/data/access";
|
|
3390
|
-
|
|
3391
|
-
if (raw === "edit_content") return "editor";
|
|
3392
|
-
return isPermissionLevel(raw) ? raw : null;
|
|
3393
|
-
}
|
|
3390
|
+
import { normalizePermissionLevel, parsePermissionLevel } from "@ai-matrx/data/access";
|
|
3394
3391
|
var OFFERED_DB_PERMISSION_LEVELS = DB_PERMISSION_LEVELS;
|
|
3395
3392
|
var PERMISSION_LEVEL_RANK = {
|
|
3396
3393
|
...PACKAGE_RANK,
|
|
3397
3394
|
edit_content: PACKAGE_RANK.editor
|
|
3398
3395
|
};
|
|
3399
|
-
function parsePermissionLevel(raw, context) {
|
|
3400
|
-
const level = normalizePermissionLevel(raw);
|
|
3401
|
-
if (level) return level;
|
|
3402
|
-
if (raw === null || raw === void 0) return null;
|
|
3403
|
-
console.error(
|
|
3404
|
-
`[permissions] ${context}: unrecognised permission level ${JSON.stringify(raw)}. Known levels are ${PERMISSION_LEVELS.join(", ")}. Add it to PERMISSION_LEVELS in utils/permissions/levels.ts (the package ladder is re-exported there) if the database gained a new value.`
|
|
3405
|
-
);
|
|
3406
|
-
return null;
|
|
3407
|
-
}
|
|
3408
3396
|
function permissionLevelRank(level) {
|
|
3409
3397
|
const rank = PERMISSION_LEVEL_RANK[level];
|
|
3410
3398
|
if (rank === void 0) {
|
|
3411
|
-
console.error(`[permissions] no rank for permission level ${JSON.stringify(level)}. Add it to PERMISSION_LEVELS in
|
|
3399
|
+
console.error(`[permissions] no rank for permission level ${JSON.stringify(level)}. Add it to PERMISSION_LEVELS in @ai-matrx/data/access (permissionLevels.ts).`);
|
|
3412
3400
|
return Number.NaN;
|
|
3413
3401
|
}
|
|
3414
3402
|
return rank;
|
|
@@ -3419,8 +3407,8 @@ function satisfiesPermissionLevel(current, required) {
|
|
|
3419
3407
|
return permissionLevelRank(current) >= permissionLevelRank(required);
|
|
3420
3408
|
}
|
|
3421
3409
|
function getPermissionLevelsAtOrAbove(level) {
|
|
3422
|
-
const levelIndex =
|
|
3423
|
-
return [...
|
|
3410
|
+
const levelIndex = PERMISSION_LEVELS.indexOf(level);
|
|
3411
|
+
return [...PERMISSION_LEVELS].slice(levelIndex);
|
|
3424
3412
|
}
|
|
3425
3413
|
function getPermissionLevelLabel(level) {
|
|
3426
3414
|
return PERMISSION_LEVEL_LABELS[level] ?? `Unknown level (${level})`;
|
|
@@ -3536,13 +3524,16 @@ async function getShareCapabilities(resourceType) {
|
|
|
3536
3524
|
rowChildColumn: typeof data.row_child_column === "string" ? data.row_child_column : null
|
|
3537
3525
|
};
|
|
3538
3526
|
}
|
|
3539
|
-
function
|
|
3540
|
-
const base = process.env.NEXT_PUBLIC_APP_URL || (typeof window !== "undefined" ? window.location.origin : "");
|
|
3541
|
-
return
|
|
3527
|
+
function shareBase(origin) {
|
|
3528
|
+
const base = origin || process.env.NEXT_PUBLIC_APP_URL || (typeof window !== "undefined" ? window.location.origin : "");
|
|
3529
|
+
return base.replace(/\/+$/, "");
|
|
3542
3530
|
}
|
|
3543
|
-
function
|
|
3544
|
-
|
|
3545
|
-
|
|
3531
|
+
function shareLinkUrl(token, origin) {
|
|
3532
|
+
return `${shareBase(origin)}/s/${token}`;
|
|
3533
|
+
}
|
|
3534
|
+
function shareUrlForLink(link, origin) {
|
|
3535
|
+
const base = shareBase(origin);
|
|
3536
|
+
return link.shortToken ? shortLinkUrl(base, link.shortToken) : shareLinkUrl(link.token, base);
|
|
3546
3537
|
}
|
|
3547
3538
|
async function createShareLink(options) {
|
|
3548
3539
|
try {
|
|
@@ -3613,7 +3604,7 @@ async function forkSharedResource(resourceType, resourceId, shareToken, organiza
|
|
|
3613
3604
|
try {
|
|
3614
3605
|
const orgId = await ensureOrgId(organizationId);
|
|
3615
3606
|
if (resourceType === "conversation") {
|
|
3616
|
-
const { data, error } = await supabase.rpc("fork_shared_conversation", {
|
|
3607
|
+
const { data, error } = await supabase.schema("chat").rpc("fork_shared_conversation", {
|
|
3617
3608
|
p_conversation_id: resourceId,
|
|
3618
3609
|
p_organization_id: orgId,
|
|
3619
3610
|
p_token: shareToken ?? void 0
|
|
@@ -3623,7 +3614,7 @@ async function forkSharedResource(resourceType, resourceId, shareToken, organiza
|
|
|
3623
3614
|
return r?.success ? { success: true, path: `/chat/${r.conversation_id}` } : { success: false, error: r?.error };
|
|
3624
3615
|
}
|
|
3625
3616
|
if (resourceType === "fc_set") {
|
|
3626
|
-
const { data, error } = await supabase.rpc("fork_shared_flashcard_set", {
|
|
3617
|
+
const { data, error } = await supabase.schema("education").rpc("fork_shared_flashcard_set", {
|
|
3627
3618
|
p_set_id: resourceId,
|
|
3628
3619
|
p_organization_id: orgId,
|
|
3629
3620
|
p_token: shareToken ?? void 0
|
|
@@ -3633,7 +3624,7 @@ async function forkSharedResource(resourceType, resourceId, shareToken, organiza
|
|
|
3633
3624
|
return r?.success ? { success: true, path: `/education/flashcards/${r.set_id}` } : { success: false, error: r?.error };
|
|
3634
3625
|
}
|
|
3635
3626
|
if (resourceType === "quiz_session") {
|
|
3636
|
-
const { data, error } = await supabase.rpc("fork_shared_quiz", {
|
|
3627
|
+
const { data, error } = await supabase.schema("education").rpc("fork_shared_quiz", {
|
|
3637
3628
|
p_quiz_id: resourceId,
|
|
3638
3629
|
p_organization_id: orgId,
|
|
3639
3630
|
p_token: shareToken ?? void 0
|
|
@@ -3654,7 +3645,7 @@ function isForkable(resourceType) {
|
|
|
3654
3645
|
return resourceType === "conversation" || resourceType === "fc_set" || resourceType === "quiz_session";
|
|
3655
3646
|
}
|
|
3656
3647
|
async function resolveShareToken(token, client = supabase) {
|
|
3657
|
-
const { data, error } = await client.rpc("resolve_share_token", {
|
|
3648
|
+
const { data, error } = await client.schema("iam").rpc("resolve_share_token", {
|
|
3658
3649
|
p_token: token
|
|
3659
3650
|
});
|
|
3660
3651
|
if (error) {
|
|
@@ -3738,7 +3729,7 @@ async function writeRowControl(resourceType, resourceId, patch) {
|
|
|
3738
3729
|
return { success: true };
|
|
3739
3730
|
}
|
|
3740
3731
|
async function writeStoreRowControls(resourceType, resourceId, controls) {
|
|
3741
|
-
const { data: lane, error: laneError } = await supabase.rpc("store_door_lane", {
|
|
3732
|
+
const { data: lane, error: laneError } = await supabase.schema("workbench").rpc("store_door_lane", {
|
|
3742
3733
|
p_resource_type: resourceType,
|
|
3743
3734
|
p_resource_id: resourceId
|
|
3744
3735
|
});
|
|
@@ -3772,7 +3763,7 @@ async function getResourceVisibility(resourceType, resourceId) {
|
|
|
3772
3763
|
);
|
|
3773
3764
|
}
|
|
3774
3765
|
if (entry.schemaName === "custom") {
|
|
3775
|
-
const { data: data2, error: error2 } = await supabase.rpc("store_door_lane", {
|
|
3766
|
+
const { data: data2, error: error2 } = await supabase.schema("workbench").rpc("store_door_lane", {
|
|
3776
3767
|
p_resource_type: resourceType,
|
|
3777
3768
|
p_resource_id: resourceId
|
|
3778
3769
|
});
|
|
@@ -3891,7 +3882,7 @@ async function shareWithUser(options) {
|
|
|
3891
3882
|
permissionLevel,
|
|
3892
3883
|
organizationId
|
|
3893
3884
|
} = options;
|
|
3894
|
-
const { data, error } = await supabase.rpc("share_resource_with_user", {
|
|
3885
|
+
const { data, error } = await supabase.schema("iam").rpc("share_resource_with_user", {
|
|
3895
3886
|
p_resource_type: resourceType,
|
|
3896
3887
|
p_resource_id: resourceId,
|
|
3897
3888
|
p_target_user_id: userId,
|
|
@@ -3942,7 +3933,7 @@ async function shareWithUser(options) {
|
|
|
3942
3933
|
async function grantOrgAvailability(options) {
|
|
3943
3934
|
try {
|
|
3944
3935
|
const { resourceType, resourceId, organizationId, permissionLevel } = options;
|
|
3945
|
-
const { data, error } = await supabase.rpc("grant_org_availability", {
|
|
3936
|
+
const { data, error } = await supabase.schema("iam").rpc("grant_org_availability", {
|
|
3946
3937
|
p_resource_type: resourceType,
|
|
3947
3938
|
p_resource_id: resourceId,
|
|
3948
3939
|
p_target_org_id: organizationId,
|
|
@@ -4004,7 +3995,7 @@ async function makePrivate(resourceType, resourceId) {
|
|
|
4004
3995
|
}
|
|
4005
3996
|
async function revokeUserAccess(resourceType, resourceId, userId) {
|
|
4006
3997
|
try {
|
|
4007
|
-
const { data, error } = await supabase.rpc("revoke_resource_access", {
|
|
3998
|
+
const { data, error } = await supabase.schema("iam").rpc("revoke_resource_access", {
|
|
4008
3999
|
p_resource_type: resourceType,
|
|
4009
4000
|
p_resource_id: resourceId,
|
|
4010
4001
|
p_target_user_id: userId
|
|
@@ -4027,7 +4018,7 @@ async function revokeUserAccess(resourceType, resourceId, userId) {
|
|
|
4027
4018
|
}
|
|
4028
4019
|
async function revokeOrgAccess(resourceType, resourceId, organizationId) {
|
|
4029
4020
|
try {
|
|
4030
|
-
const { data, error } = await supabase.rpc("revoke_resource_org_access", {
|
|
4021
|
+
const { data, error } = await supabase.schema("iam").rpc("revoke_resource_org_access", {
|
|
4031
4022
|
p_resource_type: resourceType,
|
|
4032
4023
|
p_resource_id: resourceId,
|
|
4033
4024
|
p_target_org_id: organizationId
|
|
@@ -4068,7 +4059,7 @@ async function updatePermissionLevel(options) {
|
|
|
4068
4059
|
if (!userId && !organizationId) {
|
|
4069
4060
|
return { success: false, error: "Must specify userId or organizationId" };
|
|
4070
4061
|
}
|
|
4071
|
-
const { data, error } = await supabase.rpc("update_permission_level", {
|
|
4062
|
+
const { data, error } = await supabase.schema("iam").rpc("update_permission_level", {
|
|
4072
4063
|
p_resource_type: resourceType,
|
|
4073
4064
|
p_resource_id: resourceId,
|
|
4074
4065
|
p_target_user_id: userId,
|
|
@@ -4096,7 +4087,7 @@ async function updatePermissionLevel(options) {
|
|
|
4096
4087
|
}
|
|
4097
4088
|
async function listPermissions(resourceType, resourceId) {
|
|
4098
4089
|
try {
|
|
4099
|
-
const { data, error } = await supabase.rpc("get_resource_permissions", {
|
|
4090
|
+
const { data, error } = await supabase.schema("iam").rpc("get_resource_permissions", {
|
|
4100
4091
|
p_resource_type: resourceType,
|
|
4101
4092
|
p_resource_id: resourceId
|
|
4102
4093
|
});
|
|
@@ -4175,7 +4166,7 @@ async function resolveSharingAuthority(resourceType, resourceId) {
|
|
|
4175
4166
|
};
|
|
4176
4167
|
}
|
|
4177
4168
|
try {
|
|
4178
|
-
const { data, error } = await supabase.rpc("may_manage_sharing", {
|
|
4169
|
+
const { data, error } = await supabase.schema("iam").rpc("may_manage_sharing", {
|
|
4179
4170
|
p_resource_type: resourceType,
|
|
4180
4171
|
p_resource_id: resourceId
|
|
4181
4172
|
});
|
|
@@ -4470,7 +4461,7 @@ async function fetchEntityTitles(entityType, ids) {
|
|
|
4470
4461
|
const unique = Array.from(new Set(ids.filter(Boolean)));
|
|
4471
4462
|
if (unique.length === 0) return out;
|
|
4472
4463
|
const supabase2 = createClient();
|
|
4473
|
-
const { data, error } = await supabase2.rpc("entity_titles", {
|
|
4464
|
+
const { data, error } = await supabase2.schema("platform").rpc("entity_titles", {
|
|
4474
4465
|
p_type: entityType,
|
|
4475
4466
|
p_ids: unique
|
|
4476
4467
|
});
|
|
@@ -4989,7 +4980,7 @@ async function revokeOutside(organizationId, invitationId) {
|
|
|
4989
4980
|
return data;
|
|
4990
4981
|
}
|
|
4991
4982
|
async function peekTableShare(token) {
|
|
4992
|
-
const { data, error } = await createClient().rpc("table_share_peek", { p_token: token });
|
|
4983
|
+
const { data, error } = await createClient().schema("iam").rpc("table_share_peek", { p_token: token });
|
|
4993
4984
|
if (error) throw new Error(error.message);
|
|
4994
4985
|
return data;
|
|
4995
4986
|
}
|
|
@@ -5145,7 +5136,7 @@ function readOrganizationMemberRows2(orgId, {
|
|
|
5145
5136
|
const db = client ?? createClient();
|
|
5146
5137
|
const entry = { at: now, settled: false, rows: Promise.resolve([]) };
|
|
5147
5138
|
const rows = (async () => {
|
|
5148
|
-
const { data, error } = await db.rpc("get_organization_members_with_users", {
|
|
5139
|
+
const { data, error } = await db.schema("iam").rpc("get_organization_members_with_users", {
|
|
5149
5140
|
p_org_id: orgId
|
|
5150
5141
|
});
|
|
5151
5142
|
if (error) throw pgErrorToError(error);
|
|
@@ -5192,7 +5183,7 @@ function toRole(value) {
|
|
|
5192
5183
|
return value === "admin" || value === "member" ? value : null;
|
|
5193
5184
|
}
|
|
5194
5185
|
async function listTeams(organizationId, includeArchived = false) {
|
|
5195
|
-
const { data, error } = await shareClient().rpc("team_list", { p_organization_id: organizationId, p_include_archived: includeArchived });
|
|
5186
|
+
const { data, error } = await shareClient().schema("iam").rpc("team_list", { p_organization_id: organizationId, p_include_archived: includeArchived });
|
|
5196
5187
|
if (error) throw pgErrorToError2(error);
|
|
5197
5188
|
return (data ?? []).map((row) => ({
|
|
5198
5189
|
id: String(row.id),
|
|
@@ -5208,7 +5199,7 @@ async function listTeams(organizationId, includeArchived = false) {
|
|
|
5208
5199
|
}));
|
|
5209
5200
|
}
|
|
5210
5201
|
async function listTeamMembers(teamId) {
|
|
5211
|
-
const { data, error } = await shareClient().rpc("team_members", { p_team_id: teamId });
|
|
5202
|
+
const { data, error } = await shareClient().schema("iam").rpc("team_members", { p_team_id: teamId });
|
|
5212
5203
|
if (error) throw pgErrorToError2(error);
|
|
5213
5204
|
return (data ?? []).map((row) => ({
|
|
5214
5205
|
userId: String(row.user_id),
|
|
@@ -5231,7 +5222,7 @@ export {
|
|
|
5231
5222
|
NO_GRANTS_HEADLINE,
|
|
5232
5223
|
NO_GRANTS_YET_HEADLINE,
|
|
5233
5224
|
OFFERED_DB_PERMISSION_LEVELS,
|
|
5234
|
-
|
|
5225
|
+
PERMISSION_LEVELS,
|
|
5235
5226
|
PERMISSION_LEVEL_HINTS,
|
|
5236
5227
|
PERMISSION_LEVEL_LABELS,
|
|
5237
5228
|
PERMISSION_LEVEL_RANK,
|
|
@@ -5304,7 +5295,7 @@ export {
|
|
|
5304
5295
|
isForkable,
|
|
5305
5296
|
isJsonObject,
|
|
5306
5297
|
isKnownEntity,
|
|
5307
|
-
|
|
5298
|
+
isPermissionLevel,
|
|
5308
5299
|
isPrivateSummary,
|
|
5309
5300
|
isResourceOwner,
|
|
5310
5301
|
listPermissions,
|