@supacloud/js 0.30.0 → 0.31.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.
- package/dist/index.d.ts +15 -0
- package/dist/index.js +32 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,21 @@ export type SupaCloudTaskDetail<TResult = unknown> = {
|
|
|
42
42
|
id: string;
|
|
43
43
|
project_ref: string;
|
|
44
44
|
status: SupaCloudTaskStatus | string;
|
|
45
|
+
task_type?: string;
|
|
46
|
+
executor?: {
|
|
47
|
+
kind: string;
|
|
48
|
+
version: string;
|
|
49
|
+
definition: string;
|
|
50
|
+
run_id: string;
|
|
51
|
+
native_status: string;
|
|
52
|
+
};
|
|
53
|
+
capabilities?: {
|
|
54
|
+
cancel: boolean;
|
|
55
|
+
retry: boolean;
|
|
56
|
+
};
|
|
57
|
+
blocked_reason?: string | null;
|
|
58
|
+
total_steps?: number;
|
|
59
|
+
finished_steps?: number;
|
|
45
60
|
function_slug?: string | null;
|
|
46
61
|
function_version?: string | null;
|
|
47
62
|
attempt?: number | null;
|
package/dist/index.js
CHANGED
|
@@ -2639,6 +2639,25 @@ function decodeTaskAttempt(value) {
|
|
|
2639
2639
|
}
|
|
2640
2640
|
function decodeTaskDetail(value) {
|
|
2641
2641
|
const record = responseRecord(value, "task");
|
|
2642
|
+
let executor;
|
|
2643
|
+
let capabilities;
|
|
2644
|
+
if (Object.hasOwn(record, "executor")) {
|
|
2645
|
+
const source = responseRecord(record.executor, "task executor");
|
|
2646
|
+
executor = {
|
|
2647
|
+
kind: taskText(source.kind),
|
|
2648
|
+
version: taskText(source.version),
|
|
2649
|
+
definition: taskText(source.definition),
|
|
2650
|
+
run_id: taskText(source.run_id),
|
|
2651
|
+
native_status: taskText(source.native_status)
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
if (Object.hasOwn(record, "capabilities")) {
|
|
2655
|
+
const source = responseRecord(record.capabilities, "task capabilities");
|
|
2656
|
+
if (typeof source.cancel !== "boolean" || typeof source.retry !== "boolean") {
|
|
2657
|
+
throw new Error("Invalid task capabilities");
|
|
2658
|
+
}
|
|
2659
|
+
capabilities = { cancel: source.cancel, retry: source.retry };
|
|
2660
|
+
}
|
|
2642
2661
|
for (const key of [
|
|
2643
2662
|
"function_slug",
|
|
2644
2663
|
"function_version",
|
|
@@ -2647,7 +2666,8 @@ function decodeTaskDetail(value) {
|
|
|
2647
2666
|
"correlation_id",
|
|
2648
2667
|
"business_task_id",
|
|
2649
2668
|
"updated_at",
|
|
2650
|
-
"created_at"
|
|
2669
|
+
"created_at",
|
|
2670
|
+
"blocked_reason"
|
|
2651
2671
|
]) {
|
|
2652
2672
|
if (Object.hasOwn(record, key))
|
|
2653
2673
|
taskNullable(record[key], taskText);
|
|
@@ -2656,6 +2676,15 @@ function decodeTaskDetail(value) {
|
|
|
2656
2676
|
if (Object.hasOwn(record, key))
|
|
2657
2677
|
taskNullable(record[key], taskNumber);
|
|
2658
2678
|
}
|
|
2679
|
+
if (Object.hasOwn(record, "task_type"))
|
|
2680
|
+
taskText(record.task_type);
|
|
2681
|
+
for (const key of ["total_steps", "finished_steps"]) {
|
|
2682
|
+
if (Object.hasOwn(record, key)) {
|
|
2683
|
+
const count = taskNumber(record[key]);
|
|
2684
|
+
if (!Number.isSafeInteger(count) || count < 0)
|
|
2685
|
+
throw new Error("Invalid task step count");
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2659
2688
|
if (Object.hasOwn(record, "payload"))
|
|
2660
2689
|
responseRecord(record.payload, "task payload");
|
|
2661
2690
|
if (Object.hasOwn(record, "metadata") && record.metadata !== null)
|
|
@@ -2665,6 +2694,8 @@ function decodeTaskDetail(value) {
|
|
|
2665
2694
|
id: responseString(record, "id", "task"),
|
|
2666
2695
|
project_ref: responseString(record, "project_ref", "task"),
|
|
2667
2696
|
status: responseString(record, "status", "task"),
|
|
2697
|
+
...executor === undefined ? {} : { executor },
|
|
2698
|
+
...capabilities === undefined ? {} : { capabilities },
|
|
2668
2699
|
...Object.hasOwn(record, "attempts") ? { attempts: taskArray(record.attempts, decodeTaskAttempt) } : {},
|
|
2669
2700
|
...Object.hasOwn(record, "latest_logs") ? { latest_logs: taskArray(record.latest_logs, decodeTaskLog) } : {}
|
|
2670
2701
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Platform SDK for SupaCloud, built on top of supabase-js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@supabase/supabase-js": "^2.115.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@supacloud/contracts": "0.
|
|
48
|
+
"@supacloud/contracts": "0.4.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/bun": "^1.4.2",
|