Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
echo "Package.json version: v${{ steps.package-version.outputs.packageVersion }}"
test "${{ steps.tag-version.outputs.tagVersion }}" == "v${{ steps.package-version.outputs.packageVersion }}"
- name: Notify release in progress in Slack
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
needs: [create-release]
runs-on: ubuntu-latest
steps:
- uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
- uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
needs: [create-release]
runs-on: ubuntu-latest
steps:
- uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
- uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notify-release-published.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Send Slack release published notification
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Docker metadata
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
with:
images: harperfast/harper
- name: Login to Docker Hub
Expand Down Expand Up @@ -61,14 +61,14 @@ jobs:
docker-image-tag: ${{ steps.meta.outputs.version }}
steps:
- name: Download digests
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: /tmp/digests
pattern: digest-*
merge-multiple: true
- name: Setup Docker metadata
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
with:
images: harperfast/harper
tags: |
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Send Slack published notification
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
needs: [merge]
runs-on: ubuntu-latest
steps:
- uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
- uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Send Slack published notification
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
- publish-harper-npm-package
runs-on: ubuntu-latest
steps:
- uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
- uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down
13 changes: 12 additions & 1 deletion resources/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,9 @@ export function makeTable(options) {
return (entryA, entryB) => {
const a = getAttributeValue(entryA, order.attribute, context);
const b = getAttributeValue(entryB, order.attribute, context);
const diff = descending ? compareKeys(b, a) : compareKeys(a, b);
const diff = descending
? compareKeys(convertToComparableKeys(b), convertToComparableKeys(a))
: compareKeys(convertToComparableKeys(a), convertToComparableKeys(b));
if (diff === 0) return nextComparator?.(entryA, entryB) || 0;
return diff;
};
Expand Down Expand Up @@ -4572,3 +4574,12 @@ function hasOtherProcesses(store) {
return +line.match(/\d+/)?.[0] != pid;
});
}
function convertToComparableKeys(a) {
if (a instanceof Date) {
return a.getTime();
}
if (Array.isArray(a)) {
return a.map(convertToComparableKeys);
}
return a;
}
14 changes: 14 additions & 0 deletions unitTests/resources/query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('Querying through Resource API', () => {
{ name: 'name', type: 'String' },
],
},
{ name: 'createdAt', type: 'Date', assignCreatedTime: true },
],
});
QueryTable.setComputedAttribute('computed', (instance) => instance.name + ' computed');
Expand Down Expand Up @@ -148,6 +149,7 @@ describe('Querying through Resource API', () => {
notIndexed: 'not indexed ' + i,
nestedData: i > 0 ? { id: 'nested-' + i, name: 'nested name ' + i } : null,
});
await new Promise((resolve) => setTimeout(resolve, 1)); // leave one ms so createdAt is different
}
await last;
// rewrite one of them to ensure the prototype doesn't get messed up
Expand Down Expand Up @@ -904,6 +906,18 @@ describe('Querying through Resource API', () => {
assert.equal(results[0].id, 'id-98');
assert.equal(results[1].id, 'id-93');
});
it('Query data in a table with and sort on createdAt', async function () {
let results = [];
for await (let record of QueryTable.search({
conditions: [{ attribute: 'relatedId', value: 3 }],
sort: { attribute: 'createdAt', descending: true },
})) {
results.push(record);
}
assert.equal(results.length, 20);
assert.equal(results[0].id, 'id-98');
assert.equal(results[1].id, 'id-93');
});
it('Query data in a table with narrow constraint with multiple sorting on different properties', async function () {
let results = [];
for await (let record of QueryTable.search({
Expand Down
Loading