@marcoappio/marco-config 2.0.168 → 2.0.170

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.
Files changed (32) hide show
  1. package/dist/clients/account.d.ts +3 -3
  2. package/dist/clients/draft.d.ts +73 -5
  3. package/dist/clients/draft.d.ts.map +1 -1
  4. package/dist/clients/draft.js +34 -14
  5. package/dist/clients/index.d.ts +79 -11
  6. package/dist/clients/index.d.ts.map +1 -1
  7. package/dist/clients/user.d.ts +3 -3
  8. package/dist/schemas.d.ts +26 -11
  9. package/dist/schemas.d.ts.map +1 -1
  10. package/dist/schemas.js +34 -20
  11. package/dist/sdk/endpoints/index.d.ts +27 -7
  12. package/dist/sdk/endpoints/index.d.ts.map +1 -1
  13. package/dist/sdk/endpoints/private/index.d.ts +27 -7
  14. package/dist/sdk/endpoints/private/index.d.ts.map +1 -1
  15. package/dist/sdk/endpoints/private/sync/index.d.ts +27 -7
  16. package/dist/sdk/endpoints/private/sync/index.d.ts.map +1 -1
  17. package/dist/sdk/endpoints/private/sync/push/account.d.ts +3 -3
  18. package/dist/sdk/endpoints/private/sync/push/draft.d.ts +21 -1
  19. package/dist/sdk/endpoints/private/sync/push/draft.d.ts.map +1 -1
  20. package/dist/sdk/endpoints/private/sync/push/draft.js +14 -2
  21. package/dist/sdk/endpoints/private/sync/push/index.d.ts +27 -7
  22. package/dist/sdk/endpoints/private/sync/push/index.d.ts.map +1 -1
  23. package/dist/sdk/endpoints/private/sync/push/user.d.ts +3 -3
  24. package/dist/sdk/index.d.ts +27 -7
  25. package/dist/sdk/index.d.ts.map +1 -1
  26. package/dist/utils/stringPatch/stringPatch.d.ts +9 -0
  27. package/dist/utils/stringPatch/stringPatch.d.ts.map +1 -0
  28. package/dist/utils/stringPatch/stringPatch.js +36 -0
  29. package/dist/utils/stringPatch/stringPatch.test.d.ts +2 -0
  30. package/dist/utils/stringPatch/stringPatch.test.d.ts.map +1 -0
  31. package/dist/utils/stringPatch/stringPatch.test.js +101 -0
  32. package/package.json +4 -1
