@manta-eu/upload 0.1.6 → 0.1.7
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/README.md +3 -0
- package/dist/cli.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/upload.d.ts +2 -0
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,6 +18,9 @@ The upload targets hiremanta.com production unless `--api-url`, `--keycloak-url`
|
|
|
18
18
|
|
|
19
19
|
For each file the CLI prints the file's IRI, its media type and its size.
|
|
20
20
|
|
|
21
|
+
`--bundle` stores the files without ingesting them, for files that are loaded together as a
|
|
22
|
+
bundle.
|
|
23
|
+
|
|
21
24
|
## Log in
|
|
22
25
|
|
|
23
26
|
Login works as it does for `manta-codegen`: both CLIs register the same commands from
|
package/dist/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ async function upload(paths, options) {
|
|
|
23
23
|
// A failed file does not stop the rest of the batch; the exit code reports it at the end.
|
|
24
24
|
for (const path of paths) {
|
|
25
25
|
try {
|
|
26
|
-
const uploaded = await uploadFile({ path, graphql });
|
|
26
|
+
const uploaded = await uploadFile({ path, graphql, purpose: options.bundle ? "BUNDLE" : "FILE" });
|
|
27
27
|
console.error(`manta-upload: ${path} -> ${uploaded.fileIri} (${uploaded.mediaType}, ${uploaded.byteSize} bytes)`);
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
@@ -51,6 +51,7 @@ program
|
|
|
51
51
|
.option("--client-id <id>", clientIdHelp)
|
|
52
52
|
.option("--scope <scope>", "scope to ask a service account token for")
|
|
53
53
|
.option("--use-device-code", "if a login is needed, use a one-time code instead of a browser redirect")
|
|
54
|
+
.option("--bundle", "keep the files for loading with a bundle instead of ingesting them")
|
|
54
55
|
.action(async (paths, options) => {
|
|
55
56
|
try {
|
|
56
57
|
await upload(paths, options);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { graphqlClient, graphqlEndpoint, type GraphqlClient } from "./graphql.js";
|
|
2
|
-
export { readFully, uploadFile, uploadPartSize, type PartReader, type Sleep, type UploadedFile } from "./upload.js";
|
|
2
|
+
export { readFully, uploadFile, uploadPartSize, type PartReader, type Sleep, type UploadedFile, type UploadPurpose, } from "./upload.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { graphqlClient, graphqlEndpoint } from "./graphql.js";
|
|
2
|
-
export { readFully, uploadFile, uploadPartSize } from "./upload.js";
|
|
2
|
+
export { readFully, uploadFile, uploadPartSize, } from "./upload.js";
|
package/dist/upload.d.ts
CHANGED
|
@@ -14,9 +14,11 @@ export type PartReader = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare function readFully(file: PartReader, start: number, length: number): Promise<Uint8Array>;
|
|
16
16
|
export type Sleep = (ms: number) => Promise<void>;
|
|
17
|
+
export type UploadPurpose = "FILE" | "BUNDLE";
|
|
17
18
|
export declare function uploadFile(options: {
|
|
18
19
|
path: string;
|
|
19
20
|
graphql: GraphqlClient;
|
|
21
|
+
purpose?: UploadPurpose;
|
|
20
22
|
fetchImpl?: FetchLike;
|
|
21
23
|
sleep?: Sleep;
|
|
22
24
|
}): Promise<UploadedFile>;
|
package/dist/upload.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAInE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,eAAO,MAAM,cAAc,QAAkB,CAAC;AAoB9C,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExG,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5G,CAAC;AAGF,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAapG;AAED,MAAM,MAAM,KAAK,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAInE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,eAAO,MAAM,cAAc,QAAkB,CAAC;AAoB9C,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExG,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5G,CAAC;AAGF,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAapG;AAED,MAAM,MAAM,KAAK,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAgDlD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAG9C,wBAAsB,UAAU,CAAC,OAAO,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,GAAG,OAAO,CAAC,YAAY,CAAC,CASxB"}
|
package/dist/upload.js
CHANGED
|
@@ -74,11 +74,11 @@ export async function uploadFile(options) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
async function uploadHandle(file, options) {
|
|
77
|
-
const { path, fileName, graphql, fetchImpl = fetch, sleep = sleepFor } = options;
|
|
77
|
+
const { path, fileName, graphql, purpose = "FILE", fetchImpl = fetch, sleep = sleepFor } = options;
|
|
78
78
|
const byteSize = (await file.stat()).size;
|
|
79
79
|
if (byteSize === 0)
|
|
80
80
|
throw new Error(`${path} is empty`);
|
|
81
|
-
const { initiateUpload } = await graphql(initiateMutation, { input: { fileName, byteSize } });
|
|
81
|
+
const { initiateUpload } = await graphql(initiateMutation, { input: { fileName, byteSize, purpose } });
|
|
82
82
|
const { uploadId, storageKey, partUrls } = initiateUpload;
|
|
83
83
|
try {
|
|
84
84
|
if (partUrls.length !== Math.ceil(byteSize / uploadPartSize)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manta-eu/upload",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "CLI that uploads files to a Manta datastore, where supported types are ingested into its knowledge graph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"commander": "^15.0.0",
|
|
19
|
-
"@manta-eu/auth": "0.1.
|
|
19
|
+
"@manta-eu/auth": "0.1.7"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^24.13.3",
|