@scalemule/sdk 0.0.19 → 0.0.20
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 +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +29 -8
- package/dist/index.mjs +29 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3589,6 +3589,11 @@ declare class PhotoService extends ServiceModule {
|
|
|
3589
3589
|
* Use this when files are uploaded via the storage service (presigned URL)
|
|
3590
3590
|
* instead of the photo service's upload endpoint.
|
|
3591
3591
|
*
|
|
3592
|
+
* If the file scan is still in progress, the server waits briefly (~5s) for it
|
|
3593
|
+
* to complete. In the rare case the scan exceeds that window, the server queues
|
|
3594
|
+
* the registration and returns 202; this method retries automatically until the
|
|
3595
|
+
* photo record is available.
|
|
3596
|
+
*
|
|
3592
3597
|
* Returns the photo record with `id` that can be used with `getTransformUrl()`.
|
|
3593
3598
|
*/
|
|
3594
3599
|
register(registerOptions: {
|
package/dist/index.d.ts
CHANGED
|
@@ -3589,6 +3589,11 @@ declare class PhotoService extends ServiceModule {
|
|
|
3589
3589
|
* Use this when files are uploaded via the storage service (presigned URL)
|
|
3590
3590
|
* instead of the photo service's upload endpoint.
|
|
3591
3591
|
*
|
|
3592
|
+
* If the file scan is still in progress, the server waits briefly (~5s) for it
|
|
3593
|
+
* to complete. In the rare case the scan exceeds that window, the server queues
|
|
3594
|
+
* the registration and returns 202; this method retries automatically until the
|
|
3595
|
+
* photo record is available.
|
|
3596
|
+
*
|
|
3592
3597
|
* Returns the photo record with `id` that can be used with `getTransformUrl()`.
|
|
3593
3598
|
*/
|
|
3594
3599
|
register(registerOptions: {
|
package/dist/index.js
CHANGED
|
@@ -4938,17 +4938,38 @@ var PhotoService = class extends ServiceModule {
|
|
|
4938
4938
|
* Use this when files are uploaded via the storage service (presigned URL)
|
|
4939
4939
|
* instead of the photo service's upload endpoint.
|
|
4940
4940
|
*
|
|
4941
|
+
* If the file scan is still in progress, the server waits briefly (~5s) for it
|
|
4942
|
+
* to complete. In the rare case the scan exceeds that window, the server queues
|
|
4943
|
+
* the registration and returns 202; this method retries automatically until the
|
|
4944
|
+
* photo record is available.
|
|
4945
|
+
*
|
|
4941
4946
|
* Returns the photo record with `id` that can be used with `getTransformUrl()`.
|
|
4942
4947
|
*/
|
|
4943
4948
|
async register(registerOptions, requestOptions) {
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4949
|
+
const body = {
|
|
4950
|
+
file_id: registerOptions.fileId,
|
|
4951
|
+
sm_user_id: registerOptions.userId
|
|
4952
|
+
};
|
|
4953
|
+
const result = await this.post("/register", body, requestOptions);
|
|
4954
|
+
const isPending = (r) => !r.error && r.data && "status" in r.data && r.data.status === "pending_scan";
|
|
4955
|
+
if (!isPending(result)) {
|
|
4956
|
+
return result;
|
|
4957
|
+
}
|
|
4958
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
4959
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
4960
|
+
const retry = await this.post("/register", body, requestOptions);
|
|
4961
|
+
if (!isPending(retry)) {
|
|
4962
|
+
return retry;
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4965
|
+
return {
|
|
4966
|
+
data: null,
|
|
4967
|
+
error: {
|
|
4968
|
+
code: "scan_timeout",
|
|
4969
|
+
message: "File scan did not complete in time. The photo will be registered automatically when the scan finishes.",
|
|
4970
|
+
status: 202
|
|
4971
|
+
}
|
|
4972
|
+
};
|
|
4952
4973
|
}
|
|
4953
4974
|
/** @deprecated Use upload() instead */
|
|
4954
4975
|
async uploadPhoto(file, options) {
|
package/dist/index.mjs
CHANGED
|
@@ -4582,17 +4582,38 @@ var PhotoService = class extends ServiceModule {
|
|
|
4582
4582
|
* Use this when files are uploaded via the storage service (presigned URL)
|
|
4583
4583
|
* instead of the photo service's upload endpoint.
|
|
4584
4584
|
*
|
|
4585
|
+
* If the file scan is still in progress, the server waits briefly (~5s) for it
|
|
4586
|
+
* to complete. In the rare case the scan exceeds that window, the server queues
|
|
4587
|
+
* the registration and returns 202; this method retries automatically until the
|
|
4588
|
+
* photo record is available.
|
|
4589
|
+
*
|
|
4585
4590
|
* Returns the photo record with `id` that can be used with `getTransformUrl()`.
|
|
4586
4591
|
*/
|
|
4587
4592
|
async register(registerOptions, requestOptions) {
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4593
|
+
const body = {
|
|
4594
|
+
file_id: registerOptions.fileId,
|
|
4595
|
+
sm_user_id: registerOptions.userId
|
|
4596
|
+
};
|
|
4597
|
+
const result = await this.post("/register", body, requestOptions);
|
|
4598
|
+
const isPending = (r) => !r.error && r.data && "status" in r.data && r.data.status === "pending_scan";
|
|
4599
|
+
if (!isPending(result)) {
|
|
4600
|
+
return result;
|
|
4601
|
+
}
|
|
4602
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
4603
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
4604
|
+
const retry = await this.post("/register", body, requestOptions);
|
|
4605
|
+
if (!isPending(retry)) {
|
|
4606
|
+
return retry;
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
return {
|
|
4610
|
+
data: null,
|
|
4611
|
+
error: {
|
|
4612
|
+
code: "scan_timeout",
|
|
4613
|
+
message: "File scan did not complete in time. The photo will be registered automatically when the scan finishes.",
|
|
4614
|
+
status: 202
|
|
4615
|
+
}
|
|
4616
|
+
};
|
|
4596
4617
|
}
|
|
4597
4618
|
/** @deprecated Use upload() instead */
|
|
4598
4619
|
async uploadPhoto(file, options) {
|