rrule-rust 2.0.0-alpha.4 → 2.0.0-next.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/{index.d.ts → dist/index.d.ts} +4 -1
- package/{index.js → dist/index.js} +62 -4
- package/package.json +41 -31
- package/.eslintrc.js +0 -58
- package/.prettierrc +0 -4
- package/.releaserc +0 -46
- package/.yarnrc.yml +0 -1
- package/Cargo.toml +0 -22
- package/benchmark/.gitignore +0 -3
- package/benchmark/index.ts +0 -59
- package/build.rs +0 -5
- package/jest.config.ts +0 -7
- package/src/js/frequency.rs +0 -40
- package/src/js/month.rs +0 -56
- package/src/js/n_weekday.rs +0 -36
- package/src/js/rrule.rs +0 -275
- package/src/js/rrule_datetime.rs +0 -128
- package/src/js/rrule_set.rs +0 -258
- package/src/js/rrule_timezone.rs +0 -52
- package/src/js/weekday.rs +0 -40
- package/src/js.rs +0 -17
- package/src/lib.rs +0 -1
- package/tsconfig.eslint.json +0 -6
- package/tsconfig.json +0 -24
|
@@ -88,12 +88,15 @@ export class RRuleDateTime {
|
|
|
88
88
|
get minute(): number
|
|
89
89
|
get second(): number
|
|
90
90
|
get millisecond(): number
|
|
91
|
-
|
|
91
|
+
toString(): string
|
|
92
|
+
toRFC3339(): string
|
|
92
93
|
toDate(): Date
|
|
93
94
|
toUtcDate(): Date
|
|
95
|
+
toObject(): { day: number, month: number, year: number, hour: number, minute: number, second: number, millisecond: number }
|
|
94
96
|
}
|
|
95
97
|
export class RRuleSet {
|
|
96
98
|
constructor(dtstart: RRuleDateTime | Date)
|
|
99
|
+
setFromString(str: string): this
|
|
97
100
|
static parse(str: string): RRuleSet
|
|
98
101
|
toString(): string
|
|
99
102
|
addRrule(jsRrule: RRule): this
|
|
@@ -17,7 +17,7 @@ function isMusl() {
|
|
|
17
17
|
// For Node 10
|
|
18
18
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
19
19
|
try {
|
|
20
|
-
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
20
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
21
21
|
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
22
22
|
} catch (e) {
|
|
23
23
|
return true
|
|
@@ -224,14 +224,72 @@ switch (platform) {
|
|
|
224
224
|
}
|
|
225
225
|
break
|
|
226
226
|
case 'arm':
|
|
227
|
+
if (isMusl()) {
|
|
228
|
+
localFileExisted = existsSync(
|
|
229
|
+
join(__dirname, 'rrule-rust.linux-arm-musleabihf.node')
|
|
230
|
+
)
|
|
231
|
+
try {
|
|
232
|
+
if (localFileExisted) {
|
|
233
|
+
nativeBinding = require('./rrule-rust.linux-arm-musleabihf.node')
|
|
234
|
+
} else {
|
|
235
|
+
nativeBinding = require('@rrule-rust/lib-linux-arm-musleabihf')
|
|
236
|
+
}
|
|
237
|
+
} catch (e) {
|
|
238
|
+
loadError = e
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
localFileExisted = existsSync(
|
|
242
|
+
join(__dirname, 'rrule-rust.linux-arm-gnueabihf.node')
|
|
243
|
+
)
|
|
244
|
+
try {
|
|
245
|
+
if (localFileExisted) {
|
|
246
|
+
nativeBinding = require('./rrule-rust.linux-arm-gnueabihf.node')
|
|
247
|
+
} else {
|
|
248
|
+
nativeBinding = require('@rrule-rust/lib-linux-arm-gnueabihf')
|
|
249
|
+
}
|
|
250
|
+
} catch (e) {
|
|
251
|
+
loadError = e
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
break
|
|
255
|
+
case 'riscv64':
|
|
256
|
+
if (isMusl()) {
|
|
257
|
+
localFileExisted = existsSync(
|
|
258
|
+
join(__dirname, 'rrule-rust.linux-riscv64-musl.node')
|
|
259
|
+
)
|
|
260
|
+
try {
|
|
261
|
+
if (localFileExisted) {
|
|
262
|
+
nativeBinding = require('./rrule-rust.linux-riscv64-musl.node')
|
|
263
|
+
} else {
|
|
264
|
+
nativeBinding = require('@rrule-rust/lib-linux-riscv64-musl')
|
|
265
|
+
}
|
|
266
|
+
} catch (e) {
|
|
267
|
+
loadError = e
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
localFileExisted = existsSync(
|
|
271
|
+
join(__dirname, 'rrule-rust.linux-riscv64-gnu.node')
|
|
272
|
+
)
|
|
273
|
+
try {
|
|
274
|
+
if (localFileExisted) {
|
|
275
|
+
nativeBinding = require('./rrule-rust.linux-riscv64-gnu.node')
|
|
276
|
+
} else {
|
|
277
|
+
nativeBinding = require('@rrule-rust/lib-linux-riscv64-gnu')
|
|
278
|
+
}
|
|
279
|
+
} catch (e) {
|
|
280
|
+
loadError = e
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
break
|
|
284
|
+
case 's390x':
|
|
227
285
|
localFileExisted = existsSync(
|
|
228
|
-
join(__dirname, 'rrule-rust.linux-
|
|
286
|
+
join(__dirname, 'rrule-rust.linux-s390x-gnu.node')
|
|
229
287
|
)
|
|
230
288
|
try {
|
|
231
289
|
if (localFileExisted) {
|
|
232
|
-
nativeBinding = require('./rrule-rust.linux-
|
|
290
|
+
nativeBinding = require('./rrule-rust.linux-s390x-gnu.node')
|
|
233
291
|
} else {
|
|
234
|
-
nativeBinding = require('@rrule-rust/lib-linux-
|
|
292
|
+
nativeBinding = require('@rrule-rust/lib-linux-s390x-gnu')
|
|
235
293
|
}
|
|
236
294
|
} catch (e) {
|
|
237
295
|
loadError = e
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rrule-rust",
|
|
3
|
-
"version": "2.0.0-
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"types": "index.d.ts",
|
|
3
|
+
"version": "2.0.0-next.10",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rrule",
|
|
8
8
|
"icalendar",
|
|
@@ -29,42 +29,48 @@
|
|
|
29
29
|
"aarch64-unknown-linux-musl",
|
|
30
30
|
"aarch64-pc-windows-msvc",
|
|
31
31
|
"armv7-unknown-linux-gnueabihf",
|
|
32
|
+
"armv7-unknown-linux-musleabihf",
|
|
32
33
|
"x86_64-unknown-linux-musl",
|
|
33
34
|
"x86_64-unknown-freebsd",
|
|
34
35
|
"i686-pc-windows-msvc",
|
|
35
36
|
"armv7-linux-androideabi",
|
|
36
|
-
"universal-apple-darwin"
|
|
37
|
+
"universal-apple-darwin",
|
|
38
|
+
"riscv64gc-unknown-linux-gnu"
|
|
37
39
|
]
|
|
38
40
|
}
|
|
39
41
|
},
|
|
40
42
|
"license": "MIT",
|
|
41
43
|
"devDependencies": {
|
|
42
|
-
"@
|
|
44
|
+
"@commitlint/cli": "^19.3.0",
|
|
45
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
46
|
+
"@napi-rs/cli": "^2.18.2",
|
|
43
47
|
"@semantic-release/git": "^10.0.1",
|
|
44
48
|
"@types/jest": "^29.5.0",
|
|
45
|
-
"@types/node": "^
|
|
49
|
+
"@types/node": "^20.12.8",
|
|
50
|
+
"@types/luxon": "^3.4.2",
|
|
46
51
|
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
|
47
52
|
"@typescript-eslint/parser": "^5.50.0",
|
|
48
53
|
"benny": "^3.7.1",
|
|
49
54
|
"conventional-changelog-conventionalcommits": "^7.0.2",
|
|
55
|
+
"cpy-cli": "^5.0.0",
|
|
50
56
|
"eslint": "^8.33.0",
|
|
51
57
|
"eslint-config-prettier": "^8.6.0",
|
|
52
58
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
53
59
|
"eslint-plugin-import": "^2.27.5",
|
|
54
60
|
"eslint-plugin-prettier": "^4.2.1",
|
|
61
|
+
"husky": "^9.0.11",
|
|
55
62
|
"jest": "^29.5.0",
|
|
56
|
-
"lint-staged": "^
|
|
57
|
-
"
|
|
63
|
+
"lint-staged": "^15.2.2",
|
|
64
|
+
"mkdirp": "^3.0.1",
|
|
65
|
+
"luxon": "^3.4.4",
|
|
58
66
|
"prettier": "^2.8.3",
|
|
67
|
+
"rimraf": "^5.0.5",
|
|
59
68
|
"rrule": "^2.7.2",
|
|
60
|
-
"semantic-release": "^
|
|
69
|
+
"semantic-release": "^23.0.8",
|
|
61
70
|
"ts-jest": "^29.0.5",
|
|
62
71
|
"ts-node": "^10.9.1",
|
|
63
|
-
"typescript": "^4.
|
|
72
|
+
"typescript": "^5.4.5"
|
|
64
73
|
},
|
|
65
|
-
"pre-commit": [
|
|
66
|
-
"lint:fix-staged"
|
|
67
|
-
],
|
|
68
74
|
"lint-staged": {
|
|
69
75
|
"**/*.{js,ts,json}": "eslint --fix --max-warnings=0",
|
|
70
76
|
"**/*.rs": "rustfmt"
|
|
@@ -74,31 +80,35 @@
|
|
|
74
80
|
},
|
|
75
81
|
"scripts": {
|
|
76
82
|
"artifacts": "napi artifacts",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
83
|
+
"prebuild": "rimraf ./dist && mkdirp ./dist",
|
|
84
|
+
"postbuild": "cpy ./*.node ./dist && rimraf --glob ./*.node",
|
|
85
|
+
"build": "napi build --js dist/index.js --dts dist/index.d.ts --platform --release",
|
|
79
86
|
"prepublishOnly": "napi prepublish -t npm",
|
|
80
87
|
"test": "jest",
|
|
81
88
|
"universal": "napi universal",
|
|
82
89
|
"version": "napi version",
|
|
83
90
|
"benchmark": "ts-node ./benchmark/index.ts",
|
|
84
91
|
"lint": "cargo fmt --all -- --check && eslint \"**/*.{js,ts,json}\" --max-warnings=0",
|
|
85
|
-
"lint:fix": "cargo fmt --all &&
|
|
86
|
-
"lint:fix-staged": "lint-staged"
|
|
92
|
+
"lint:fix": "cargo fmt --all && npm run lint -- --fix",
|
|
93
|
+
"lint:fix-staged": "lint-staged",
|
|
94
|
+
"prepare": "husky && npm run build"
|
|
87
95
|
},
|
|
88
96
|
"optionalDependencies": {
|
|
89
|
-
"@rrule-rust/lib-win32-x64-msvc": "2.0.0-
|
|
90
|
-
"@rrule-rust/lib-darwin-x64": "2.0.0-
|
|
91
|
-
"@rrule-rust/lib-linux-x64-gnu": "2.0.0-
|
|
92
|
-
"@rrule-rust/lib-darwin-arm64": "2.0.0-
|
|
93
|
-
"@rrule-rust/lib-android-arm64": "2.0.0-
|
|
94
|
-
"@rrule-rust/lib-linux-arm64-gnu": "2.0.0-
|
|
95
|
-
"@rrule-rust/lib-linux-arm64-musl": "2.0.0-
|
|
96
|
-
"@rrule-rust/lib-win32-arm64-msvc": "2.0.0-
|
|
97
|
-
"@rrule-rust/lib-linux-arm-gnueabihf": "2.0.0-
|
|
98
|
-
"@rrule-rust/lib-linux-
|
|
99
|
-
"@rrule-rust/lib-
|
|
100
|
-
"@rrule-rust/lib-
|
|
101
|
-
"@rrule-rust/lib-
|
|
102
|
-
"@rrule-rust/lib-
|
|
97
|
+
"@rrule-rust/lib-win32-x64-msvc": "2.0.0-next.10",
|
|
98
|
+
"@rrule-rust/lib-darwin-x64": "2.0.0-next.10",
|
|
99
|
+
"@rrule-rust/lib-linux-x64-gnu": "2.0.0-next.10",
|
|
100
|
+
"@rrule-rust/lib-darwin-arm64": "2.0.0-next.10",
|
|
101
|
+
"@rrule-rust/lib-android-arm64": "2.0.0-next.10",
|
|
102
|
+
"@rrule-rust/lib-linux-arm64-gnu": "2.0.0-next.10",
|
|
103
|
+
"@rrule-rust/lib-linux-arm64-musl": "2.0.0-next.10",
|
|
104
|
+
"@rrule-rust/lib-win32-arm64-msvc": "2.0.0-next.10",
|
|
105
|
+
"@rrule-rust/lib-linux-arm-gnueabihf": "2.0.0-next.10",
|
|
106
|
+
"@rrule-rust/lib-linux-arm-musleabihf": "2.0.0-next.10",
|
|
107
|
+
"@rrule-rust/lib-linux-x64-musl": "2.0.0-next.10",
|
|
108
|
+
"@rrule-rust/lib-freebsd-x64": "2.0.0-next.10",
|
|
109
|
+
"@rrule-rust/lib-win32-ia32-msvc": "2.0.0-next.10",
|
|
110
|
+
"@rrule-rust/lib-android-arm-eabi": "2.0.0-next.10",
|
|
111
|
+
"@rrule-rust/lib-darwin-universal": "2.0.0-next.10",
|
|
112
|
+
"@rrule-rust/lib-linux-riscv64-gnu": "2.0.0-next.10"
|
|
103
113
|
}
|
|
104
114
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: [
|
|
4
|
-
'eslint:recommended',
|
|
5
|
-
'plugin:@typescript-eslint/recommended',
|
|
6
|
-
'plugin:prettier/recommended',
|
|
7
|
-
'plugin:import/recommended',
|
|
8
|
-
'plugin:import/typescript',
|
|
9
|
-
'plugin:eslint-comments/recommended',
|
|
10
|
-
],
|
|
11
|
-
plugins: ['@typescript-eslint'],
|
|
12
|
-
ignorePatterns: ['node_modules', '/target', '/index.d.ts', '/index.js'],
|
|
13
|
-
env: {
|
|
14
|
-
node: true,
|
|
15
|
-
},
|
|
16
|
-
overrides: [
|
|
17
|
-
{
|
|
18
|
-
files: ['*.ts'],
|
|
19
|
-
extends: [
|
|
20
|
-
'eslint:recommended',
|
|
21
|
-
'plugin:@typescript-eslint/recommended',
|
|
22
|
-
'plugin:prettier/recommended',
|
|
23
|
-
'plugin:import/recommended',
|
|
24
|
-
'plugin:import/typescript',
|
|
25
|
-
],
|
|
26
|
-
parserOptions: {
|
|
27
|
-
project: ['tsconfig.eslint.json'],
|
|
28
|
-
},
|
|
29
|
-
rules: {
|
|
30
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
31
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
32
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
33
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
34
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
35
|
-
'import/no-cycle': 'error',
|
|
36
|
-
'import/no-unresolved': 'error',
|
|
37
|
-
'@typescript-eslint/no-for-in-array': 'error',
|
|
38
|
-
'no-implied-eval': 'off',
|
|
39
|
-
'@typescript-eslint/no-implied-eval': 'error',
|
|
40
|
-
'@typescript-eslint/no-misused-promises': 'error',
|
|
41
|
-
'require-await': 'off',
|
|
42
|
-
'@typescript-eslint/require-await': 'error',
|
|
43
|
-
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
44
|
-
'@typescript-eslint/unbound-method': 'error',
|
|
45
|
-
'import/no-default-export': 'error',
|
|
46
|
-
'eslint-comments/require-description': 'error',
|
|
47
|
-
'eslint-comments/disable-enable-pair': 'off',
|
|
48
|
-
'eslint-comments/no-unlimited-disable': 'off',
|
|
49
|
-
},
|
|
50
|
-
settings: {
|
|
51
|
-
'import/parsers': {
|
|
52
|
-
'@typescript-eslint/parser': ['.ts'],
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
reportUnusedDisableDirectives: true,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
package/.prettierrc
DELETED
package/.releaserc
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"plugins": [
|
|
3
|
-
[
|
|
4
|
-
"@semantic-release/commit-analyzer",
|
|
5
|
-
{
|
|
6
|
-
"preset": "angular",
|
|
7
|
-
"releaseRules": [
|
|
8
|
-
{ "type": "docs", "release": "patch" },
|
|
9
|
-
{ "type": "perf", "release": "patch" },
|
|
10
|
-
{ "type": "revert", "release": "patch" }
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
[
|
|
15
|
-
"@semantic-release/release-notes-generator",
|
|
16
|
-
{
|
|
17
|
-
"parserOpts": {
|
|
18
|
-
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
|
|
19
|
-
},
|
|
20
|
-
"preset": "conventionalcommits",
|
|
21
|
-
"presetConfig": {
|
|
22
|
-
"types": [
|
|
23
|
-
{ "type": "build", "section": "Build System", "hidden": false },
|
|
24
|
-
{ "type": "chore", "section": "Build System", "hidden": false },
|
|
25
|
-
{ "type": "chore", "scope": "merge", "section": "Build System", "hidden": true },
|
|
26
|
-
{ "type": "ci", "section": "Continuous Integration", "hidden": false },
|
|
27
|
-
{ "type": "docs", "section": "Documentation", "hidden": false },
|
|
28
|
-
{ "type": "feat", "section": "Features", "hidden": false },
|
|
29
|
-
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
|
|
30
|
-
{ "type": "perf", "section": "Performance Improvements", "hidden": false },
|
|
31
|
-
{ "type": "refactor", "section": "Code Refactoring", "hidden": false },
|
|
32
|
-
{ "type": "revert", "section": "Reverted Changes", "hidden": false },
|
|
33
|
-
{ "type": "style", "section": "Styles", "hidden": false },
|
|
34
|
-
{ "type": "test", "section": "Tests", "hidden": false }
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
"writerOpts": {
|
|
38
|
-
"commitsSort": ["subject", "scope"]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"@semantic-release/github",
|
|
43
|
-
"@semantic-release/npm"
|
|
44
|
-
],
|
|
45
|
-
"branches": ["+([0-9])?(.{+([0-9]),x}).x", "master", {"name": "next", "prerelease": true}, {"name": "alpha", "prerelease": true}]
|
|
46
|
-
}
|
package/.yarnrc.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
package/Cargo.toml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
edition = "2021"
|
|
3
|
-
name = "rrule-rust"
|
|
4
|
-
version = "0.0.0"
|
|
5
|
-
|
|
6
|
-
[lib]
|
|
7
|
-
crate-type = ["cdylib"]
|
|
8
|
-
|
|
9
|
-
[dependencies]
|
|
10
|
-
chrono = "0.4.24"
|
|
11
|
-
chrono-tz = "0.8.5"
|
|
12
|
-
# Default enable napi5 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
|
|
13
|
-
napi = { version = "2.11.1", default-features = false, features = ["napi5"] }
|
|
14
|
-
napi-derive = "2.11.0"
|
|
15
|
-
replace_with = "0.1.7"
|
|
16
|
-
rrule = { version = "0.12.0", features = ["exrule"] }
|
|
17
|
-
|
|
18
|
-
[build-dependencies]
|
|
19
|
-
napi-build = "2.0.1"
|
|
20
|
-
|
|
21
|
-
[profile.release]
|
|
22
|
-
lto = true
|
package/benchmark/.gitignore
DELETED
package/benchmark/index.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import b from 'benny';
|
|
2
|
-
import * as node from 'rrule';
|
|
3
|
-
import * as rust from '../';
|
|
4
|
-
|
|
5
|
-
b.suite(
|
|
6
|
-
'UTC TZ',
|
|
7
|
-
b.add('rrule-rust', () => {
|
|
8
|
-
const rrule = new rust.RRule(rust.Frequency.Daily)
|
|
9
|
-
.setCount(30)
|
|
10
|
-
.setInterval(1);
|
|
11
|
-
const set = new rust.RRuleSet(
|
|
12
|
-
new rust.RRuleDateTime(new Date(1679428740000), 'UTC'),
|
|
13
|
-
).addRrule(rrule);
|
|
14
|
-
|
|
15
|
-
set.all();
|
|
16
|
-
}),
|
|
17
|
-
b.add('rrule', () => {
|
|
18
|
-
const rrule = new node.RRule({
|
|
19
|
-
freq: node.RRule.DAILY,
|
|
20
|
-
dtstart: new Date(Date.UTC(2023, 2, 21, 23, 59, 0)),
|
|
21
|
-
tzid: 'UTC',
|
|
22
|
-
count: 30,
|
|
23
|
-
interval: 1,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
rrule.all();
|
|
27
|
-
}),
|
|
28
|
-
|
|
29
|
-
b.cycle(),
|
|
30
|
-
b.complete(),
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
b.suite(
|
|
34
|
-
'Other TZ',
|
|
35
|
-
b.add('rrule-rust', () => {
|
|
36
|
-
const rrule = new rust.RRule(rust.Frequency.Daily)
|
|
37
|
-
.setCount(30)
|
|
38
|
-
.setInterval(1);
|
|
39
|
-
const set = new rust.RRuleSet(
|
|
40
|
-
new rust.RRuleDateTime(new Date(1679428740000), 'Pacific/Kiritimati'),
|
|
41
|
-
).addRrule(rrule);
|
|
42
|
-
|
|
43
|
-
set.all();
|
|
44
|
-
}),
|
|
45
|
-
b.add('rrule', () => {
|
|
46
|
-
const rrule = new node.RRule({
|
|
47
|
-
freq: node.RRule.DAILY,
|
|
48
|
-
dtstart: new Date(Date.UTC(2023, 2, 21, 23, 59, 0)),
|
|
49
|
-
tzid: 'Pacific/Kiritimati',
|
|
50
|
-
count: 30,
|
|
51
|
-
interval: 1,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
rrule.all();
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
b.cycle(),
|
|
58
|
-
b.complete(),
|
|
59
|
-
);
|
package/build.rs
DELETED
package/jest.config.ts
DELETED
package/src/js/frequency.rs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
use napi_derive::napi;
|
|
2
|
-
|
|
3
|
-
#[napi(js_name = "Frequency")]
|
|
4
|
-
pub enum Frequency {
|
|
5
|
-
Yearly,
|
|
6
|
-
Monthly,
|
|
7
|
-
Weekly,
|
|
8
|
-
Daily,
|
|
9
|
-
Hourly,
|
|
10
|
-
Minutely,
|
|
11
|
-
Secondly,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
impl From<rrule::Frequency> for Frequency {
|
|
15
|
-
fn from(freq: rrule::Frequency) -> Self {
|
|
16
|
-
match freq {
|
|
17
|
-
rrule::Frequency::Daily => Frequency::Daily,
|
|
18
|
-
rrule::Frequency::Hourly => Frequency::Hourly,
|
|
19
|
-
rrule::Frequency::Minutely => Frequency::Minutely,
|
|
20
|
-
rrule::Frequency::Monthly => Frequency::Monthly,
|
|
21
|
-
rrule::Frequency::Secondly => Frequency::Secondly,
|
|
22
|
-
rrule::Frequency::Weekly => Frequency::Weekly,
|
|
23
|
-
rrule::Frequency::Yearly => Frequency::Yearly,
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
impl Into<rrule::Frequency> for Frequency {
|
|
29
|
-
fn into(self) -> rrule::Frequency {
|
|
30
|
-
match self {
|
|
31
|
-
Frequency::Daily => rrule::Frequency::Daily,
|
|
32
|
-
Frequency::Hourly => rrule::Frequency::Hourly,
|
|
33
|
-
Frequency::Minutely => rrule::Frequency::Minutely,
|
|
34
|
-
Frequency::Monthly => rrule::Frequency::Monthly,
|
|
35
|
-
Frequency::Secondly => rrule::Frequency::Secondly,
|
|
36
|
-
Frequency::Weekly => rrule::Frequency::Weekly,
|
|
37
|
-
Frequency::Yearly => rrule::Frequency::Yearly,
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/js/month.rs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
use napi_derive::napi;
|
|
2
|
-
|
|
3
|
-
#[napi(js_name = "Month")]
|
|
4
|
-
pub enum Month {
|
|
5
|
-
January,
|
|
6
|
-
February,
|
|
7
|
-
March,
|
|
8
|
-
April,
|
|
9
|
-
May,
|
|
10
|
-
June,
|
|
11
|
-
July,
|
|
12
|
-
August,
|
|
13
|
-
September,
|
|
14
|
-
October,
|
|
15
|
-
November,
|
|
16
|
-
December,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
impl From<&u8> for Month {
|
|
20
|
-
fn from(month: &u8) -> Self {
|
|
21
|
-
match month {
|
|
22
|
-
0 => Month::January,
|
|
23
|
-
1 => Month::February,
|
|
24
|
-
2 => Month::March,
|
|
25
|
-
3 => Month::April,
|
|
26
|
-
4 => Month::May,
|
|
27
|
-
5 => Month::June,
|
|
28
|
-
6 => Month::July,
|
|
29
|
-
7 => Month::August,
|
|
30
|
-
8 => Month::September,
|
|
31
|
-
9 => Month::October,
|
|
32
|
-
10 => Month::November,
|
|
33
|
-
11 => Month::December,
|
|
34
|
-
_ => panic!("Unknown month index: {}", month),
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
impl Into<chrono::Month> for Month {
|
|
40
|
-
fn into(self) -> chrono::Month {
|
|
41
|
-
match self {
|
|
42
|
-
Month::January => chrono::Month::January,
|
|
43
|
-
Month::February => chrono::Month::February,
|
|
44
|
-
Month::March => chrono::Month::March,
|
|
45
|
-
Month::April => chrono::Month::April,
|
|
46
|
-
Month::May => chrono::Month::May,
|
|
47
|
-
Month::June => chrono::Month::June,
|
|
48
|
-
Month::July => chrono::Month::July,
|
|
49
|
-
Month::August => chrono::Month::August,
|
|
50
|
-
Month::September => chrono::Month::September,
|
|
51
|
-
Month::October => chrono::Month::October,
|
|
52
|
-
Month::November => chrono::Month::November,
|
|
53
|
-
Month::December => chrono::Month::December,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
package/src/js/n_weekday.rs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
use super::weekday::Weekday;
|
|
2
|
-
use napi_derive::napi;
|
|
3
|
-
|
|
4
|
-
#[napi(object, js_name = "NWeekday")]
|
|
5
|
-
pub struct NWeekday {
|
|
6
|
-
/// If set, this represents the nth occurrence of the weekday.
|
|
7
|
-
/// Otherwise it represents every occurrence of the weekday.
|
|
8
|
-
///
|
|
9
|
-
/// A negative value represents nth occurrence from the end.
|
|
10
|
-
pub n: Option<i16>,
|
|
11
|
-
pub weekday: Weekday,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
impl From<rrule::NWeekday> for NWeekday {
|
|
15
|
-
fn from(nday: rrule::NWeekday) -> Self {
|
|
16
|
-
match nday {
|
|
17
|
-
rrule::NWeekday::Every(weekday) => NWeekday {
|
|
18
|
-
n: None,
|
|
19
|
-
weekday: Weekday::from(weekday),
|
|
20
|
-
},
|
|
21
|
-
rrule::NWeekday::Nth(n, weekday) => NWeekday {
|
|
22
|
-
n: Some(n),
|
|
23
|
-
weekday: weekday.into(),
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
impl Into<rrule::NWeekday> for NWeekday {
|
|
30
|
-
fn into(self) -> rrule::NWeekday {
|
|
31
|
-
match self.n {
|
|
32
|
-
Some(n) => rrule::NWeekday::Nth(n, self.weekday.into()),
|
|
33
|
-
None => rrule::NWeekday::Every(self.weekday.into()),
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|