Skip to content

Commit a73fbf3

Browse files
authored
release: 2.16.1 #77
release: 2.16.1
2 parents 0198c52 + 7226291 commit a73fbf3

12 files changed

Lines changed: 209 additions & 71 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Sync release to main
2+
3+
on:
4+
workflow_run:
5+
workflows: [Release]
6+
types: [completed]
7+
branches: [release]
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
sync:
15+
if: github.event.workflow_run.conclusion == 'success'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Check if release is ahead of main
23+
id: check
24+
run: |
25+
git fetch origin main release
26+
AHEAD=$(git rev-list --count origin/main..origin/release)
27+
echo "ahead=$AHEAD" >> $GITHUB_OUTPUT
28+
29+
- name: Create sync PR
30+
if: steps.check.outputs.ahead != '0'
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: |
34+
EXISTING=$(gh pr list --repo ${{ github.repository }} --base main --head release --state open --json number --jq '.[0].number')
35+
if [ -n "$EXISTING" ]; then
36+
echo "Sync PR #$EXISTING already exists"
37+
else
38+
gh pr create \
39+
--repo ${{ github.repository }} \
40+
--base main \
41+
--head release \
42+
--title "chore: sync release to main" \
43+
--body "Automated sync of release tags back to main."
44+
fi
45+
46+
- name: Auto-merge sync PR
47+
if: steps.check.outputs.ahead != '0'
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
PR=$(gh pr list --repo ${{ github.repository }} --base main --head release --state open --json number --jq '.[0].number')
52+
if [ -n "$PR" ]; then
53+
gh pr merge "$PR" --repo ${{ github.repository }} --merge
54+
fi

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@aws-sdk/credential-providers": "^3.1024.0",
9494
"@smithy/shared-ini-file-loader": "^4.4.7",
9595
"@tigrisdata/iam": "^1.4.1",
96-
"@tigrisdata/storage": "^2.16.2",
96+
"@tigrisdata/storage": "^3.0.0",
9797
"commander": "^14.0.3",
9898
"enquirer": "^2.4.1",
9999
"jose": "^6.2.2",

