@docbox-nz/hapi-gateway 0.2.1 → 0.3.1
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/.github/workflows/build.yml +33 -0
- package/.github/workflows/release.yml +37 -0
- package/.oxfmtrc.json +8 -0
- package/.oxlintrc.json +11 -0
- package/.zed/settings.json +10 -0
- package/README.md +32 -38
- package/cspell.json +1 -4
- package/dist/index.node.cjs +15319 -24159
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.esm.js +15259 -24104
- package/dist/index.node.esm.js.map +1 -1
- package/package.json +20 -30
- package/rolldown.config.js +19 -0
- package/src/index.ts +257 -257
- package/tsconfig.json +15 -15
- package/.eslintignore +0 -6
- package/.eslintrc +0 -131
- package/.prettierignore +0 -11
- package/.prettierrc +0 -6
- package/dist/api/adminService.d.ts +0 -16
- package/dist/api/boxService.d.ts +0 -43
- package/dist/api/client.d.ts +0 -45
- package/dist/api/docboxFile.d.ts +0 -15
- package/dist/api/fileService.d.ts +0 -251
- package/dist/api/folderService.d.ts +0 -45
- package/dist/api/linkService.d.ts +0 -115
- package/dist/api/taskService.d.ts +0 -23
- package/dist/api/utils.d.ts +0 -1
- package/dist/error.d.ts +0 -11
- package/dist/index.browser.cjs +0 -988
- package/dist/index.browser.cjs.map +0 -1
- package/dist/index.browser.esm.js +0 -984
- package/dist/index.browser.esm.js.map +0 -1
- package/dist/index.browser.js +0 -4390
- package/dist/index.browser.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.node.js +0 -20809
- package/dist/index.node.js.map +0 -1
- package/dist/options.d.ts +0 -85
- package/dist/types/box.d.ts +0 -59
- package/dist/types/file.d.ts +0 -371
- package/dist/types/folder.d.ts +0 -153
- package/dist/types/index.d.ts +0 -22
- package/dist/types/link.d.ts +0 -136
- package/dist/types/search.d.ts +0 -177
- package/dist/types/shared.d.ts +0 -94
- package/dist/types/user.d.ts +0 -20
- package/rollup.config.js +0 -36
package/dist/types/link.d.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { EditHistoryMetadataLinkValue, EditHistoryMetadataMoveToFolder, EditHistoryMetadataRename, EditHistoryType, FolderId, ISODate, LinkId } from './shared';
|
|
2
|
-
import { User } from './user';
|
|
3
|
-
/**
|
|
4
|
-
* Link stored within docbox
|
|
5
|
-
*/
|
|
6
|
-
export interface DocLink {
|
|
7
|
-
/**
|
|
8
|
-
* Unique ID of the link
|
|
9
|
-
*/
|
|
10
|
-
id: LinkId;
|
|
11
|
-
/**
|
|
12
|
-
* Name of the link
|
|
13
|
-
*/
|
|
14
|
-
name: string;
|
|
15
|
-
/**
|
|
16
|
-
* URL value of the link
|
|
17
|
-
*/
|
|
18
|
-
value: string;
|
|
19
|
-
/**
|
|
20
|
-
* ID of the folder this link is stored within.
|
|
21
|
-
*/
|
|
22
|
-
folder_id: FolderId;
|
|
23
|
-
/**
|
|
24
|
-
* Timestamp of when the link was created
|
|
25
|
-
*/
|
|
26
|
-
created_at: ISODate;
|
|
27
|
-
/**
|
|
28
|
-
* User who created the link if the user was known
|
|
29
|
-
* at the point of creation
|
|
30
|
-
*/
|
|
31
|
-
created_by: User | null;
|
|
32
|
-
/**
|
|
33
|
-
* Timestamp of when the link was last modified
|
|
34
|
-
*/
|
|
35
|
-
last_modified_at: ISODate | null;
|
|
36
|
-
/**
|
|
37
|
-
* User who last modified the link if the user was
|
|
38
|
-
* known at the point of modification
|
|
39
|
-
*
|
|
40
|
-
* NOTE: This is the user for the most recent modification, not the
|
|
41
|
-
* most recent modification with a user
|
|
42
|
-
*/
|
|
43
|
-
last_modified_by: User | null;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Entry within an edit history for a file
|
|
47
|
-
*/
|
|
48
|
-
export interface DocLinkEditHistoryBase {
|
|
49
|
-
/**
|
|
50
|
-
* ID of the specific entry
|
|
51
|
-
*/
|
|
52
|
-
id: string;
|
|
53
|
-
/**
|
|
54
|
-
* ID of the link the edit history belongs to
|
|
55
|
-
*/
|
|
56
|
-
link_id: LinkId;
|
|
57
|
-
/**
|
|
58
|
-
* User who performed the edit, if available at the
|
|
59
|
-
* time of the edit
|
|
60
|
-
*/
|
|
61
|
-
user: User | null;
|
|
62
|
-
/**
|
|
63
|
-
* Timestamp the edit was performed at
|
|
64
|
-
*/
|
|
65
|
-
created_at: ISODate;
|
|
66
|
-
}
|
|
67
|
-
export type DocLinkEditHistoryData = {
|
|
68
|
-
type: EditHistoryType.MoveToFolder;
|
|
69
|
-
metadata: EditHistoryMetadataMoveToFolder;
|
|
70
|
-
} | {
|
|
71
|
-
type: EditHistoryType.Rename;
|
|
72
|
-
metadata: EditHistoryMetadataRename;
|
|
73
|
-
} | {
|
|
74
|
-
type: EditHistoryType.LinkValue;
|
|
75
|
-
metadata: EditHistoryMetadataLinkValue;
|
|
76
|
-
};
|
|
77
|
-
export type DocLinkEditHistory = DocLinkEditHistoryBase & DocLinkEditHistoryData;
|
|
78
|
-
/**
|
|
79
|
-
* Metadata resolved from looking up a website
|
|
80
|
-
*/
|
|
81
|
-
export interface LinkMetadata {
|
|
82
|
-
/**
|
|
83
|
-
* Website <title/> tag contents if available
|
|
84
|
-
*/
|
|
85
|
-
title: string | null;
|
|
86
|
-
/**
|
|
87
|
-
* OGP metadata title if available
|
|
88
|
-
*/
|
|
89
|
-
og_title: string | null;
|
|
90
|
-
/**
|
|
91
|
-
* OGP metadata description if available
|
|
92
|
-
*/
|
|
93
|
-
og_description: string | null;
|
|
94
|
-
/**
|
|
95
|
-
* Whether a favicon was determined to be available
|
|
96
|
-
*/
|
|
97
|
-
favicon: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Whether an OGP image was determined to be available
|
|
100
|
-
*/
|
|
101
|
-
image: boolean;
|
|
102
|
-
}
|
|
103
|
-
export interface CreateLink {
|
|
104
|
-
/**
|
|
105
|
-
* Name of the link
|
|
106
|
-
*/
|
|
107
|
-
name: string;
|
|
108
|
-
/**
|
|
109
|
-
* URL value of the link
|
|
110
|
-
*/
|
|
111
|
-
value: string;
|
|
112
|
-
/**
|
|
113
|
-
* ID of the folder to create the link within
|
|
114
|
-
*/
|
|
115
|
-
folder_id: FolderId;
|
|
116
|
-
}
|
|
117
|
-
export interface UpdateLink {
|
|
118
|
-
/**
|
|
119
|
-
* Optional new name of the link.
|
|
120
|
-
*
|
|
121
|
-
* leave undefined or specify null to not update this field
|
|
122
|
-
*/
|
|
123
|
-
name?: string | null;
|
|
124
|
-
/**
|
|
125
|
-
* Optional new folder to move the link to.
|
|
126
|
-
*
|
|
127
|
-
* leave undefined or specify null to not update this field
|
|
128
|
-
*/
|
|
129
|
-
folder_id?: FolderId | null;
|
|
130
|
-
/**
|
|
131
|
-
* Optional new URL value for the link
|
|
132
|
-
*
|
|
133
|
-
* leave undefined or specify null to not update this field
|
|
134
|
-
*/
|
|
135
|
-
value?: string | null;
|
|
136
|
-
}
|
package/dist/types/search.d.ts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { DocFile } from './file';
|
|
2
|
-
import { DocFolder, FolderPathSegment } from './folder';
|
|
3
|
-
import { DocLink } from './link';
|
|
4
|
-
import { DocboxItemId, DocumentBoxScope, FolderId, UserId } from './shared';
|
|
5
|
-
/**
|
|
6
|
-
* Possible search result item types
|
|
7
|
-
*/
|
|
8
|
-
export declare enum SearchResultItemType {
|
|
9
|
-
FILE = "File",
|
|
10
|
-
FOLDER = "Folder",
|
|
11
|
-
LINK = "Link"
|
|
12
|
-
}
|
|
13
|
-
export type DocboxSearchResultData = ({
|
|
14
|
-
type: SearchResultItemType.FILE;
|
|
15
|
-
} & DocFile) | ({
|
|
16
|
-
type: SearchResultItemType.FOLDER;
|
|
17
|
-
} & DocFolder) | ({
|
|
18
|
-
type: SearchResultItemType.LINK;
|
|
19
|
-
} & DocLink);
|
|
20
|
-
export type DocboxSearchResult = {
|
|
21
|
-
/**
|
|
22
|
-
* Score the search result obtained
|
|
23
|
-
*/
|
|
24
|
-
score: number;
|
|
25
|
-
/**
|
|
26
|
-
* Matches within pages of the content
|
|
27
|
-
*/
|
|
28
|
-
page_matches: PageMatch[];
|
|
29
|
-
/**
|
|
30
|
-
* Resolved path to the item
|
|
31
|
-
*/
|
|
32
|
-
path: FolderPathSegment[];
|
|
33
|
-
/**
|
|
34
|
-
* Total number of search "hits"
|
|
35
|
-
*/
|
|
36
|
-
total_hits: number;
|
|
37
|
-
} & DocboxSearchResultData;
|
|
38
|
-
export type DocboxSearchResultAdmin = DocboxSearchResult & {
|
|
39
|
-
scope: DocumentBoxScope;
|
|
40
|
-
};
|
|
41
|
-
export interface DocboxSearchResponse {
|
|
42
|
-
/**
|
|
43
|
-
* Total number of hits
|
|
44
|
-
*/
|
|
45
|
-
total_hits: number;
|
|
46
|
-
/**
|
|
47
|
-
* Results from the search
|
|
48
|
-
*/
|
|
49
|
-
results: DocboxSearchResult[];
|
|
50
|
-
}
|
|
51
|
-
export interface DocboxFileSearchResponse {
|
|
52
|
-
/**
|
|
53
|
-
* Total number of hits
|
|
54
|
-
*/
|
|
55
|
-
total_hits: number;
|
|
56
|
-
/**
|
|
57
|
-
* Results from the search
|
|
58
|
-
*/
|
|
59
|
-
results: PageMatch[];
|
|
60
|
-
}
|
|
61
|
-
export interface DocboxSearchResponseAdmin {
|
|
62
|
-
/**
|
|
63
|
-
* Total number of hits
|
|
64
|
-
*/
|
|
65
|
-
total_hits: number;
|
|
66
|
-
/**
|
|
67
|
-
* Results from the search
|
|
68
|
-
*/
|
|
69
|
-
results: DocboxSearchResultAdmin[];
|
|
70
|
-
}
|
|
71
|
-
export interface PageMatch {
|
|
72
|
-
/**
|
|
73
|
-
* Page number
|
|
74
|
-
*/
|
|
75
|
-
page: number;
|
|
76
|
-
/**
|
|
77
|
-
* Matched content results
|
|
78
|
-
*/
|
|
79
|
-
matches: string[];
|
|
80
|
-
}
|
|
81
|
-
export type DocboxAdminSearchRequest = DocboxSearchRequest & {
|
|
82
|
-
scopes: DocumentBoxScope[];
|
|
83
|
-
};
|
|
84
|
-
export interface DocboxFileSearchRequest {
|
|
85
|
-
/**
|
|
86
|
-
* Search query to search for
|
|
87
|
-
*/
|
|
88
|
-
query?: string | null;
|
|
89
|
-
/**
|
|
90
|
-
* Number of results to skip
|
|
91
|
-
*/
|
|
92
|
-
offset?: number;
|
|
93
|
-
/**
|
|
94
|
-
* Maximum number of results to return
|
|
95
|
-
*/
|
|
96
|
-
limit?: number;
|
|
97
|
-
}
|
|
98
|
-
export interface DocboxSearchRequest {
|
|
99
|
-
/**
|
|
100
|
-
* Search query to search for
|
|
101
|
-
*/
|
|
102
|
-
query?: string | null;
|
|
103
|
-
/**
|
|
104
|
-
* Whether to use neural searching
|
|
105
|
-
*/
|
|
106
|
-
neural?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Mime type to filter search by
|
|
109
|
-
*/
|
|
110
|
-
mime?: string | null;
|
|
111
|
-
/**
|
|
112
|
-
* Whether to include the item name when searching
|
|
113
|
-
*/
|
|
114
|
-
include_name?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Whether to perform full text search over the contents
|
|
117
|
-
* of files, links, ...etc
|
|
118
|
-
*/
|
|
119
|
-
include_content?: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Filter to a specific created at range
|
|
122
|
-
*/
|
|
123
|
-
created_at?: DateRange | null;
|
|
124
|
-
/**
|
|
125
|
-
* Filter to a specific date modified range
|
|
126
|
-
*/
|
|
127
|
-
modified?: DateRange | null;
|
|
128
|
-
/**
|
|
129
|
-
* Filter to a specific user who created
|
|
130
|
-
*/
|
|
131
|
-
created_by?: UserId | null;
|
|
132
|
-
/**
|
|
133
|
-
* Filter to only results within the children of a specific
|
|
134
|
-
* folder by ID
|
|
135
|
-
*/
|
|
136
|
-
folder_id?: FolderId | null;
|
|
137
|
-
/**
|
|
138
|
-
* Filter results to only results for a specific item
|
|
139
|
-
*
|
|
140
|
-
* (i.e searching full text within a specific file)
|
|
141
|
-
*
|
|
142
|
-
* @deprecated Use dedicated file search API instead
|
|
143
|
-
*/
|
|
144
|
-
item_id?: DocboxItemId | null;
|
|
145
|
-
/**
|
|
146
|
-
* Number of results to obtain
|
|
147
|
-
*/
|
|
148
|
-
size?: number;
|
|
149
|
-
/**
|
|
150
|
-
* Number of results to skip
|
|
151
|
-
*/
|
|
152
|
-
offset?: number;
|
|
153
|
-
/**
|
|
154
|
-
* Number of pages of content results to obtain
|
|
155
|
-
*/
|
|
156
|
-
max_pages?: number;
|
|
157
|
-
/**
|
|
158
|
-
* Number of pages of content results to skip
|
|
159
|
-
*
|
|
160
|
-
* @deprecated Use dedicated file search API instead
|
|
161
|
-
*/
|
|
162
|
-
pages_offset?: number;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Searchable date range, must have either a start
|
|
166
|
-
* or end date or both, cannot be both null
|
|
167
|
-
*/
|
|
168
|
-
export interface DateRange {
|
|
169
|
-
/**
|
|
170
|
-
* Start date, leave undefined/null for the beginning of time
|
|
171
|
-
*/
|
|
172
|
-
start?: string | null;
|
|
173
|
-
/**
|
|
174
|
-
* End date, leave undefined/null for the end of time
|
|
175
|
-
*/
|
|
176
|
-
end?: string | null;
|
|
177
|
-
}
|
package/dist/types/shared.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Alias of a string representing a user ID
|
|
3
|
-
*/
|
|
4
|
-
export type UserId = string;
|
|
5
|
-
/**
|
|
6
|
-
* Alias of a string representing a tenant ID
|
|
7
|
-
*/
|
|
8
|
-
export type TenantId = string;
|
|
9
|
-
/**
|
|
10
|
-
* Alias of a string representing a file ID
|
|
11
|
-
*/
|
|
12
|
-
export type FileId = string;
|
|
13
|
-
/**
|
|
14
|
-
* Alias of a string representing a generated file ID
|
|
15
|
-
*/
|
|
16
|
-
export type GeneratedFileId = string;
|
|
17
|
-
/**
|
|
18
|
-
* Alias of a string representing a folder ID
|
|
19
|
-
*/
|
|
20
|
-
export type FolderId = string;
|
|
21
|
-
/**
|
|
22
|
-
* Alias of a string representing a link ID
|
|
23
|
-
*/
|
|
24
|
-
export type LinkId = string;
|
|
25
|
-
/**
|
|
26
|
-
* Alias of a string representing a document box scope
|
|
27
|
-
*/
|
|
28
|
-
export type DocumentBoxScope = string;
|
|
29
|
-
/**
|
|
30
|
-
* Alias of any docbox item ID (File, Folder, Link)
|
|
31
|
-
*/
|
|
32
|
-
export type DocboxItemId = FileId | FolderId | LinkId;
|
|
33
|
-
/**
|
|
34
|
-
* Alias for a string representing a ISO date
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* This can be turned into a date using;
|
|
38
|
-
* ```
|
|
39
|
-
* const date = new Date(value);
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export type ISODate = string;
|
|
43
|
-
export declare enum EditHistoryType {
|
|
44
|
-
MoveToFolder = "MoveToFolder",
|
|
45
|
-
Rename = "Rename",
|
|
46
|
-
LinkValue = "LinkValue"
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Edit history metadata for moving something from
|
|
50
|
-
* one folder to another
|
|
51
|
-
*
|
|
52
|
-
* Can be seen on: Files, Folders, and Links
|
|
53
|
-
*/
|
|
54
|
-
export interface EditHistoryMetadataMoveToFolder {
|
|
55
|
-
/**
|
|
56
|
-
* ID of the original folder before moving
|
|
57
|
-
*/
|
|
58
|
-
original_id: string;
|
|
59
|
-
/**
|
|
60
|
-
* ID of the folder after moving
|
|
61
|
-
*/
|
|
62
|
-
target_id: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Edit history metadata for renaming something
|
|
66
|
-
*
|
|
67
|
-
* Can be seen on: Files, Folders, and Links
|
|
68
|
-
*/
|
|
69
|
-
export interface EditHistoryMetadataRename {
|
|
70
|
-
/**
|
|
71
|
-
* Name of the file before renaming
|
|
72
|
-
*/
|
|
73
|
-
original_name: string;
|
|
74
|
-
/**
|
|
75
|
-
* Name of the file after renaming
|
|
76
|
-
*/
|
|
77
|
-
new_name: string;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Edit history metadata for changing the value of
|
|
81
|
-
* a link
|
|
82
|
-
*
|
|
83
|
-
* Can be seen on: Link
|
|
84
|
-
*/
|
|
85
|
-
export interface EditHistoryMetadataLinkValue {
|
|
86
|
-
/**
|
|
87
|
-
* Previous URL value of the link
|
|
88
|
-
*/
|
|
89
|
-
previous_value: string;
|
|
90
|
-
/**
|
|
91
|
-
* New URL value of the link
|
|
92
|
-
*/
|
|
93
|
-
new_value: string;
|
|
94
|
-
}
|
package/dist/types/user.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { UserId } from './shared';
|
|
2
|
-
/**
|
|
3
|
-
* User within the docbox database
|
|
4
|
-
*/
|
|
5
|
-
export interface User {
|
|
6
|
-
/**
|
|
7
|
-
* ID of the user
|
|
8
|
-
*/
|
|
9
|
-
id: UserId;
|
|
10
|
-
/**
|
|
11
|
-
* Name of the user if this is known
|
|
12
|
-
* (Based on the last modification performed)
|
|
13
|
-
*/
|
|
14
|
-
name: string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Image ID of the user if this is known
|
|
17
|
-
* (Based on the last modification performed)
|
|
18
|
-
*/
|
|
19
|
-
image_id: string | null;
|
|
20
|
-
}
|
package/rollup.config.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import typescript from 'rollup-plugin-typescript2';
|
|
2
|
-
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
3
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
4
|
-
import json from '@rollup/plugin-json';
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
// Node builds
|
|
8
|
-
{
|
|
9
|
-
external: ['@hapi/hapi'],
|
|
10
|
-
input: 'src/index.ts',
|
|
11
|
-
output: [
|
|
12
|
-
{
|
|
13
|
-
file: 'dist/index.node.cjs',
|
|
14
|
-
format: 'cjs',
|
|
15
|
-
sourcemap: true
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
file: 'dist/index.node.esm.js',
|
|
19
|
-
format: 'esm',
|
|
20
|
-
sourcemap: true
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
plugins: [
|
|
24
|
-
json(),
|
|
25
|
-
nodeResolve({
|
|
26
|
-
browser: false,
|
|
27
|
-
preferBuiltins: true
|
|
28
|
-
}),
|
|
29
|
-
commonjs(),
|
|
30
|
-
typescript({
|
|
31
|
-
tsconfig: './tsconfig.json'
|
|
32
|
-
}),
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
];
|