@managemint-solutions/sdk 0.51.0 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,11 @@ export declare class SupportingFilesResource {
11
11
  private readonly table;
12
12
  constructor(supabase: TypedSupabaseClient, auth: AuthContext, audit: AuditResource);
13
13
  getPresignedUrl(supportingFileId: string): Promise<SupportingFilePresignedUrl>;
14
+ /** The record a file hangs off - what the api checks the caller can reach before a download or delete. */
15
+ getParent(supportingFileId: string): Promise<{
16
+ entity_type: SupportingFilesEntityTypes;
17
+ entity_id: string;
18
+ }>;
14
19
  list(entity: SupportingFilesEntityTypes, entityId: string): Promise<SupportingFileEntity[]>;
15
20
  /**
16
21
  * Where the caller puts each file: one signed upload URL per name, in request order, valid
@@ -76,6 +76,18 @@ class SupportingFilesResource {
76
76
  throw (0, errors_1.mapStorageError)(signedError);
77
77
  return { url: signed.signedUrl, ttl: SIGNED_URL_TTL_SECONDS };
78
78
  }
79
+ /** The record a file hangs off - what the api checks the caller can reach before a download or delete. */
80
+ async getParent(supportingFileId) {
81
+ const { data, error } = await this.supabase
82
+ .from('supporting_files')
83
+ .select('entity_type, entity_id')
84
+ .eq('mms_id', supportingFileId)
85
+ .eq('organization_id', this.auth.organization_id)
86
+ .single();
87
+ if (error)
88
+ throw (0, errors_1.mapPostgrestError)(error);
89
+ return data;
90
+ }
79
91
  async list(entity, entityId) {
80
92
  const { data, error } = await this.supabase
81
93
  .from('supporting_files')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/sdk",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "Typed Supabase data-access SDK for ManageMint Solutions",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Scott Bebington <scottbebington@gmail.com>",