@uniformdev/files 19.54.3-alpha.3 → 19.55.1-alpha.8

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/index.d.mts CHANGED
@@ -1,42 +1,192 @@
1
1
  import { ApiClient, ClientOptions } from '@uniformdev/context/api';
2
2
 
3
- type GetFileOptions = {
4
- id: string;
5
- } | {
6
- url: string;
7
- projectId?: string;
8
- } | {
9
- sourceId: string;
10
- projectId: string;
11
- };
12
- interface NewFileOptions {
13
- name: string;
14
- size: number;
15
- mediaType: string;
16
- width?: number;
17
- height?: number;
18
- sourceId?: string;
19
- projectId?: string;
3
+ /**
4
+ * This file was auto-generated by openapi-typescript.
5
+ * Do not make direct changes to the file.
6
+ */
7
+ interface paths {
8
+ "/api/v1/files": {
9
+ /** Gets a single file */
10
+ get: {
11
+ parameters: {
12
+ query: {
13
+ id?: string;
14
+ url?: string;
15
+ sourceId?: string;
16
+ projectId?: string;
17
+ };
18
+ };
19
+ responses: {
20
+ /** 200 response */
21
+ 200: {
22
+ content: {
23
+ "application/json": {
24
+ /** Format: uuid */
25
+ id: string;
26
+ state: number;
27
+ url?: string;
28
+ name: string;
29
+ mediaType: string;
30
+ metadata?: unknown;
31
+ size: number;
32
+ };
33
+ };
34
+ };
35
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
36
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
37
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
38
+ /** 404 response */
39
+ 404: unknown;
40
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
41
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
42
+ };
43
+ };
44
+ /** Creates a new file */
45
+ post: {
46
+ responses: {
47
+ /** 202 response */
48
+ 202: {
49
+ content: {
50
+ "application/json": {
51
+ /** Format: uuid */
52
+ id: string;
53
+ uploadUrl: string;
54
+ /** @enum {string} */
55
+ method: "POST" | "PUT";
56
+ };
57
+ };
58
+ };
59
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
60
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
61
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
62
+ /** 404 response */
63
+ 404: unknown;
64
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
65
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
66
+ };
67
+ requestBody: {
68
+ content: {
69
+ "application/json": {
70
+ /** Format: uuid */
71
+ projectId?: string;
72
+ sourceId?: string;
73
+ /** Format: uuid */
74
+ teamId?: string;
75
+ name: string;
76
+ size: number;
77
+ mediaType: string;
78
+ width?: number;
79
+ height?: number;
80
+ };
81
+ };
82
+ };
83
+ };
84
+ /** Deletes a file */
85
+ delete: {
86
+ responses: {
87
+ /** 200 response */
88
+ 200: {
89
+ content: {
90
+ "application/json": {
91
+ /** Format: uuid */
92
+ id: string;
93
+ };
94
+ };
95
+ };
96
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
97
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
98
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
99
+ /** 404 response */
100
+ 404: unknown;
101
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
102
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
103
+ };
104
+ requestBody: {
105
+ content: {
106
+ "application/json": {
107
+ url: string;
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
20
113
  }
21
- interface NewFileResponse {
22
- id: string;
23
- uploadUrl: string;
24
- method: string;
25
- }
26
- interface FileStateResponse {
27
- id: string;
28
- state: number;
29
- url: string;
30
- mediaType: string;
31
- name: string;
32
- size: number;
33
- metadata: unknown;
114
+ interface external {
115
+ "swagger.yml": {
116
+ paths: {};
117
+ components: {
118
+ schemas: {
119
+ Error: {
120
+ /** @description Error message(s) that occurred while processing the request */
121
+ errorMessage?: string[] | string;
122
+ };
123
+ };
124
+ responses: {
125
+ /** Request input validation failed */
126
+ BadRequestError: {
127
+ content: {
128
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
129
+ };
130
+ };
131
+ /** API key or token was not valid */
132
+ UnauthorizedError: {
133
+ content: {
134
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
135
+ };
136
+ };
137
+ /** Permission was denied */
138
+ ForbiddenError: {
139
+ content: {
140
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
141
+ };
142
+ };
143
+ /** Resource not found */
144
+ NotFoundError: {
145
+ content: {
146
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
147
+ };
148
+ };
149
+ /** Too many requests in allowed time period */
150
+ RateLimitError: unknown;
151
+ /** Execution error occurred */
152
+ InternalServerError: unknown;
153
+ };
154
+ };
155
+ operations: {};
156
+ };
34
157
  }
158
+
159
+ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content']['application/json'];
160
+ type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
161
+ type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
162
+ type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json'];
163
+ type FileGetRequest = paths['/api/v1/files']['get']['parameters']['query'];
164
+ type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
165
+ type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
166
+ type FileGetBySourceIDRequest = Pick<FileGetRequest, 'sourceId' | 'projectId'>;
167
+ type FileGetResponse = paths['/api/v1/files']['get']['responses']['200']['content']['application/json'];
168
+
169
+ type WithoutProjectId<T extends {
170
+ projectId?: string;
171
+ }> = Omit<T, 'projectId'>;
35
172
  declare class FileClient extends ApiClient {
36
- constructor(options: ClientOptions);
37
- createNewProjectFile(options: NewFileOptions): Promise<NewFileResponse>;
38
- getFile(options: GetFileOptions): Promise<FileStateResponse>;
39
- deleteFileByUrl(url: string): Promise<FileStateResponse>;
173
+ constructor(options: ClientOptions & {
174
+ projectId: NonNullable<ClientOptions['projectId']>;
175
+ });
176
+ get(options: FileGetByIDRequest | WithoutProjectId<FileGetBySourceIDRequest> | WithoutProjectId<FileGetByURLRequest>): Promise<FileGetResponse>;
177
+ insert(options: WithoutProjectId<FileInsertRequest>): Promise<{
178
+ id: string;
179
+ uploadUrl: string;
180
+ method: "POST" | "PUT";
181
+ }>;
182
+ delete(options: FileDeleteRequest): Promise<{
183
+ id: string;
184
+ }>;
185
+ }
186
+ declare class UncachedFileClient extends FileClient {
187
+ constructor(options: Omit<ClientOptions & {
188
+ projectId: NonNullable<ClientOptions['projectId']>;
189
+ }, 'bypassCache'>);
40
190
  }
41
191
 
42
192
  declare const getFileNameFromUrl: (fileUrl: string) => string;
@@ -49,4 +199,4 @@ declare const FILE_READY_STATE = 64;
49
199
  declare const FILE_MAX_SIZE: number;
50
200
  declare const FILE_TYPES_IMAGE: string[];
51
201
 
52
- export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_READY_STATE, FILE_TYPES_IMAGE, FileClient, FileStateResponse, NewFileOptions, NewFileResponse, getFileNameFromUrl };
202
+ export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_READY_STATE, FILE_TYPES_IMAGE, FileClient, FileDeleteRequest, FileDeleteResponse, FileGetByIDRequest, FileGetBySourceIDRequest, FileGetByURLRequest, FileGetRequest, FileGetResponse, FileInsertRequest, FileInsertResponse, UncachedFileClient, getFileNameFromUrl };
package/dist/index.d.ts CHANGED
@@ -1,42 +1,192 @@
1
1
  import { ApiClient, ClientOptions } from '@uniformdev/context/api';
2
2
 
3
- type GetFileOptions = {
4
- id: string;
5
- } | {
6
- url: string;
7
- projectId?: string;
8
- } | {
9
- sourceId: string;
10
- projectId: string;
11
- };
12
- interface NewFileOptions {
13
- name: string;
14
- size: number;
15
- mediaType: string;
16
- width?: number;
17
- height?: number;
18
- sourceId?: string;
19
- projectId?: string;
3
+ /**
4
+ * This file was auto-generated by openapi-typescript.
5
+ * Do not make direct changes to the file.
6
+ */
7
+ interface paths {
8
+ "/api/v1/files": {
9
+ /** Gets a single file */
10
+ get: {
11
+ parameters: {
12
+ query: {
13
+ id?: string;
14
+ url?: string;
15
+ sourceId?: string;
16
+ projectId?: string;
17
+ };
18
+ };
19
+ responses: {
20
+ /** 200 response */
21
+ 200: {
22
+ content: {
23
+ "application/json": {
24
+ /** Format: uuid */
25
+ id: string;
26
+ state: number;
27
+ url?: string;
28
+ name: string;
29
+ mediaType: string;
30
+ metadata?: unknown;
31
+ size: number;
32
+ };
33
+ };
34
+ };
35
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
36
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
37
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
38
+ /** 404 response */
39
+ 404: unknown;
40
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
41
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
42
+ };
43
+ };
44
+ /** Creates a new file */
45
+ post: {
46
+ responses: {
47
+ /** 202 response */
48
+ 202: {
49
+ content: {
50
+ "application/json": {
51
+ /** Format: uuid */
52
+ id: string;
53
+ uploadUrl: string;
54
+ /** @enum {string} */
55
+ method: "POST" | "PUT";
56
+ };
57
+ };
58
+ };
59
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
60
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
61
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
62
+ /** 404 response */
63
+ 404: unknown;
64
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
65
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
66
+ };
67
+ requestBody: {
68
+ content: {
69
+ "application/json": {
70
+ /** Format: uuid */
71
+ projectId?: string;
72
+ sourceId?: string;
73
+ /** Format: uuid */
74
+ teamId?: string;
75
+ name: string;
76
+ size: number;
77
+ mediaType: string;
78
+ width?: number;
79
+ height?: number;
80
+ };
81
+ };
82
+ };
83
+ };
84
+ /** Deletes a file */
85
+ delete: {
86
+ responses: {
87
+ /** 200 response */
88
+ 200: {
89
+ content: {
90
+ "application/json": {
91
+ /** Format: uuid */
92
+ id: string;
93
+ };
94
+ };
95
+ };
96
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
97
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
98
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
99
+ /** 404 response */
100
+ 404: unknown;
101
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
102
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
103
+ };
104
+ requestBody: {
105
+ content: {
106
+ "application/json": {
107
+ url: string;
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
20
113
  }
21
- interface NewFileResponse {
22
- id: string;
23
- uploadUrl: string;
24
- method: string;
25
- }
26
- interface FileStateResponse {
27
- id: string;
28
- state: number;
29
- url: string;
30
- mediaType: string;
31
- name: string;
32
- size: number;
33
- metadata: unknown;
114
+ interface external {
115
+ "swagger.yml": {
116
+ paths: {};
117
+ components: {
118
+ schemas: {
119
+ Error: {
120
+ /** @description Error message(s) that occurred while processing the request */
121
+ errorMessage?: string[] | string;
122
+ };
123
+ };
124
+ responses: {
125
+ /** Request input validation failed */
126
+ BadRequestError: {
127
+ content: {
128
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
129
+ };
130
+ };
131
+ /** API key or token was not valid */
132
+ UnauthorizedError: {
133
+ content: {
134
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
135
+ };
136
+ };
137
+ /** Permission was denied */
138
+ ForbiddenError: {
139
+ content: {
140
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
141
+ };
142
+ };
143
+ /** Resource not found */
144
+ NotFoundError: {
145
+ content: {
146
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
147
+ };
148
+ };
149
+ /** Too many requests in allowed time period */
150
+ RateLimitError: unknown;
151
+ /** Execution error occurred */
152
+ InternalServerError: unknown;
153
+ };
154
+ };
155
+ operations: {};
156
+ };
34
157
  }
158
+
159
+ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content']['application/json'];
160
+ type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
161
+ type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
162
+ type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json'];
163
+ type FileGetRequest = paths['/api/v1/files']['get']['parameters']['query'];
164
+ type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
165
+ type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
166
+ type FileGetBySourceIDRequest = Pick<FileGetRequest, 'sourceId' | 'projectId'>;
167
+ type FileGetResponse = paths['/api/v1/files']['get']['responses']['200']['content']['application/json'];
168
+
169
+ type WithoutProjectId<T extends {
170
+ projectId?: string;
171
+ }> = Omit<T, 'projectId'>;
35
172
  declare class FileClient extends ApiClient {
36
- constructor(options: ClientOptions);
37
- createNewProjectFile(options: NewFileOptions): Promise<NewFileResponse>;
38
- getFile(options: GetFileOptions): Promise<FileStateResponse>;
39
- deleteFileByUrl(url: string): Promise<FileStateResponse>;
173
+ constructor(options: ClientOptions & {
174
+ projectId: NonNullable<ClientOptions['projectId']>;
175
+ });
176
+ get(options: FileGetByIDRequest | WithoutProjectId<FileGetBySourceIDRequest> | WithoutProjectId<FileGetByURLRequest>): Promise<FileGetResponse>;
177
+ insert(options: WithoutProjectId<FileInsertRequest>): Promise<{
178
+ id: string;
179
+ uploadUrl: string;
180
+ method: "POST" | "PUT";
181
+ }>;
182
+ delete(options: FileDeleteRequest): Promise<{
183
+ id: string;
184
+ }>;
185
+ }
186
+ declare class UncachedFileClient extends FileClient {
187
+ constructor(options: Omit<ClientOptions & {
188
+ projectId: NonNullable<ClientOptions['projectId']>;
189
+ }, 'bypassCache'>);
40
190
  }
41
191
 
42
192
  declare const getFileNameFromUrl: (fileUrl: string) => string;
@@ -49,4 +199,4 @@ declare const FILE_READY_STATE = 64;
49
199
  declare const FILE_MAX_SIZE: number;
50
200
  declare const FILE_TYPES_IMAGE: string[];
51
201
 
52
- export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_READY_STATE, FILE_TYPES_IMAGE, FileClient, FileStateResponse, NewFileOptions, NewFileResponse, getFileNameFromUrl };
202
+ export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_READY_STATE, FILE_TYPES_IMAGE, FileClient, FileDeleteRequest, FileDeleteResponse, FileGetByIDRequest, FileGetBySourceIDRequest, FileGetByURLRequest, FileGetRequest, FileGetResponse, FileInsertRequest, FileInsertResponse, UncachedFileClient, getFileNameFromUrl };
package/dist/index.esm.js CHANGED
@@ -1,36 +1,39 @@
1
1
  // src/FileClient.ts
2
2
  import { ApiClient } from "@uniformdev/context/api";
3
- var FILE_BASE_PATH = "/api/v1/file";
3
+ var FILE_BASE_PATH = "/api/v1/files";
4
4
  var FileClient = class extends ApiClient {
5
5
  constructor(options) {
6
6
  super(options);
7
7
  }
8
- async createNewProjectFile(options) {
9
- if (!this.options.projectId)
10
- throw new Error("A project ID must exist to upload a file to a project");
11
- const fetchUrl = this.createUrl(FILE_BASE_PATH);
12
- return await this.apiClient(fetchUrl, {
13
- method: "POST",
14
- body: JSON.stringify({
15
- projectId: this.options.projectId,
16
- ...options
17
- })
8
+ async get(options) {
9
+ const { projectId } = this.options;
10
+ const fetchUri = this.createUrl(FILE_BASE_PATH, {
11
+ ...options,
12
+ projectId
18
13
  });
14
+ return this.apiClient(fetchUri);
19
15
  }
20
- async getFile(options) {
21
- const fetchUrl = this.createUrl(FILE_BASE_PATH, options);
22
- return await this.apiClient(fetchUrl);
16
+ async insert(options) {
17
+ const { projectId } = this.options;
18
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
19
+ return this.apiClient(fetchUri, {
20
+ method: "POST",
21
+ body: JSON.stringify({ ...options, projectId })
22
+ });
23
23
  }
24
- async deleteFileByUrl(url) {
25
- const fetchUrl = this.createUrl(FILE_BASE_PATH);
26
- return await this.apiClient(fetchUrl, {
24
+ async delete(options) {
25
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
26
+ return this.apiClient(fetchUri, {
27
27
  method: "DELETE",
28
- body: JSON.stringify({
29
- url
30
- })
28
+ body: JSON.stringify(options)
31
29
  });
32
30
  }
33
31
  };
32
+ var UncachedFileClient = class extends FileClient {
33
+ constructor(options) {
34
+ super({ ...options, bypassCache: true });
35
+ }
36
+ };
34
37
 
35
38
  // src/fileUrl.ts
36
39
  var getFileNameFromUrl = (fileUrl) => {
@@ -62,5 +65,6 @@ export {
62
65
  FILE_READY_STATE,
63
66
  FILE_TYPES_IMAGE,
64
67
  FileClient,
68
+ UncachedFileClient,
65
69
  getFileNameFromUrl
66
70
  };
package/dist/index.js CHANGED
@@ -25,43 +25,47 @@ __export(src_exports, {
25
25
  FILE_READY_STATE: () => FILE_READY_STATE,
26
26
  FILE_TYPES_IMAGE: () => FILE_TYPES_IMAGE,
27
27
  FileClient: () => FileClient,
28
+ UncachedFileClient: () => UncachedFileClient,
28
29
  getFileNameFromUrl: () => getFileNameFromUrl
29
30
  });
30
31
  module.exports = __toCommonJS(src_exports);
31
32
 
32
33
  // src/FileClient.ts
33
34
  var import_api = require("@uniformdev/context/api");
34
- var FILE_BASE_PATH = "/api/v1/file";
35
+ var FILE_BASE_PATH = "/api/v1/files";
35
36
  var FileClient = class extends import_api.ApiClient {
36
37
  constructor(options) {
37
38
  super(options);
38
39
  }
39
- async createNewProjectFile(options) {
40
- if (!this.options.projectId)
41
- throw new Error("A project ID must exist to upload a file to a project");
42
- const fetchUrl = this.createUrl(FILE_BASE_PATH);
43
- return await this.apiClient(fetchUrl, {
44
- method: "POST",
45
- body: JSON.stringify({
46
- projectId: this.options.projectId,
47
- ...options
48
- })
40
+ async get(options) {
41
+ const { projectId } = this.options;
42
+ const fetchUri = this.createUrl(FILE_BASE_PATH, {
43
+ ...options,
44
+ projectId
49
45
  });
46
+ return this.apiClient(fetchUri);
50
47
  }
51
- async getFile(options) {
52
- const fetchUrl = this.createUrl(FILE_BASE_PATH, options);
53
- return await this.apiClient(fetchUrl);
48
+ async insert(options) {
49
+ const { projectId } = this.options;
50
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
51
+ return this.apiClient(fetchUri, {
52
+ method: "POST",
53
+ body: JSON.stringify({ ...options, projectId })
54
+ });
54
55
  }
55
- async deleteFileByUrl(url) {
56
- const fetchUrl = this.createUrl(FILE_BASE_PATH);
57
- return await this.apiClient(fetchUrl, {
56
+ async delete(options) {
57
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
58
+ return this.apiClient(fetchUri, {
58
59
  method: "DELETE",
59
- body: JSON.stringify({
60
- url
61
- })
60
+ body: JSON.stringify(options)
62
61
  });
63
62
  }
64
63
  };
64
+ var UncachedFileClient = class extends FileClient {
65
+ constructor(options) {
66
+ super({ ...options, bypassCache: true });
67
+ }
68
+ };
65
69
 
66
70
  // src/fileUrl.ts
67
71
  var getFileNameFromUrl = (fileUrl) => {
@@ -94,5 +98,6 @@ var FILE_TYPES_IMAGE = [
94
98
  FILE_READY_STATE,
95
99
  FILE_TYPES_IMAGE,
96
100
  FileClient,
101
+ UncachedFileClient,
97
102
  getFileNameFromUrl
98
103
  });
package/dist/index.mjs CHANGED
@@ -1,36 +1,39 @@
1
1
  // src/FileClient.ts
2
2
  import { ApiClient } from "@uniformdev/context/api";
3
- var FILE_BASE_PATH = "/api/v1/file";
3
+ var FILE_BASE_PATH = "/api/v1/files";
4
4
  var FileClient = class extends ApiClient {
5
5
  constructor(options) {
6
6
  super(options);
7
7
  }
8
- async createNewProjectFile(options) {
9
- if (!this.options.projectId)
10
- throw new Error("A project ID must exist to upload a file to a project");
11
- const fetchUrl = this.createUrl(FILE_BASE_PATH);
12
- return await this.apiClient(fetchUrl, {
13
- method: "POST",
14
- body: JSON.stringify({
15
- projectId: this.options.projectId,
16
- ...options
17
- })
8
+ async get(options) {
9
+ const { projectId } = this.options;
10
+ const fetchUri = this.createUrl(FILE_BASE_PATH, {
11
+ ...options,
12
+ projectId
18
13
  });
14
+ return this.apiClient(fetchUri);
19
15
  }
20
- async getFile(options) {
21
- const fetchUrl = this.createUrl(FILE_BASE_PATH, options);
22
- return await this.apiClient(fetchUrl);
16
+ async insert(options) {
17
+ const { projectId } = this.options;
18
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
19
+ return this.apiClient(fetchUri, {
20
+ method: "POST",
21
+ body: JSON.stringify({ ...options, projectId })
22
+ });
23
23
  }
24
- async deleteFileByUrl(url) {
25
- const fetchUrl = this.createUrl(FILE_BASE_PATH);
26
- return await this.apiClient(fetchUrl, {
24
+ async delete(options) {
25
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
26
+ return this.apiClient(fetchUri, {
27
27
  method: "DELETE",
28
- body: JSON.stringify({
29
- url
30
- })
28
+ body: JSON.stringify(options)
31
29
  });
32
30
  }
33
31
  };
32
+ var UncachedFileClient = class extends FileClient {
33
+ constructor(options) {
34
+ super({ ...options, bypassCache: true });
35
+ }
36
+ };
34
37
 
35
38
  // src/fileUrl.ts
36
39
  var getFileNameFromUrl = (fileUrl) => {
@@ -62,5 +65,6 @@ export {
62
65
  FILE_READY_STATE,
63
66
  FILE_TYPES_IMAGE,
64
67
  FileClient,
68
+ UncachedFileClient,
65
69
  getFileNameFromUrl
66
70
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/files",
3
- "version": "19.54.3-alpha.3+c24f64403",
3
+ "version": "19.55.1-alpha.8+02b3f0ddb",
4
4
  "description": "Uniform Files helpers",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -19,12 +19,15 @@
19
19
  "types": "./dist/index.d.ts",
20
20
  "sideEffects": false,
21
21
  "scripts": {
22
- "build": "tsup",
23
- "dev": "tsup --watch",
22
+ "build": "run-s update-openapi build:ts",
23
+ "build:ts": "tsup",
24
+ "dev": "run-s update-openapi dev:ts",
25
+ "dev:ts": "tsup --watch",
24
26
  "clean": "rimraf dist",
25
27
  "test": "jest --maxWorkers=1 --passWithNoTests",
26
28
  "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
27
- "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
29
+ "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
30
+ "update-openapi": "tsx ./scripts/update-openapi.cts"
28
31
  },
29
32
  "files": [
30
33
  "/dist"
@@ -33,7 +36,7 @@
33
36
  "access": "public"
34
37
  },
35
38
  "dependencies": {
36
- "@uniformdev/context": "19.54.3-alpha.3+c24f64403"
39
+ "@uniformdev/context": "19.55.1-alpha.8+02b3f0ddb"
37
40
  },
38
- "gitHead": "c24f64403ca47e28674e94da9ab1566671f398fc"
41
+ "gitHead": "02b3f0ddb80a99d95d2f69cab42013682d763ca8"
39
42
  }