@@ -0,0 +1,101 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import { stringPatch } from './stringPatch';
3
+ describe('stringPatch', () => {
4
+ const testCases = [
5
+ ['hello world', 'hello beautiful world'],
6
+ ['the quick brown fox', 'the slow brown fox'],
7
+ ['', 'new content'],
8
+ ['delete me', ''],
9
+ ['no changes', 'no changes'],
10
+ ['one two three', 'one three'],
11
+ ['start middle end', 'start new middle end'],
12
+ ['repeated repeated words', 'repeated words'],
13
+ ['missing punctuation', 'missing, punctuation!'],
14
+ ['old formatting', 'NEW FORMATTING'],
15
+ ['extra spaces', 'extra spaces'],
16
+ ['camelCase', 'snake_case'],
17
+ ['this is a test', 'this is only a test'],
18
+ ['remove last word test', 'remove last word'],
19
+ ['beginning test', 'new beginning test'],
20
+ ['[brackets]', '{curly brackets}'],
21
+ ['line\nbreak', 'line break'],
22
+ ['tab\tseparated', 'space separated'],
23
+ ['numbers 123', 'numbers 456'],
24
+ ['special chars !@#', 'different chars $%^'],
25
+ ['uppercase TEXT', 'lowercase text'],
26
+ ['trim this ', 'trim this'],
27
+ [' leading space', 'leading space'],
28
+ ['mixed CASE text', 'all lower case text'],
29
+ ['join these words', 'jointheseswords'],
30
+ ['split,words,here', 'split words here'],
31
+ ['version 1.0.0', 'version 2.0.0'],
32
+ ['prefix-', 'prefix-added'],
33
+ ['-suffix', 'added-suffix'],
34
+ ['multi\nline\ntext', 'single line text'],
35
+ ['short', 'much longer replacement'],
36
+ ['very long original text', 'short'],
37
+ ['kebab-case', 'camelCase'],
38
+ ['PascalCase', 'camelCase'],
39
+ ['duplicate duplicate', 'duplicate'],
40
+ [' multiple spaces ', 'single space'],
41
+ ['<html>tags</html>', 'plain text'],
42
+ ['quoted \'text\'', 'quoted "text"'],
43
+ ['email@test.com', 'newemail@test.com'],
44
+ ['http://old.url', 'http://new.url'],
45
+ ['date: 2023-01-01', 'date: 2024-01-01'],
46
+ ['rgb(255,0,0)', 'rgb(0,255,0)'],
47
+ ['function(){\n}', 'function() {\n}'],
48
+ ['snake_case_text', 'camelCaseText'],
49
+ ['trailing comma,', 'no trailing comma'],
50
+ ['...ellipsis', 'no ellipsis'],
51
+ ['**markdown**', '_different markdown_'],
52
+ ['(parentheses)', '[brackets]'],
53
+ ['TRUE', 'false'],
54
+ ['1234567890', '0987654321'],
55
+ ['café', 'cafe'],
56
+ ['🌟 star', '⭐ star'],
57
+ ['é è ê ë', 'e e e e'],
58
+ ['über', 'uber'],
59
+ ['中文', 'chinese'],
60
+ ['→↓←↑', '>>>>'],
61
+ ['\u200B\u200Bzero width spaces\u200B', 'no zero width spaces'],
62
+ ['line1\r\nline2\r\nline3', 'line1\nline2\nline3'],
63
+ ['tab\u0009unicode', 'tab normal'],
64
+ ['no\u00A0break\u00A0space', 'normal spaces'],
65
+ ['mixed \t \n spaces', 'single space'],
66
+ ['hidden\u0000null', 'visible text'],
67
+ ['bell\u0007char', 'normal char'],
68
+ ['vertical\u000Btab', 'normal tab'],
69
+ ['Hello שָׁלוֹם', 'Hello peace'],
70
+ ['مرحبا world', 'hello world'],
71
+ ['a\u202Eb\u202Cc', 'abc'],
72
+ ['', ''],
73
+ ['a', ''],
74
+ ['', 'a'],
75
+ ['a', 'b'],
76
+ ['aa', 'a'],
77
+ ['a', 'aa'],
78
+ ['abababab', 'ab'],
79
+ ['aaaaaa', 'a'],
80
+ ['a b a b a b', 'a b'],
81
+ ['{"key":"value"}', '{"newKey":"newValue"}'],
82
+ ['[1,2,3]', '[4,5,6]'],
83
+ ['https://user:pass@host.com:8080/path?q=1#hash', 'https://newhost.com/path'],
84
+ ['?param1=1&param2=2', '?param1=2&param2=1'],
85
+ ['C:\\Windows\\Path', '/unix/path'],
86
+ ['./relative/path', '../other/path'],
87
+ ['2024-02-17T12:00:00Z', '2024-02-17T13:00:00Z'],
88
+ ['<![CDATA[test]]>', 'normal text'],
89
+ ['BASE64/test==', 'plain text'],
90
+ ['<script>alert(1)</script>', 'sanitized'],
91
+ ['../../../../etc/passwd', 'safe/path'],
92
+ ['Robert\'); DROP TABLE Students;--', 'Robert'],
93
+ ];
94
+ for (const [start, end] of testCases) {
95
+ it(`should create a patch for ${start} to ${end}`, () => {
96
+ const patch = stringPatch.create(start, end);
97
+ const patched = stringPatch.apply(start, patch);
98
+ expect(patched).toBe(end);
99
+ });
100
+ }
101
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "2.0.168",
3
+ "version": "2.0.170",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",
@@ -22,6 +22,7 @@
22
22
  "dependencies": {
23
23
  "@typescript-eslint/eslint-plugin": "5.62.0",
24
24
  "@typescript-eslint/parser": "6.21.0",
25
+ "diff": "7.0.0",
25
26
  "eslint": "8.41.0",
26
27
  "eslint-plugin-import": "2.29.1",
27
28
  "eslint-plugin-prefer-arrow": "1.2.3",
@@ -34,6 +35,8 @@
34
35
  },
35
36
  "devDependencies": {
36
37
  "@auto-it/npm": "11.2.0",
38
+ "@types/bun": "1.2.2",
39
+ "@types/diff": "7.0.1",
37
40
  "auto": "11.2.0",
38
41
  "tsc-alias": "1.8.10",
39
42
  "typescript": "5.5.4"