@stonyx/cron 0.2.1-alpha.0 → 0.2.1-alpha.10

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/.git/config DELETED
@@ -1,18 +0,0 @@
1
- [core]
2
- repositoryformatversion = 0
3
- filemode = true
4
- bare = false
5
- logallrefupdates = true
6
- [remote "origin"]
7
- url = https://github.com/abofs/stonyx-cron
8
- fetch = +refs/heads/*:refs/remotes/origin/*
9
- [gc]
10
- auto = 0
11
- [http "https://github.com/"]
12
- extraheader = AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2hzX3VEalZ2VU1jcHZHb1d4YzJHRFlqbER6VkxRVDVrQzEzU1JZQQ==
13
- [branch "fix/use-published-dependencies"]
14
- remote = origin
15
- merge = refs/heads/fix/use-published-dependencies
16
- [user]
17
- name = github-actions[bot]
18
- email = github-actions[bot]@users.noreply.github.com
@@ -1,36 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- pull_request:
5
- branches:
6
- - dev
7
- - main
8
-
9
- concurrency:
10
- group: ci-${{ github.head_ref || github.ref }}
11
- cancel-in-progress: true
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
-
17
- steps:
18
- - name: Checkout code
19
- uses: actions/checkout@v3
20
-
21
- - name: Setup pnpm
22
- uses: pnpm/action-setup@v4
23
- with:
24
- version: 9
25
-
26
- - name: Set up Node.js
27
- uses: actions/setup-node@v3
28
- with:
29
- node-version: 24.13.0
30
- cache: 'pnpm'
31
-
32
- - name: Install dependencies
33
- run: pnpm install --frozen-lockfile
34
-
35
- - name: Run tests
36
- run: pnpm test
@@ -1,143 +0,0 @@
1
- name: Publish to NPM
2
-
3
- on:
4
- # Manual trigger (kept for flexibility)
5
- workflow_dispatch:
6
- inputs:
7
- version-type:
8
- description: 'Version type'
9
- required: true
10
- type: choice
11
- options:
12
- - alpha
13
- - patch
14
- - minor
15
- - major
16
- custom-version:
17
- description: 'Custom version (optional, overrides version-type)'
18
- required: false
19
- type: string
20
-
21
- # Auto-publish alpha on PR
22
- pull_request:
23
- types: [opened, synchronize, reopened]
24
- branches: [main, dev]
25
-
26
- # Auto-publish stable on merge to main
27
- push:
28
- branches: [main]
29
-
30
- permissions:
31
- contents: write
32
- id-token: write # Required for npm provenance
33
- pull-requests: write # For PR comments
34
-
35
- jobs:
36
- publish:
37
- runs-on: ubuntu-latest
38
-
39
- steps:
40
- - name: Checkout code
41
- uses: actions/checkout@v3
42
- with:
43
- fetch-depth: 0
44
- # For PR events, check out the PR branch
45
- ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
46
-
47
- - name: Setup pnpm
48
- uses: pnpm/action-setup@v4
49
- with:
50
- version: 9
51
-
52
- - name: Set up Node.js
53
- uses: actions/setup-node@v3
54
- with:
55
- node-version: 24.13.0
56
- cache: 'pnpm'
57
- registry-url: 'https://registry.npmjs.org'
58
-
59
- - name: Install dependencies
60
- run: pnpm install --frozen-lockfile
61
-
62
- - name: Run tests
63
- run: pnpm test
64
-
65
- - name: Configure git
66
- run: |
67
- git config user.name "github-actions[bot]"
68
- git config user.email "github-actions[bot]@users.noreply.github.com"
69
-
70
- # Determine version type based on trigger
71
- - name: Determine version bump type
72
- id: version-type
73
- run: |
74
- if [ "${{ github.event_name }}" = "pull_request" ]; then
75
- echo "type=alpha" >> $GITHUB_OUTPUT
76
- elif [ "${{ github.event_name }}" = "push" ]; then
77
- echo "type=patch" >> $GITHUB_OUTPUT
78
- elif [ "${{ github.event.inputs.custom-version }}" != "" ]; then
79
- echo "type=custom" >> $GITHUB_OUTPUT
80
- else
81
- echo "type=${{ github.event.inputs.version-type }}" >> $GITHUB_OUTPUT
82
- fi
83
-
84
- # Version bumping
85
- - name: Bump version (custom)
86
- if: steps.version-type.outputs.type == 'custom'
87
- run: pnpm version ${{ github.event.inputs.custom-version }} --no-git-tag-version
88
-
89
- - name: Bump version (alpha)
90
- if: steps.version-type.outputs.type == 'alpha'
91
- run: pnpm version prerelease --preid=alpha --no-git-tag-version
92
-
93
- - name: Bump version (patch/minor/major)
94
- if: steps.version-type.outputs.type == 'patch' || steps.version-type.outputs.type == 'minor' || steps.version-type.outputs.type == 'major'
95
- run: pnpm version ${{ steps.version-type.outputs.type }} --no-git-tag-version
96
-
97
- - name: Get package version
98
- id: package-version
99
- run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
100
-
101
- # Publishing
102
- - name: Publish to NPM (alpha)
103
- if: contains(steps.package-version.outputs.version, 'alpha')
104
- run: pnpm publish --tag alpha --access public --no-git-checks
105
-
106
- - name: Publish to NPM (stable)
107
- if: "!contains(steps.package-version.outputs.version, 'alpha')"
108
- run: pnpm publish --access public
109
-
110
- # Only commit and tag for stable releases (push to main or manual stable)
111
- - name: Commit version bump and create tag
112
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !contains(steps.package-version.outputs.version, 'alpha'))
113
- run: |
114
- git add package.json
115
- git commit -m "chore: release v${{ steps.package-version.outputs.version }}"
116
- git tag v${{ steps.package-version.outputs.version }}
117
- git push origin main --tags
118
-
119
- - name: Create GitHub Release
120
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !contains(steps.package-version.outputs.version, 'alpha'))
121
- uses: actions/create-release@v1
122
- env:
123
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124
- with:
125
- tag_name: v${{ steps.package-version.outputs.version }}
126
- release_name: v${{ steps.package-version.outputs.version }}
127
- draft: false
128
- prerelease: false
129
-
130
- # Add PR comment with alpha version info
131
- - name: Comment on PR with alpha version
132
- if: github.event_name == 'pull_request'
133
- uses: actions/github-script@v6
134
- with:
135
- script: |
136
- const version = '${{ steps.package-version.outputs.version }}';
137
- const packageName = require('./package.json').name;
138
- github.rest.issues.createComment({
139
- issue_number: context.issue.number,
140
- owner: context.repo.owner,
141
- repo: context.repo.repo,
142
- body: `## 🚀 Alpha Version Published\n\n**Version:** \`${version}\`\n\n**Install:**\n\`\`\`bash\npnpm add ${packageName}@${version}\n# or\npnpm add ${packageName}@alpha # latest alpha\n\`\`\`\n\nThis alpha version is now available for testing!`
143
- });
package/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- # dependencies
2
- /node_modules/
3
-
4
- # config
5
- config/environment.js
6
-
7
- # logs
8
- *logs/*
9
-
10
- # os / IDE
11
- .vscode/*
12
- *.vsix%
13
- *DS_Store*
14
-
15
- # npm auth (never commit tokens)
16
- .npmrc
package/.npmignore DELETED
@@ -1,5 +0,0 @@
1
- # tests
2
- test/
3
-
4
- # config
5
- .nvmrc
package/logs/error.log DELETED
@@ -1,2 +0,0 @@
1
- [1/1/1970, 12:00:01 AM] Cron job "jobErr" failed:
2
- [1/1/1970, 12:00:01 AM] Cron job "jobErr" failed:
package/pnpm-lock.yaml DELETED
@@ -1,369 +0,0 @@
1
- lockfileVersion: '9.0'
2
-
3
- settings:
4
- autoInstallPeers: true
5
- excludeLinksFromLockfile: false
6
-
7
- importers:
8
-
9
- .:
10
- dependencies:
11
- stonyx:
12
- specifier: ^0.2.2
13
- version: 0.2.2
14
- devDependencies:
15
- '@stonyx/utils':
16
- specifier: ^0.2.2
17
- version: 0.2.2
18
- qunit:
19
- specifier: ^2.24.1
20
- version: 2.25.0
21
- sinon:
22
- specifier: ^21.0.0
23
- version: 21.0.1
24
-
25
- packages:
26
-
27
- '@sinonjs/commons@3.0.1':
28
- resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==}
29
-
30
- '@sinonjs/fake-timers@15.1.0':
31
- resolution: {integrity: sha512-cqfapCxwTGsrR80FEgOoPsTonoefMBY7dnUEbQ+GRcved0jvkJLzvX6F4WtN+HBqbPX/SiFsIRUp+IrCW/2I2w==}
32
-
33
- '@sinonjs/samsam@8.0.3':
34
- resolution: {integrity: sha512-hw6HbX+GyVZzmaYNh82Ecj1vdGZrqVIn/keDTg63IgAwiQPO+xCz99uG6Woqgb4tM0mUiFENKZ4cqd7IX94AXQ==}
35
-
36
- '@stonyx/utils@0.2.2':
37
- resolution: {integrity: sha512-z/pDbX3QPeVJ3kFpU1rQURj3+BLwvGkLHVJiSckmjaBZ/vQIZzaerkf6BTZnHbSmQuUwO0lFzJRwlKOTIaXp0g==}
38
-
39
- call-bind-apply-helpers@1.0.2:
40
- resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
41
- engines: {node: '>= 0.4'}
42
-
43
- call-bound@1.0.4:
44
- resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
45
- engines: {node: '>= 0.4'}
46
-
47
- chalk@5.6.2:
48
- resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==}
49
- engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
50
-
51
- commander@7.2.0:
52
- resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==}
53
- engines: {node: '>= 10'}
54
-
55
- diff@8.0.3:
56
- resolution: {integrity: sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==}
57
- engines: {node: '>=0.3.1'}
58
-
59
- dunder-proto@1.0.1:
60
- resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
61
- engines: {node: '>= 0.4'}
62
-
63
- es-define-property@1.0.1:
64
- resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
65
- engines: {node: '>= 0.4'}
66
-
67
- es-errors@1.3.0:
68
- resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
69
- engines: {node: '>= 0.4'}
70
-
71
- es-object-atoms@1.1.1:
72
- resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
73
- engines: {node: '>= 0.4'}
74
-
75
- fs@0.0.1-security:
76
- resolution: {integrity: sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==}
77
-
78
- function-bind@1.1.2:
79
- resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
80
-
81
- get-intrinsic@1.3.0:
82
- resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
83
- engines: {node: '>= 0.4'}
84
-
85
- get-proto@1.0.1:
86
- resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
87
- engines: {node: '>= 0.4'}
88
-
89
- globalyzer@0.1.0:
90
- resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==}
91
-
92
- globrex@0.1.2:
93
- resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==}
94
-
95
- gopd@1.2.0:
96
- resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
97
- engines: {node: '>= 0.4'}
98
-
99
- has-flag@4.0.0:
100
- resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
101
- engines: {node: '>=8'}
102
-
103
- has-symbols@1.1.0:
104
- resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
105
- engines: {node: '>= 0.4'}
106
-
107
- hasown@2.0.2:
108
- resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
109
- engines: {node: '>= 0.4'}
110
-
111
- inherits@2.0.3:
112
- resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==}
113
-
114
- math-intrinsics@1.1.0:
115
- resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
116
- engines: {node: '>= 0.4'}
117
-
118
- node-chronicle@0.2.0:
119
- resolution: {integrity: sha512-se9NsW67UZqDFbK/+Rbml9KdCVTwzaadIgL4NDBcDpLMhOf1qerRxXicE+/dBsoyhDqWCwAFbBjR3iytF3gepA==}
120
-
121
- node-watch@0.7.3:
122
- resolution: {integrity: sha512-3l4E8uMPY1HdMMryPRUAl+oIHtXtyiTlIiESNSVSNxcPfzAFzeTbXFQkZfAwBbo0B1qMSG8nUABx+Gd+YrbKrQ==}
123
- engines: {node: '>=6'}
124
-
125
- object-inspect@1.13.4:
126
- resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}
127
- engines: {node: '>= 0.4'}
128
-
129
- path@0.12.7:
130
- resolution: {integrity: sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==}
131
-
132
- process@0.11.10:
133
- resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
134
- engines: {node: '>= 0.6.0'}
135
-
136
- punycode@1.4.1:
137
- resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==}
138
-
139
- qs@6.14.1:
140
- resolution: {integrity: sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==}
141
- engines: {node: '>=0.6'}
142
-
143
- qunit@2.25.0:
144
- resolution: {integrity: sha512-MONPKgjavgTqArCwZOEz8nEMbA19zNXIp5ZOW9rPYj5cbgQp0fiI36c9dPTSzTRRzx+KcfB5eggYB/ENqxi0+w==}
145
- engines: {node: '>=10'}
146
- hasBin: true
147
-
148
- side-channel-list@1.0.0:
149
- resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
150
- engines: {node: '>= 0.4'}
151
-
152
- side-channel-map@1.0.1:
153
- resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}
154
- engines: {node: '>= 0.4'}
155
-
156
- side-channel-weakmap@1.0.2:
157
- resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}
158
- engines: {node: '>= 0.4'}
159
-
160
- side-channel@1.1.0:
161
- resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==}
162
- engines: {node: '>= 0.4'}
163
-
164
- sinon@21.0.1:
165
- resolution: {integrity: sha512-Z0NVCW45W8Mg5oC/27/+fCqIHFnW8kpkFOq0j9XJIev4Ld0mKmERaZv5DMLAb9fGCevjKwaEeIQz5+MBXfZcDw==}
166
-
167
- stonyx@0.2.2:
168
- resolution: {integrity: sha512-X37/2R2YklI+CX4wKHckPg2pFmOL1hk0CwOMvn7E00sE+8JjhmbHvAeTI+0t50kufBsXKREPX3FBHVUd4Yi4Fw==}
169
-
170
- supports-color@7.2.0:
171
- resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
172
- engines: {node: '>=8'}
173
-
174
- tiny-glob@0.2.9:
175
- resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==}
176
-
177
- type-detect@4.0.8:
178
- resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
179
- engines: {node: '>=4'}
180
-
181
- type-detect@4.1.0:
182
- resolution: {integrity: sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==}
183
- engines: {node: '>=4'}
184
-
185
- url@0.11.4:
186
- resolution: {integrity: sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==}
187
- engines: {node: '>= 0.4'}
188
-
189
- util@0.10.4:
190
- resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==}
191
-
192
- snapshots:
193
-
194
- '@sinonjs/commons@3.0.1':
195
- dependencies:
196
- type-detect: 4.0.8
197
-
198
- '@sinonjs/fake-timers@15.1.0':
199
- dependencies:
200
- '@sinonjs/commons': 3.0.1
201
-
202
- '@sinonjs/samsam@8.0.3':
203
- dependencies:
204
- '@sinonjs/commons': 3.0.1
205
- type-detect: 4.1.0
206
-
207
- '@stonyx/utils@0.2.2': {}
208
-
209
- call-bind-apply-helpers@1.0.2:
210
- dependencies:
211
- es-errors: 1.3.0
212
- function-bind: 1.1.2
213
-
214
- call-bound@1.0.4:
215
- dependencies:
216
- call-bind-apply-helpers: 1.0.2
217
- get-intrinsic: 1.3.0
218
-
219
- chalk@5.6.2: {}
220
-
221
- commander@7.2.0: {}
222
-
223
- diff@8.0.3: {}
224
-
225
- dunder-proto@1.0.1:
226
- dependencies:
227
- call-bind-apply-helpers: 1.0.2
228
- es-errors: 1.3.0
229
- gopd: 1.2.0
230
-
231
- es-define-property@1.0.1: {}
232
-
233
- es-errors@1.3.0: {}
234
-
235
- es-object-atoms@1.1.1:
236
- dependencies:
237
- es-errors: 1.3.0
238
-
239
- fs@0.0.1-security: {}
240
-
241
- function-bind@1.1.2: {}
242
-
243
- get-intrinsic@1.3.0:
244
- dependencies:
245
- call-bind-apply-helpers: 1.0.2
246
- es-define-property: 1.0.1
247
- es-errors: 1.3.0
248
- es-object-atoms: 1.1.1
249
- function-bind: 1.1.2
250
- get-proto: 1.0.1
251
- gopd: 1.2.0
252
- has-symbols: 1.1.0
253
- hasown: 2.0.2
254
- math-intrinsics: 1.1.0
255
-
256
- get-proto@1.0.1:
257
- dependencies:
258
- dunder-proto: 1.0.1
259
- es-object-atoms: 1.1.1
260
-
261
- globalyzer@0.1.0: {}
262
-
263
- globrex@0.1.2: {}
264
-
265
- gopd@1.2.0: {}
266
-
267
- has-flag@4.0.0: {}
268
-
269
- has-symbols@1.1.0: {}
270
-
271
- hasown@2.0.2:
272
- dependencies:
273
- function-bind: 1.1.2
274
-
275
- inherits@2.0.3: {}
276
-
277
- math-intrinsics@1.1.0: {}
278
-
279
- node-chronicle@0.2.0:
280
- dependencies:
281
- chalk: 5.6.2
282
- fs: 0.0.1-security
283
- path: 0.12.7
284
- url: 0.11.4
285
-
286
- node-watch@0.7.3: {}
287
-
288
- object-inspect@1.13.4: {}
289
-
290
- path@0.12.7:
291
- dependencies:
292
- process: 0.11.10
293
- util: 0.10.4
294
-
295
- process@0.11.10: {}
296
-
297
- punycode@1.4.1: {}
298
-
299
- qs@6.14.1:
300
- dependencies:
301
- side-channel: 1.1.0
302
-
303
- qunit@2.25.0:
304
- dependencies:
305
- commander: 7.2.0
306
- node-watch: 0.7.3
307
- tiny-glob: 0.2.9
308
-
309
- side-channel-list@1.0.0:
310
- dependencies:
311
- es-errors: 1.3.0
312
- object-inspect: 1.13.4
313
-
314
- side-channel-map@1.0.1:
315
- dependencies:
316
- call-bound: 1.0.4
317
- es-errors: 1.3.0
318
- get-intrinsic: 1.3.0
319
- object-inspect: 1.13.4
320
-
321
- side-channel-weakmap@1.0.2:
322
- dependencies:
323
- call-bound: 1.0.4
324
- es-errors: 1.3.0
325
- get-intrinsic: 1.3.0
326
- object-inspect: 1.13.4
327
- side-channel-map: 1.0.1
328
-
329
- side-channel@1.1.0:
330
- dependencies:
331
- es-errors: 1.3.0
332
- object-inspect: 1.13.4
333
- side-channel-list: 1.0.0
334
- side-channel-map: 1.0.1
335
- side-channel-weakmap: 1.0.2
336
-
337
- sinon@21.0.1:
338
- dependencies:
339
- '@sinonjs/commons': 3.0.1
340
- '@sinonjs/fake-timers': 15.1.0
341
- '@sinonjs/samsam': 8.0.3
342
- diff: 8.0.3
343
- supports-color: 7.2.0
344
-
345
- stonyx@0.2.2:
346
- dependencies:
347
- node-chronicle: 0.2.0
348
-
349
- supports-color@7.2.0:
350
- dependencies:
351
- has-flag: 4.0.0
352
-
353
- tiny-glob@0.2.9:
354
- dependencies:
355
- globalyzer: 0.1.0
356
- globrex: 0.1.2
357
-
358
- type-detect@4.0.8: {}
359
-
360
- type-detect@4.1.0: {}
361
-
362
- url@0.11.4:
363
- dependencies:
364
- punycode: 1.4.1
365
- qs: 6.14.1
366
-
367
- util@0.10.4:
368
- dependencies:
369
- inherits: 2.0.3
package/src/main.js DELETED
@@ -1,112 +0,0 @@
1
- /*
2
- * Copyright 2025 Stone Costa
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the 'License');
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import config from 'stonyx/config';
18
- import log from 'stonyx/log';
19
- import { getTimestamp } from "@stonyx/utils/date";
20
- import MinHeap from '@stonyx/cron/min-heap';
21
-
22
- export default class Cron {
23
- jobs = {};
24
- heap = new MinHeap();
25
- timer = null;
26
-
27
- constructor() {
28
- if (Cron.instance) return Cron.instance;
29
- Cron.instance = this;
30
- }
31
-
32
- scheduleNextRun() {
33
- clearTimeout(this.timer);
34
-
35
- const { heap } = this;
36
-
37
- if (heap.isEmpty()) return;
38
-
39
- const nextJob = heap.peek();
40
- const delay = Math.max(0, nextJob.nextTrigger - getTimestamp()) * 1000;
41
-
42
- this.timer = setTimeout(() => this.runDueJobs(), delay);
43
- }
44
-
45
- async runDueJobs() {
46
- const now = getTimestamp();
47
- const { heap } = this;
48
-
49
- while (!heap.isEmpty() && heap.peek().nextTrigger <= now) {
50
- const job = heap.pop();
51
-
52
- if (config.debug) this.log('job has been triggered', job.key);
53
-
54
- try {
55
- await job.callback();
56
- } catch (err) {
57
- log.error(`Cron job "${job.key}" failed:`, err);
58
- }
59
-
60
- this.setNextTrigger(job);
61
- heap.push(job);
62
- }
63
-
64
- this.scheduleNextRun();
65
- }
66
-
67
- register(key, callback, interval, runOnInit=false) {
68
- const job = { callback, interval, key };
69
- this.jobs[key] = job;
70
- this.setNextTrigger(job);
71
- this.heap.push(job);
72
-
73
- if (config.debug) {
74
- this.log(`job has been registered with interval: ${interval}`, key);
75
- }
76
-
77
- if (runOnInit) {
78
- try {
79
- callback();
80
- } catch (err) {
81
- log.error(`Cron job "${key}" failed on init:`, err);
82
- }
83
- }
84
-
85
- this.scheduleNextRun();
86
- }
87
-
88
- unregister(key) {
89
- const { heap, jobs } = this;
90
- const job = jobs[key];
91
-
92
- if (!job) return;
93
-
94
- delete jobs[key];
95
- heap.remove(job);
96
-
97
- if (config.debug) this.log('job has been unregistered', key);
98
-
99
- this.scheduleNextRun();
100
- }
101
-
102
- setNextTrigger(job) {
103
- job.nextTrigger = getTimestamp() + parseInt(job.interval, 10);
104
- }
105
-
106
- log(text, key = null) {
107
- if (!config.cron?.log) return;
108
-
109
- const tag = key ? `Cron::${key}` : `Cron`;
110
- log.cron(`${tag} - ${text}:`);
111
- }
112
- }