codecane 1.0.269 → 1.0.270
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/dist/background-process-manager.d.ts +1 -1
- package/dist/background-process-manager.js +3 -3
- package/dist/browser-runner.d.ts +1 -1
- package/dist/browser-runner.js +4 -4
- package/dist/chat-storage.d.ts +1 -1
- package/dist/chat-storage.js +1 -1
- package/dist/checkpoints/checkpoint-manager.d.ts +1 -1
- package/dist/checkpoints/checkpoint-manager.js +1 -1
- package/dist/cli-handlers/api-key.d.ts +1 -1
- package/dist/cli-handlers/api-key.js +1 -1
- package/dist/cli-handlers/diff.d.ts +1 -1
- package/dist/cli-handlers/inititalization-flow.js +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +2 -2
- package/dist/client.d.ts +7 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +9 -9
- package/dist/credentials.d.ts +1 -1
- package/dist/credentials.js +2 -2
- package/dist/dev-process-manager.d.ts +1 -1
- package/dist/dev-process-manager.js +1 -1
- package/dist/index.js +1 -1
- package/dist/menu.d.ts +1 -1
- package/dist/menu.js +1 -1
- package/dist/project-files.d.ts +2 -2
- package/dist/project-files.js +6 -6
- package/dist/startup-process-handler.d.ts +1 -1
- package/dist/tool-handlers.d.ts +2 -2
- package/dist/tool-handlers.js +4 -4
- package/dist/types.d.ts +1 -1
- package/dist/utils/__tests__/tool-renderers.test.js +1 -1
- package/dist/utils/__tests__/xml-stream-parser.test.js +1 -1
- package/dist/utils/analytics.d.ts +1 -1
- package/dist/utils/logger.js +2 -2
- package/dist/utils/terminal.js +3 -3
- package/dist/utils/tool-renderers.d.ts +1 -1
- package/dist/utils/tool-renderers.js +1 -1
- package/dist/utils/xml-stream-parser.d.ts +1 -1
- package/dist/utils/xml-stream-parser.js +2 -2
- package/dist/web-scraper.js +1 -1
- package/dist/workers/project-context.js +1 -1
- package/package.json +4 -4
- package/dist/common/actions.d.ts +0 -2590
- package/dist/common/actions.d.ts.map +0 -1
- package/dist/common/actions.js +0 -143
- package/dist/common/actions.js.map +0 -1
- package/dist/common/analytics.d.ts +0 -5
- package/dist/common/analytics.d.ts.map +0 -1
- package/dist/common/analytics.js +0 -40
- package/dist/common/analytics.js.map +0 -1
- package/dist/common/api-keys/constants.d.ts +0 -9
- package/dist/common/api-keys/constants.d.ts.map +0 -1
- package/dist/common/api-keys/constants.js +0 -26
- package/dist/common/api-keys/constants.js.map +0 -1
- package/dist/common/api-keys/crypto.d.ts +0 -25
- package/dist/common/api-keys/crypto.d.ts.map +0 -1
- package/dist/common/api-keys/crypto.js +0 -186
- package/dist/common/api-keys/crypto.js.map +0 -1
- package/dist/common/browser-actions.d.ts +0 -4416
- package/dist/common/browser-actions.d.ts.map +0 -1
- package/dist/common/browser-actions.js +0 -343
- package/dist/common/browser-actions.js.map +0 -1
- package/dist/common/constants/analytics-events.d.ts +0 -20
- package/dist/common/constants/analytics-events.d.ts.map +0 -1
- package/dist/common/constants/analytics-events.js +0 -27
- package/dist/common/constants/analytics-events.js.map +0 -1
- package/dist/common/constants/grant-priorities.d.ts +0 -3
- package/dist/common/constants/grant-priorities.d.ts.map +0 -1
- package/dist/common/constants/grant-priorities.js +0 -10
- package/dist/common/constants/grant-priorities.js.map +0 -1
- package/dist/common/constants/tools.d.ts +0 -17
- package/dist/common/constants/tools.d.ts.map +0 -1
- package/dist/common/constants/tools.js +0 -44
- package/dist/common/constants/tools.js.map +0 -1
- package/dist/common/constants.d.ts +0 -135
- package/dist/common/constants.d.ts.map +0 -1
- package/dist/common/constants.js +0 -180
- package/dist/common/constants.js.map +0 -1
- package/dist/common/db/drizzle.config.d.ts +0 -3
- package/dist/common/db/drizzle.config.d.ts.map +0 -1
- package/dist/common/db/drizzle.config.js +0 -17
- package/dist/common/db/drizzle.config.js.map +0 -1
- package/dist/common/db/env.d.mts +0 -2
- package/dist/common/db/env.d.mts.map +0 -1
- package/dist/common/db/env.mjs +0 -26
- package/dist/common/db/env.mjs.map +0 -1
- package/dist/common/db/index.d.ts +0 -7
- package/dist/common/db/index.d.ts.map +0 -1
- package/dist/common/db/index.js +0 -35
- package/dist/common/db/index.js.map +0 -1
- package/dist/common/db/schema.d.ts +0 -1420
- package/dist/common/db/schema.d.ts.map +0 -1
- package/dist/common/db/schema.js +0 -175
- package/dist/common/db/schema.js.map +0 -1
- package/dist/common/db/transaction.d.ts +0 -13
- package/dist/common/db/transaction.d.ts.map +0 -1
- package/dist/common/db/transaction.js +0 -36
- package/dist/common/db/transaction.js.map +0 -1
- package/dist/common/env.d.mts +0 -2
- package/dist/common/env.d.mts.map +0 -1
- package/dist/common/env.mjs +0 -40
- package/dist/common/env.mjs.map +0 -1
- package/dist/common/json-config/__tests__/stringify-schema.test.d.ts +0 -2
- package/dist/common/json-config/__tests__/stringify-schema.test.d.ts.map +0 -1
- package/dist/common/json-config/__tests__/stringify-schema.test.js +0 -66
- package/dist/common/json-config/__tests__/stringify-schema.test.js.map +0 -1
- package/dist/common/json-config/constants.d.ts +0 -83
- package/dist/common/json-config/constants.d.ts.map +0 -1
- package/dist/common/json-config/constants.js +0 -48
- package/dist/common/json-config/constants.js.map +0 -1
- package/dist/common/json-config/parser.d.ts +0 -8
- package/dist/common/json-config/parser.d.ts.map +0 -1
- package/dist/common/json-config/parser.js +0 -51
- package/dist/common/json-config/parser.js.map +0 -1
- package/dist/common/json-config/stringify-schema.d.ts +0 -10
- package/dist/common/json-config/stringify-schema.d.ts.map +0 -1
- package/dist/common/json-config/stringify-schema.js +0 -131
- package/dist/common/json-config/stringify-schema.js.map +0 -1
- package/dist/common/project-file-tree.d.ts +0 -12
- package/dist/common/project-file-tree.d.ts.map +0 -1
- package/dist/common/project-file-tree.js +0 -200
- package/dist/common/project-file-tree.js.map +0 -1
- package/dist/common/types/agent-state.d.ts +0 -465
- package/dist/common/types/agent-state.d.ts.map +0 -1
- package/dist/common/types/agent-state.js +0 -32
- package/dist/common/types/agent-state.js.map +0 -1
- package/dist/common/types/grant.d.ts +0 -3
- package/dist/common/types/grant.d.ts.map +0 -1
- package/dist/common/types/grant.js +0 -10
- package/dist/common/types/grant.js.map +0 -1
- package/dist/common/types/message.d.ts +0 -312
- package/dist/common/types/message.d.ts.map +0 -1
- package/dist/common/types/message.js +0 -54
- package/dist/common/types/message.js.map +0 -1
- package/dist/common/types/referral.d.ts +0 -3
- package/dist/common/types/referral.d.ts.map +0 -1
- package/dist/common/types/referral.js +0 -5
- package/dist/common/types/referral.js.map +0 -1
- package/dist/common/types/tools.d.ts +0 -6
- package/dist/common/types/tools.d.ts.map +0 -1
- package/dist/common/types/tools.js +0 -3
- package/dist/common/types/tools.js.map +0 -1
- package/dist/common/types/usage.d.ts +0 -41
- package/dist/common/types/usage.d.ts.map +0 -1
- package/dist/common/types/usage.js +0 -15
- package/dist/common/types/usage.js.map +0 -1
- package/dist/common/util/__tests__/messages.test.d.ts +0 -2
- package/dist/common/util/__tests__/messages.test.d.ts.map +0 -1
- package/dist/common/util/__tests__/messages.test.js +0 -70
- package/dist/common/util/__tests__/messages.test.js.map +0 -1
- package/dist/common/util/__tests__/saxy.test.d.ts +0 -2
- package/dist/common/util/__tests__/saxy.test.d.ts.map +0 -1
- package/dist/common/util/__tests__/saxy.test.js +0 -262
- package/dist/common/util/__tests__/saxy.test.js.map +0 -1
- package/dist/common/util/__tests__/string.test.d.ts +0 -2
- package/dist/common/util/__tests__/string.test.d.ts.map +0 -1
- package/dist/common/util/__tests__/string.test.js +0 -82
- package/dist/common/util/__tests__/string.test.js.map +0 -1
- package/dist/common/util/array.d.ts +0 -7
- package/dist/common/util/array.d.ts.map +0 -1
- package/dist/common/util/array.js +0 -32
- package/dist/common/util/array.js.map +0 -1
- package/dist/common/util/changes.d.ts +0 -8
- package/dist/common/util/changes.d.ts.map +0 -1
- package/dist/common/util/changes.js +0 -78
- package/dist/common/util/changes.js.map +0 -1
- package/dist/common/util/credentials.d.ts +0 -26
- package/dist/common/util/credentials.d.ts.map +0 -1
- package/dist/common/util/credentials.js +0 -24
- package/dist/common/util/credentials.js.map +0 -1
- package/dist/common/util/currency.d.ts +0 -15
- package/dist/common/util/currency.d.ts.map +0 -1
- package/dist/common/util/currency.js +0 -23
- package/dist/common/util/currency.js.map +0 -1
- package/dist/common/util/dates.d.ts +0 -11
- package/dist/common/util/dates.d.ts.map +0 -1
- package/dist/common/util/dates.js +0 -22
- package/dist/common/util/dates.js.map +0 -1
- package/dist/common/util/file.d.ts +0 -160
- package/dist/common/util/file.d.ts.map +0 -1
- package/dist/common/util/file.js +0 -192
- package/dist/common/util/file.js.map +0 -1
- package/dist/common/util/git.d.ts +0 -7
- package/dist/common/util/git.d.ts.map +0 -1
- package/dist/common/util/git.js +0 -81
- package/dist/common/util/git.js.map +0 -1
- package/dist/common/util/logger.d.ts +0 -9
- package/dist/common/util/logger.d.ts.map +0 -1
- package/dist/common/util/logger.js +0 -52
- package/dist/common/util/logger.js.map +0 -1
- package/dist/common/util/lru-cache.d.ts +0 -31
- package/dist/common/util/lru-cache.d.ts.map +0 -1
- package/dist/common/util/lru-cache.js +0 -68
- package/dist/common/util/lru-cache.js.map +0 -1
- package/dist/common/util/messages.d.ts +0 -10
- package/dist/common/util/messages.d.ts.map +0 -1
- package/dist/common/util/messages.js +0 -69
- package/dist/common/util/messages.js.map +0 -1
- package/dist/common/util/min-heap.d.ts +0 -16
- package/dist/common/util/min-heap.d.ts.map +0 -1
- package/dist/common/util/min-heap.js +0 -73
- package/dist/common/util/min-heap.js.map +0 -1
- package/dist/common/util/object.d.ts +0 -19
- package/dist/common/util/object.d.ts.map +0 -1
- package/dist/common/util/object.js +0 -91
- package/dist/common/util/object.js.map +0 -1
- package/dist/common/util/patch.d.ts +0 -2
- package/dist/common/util/patch.d.ts.map +0 -1
- package/dist/common/util/patch.js +0 -215
- package/dist/common/util/patch.js.map +0 -1
- package/dist/common/util/promise.d.ts +0 -18
- package/dist/common/util/promise.d.ts.map +0 -1
- package/dist/common/util/promise.js +0 -80
- package/dist/common/util/promise.js.map +0 -1
- package/dist/common/util/referral.d.ts +0 -2
- package/dist/common/util/referral.d.ts.map +0 -1
- package/dist/common/util/referral.js +0 -6
- package/dist/common/util/referral.js.map +0 -1
- package/dist/common/util/saxy.d.ts +0 -167
- package/dist/common/util/saxy.d.ts.map +0 -1
- package/dist/common/util/saxy.js +0 -473
- package/dist/common/util/saxy.js.map +0 -1
- package/dist/common/util/string.d.ts +0 -62
- package/dist/common/util/string.d.ts.map +0 -1
- package/dist/common/util/string.js +0 -220
- package/dist/common/util/string.js.map +0 -1
- package/dist/common/util/stripe.d.ts +0 -4
- package/dist/common/util/stripe.d.ts.map +0 -1
- package/dist/common/util/stripe.js +0 -22
- package/dist/common/util/stripe.js.map +0 -1
- package/dist/common/util/sync-failure.d.ts +0 -2
- package/dist/common/util/sync-failure.d.ts.map +0 -1
- package/dist/common/util/sync-failure.js +0 -57
- package/dist/common/util/sync-failure.js.map +0 -1
- package/dist/common/websockets/websocket-client.d.ts +0 -43
- package/dist/common/websockets/websocket-client.d.ts.map +0 -1
- package/dist/common/websockets/websocket-client.js +0 -216
- package/dist/common/websockets/websocket-client.js.map +0 -1
- package/dist/common/websockets/websocket-schema.d.ts +0 -4867
- package/dist/common/websockets/websocket-schema.d.ts.map +0 -1
- package/dist/common/websockets/websocket-schema.js +0 -55
- package/dist/common/websockets/websocket-schema.js.map +0 -1
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const bun_test_1 = require("bun:test");
|
|
4
|
-
const saxy_1 = require("../saxy");
|
|
5
|
-
(0, bun_test_1.describe)('Saxy XML Parser', () => {
|
|
6
|
-
// Helper function to process XML and get events
|
|
7
|
-
const processXML = (xml, schema) => {
|
|
8
|
-
const events = [];
|
|
9
|
-
const parser = new saxy_1.Saxy(schema);
|
|
10
|
-
parser.on('text', (data) => events.push({ type: 'text', data }));
|
|
11
|
-
parser.on('tagopen', (data) => events.push({ type: 'tagopen', data }));
|
|
12
|
-
parser.on('tagclose', (data) => events.push({ type: 'tagclose', data }));
|
|
13
|
-
parser.write(xml);
|
|
14
|
-
parser.end();
|
|
15
|
-
return events;
|
|
16
|
-
};
|
|
17
|
-
(0, bun_test_1.describe)('Schema Validation with Text Conversion', () => {
|
|
18
|
-
(0, bun_test_1.it)('should convert invalid top-level tags to text nodes', () => {
|
|
19
|
-
const schema = { root: ['child'] };
|
|
20
|
-
const xml = '<invalid>content</invalid>';
|
|
21
|
-
const events = processXML(xml, schema);
|
|
22
|
-
(0, bun_test_1.expect)(events).toEqual([
|
|
23
|
-
{
|
|
24
|
-
type: 'text',
|
|
25
|
-
data: { contents: '<invalid>' },
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'text',
|
|
29
|
-
data: { contents: 'content' },
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: 'text',
|
|
33
|
-
data: { contents: '</invalid>' },
|
|
34
|
-
},
|
|
35
|
-
]);
|
|
36
|
-
});
|
|
37
|
-
(0, bun_test_1.it)('should convert invalid nested tags to text nodes', () => {
|
|
38
|
-
const schema = { root: ['child'] };
|
|
39
|
-
const xml = '<other><invalid>content</invalid></other>';
|
|
40
|
-
const events = processXML(xml, schema);
|
|
41
|
-
(0, bun_test_1.expect)(events).toEqual([
|
|
42
|
-
{
|
|
43
|
-
type: 'text',
|
|
44
|
-
data: { contents: '<other>' },
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: 'text',
|
|
48
|
-
data: { contents: '<invalid>' },
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: 'text',
|
|
52
|
-
data: { contents: 'content' },
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: 'text',
|
|
56
|
-
data: { contents: '</invalid>' },
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: 'text',
|
|
60
|
-
data: { contents: '</other>' },
|
|
61
|
-
},
|
|
62
|
-
]);
|
|
63
|
-
});
|
|
64
|
-
(0, bun_test_1.it)('should handle valid nested tags according to schema', () => {
|
|
65
|
-
const schema = { root: ['child'] };
|
|
66
|
-
const xml = '<root><child>content</child></root>';
|
|
67
|
-
const events = processXML(xml, schema);
|
|
68
|
-
(0, bun_test_1.expect)(events).toEqual([
|
|
69
|
-
{
|
|
70
|
-
type: 'tagopen',
|
|
71
|
-
data: {
|
|
72
|
-
attrs: '',
|
|
73
|
-
isSelfClosing: false,
|
|
74
|
-
name: 'root',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
type: 'tagopen',
|
|
79
|
-
data: {
|
|
80
|
-
attrs: '',
|
|
81
|
-
isSelfClosing: false,
|
|
82
|
-
name: 'child',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: 'text',
|
|
87
|
-
data: { contents: 'content' },
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: 'tagclose',
|
|
91
|
-
data: { name: 'child' },
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
type: 'tagclose',
|
|
95
|
-
data: { name: 'root' },
|
|
96
|
-
},
|
|
97
|
-
]);
|
|
98
|
-
});
|
|
99
|
-
(0, bun_test_1.it)('should convert closing tags to text when parent is invalid', () => {
|
|
100
|
-
const schema = { root: ['child'] };
|
|
101
|
-
const xml = '<root><invalid>content</invalid><child/></root>';
|
|
102
|
-
const events = processXML(xml, schema);
|
|
103
|
-
(0, bun_test_1.expect)(events[1]).toEqual({
|
|
104
|
-
type: 'text',
|
|
105
|
-
data: { contents: '<invalid>' },
|
|
106
|
-
});
|
|
107
|
-
(0, bun_test_1.expect)(events[2]).toEqual({
|
|
108
|
-
type: 'text',
|
|
109
|
-
data: { contents: 'content' },
|
|
110
|
-
});
|
|
111
|
-
(0, bun_test_1.expect)(events[3]).toEqual({
|
|
112
|
-
type: 'text',
|
|
113
|
-
data: { contents: '</invalid>' },
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
(0, bun_test_1.it)('should handle tags starting with whitespace as text', () => {
|
|
117
|
-
const schema = { root: ['child'] };
|
|
118
|
-
const xml = '<root>< invalid>content</invalid></root>';
|
|
119
|
-
const events = processXML(xml, schema);
|
|
120
|
-
(0, bun_test_1.expect)(events[1]).toEqual({
|
|
121
|
-
type: 'text',
|
|
122
|
-
data: { contents: '< invalid>content' },
|
|
123
|
-
});
|
|
124
|
-
(0, bun_test_1.expect)(events[2]).toEqual({
|
|
125
|
-
type: 'text',
|
|
126
|
-
data: { contents: '</invalid>' },
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
(0, bun_test_1.describe)('Edge Cases', () => {
|
|
131
|
-
(0, bun_test_1.it)('should handle self-closing invalid tags', () => {
|
|
132
|
-
const schema = { root: ['child'] };
|
|
133
|
-
const xml = '<root><invalid/></root>';
|
|
134
|
-
const events = processXML(xml, schema);
|
|
135
|
-
(0, bun_test_1.expect)(events[1]).toEqual({
|
|
136
|
-
type: 'text',
|
|
137
|
-
data: { contents: '<invalid/>' },
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
(0, bun_test_1.it)('should handle nested invalid tags', () => {
|
|
141
|
-
const schema = { root: ['child'] };
|
|
142
|
-
const xml = '<root><invalid><alsoinvalid/></invalid></root>';
|
|
143
|
-
const events = processXML(xml, schema);
|
|
144
|
-
(0, bun_test_1.expect)(events[1]).toEqual({
|
|
145
|
-
type: 'text',
|
|
146
|
-
data: { contents: '<invalid>' },
|
|
147
|
-
});
|
|
148
|
-
(0, bun_test_1.expect)(events[2]).toEqual({
|
|
149
|
-
type: 'text',
|
|
150
|
-
data: { contents: '<alsoinvalid/>' },
|
|
151
|
-
});
|
|
152
|
-
(0, bun_test_1.expect)(events[3]).toEqual({
|
|
153
|
-
type: 'text',
|
|
154
|
-
data: { contents: '</invalid>' },
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
(0, bun_test_1.it)('should preserve attributes in converted text nodes', () => {
|
|
158
|
-
const schema = { root: ['child'] };
|
|
159
|
-
const xml = '<root><invalid attr="value">content</invalid></root>';
|
|
160
|
-
const events = processXML(xml, schema);
|
|
161
|
-
(0, bun_test_1.expect)(events[1]).toEqual({
|
|
162
|
-
type: 'text',
|
|
163
|
-
data: { contents: '<invalid attr="value">' },
|
|
164
|
-
});
|
|
165
|
-
(0, bun_test_1.expect)(events[2]).toEqual({
|
|
166
|
-
type: 'text',
|
|
167
|
-
data: { contents: 'content' },
|
|
168
|
-
});
|
|
169
|
-
(0, bun_test_1.expect)(events[3]).toEqual({
|
|
170
|
-
type: 'text',
|
|
171
|
-
data: { contents: '</invalid>' },
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
(0, bun_test_1.it)('should handle text that looks like invalid XML tags', () => {
|
|
176
|
-
const parser = new saxy_1.Saxy();
|
|
177
|
-
const events = [];
|
|
178
|
-
parser.on('text', (data) => events.push({ type: 'text', data }));
|
|
179
|
-
parser.on('tagopen', (data) => events.push({ type: 'tagopen', data }));
|
|
180
|
-
parser.on('tagclose', (data) => events.push({ type: 'tagclose', data }));
|
|
181
|
-
parser.write('This is < not a tag> and < another not a tag> but <valid>this is</valid>');
|
|
182
|
-
parser.end();
|
|
183
|
-
(0, bun_test_1.expect)(events).toEqual([
|
|
184
|
-
{
|
|
185
|
-
type: 'text',
|
|
186
|
-
data: {
|
|
187
|
-
contents: 'This is < not a tag> and < another not a tag> but ',
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
type: 'tagopen',
|
|
192
|
-
data: { name: 'valid', isSelfClosing: false, attrs: '' },
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
type: 'text',
|
|
196
|
-
data: { contents: 'this is' },
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
type: 'tagclose',
|
|
200
|
-
data: { name: 'valid' },
|
|
201
|
-
},
|
|
202
|
-
]);
|
|
203
|
-
});
|
|
204
|
-
(0, bun_test_1.it)('should handle text with angle brackets but no valid tag names', () => {
|
|
205
|
-
const parser = new saxy_1.Saxy();
|
|
206
|
-
const events = [];
|
|
207
|
-
parser.on('text', (data) => events.push({ type: 'text', data }));
|
|
208
|
-
parser.write('Math expressions: 2 < 3 and 5 > 4');
|
|
209
|
-
parser.end();
|
|
210
|
-
(0, bun_test_1.expect)(events).toEqual([
|
|
211
|
-
{
|
|
212
|
-
type: 'text',
|
|
213
|
-
data: { contents: 'Math expressions: 2 < 3 and 5 > 4' },
|
|
214
|
-
},
|
|
215
|
-
]);
|
|
216
|
-
});
|
|
217
|
-
(0, bun_test_1.it)('should correctly parse mixed valid and invalid XML-like content', () => {
|
|
218
|
-
const parser = new saxy_1.Saxy();
|
|
219
|
-
const events = [];
|
|
220
|
-
parser.on('text', (data) => events.push({ type: 'text', data }));
|
|
221
|
-
parser.on('tagopen', (data) => events.push({ type: 'tagopen', data }));
|
|
222
|
-
parser.on('tagclose', (data) => events.push({ type: 'tagclose', data }));
|
|
223
|
-
parser.write('Text with < brackets> and <valid-tag>real XML</valid-tag> mixed together');
|
|
224
|
-
parser.end();
|
|
225
|
-
(0, bun_test_1.expect)(events).toEqual([
|
|
226
|
-
{
|
|
227
|
-
type: 'text',
|
|
228
|
-
data: { contents: 'Text with < brackets> and ' },
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
type: 'tagopen',
|
|
232
|
-
data: { name: 'valid-tag', isSelfClosing: false, attrs: '' },
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
type: 'text',
|
|
236
|
-
data: { contents: 'real XML' },
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
type: 'tagclose',
|
|
240
|
-
data: { name: 'valid-tag' },
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
type: 'text',
|
|
244
|
-
data: { contents: ' mixed together' },
|
|
245
|
-
},
|
|
246
|
-
]);
|
|
247
|
-
});
|
|
248
|
-
(0, bun_test_1.it)('should handle edge cases with special characters after <', () => {
|
|
249
|
-
const parser = new saxy_1.Saxy();
|
|
250
|
-
const events = [];
|
|
251
|
-
parser.on('text', (data) => events.push({ type: 'text', data }));
|
|
252
|
-
parser.write('Text with <1>, <@invalid>, and <!not-a-tag>');
|
|
253
|
-
parser.end();
|
|
254
|
-
(0, bun_test_1.expect)(events).toEqual([
|
|
255
|
-
{
|
|
256
|
-
type: 'text',
|
|
257
|
-
data: { contents: 'Text with <1>, <@invalid>, and <!not-a-tag>' },
|
|
258
|
-
},
|
|
259
|
-
]);
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
//# sourceMappingURL=saxy.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"saxy.test.js","sourceRoot":"","sources":["../../../src/util/__tests__/saxy.test.ts"],"names":[],"mappings":";;AAAA,uCAA+C;AAE/C,kCAA8B;AAE9B,IAAA,mBAAQ,EAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,gDAAgD;IAChD,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,MAAiC,EAAE,EAAE;QACpE,MAAM,MAAM,GAAuC,EAAE,CAAA;QACrD,MAAM,MAAM,GAAG,IAAI,WAAI,CAAC,MAAM,CAAC,CAAA;QAE/B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAChE,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QACtE,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,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B,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;aAC5B;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE;aACtC;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAA,aAAE,EAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,MAAM,GAAG,IAAI,WAAI,EAAE,CAAA;QACzB,MAAM,MAAM,GAAU,EAAE,CAAA;QACxB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAEhE,MAAM,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAC3D,MAAM,CAAC,GAAG,EAAE,CAAA;QAEZ,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,EAAE,QAAQ,EAAE,6CAA6C,EAAE;aAClE;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/string.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const bun_test_1 = require("bun:test");
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
const string_1 = require("../string");
|
|
6
|
-
(0, bun_test_1.describe)('replaceNonStandardPlaceholderComments', () => {
|
|
7
|
-
(0, bun_test_1.it)('should replace C-style comments', () => {
|
|
8
|
-
const input = `
|
|
9
|
-
function example() {
|
|
10
|
-
// ... some code ...
|
|
11
|
-
console.log('Hello');
|
|
12
|
-
// ... rest of the function ...
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
15
|
-
const expected = `
|
|
16
|
-
function example() {
|
|
17
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
18
|
-
console.log('Hello');
|
|
19
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
(0, bun_test_1.expect)((0, string_1.replaceNonStandardPlaceholderComments)(input, constants_1.EXISTING_CODE_MARKER)).toBe(expected);
|
|
23
|
-
});
|
|
24
|
-
(0, bun_test_1.it)('should replace multi-line C-style comments', () => {
|
|
25
|
-
const input = `
|
|
26
|
-
function example() {
|
|
27
|
-
/* ... some code ... */
|
|
28
|
-
console.log('Hello');
|
|
29
|
-
/* ... rest of the function ... */
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
const expected = `
|
|
33
|
-
function example() {
|
|
34
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
35
|
-
console.log('Hello');
|
|
36
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
(0, bun_test_1.expect)((0, string_1.replaceNonStandardPlaceholderComments)(input, constants_1.EXISTING_CODE_MARKER)).toBe(expected);
|
|
40
|
-
});
|
|
41
|
-
(0, bun_test_1.it)('should replace Python-style comments', () => {
|
|
42
|
-
const input = `
|
|
43
|
-
def example():
|
|
44
|
-
# ... some code ...
|
|
45
|
-
print('Hello')
|
|
46
|
-
# ... rest of the function ...
|
|
47
|
-
`;
|
|
48
|
-
const expected = `
|
|
49
|
-
def example():
|
|
50
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
51
|
-
print('Hello')
|
|
52
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
53
|
-
`;
|
|
54
|
-
(0, bun_test_1.expect)((0, string_1.replaceNonStandardPlaceholderComments)(input, constants_1.EXISTING_CODE_MARKER)).toBe(expected);
|
|
55
|
-
});
|
|
56
|
-
(0, bun_test_1.it)('should replace JSX comments', () => {
|
|
57
|
-
const input = `
|
|
58
|
-
function Example() {
|
|
59
|
-
return (
|
|
60
|
-
<div>
|
|
61
|
-
{/* ... existing code ... */}
|
|
62
|
-
<p>Hello, World!</p>
|
|
63
|
-
{/* ...rest of component... */}
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
const expected = `
|
|
69
|
-
function Example() {
|
|
70
|
-
return (
|
|
71
|
-
<div>
|
|
72
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
73
|
-
<p>Hello, World!</p>
|
|
74
|
-
${constants_1.EXISTING_CODE_MARKER}
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
(0, bun_test_1.expect)((0, string_1.replaceNonStandardPlaceholderComments)(input, constants_1.EXISTING_CODE_MARKER)).toBe(expected);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
//# sourceMappingURL=string.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.test.js","sourceRoot":"","sources":["../../../src/util/__tests__/string.test.ts"],"names":[],"mappings":";;AAAA,uCAA+C;AAE/C,+CAAsD;AACtD,sCAAiE;AAEjE,IAAA,mBAAQ,EAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,IAAA,aAAE,EAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,KAAK,GAAG;;;;;;CAMjB,CAAA;QACG,MAAM,QAAQ,GAAG;;IAEjB,gCAAoB;;IAEpB,gCAAoB;;CAEvB,CAAA;QACG,IAAA,iBAAM,EACJ,IAAA,8CAAqC,EAAC,KAAK,EAAE,gCAAoB,CAAC,CACnE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,IAAA,aAAE,EAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,KAAK,GAAG;;;;;;CAMjB,CAAA;QACG,MAAM,QAAQ,GAAG;;IAEjB,gCAAoB;;IAEpB,gCAAoB;;CAEvB,CAAA;QACG,IAAA,iBAAM,EACJ,IAAA,8CAAqC,EAAC,KAAK,EAAE,gCAAoB,CAAC,CACnE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,IAAA,aAAE,EAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,KAAK,GAAG;;;;;CAKjB,CAAA;QACG,MAAM,QAAQ,GAAG;;MAEf,gCAAoB;;MAEpB,gCAAoB;CACzB,CAAA;QACG,IAAA,iBAAM,EACJ,IAAA,8CAAqC,EAAC,KAAK,EAAE,gCAAoB,CAAC,CACnE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,IAAA,aAAE,EAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,KAAK,GAAG;;;;;;;;;;CAUjB,CAAA;QACG,MAAM,QAAQ,GAAG;;;;QAIb,gCAAoB;;QAEpB,gCAAoB;;;;CAI3B,CAAA;QACG,IAAA,iBAAM,EACJ,IAAA,8CAAqC,EAAC,KAAK,EAAE,gCAAoB,CAAC,CACnE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function filterDefined<T>(array: (T | null | undefined)[]): T[];
|
|
2
|
-
type Falsey = false | undefined | null | 0 | '';
|
|
3
|
-
type FalseyValueArray<T> = T | Falsey | FalseyValueArray<T>[];
|
|
4
|
-
export declare function buildArray<T>(...params: FalseyValueArray<T>[]): T[];
|
|
5
|
-
export declare function groupConsecutive<T, U>(xs: T[], key: (x: T) => U): any[];
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=array.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/util/array.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GACQ,CAAC,EAAE,CAC1E;AAED,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,CAAA;AAC/C,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAA;AAE7D,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,GACrB,CAAC,EAAE,CAC3C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAiB/D"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterDefined = filterDefined;
|
|
4
|
-
exports.buildArray = buildArray;
|
|
5
|
-
exports.groupConsecutive = groupConsecutive;
|
|
6
|
-
const lodash_1 = require("lodash");
|
|
7
|
-
function filterDefined(array) {
|
|
8
|
-
return array.filter((item) => item !== null && item !== undefined);
|
|
9
|
-
}
|
|
10
|
-
function buildArray(...params) {
|
|
11
|
-
return (0, lodash_1.compact)((0, lodash_1.flattenDeep)(params));
|
|
12
|
-
}
|
|
13
|
-
function groupConsecutive(xs, key) {
|
|
14
|
-
if (!xs.length) {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
const result = [];
|
|
18
|
-
let curr = { key: key(xs[0]), items: [xs[0]] };
|
|
19
|
-
for (const x of xs.slice(1)) {
|
|
20
|
-
const k = key(x);
|
|
21
|
-
if (!(0, lodash_1.isEqual)(k, curr.key)) {
|
|
22
|
-
result.push(curr);
|
|
23
|
-
curr = { key: k, items: [x] };
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
curr.items.push(x);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
result.push(curr);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=array.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/util/array.ts"],"names":[],"mappings":";;AAEA,sCAEC;AAKD,gCAEC;AAED,4CAiBC;AA9BD,mCAAsD;AAEtD,SAAgB,aAAa,CAAI,KAA+B;IAC9D,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,CAAQ,CAAA;AAC3E,CAAC;AAKD,SAAgB,UAAU,CAAI,GAAG,MAA6B;IAC5D,OAAO,IAAA,gBAAO,EAAC,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAQ,CAAA;AAC5C,CAAC;AAED,SAAgB,gBAAgB,CAAO,EAAO,EAAE,GAAgB;IAC9D,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;QACf,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,MAAM,GAAU,EAAE,CAAA;IACxB,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9C,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;QAChB,IAAI,CAAC,IAAA,gBAAO,EAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACjB,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAC/B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjB,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FileChanges } from '../actions';
|
|
2
|
-
export declare function applyChanges(projectRoot: string, changes: FileChanges): {
|
|
3
|
-
created: string[];
|
|
4
|
-
modified: string[];
|
|
5
|
-
ignored: string[];
|
|
6
|
-
};
|
|
7
|
-
export declare function applyAndRevertChanges(projectRoot: string, changes: FileChanges, onApply: () => Promise<void>): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=changes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/util/changes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAIxC,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;;;;EAsCrE;AAED,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,iBA2B7B"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.applyChanges = applyChanges;
|
|
7
|
-
exports.applyAndRevertChanges = applyAndRevertChanges;
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const project_file_tree_1 = require("../project-file-tree");
|
|
11
|
-
const patch_1 = require("./patch");
|
|
12
|
-
function applyChanges(projectRoot, changes) {
|
|
13
|
-
const created = [];
|
|
14
|
-
const modified = [];
|
|
15
|
-
const ignored = [];
|
|
16
|
-
for (const change of changes) {
|
|
17
|
-
const { path: filePath, content, type } = change;
|
|
18
|
-
if ((0, project_file_tree_1.isFileIgnored)(filePath, projectRoot)) {
|
|
19
|
-
ignored.push(filePath);
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const fullPath = path_1.default.join(projectRoot, filePath);
|
|
23
|
-
try {
|
|
24
|
-
const fileExists = fs_1.default.existsSync(fullPath);
|
|
25
|
-
if (!fileExists) {
|
|
26
|
-
// Create directories in the path if they don't exist
|
|
27
|
-
const dirPath = path_1.default.dirname(fullPath);
|
|
28
|
-
fs_1.default.mkdirSync(dirPath, { recursive: true });
|
|
29
|
-
}
|
|
30
|
-
if (type === 'file') {
|
|
31
|
-
fs_1.default.writeFileSync(fullPath, content);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
const oldContent = fs_1.default.readFileSync(fullPath, 'utf-8');
|
|
35
|
-
const newContent = (0, patch_1.applyPatch)(oldContent, content);
|
|
36
|
-
fs_1.default.writeFileSync(fullPath, newContent);
|
|
37
|
-
}
|
|
38
|
-
if (fileExists) {
|
|
39
|
-
modified.push(filePath);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
created.push(filePath);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
console.error(`Failed to apply patch to ${filePath}:`, error, content);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return { created, modified, ignored };
|
|
50
|
-
}
|
|
51
|
-
async function applyAndRevertChanges(projectRoot, changes, onApply) {
|
|
52
|
-
const filesChanged = changes.map((change) => change.path);
|
|
53
|
-
const files = Object.fromEntries(filesChanged.map((filePath) => {
|
|
54
|
-
const fullPath = path_1.default.join(projectRoot, filePath);
|
|
55
|
-
const oldContent = fs_1.default.existsSync(fullPath)
|
|
56
|
-
? fs_1.default.readFileSync(fullPath, 'utf-8')
|
|
57
|
-
: '[DOES_NOT_EXIST]';
|
|
58
|
-
return [filePath, oldContent];
|
|
59
|
-
}));
|
|
60
|
-
applyChanges(projectRoot, changes);
|
|
61
|
-
try {
|
|
62
|
-
await onApply();
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
console.error(`Failed to apply changes:`, error);
|
|
66
|
-
}
|
|
67
|
-
for (const [filePath, oldContent] of Object.entries(files)) {
|
|
68
|
-
if (oldContent === '[DOES_NOT_EXIST]') {
|
|
69
|
-
if (fs_1.default.existsSync(path_1.default.join(projectRoot, filePath))) {
|
|
70
|
-
fs_1.default.unlinkSync(path_1.default.join(projectRoot, filePath));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
fs_1.default.writeFileSync(path_1.default.join(projectRoot, filePath), oldContent);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=changes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"changes.js","sourceRoot":"","sources":["../../src/util/changes.ts"],"names":[],"mappings":";;;;;AAOA,oCAsCC;AAED,sDA8BC;AA7ED,4CAAmB;AACnB,gDAAuB;AAGvB,4DAAoD;AACpD,mCAAoC;AAEpC,SAAgB,YAAY,CAAC,WAAmB,EAAE,OAAoB;IACpE,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,MAAM,OAAO,GAAa,EAAE,CAAA;IAE5B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,EAAE,IAAI,EAAE,QA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AAC,CAAA;YACjD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,YAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAA;QAChE,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const userSchema: z.ZodObject<{
|
|
3
|
-
id: z.ZodString;
|
|
4
|
-
email: z.ZodString;
|
|
5
|
-
name: z.ZodNullable<z.ZodString>;
|
|
6
|
-
authToken: z.ZodString;
|
|
7
|
-
fingerprintId: z.ZodString;
|
|
8
|
-
fingerprintHash: z.ZodString;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
name: string | null;
|
|
11
|
-
email: string;
|
|
12
|
-
id: string;
|
|
13
|
-
fingerprintId: string;
|
|
14
|
-
authToken: string;
|
|
15
|
-
fingerprintHash: string;
|
|
16
|
-
}, {
|
|
17
|
-
name: string | null;
|
|
18
|
-
email: string;
|
|
19
|
-
id: string;
|
|
20
|
-
fingerprintId: string;
|
|
21
|
-
authToken: string;
|
|
22
|
-
fingerprintHash: string;
|
|
23
|
-
}>;
|
|
24
|
-
export type User = z.infer<typeof userSchema>;
|
|
25
|
-
export declare const genAuthCode: (fingerprintId: string, expiresAt: string, secret: string) => string;
|
|
26
|
-
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/util/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;EAOrB,CAAA;AAEF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAE7C,eAAO,MAAM,WAAW,kBACP,MAAM,aACV,MAAM,UACT,MAAM,WAOE,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.genAuthCode = exports.userSchema = void 0;
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
9
|
-
exports.userSchema = zod_1.z.object({
|
|
10
|
-
id: zod_1.z.string(),
|
|
11
|
-
email: zod_1.z.string(),
|
|
12
|
-
name: zod_1.z.string().nullable(),
|
|
13
|
-
authToken: zod_1.z.string(),
|
|
14
|
-
fingerprintId: zod_1.z.string(),
|
|
15
|
-
fingerprintHash: zod_1.z.string(),
|
|
16
|
-
});
|
|
17
|
-
const genAuthCode = (fingerprintId, expiresAt, secret) => node_crypto_1.default
|
|
18
|
-
.createHash('sha256')
|
|
19
|
-
.update(secret)
|
|
20
|
-
.update(fingerprintId)
|
|
21
|
-
.update(expiresAt)
|
|
22
|
-
.digest('hex');
|
|
23
|
-
exports.genAuthCode = genAuthCode;
|
|
24
|
-
//# sourceMappingURL=credentials.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/util/credentials.ts"],"names":[],"mappings":";;;;;;AAAA,6BAAuB;AACvB,8DAAgC;AAEnB,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,eAAe,EAAE,OAAC,CAAC,MAAM,EAAE;CAC5B,CAAC,CAAA;AAIK,MAAM,WAAW,GAAG,CACzB,aAAqB,EACrB,SAAiB,EACjB,MAAc,EACd,EAAE,CACF,qBAAM;KACH,UAAU,CAAC,QAAQ,CAAC;KACpB,MAAM,CAAC,MAAM,CAAC;KACd,MAAM,CAAC,aAAa,CAAC;KACrB,MAAM,CAAC,SAAS,CAAC;KACjB,MAAM,CAAC,KAAK,CAAC,CAAA;AAVL,QAAA,WAAW,eAUN"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a credit amount to USD cents.
|
|
3
|
-
* @param credits The number of credits to convert
|
|
4
|
-
* @param centsPerCredit The cost per credit in cents
|
|
5
|
-
* @returns The amount in USD cents
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertCreditsToUsdCents(credits: number, centsPerCredit: number): number;
|
|
8
|
-
/**
|
|
9
|
-
* Converts a Stripe grant amount in cents to credits.
|
|
10
|
-
* @param amountInCents The amount in USD cents
|
|
11
|
-
* @param centsPerCredit The cost per credit in cents
|
|
12
|
-
* @returns The number of credits
|
|
13
|
-
*/
|
|
14
|
-
export declare function convertStripeGrantAmountToCredits(amountInCents: number, centsPerCredit: number): number;
|
|
15
|
-
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../src/util/currency.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,MAAM,CAER"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertCreditsToUsdCents = convertCreditsToUsdCents;
|
|
4
|
-
exports.convertStripeGrantAmountToCredits = convertStripeGrantAmountToCredits;
|
|
5
|
-
/**
|
|
6
|
-
* Converts a credit amount to USD cents.
|
|
7
|
-
* @param credits The number of credits to convert
|
|
8
|
-
* @param centsPerCredit The cost per credit in cents
|
|
9
|
-
* @returns The amount in USD cents
|
|
10
|
-
*/
|
|
11
|
-
function convertCreditsToUsdCents(credits, centsPerCredit) {
|
|
12
|
-
return Math.ceil(credits * centsPerCredit);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Converts a Stripe grant amount in cents to credits.
|
|
16
|
-
* @param amountInCents The amount in USD cents
|
|
17
|
-
* @param centsPerCredit The cost per credit in cents
|
|
18
|
-
* @returns The number of credits
|
|
19
|
-
*/
|
|
20
|
-
function convertStripeGrantAmountToCredits(amountInCents, centsPerCredit) {
|
|
21
|
-
return Math.floor(amountInCents / centsPerCredit);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=currency.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../src/util/currency.ts"],"names":[],"mappings":";;AAMA,4DAKC;AAQD,8EAKC;AAxBD;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,OAAe,EACf,cAAsB;IAEtB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iCAAiC,CAC/C,aAAqB,EACrB,cAAsB;IAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,cAAc,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the next quota reset date.
|
|
3
|
-
* If the current reset date is in the past or null, it calculates the next
|
|
4
|
-
* reset date based on the current date. Otherwise, it ensures the next
|
|
5
|
-
* reset date is in the future relative to the provided date.
|
|
6
|
-
*
|
|
7
|
-
* @param referenceDate The user's current `next_quota_reset` date, or the date the cycle ended.
|
|
8
|
-
* @returns The Date object representing the next reset time.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getNextQuotaReset: (referenceDate: Date | null) => Date;
|
|
11
|
-
//# sourceMappingURL=dates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/util/dates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,kBAAmB,IAAI,GAAG,IAAI,KAAG,IAO9D,CAAA"}
|