src/lib/access-keys/list.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getIAMConfig } from '@auth/iam.js';
22
import { listAccessKeys } from '@tigrisdata/iam';
33
import { failWithError } from '@utils/exit.js';
4-
import { formatOutput, formatPaginatedOutput } from '@utils/format.js';
4+
import { formatPaginatedOutput } from '@utils/format.js';
55
import {
66
msg,
77
printEmpty,
@@ -17,7 +17,7 @@ export default async function list(options: Record<string, unknown>) {
1717
printStart(context);
1818

1919
const format = getFormat(options);
20-
const { limit, pageToken, isPaginated } = getPaginationOptions(options);
20+
const { limit, pageToken } = getPaginationOptions(options);
2121

2222
const config = await getIAMConfig(context);
2323

@@ -52,15 +52,13 @@ export default async function list(options: Record<string, unknown>) {
5252

5353
const nextToken = data.paginationToken || undefined;
5454

55-
const output = isPaginated
56-
? formatPaginatedOutput(keys, format!, 'keys', 'key', columns, {
57-
paginationToken: nextToken,
58-
})
59-
: formatOutput(keys, format!, 'keys', 'key', columns);
55+
const output = formatPaginatedOutput(keys, format!, 'keys', 'key', columns, {
56+
paginationToken: nextToken,
57+
});
6058

6159
console.log(output);
6260

63-
if (isPaginated && format !== 'json' && format !== 'xml') {
61+
if (format !== 'json' && format !== 'xml') {
6462
printPaginationHint(nextToken);
6563
}
6664

src/lib/buckets/list.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default async function list(options: Record<string, unknown>) {
2828
}
2929

3030
const { data, error } = await listBuckets({
31-
...(forksOf || !isPaginated
31+
...(forksOf
3232
? {}
3333
: {
3434
...(limit !== undefined ? { limit } : {}),
@@ -57,7 +57,7 @@ export default async function list(options: Record<string, unknown>) {
5757
failWithError(context, infoError);
5858
}
5959

60-
if (!bucketInfo.hasForks) {
60+
if (!bucketInfo.forkInfo?.hasChildren) {
6161
printEmpty(context);
6262
return;
6363
}
@@ -67,7 +67,10 @@ export default async function list(options: Record<string, unknown>) {
6767
for (const bucket of data.buckets) {
6868
if (bucket.name === forksOf) continue;
6969
const { data: info } = await getBucketInfo(bucket.name, { config });
70-
if (info?.sourceBucketName === forksOf) {
70+
const isChildOf = info?.forkInfo?.parents?.some(
71+
(p) => p.bucketName === forksOf
72+
);
73+
if (isChildOf) {
7174
forks.push({ name: bucket.name, created: bucket.creationDate });
7275
}
7376
}
@@ -99,15 +102,18 @@ export default async function list(options: Record<string, unknown>) {
99102

100103
const nextToken = data.paginationToken || undefined;
101104

102-
const output = isPaginated
103-
? formatPaginatedOutput(buckets, format!, 'buckets', 'bucket', columns, {
104-
paginationToken: nextToken,
105-
})
106-
: formatOutput(buckets, format!, 'buckets', 'bucket', columns);
105+
const output = formatPaginatedOutput(
106+
buckets,
107+
format!,
108+
'buckets',
109+
'bucket',
110+
columns,
111+
{ paginationToken: nextToken }
112+
);
107113

108114
console.log(output);
109115

110-
if (isPaginated && format !== 'json' && format !== 'xml') {
116+
if (format !== 'json' && format !== 'xml') {
111117
printPaginationHint(nextToken);
112118
}
113119

src/lib/forks/list.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default async function list(options: Record<string, unknown>) {
2828
failWithError(context, infoError);
2929
}
3030

31-
if (!bucketInfo.hasForks) {
31+
if (!bucketInfo.forkInfo?.hasChildren) {
3232
printEmpty(context);
3333
return;
3434
}
@@ -47,7 +47,10 @@ export default async function list(options: Record<string, unknown>) {
4747
if (bucket.name === name) continue;
4848

4949
const { data: info } = await getBucketInfo(bucket.name, { config });
50-
if (info?.sourceBucketName === name) {
50+
const isChildOf = info?.forkInfo?.parents?.some(
51+
(p) => p.bucketName === name
52+
);
53+
if (isChildOf) {
5154
forks.push({
5255
name: bucket.name,
5356
created: bucket.creationDate,

src/lib/iam/policies/list.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getOAuthIAMConfig } from '@auth/iam.js';
22
import { listPolicies } from '@tigrisdata/iam';
33
import { failWithError } from '@utils/exit.js';
4-
import { formatOutput, formatPaginatedOutput } from '@utils/format.js';
4+
import { formatPaginatedOutput } from '@utils/format.js';
55
import {
66
msg,
77
printEmpty,
@@ -17,7 +17,7 @@ export default async function list(options: Record<string, unknown>) {
1717
printStart(context);
1818

1919
const format = getFormat(options);
20-
const { limit, pageToken, isPaginated } = getPaginationOptions(options);
20+
const { limit, pageToken } = getPaginationOptions(options);
2121

2222
const iamConfig = await getOAuthIAMConfig(context);
2323

@@ -62,15 +62,18 @@ export default async function list(options: Record<string, unknown>) {
6262

6363
const nextToken = data.paginationToken || undefined;
6464

65-
const output = isPaginated
66-
? formatPaginatedOutput(policies, format!, 'policies', 'policy', columns, {
67-
paginationToken: nextToken,
68-
})
69-
: formatOutput(policies, format!, 'policies', 'policy', columns);
65+
const output = formatPaginatedOutput(
66+
policies,
67+
format!,
68+
'policies',
69+
'policy',
70+
columns,
71+
{ paginationToken: nextToken }
72+
);
7073

7174
console.log(output);
7275

73-
if (isPaginated && format !== 'json' && format !== 'xml') {
76+
if (format !== 'json' && format !== 'xml') {
7477
printPaginationHint(nextToken);
7578
}
7679

src/lib/ls.ts

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { getStorageConfig } from '@auth/provider.js';
22
import { list, listBuckets } from '@tigrisdata/storage';
33
import { exitWithError } from '@utils/exit.js';
4-
import { formatOutput, formatSize } from '@utils/format.js';
5-
import { getFormat, getOption } from '@utils/options.js';
4+
import { formatPaginatedOutput, formatSize } from '@utils/format.js';
5+
import { printPaginationHint } from '@utils/messages.js';
6+
import { getFormat, getOption, getPaginationOptions } from '@utils/options.js';
67
import { parseAnyPath } from '@utils/path.js';
78

89
export default async function ls(options: Record<string, unknown>) {
@@ -13,11 +14,16 @@ export default async function ls(options: Record<string, unknown>) {
1314
'snapshot',
1415
]);
1516
const format = getFormat(options);
17+
const { limit, pageToken } = getPaginationOptions(options);
1618

1719
if (!pathString) {
1820
// No path provided, list all buckets
1921
const config = await getStorageConfig();
20-
const { data, error } = await listBuckets({ config });
22+
const { data, error } = await listBuckets({
23+
...(limit !== undefined ? { limit } : {}),
24+
...(pageToken ? { paginationToken: pageToken } : {}),
25+
config,
26+
});
2127

2228
if (error) {
2329
exitWithError(error);
@@ -28,12 +34,28 @@ export default async function ls(options: Record<string, unknown>) {
2834
created: bucket.creationDate,
2935
}));
3036

31-
const output = formatOutput(buckets, format!, 'buckets', 'bucket', [
37+
const columns = [
3238
{ key: 'name', header: 'Name' },
3339
{ key: 'created', header: 'Created' },
34-
]);
40+
];
41+
42+
const nextToken = data.paginationToken || undefined;
43+
44+
const output = formatPaginatedOutput(
45+
buckets,
46+
format!,
47+
'buckets',
48+
'bucket',
49+
columns,
50+
{ paginationToken: nextToken }
51+
);
3552

3653
console.log(output);
54+
55+
if (format !== 'json' && format !== 'xml') {
56+
printPaginationHint(nextToken);
57+
}
58+
3759
return;
3860
}
3961

@@ -51,6 +73,8 @@ export default async function ls(options: Record<string, unknown>) {
5173
const { data, error } = await list({
5274
prefix,
5375
...(snapshotVersion ? { snapshotVersion } : {}),
76+
...(limit !== undefined ? { limit } : {}),
77+
...(pageToken ? { paginationToken: pageToken } : {}),
5478
config: {
5579
...config,
5680
bucket,
@@ -84,11 +108,26 @@ export default async function ls(options: Record<string, unknown>) {
84108
item.key !== '' && arr.findIndex((i) => i.key === item.key) === index
85109
);
86110

87-
const output = formatOutput(objects, format!, 'objects', 'object', [
111+
const columns = [
88112
{ key: 'key', header: 'Key' },
89113
{ key: 'size', header: 'Size' },
90114
{ key: 'modified', header: 'Modified' },
91-
]);
115+
];
116+
117+
const nextToken = data.paginationToken || undefined;
118+
119+
const output = formatPaginatedOutput(
120+
objects,
121+
format!,
122+
'objects',
123+
'object',
124+
columns,
125+
{ paginationToken: nextToken }
126+
);
92127

93128
console.log(output);
129+
130+
if (format !== 'json' && format !== 'xml') {
131+
printPaginationHint(nextToken);
132+
}
94133
}

src/lib/objects/list.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { getStorageConfig } from '@auth/provider.js';
22
import { list } from '@tigrisdata/storage';
33
import { failWithError } from '@utils/exit.js';
4-
import {
5-
formatOutput,
6-
formatPaginatedOutput,
7-
formatSize,
8-
} from '@utils/format.js';
4+
import { formatPaginatedOutput, formatSize } from '@utils/format.js';
95
import {
106
msg,
117
printEmpty,
@@ -29,7 +25,7 @@ export default async function listObjects(options: Record<string, unknown>) {
2925
'snapshotVersion',
3026
'snapshot',
3127
]);
32-
const { limit, pageToken, isPaginated } = getPaginationOptions(options);
28+
const { limit, pageToken } = getPaginationOptions(options);
3329

3430
if (!bucketArg) {
3531
failWithError(context, 'Bucket name is required');
@@ -75,15 +71,18 @@ export default async function listObjects(options: Record<string, unknown>) {
7571

7672
const nextToken = data.paginationToken || undefined;
7773

78-
const output = isPaginated
79-
? formatPaginatedOutput(objects, format!, 'objects', 'object', columns, {
80-
paginationToken: nextToken,
81-
})
82-
: formatOutput(objects, format!, 'objects', 'object', columns);
74+
const output = formatPaginatedOutput(
75+
objects,
76+
format!,
77+
'objects',
78+
'object',
79+
columns,
80+
{ paginationToken: nextToken }
81+
);
8382

8483
console.log(output);
8584

86-
if (isPaginated && format !== 'json' && format !== 'xml') {
85+
if (format !== 'json' && format !== 'xml') {
8786
printPaginationHint(nextToken);
8887
}
8988

0 commit comments

Comments
 (0)