@kodelyth/zalouser 2026.5.42 → 2026.6.2
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/klaw.plugin.json +286 -3
- package/package.json +19 -6
- package/api.ts +0 -9
- package/channel-plugin-api.ts +0 -3
- package/contract-api.ts +0 -2
- package/doctor-contract-api.ts +0 -1
- package/index.ts +0 -34
- package/runtime-api.ts +0 -62
- package/secret-contract-api.ts +0 -4
- package/setup-entry.ts +0 -9
- package/setup-plugin-api.ts +0 -2
- package/src/accounts.runtime.ts +0 -1
- package/src/accounts.test-mocks.ts +0 -14
- package/src/accounts.test.ts +0 -298
- package/src/accounts.ts +0 -136
- package/src/channel-api.ts +0 -16
- package/src/channel.adapters.ts +0 -432
- package/src/channel.directory.test.ts +0 -59
- package/src/channel.runtime.ts +0 -12
- package/src/channel.sendpayload.test.ts +0 -311
- package/src/channel.setup.test.ts +0 -30
- package/src/channel.setup.ts +0 -12
- package/src/channel.test.ts +0 -424
- package/src/channel.ts +0 -221
- package/src/config-schema.ts +0 -33
- package/src/directory.ts +0 -54
- package/src/doctor-contract.ts +0 -156
- package/src/doctor.test.ts +0 -87
- package/src/doctor.ts +0 -37
- package/src/group-policy.test.ts +0 -61
- package/src/group-policy.ts +0 -83
- package/src/message-sid.test.ts +0 -66
- package/src/message-sid.ts +0 -80
- package/src/monitor.account-scope.test.ts +0 -122
- package/src/monitor.group-gating.test.ts +0 -967
- package/src/monitor.send-mocks.ts +0 -20
- package/src/monitor.ts +0 -1057
- package/src/probe.test.ts +0 -60
- package/src/probe.ts +0 -35
- package/src/qr-temp-file.ts +0 -19
- package/src/reaction.test.ts +0 -19
- package/src/reaction.ts +0 -32
- package/src/runtime.ts +0 -9
- package/src/security-audit.test.ts +0 -83
- package/src/security-audit.ts +0 -71
- package/src/send-receipt.ts +0 -31
- package/src/send.test.ts +0 -424
- package/src/send.ts +0 -280
- package/src/session-route.ts +0 -121
- package/src/setup-core.ts +0 -36
- package/src/setup-surface.test.ts +0 -367
- package/src/setup-surface.ts +0 -481
- package/src/setup-test-helpers.ts +0 -42
- package/src/shared.ts +0 -92
- package/src/status-issues.test.ts +0 -31
- package/src/status-issues.ts +0 -55
- package/src/test-helpers.ts +0 -26
- package/src/text-styles.test.ts +0 -203
- package/src/text-styles.ts +0 -540
- package/src/tool.test.ts +0 -212
- package/src/tool.ts +0 -200
- package/src/types.ts +0 -127
- package/src/zalo-js.credentials.test.ts +0 -465
- package/src/zalo-js.test-mocks.ts +0 -89
- package/src/zalo-js.ts +0 -1889
- package/src/zca-client.test.ts +0 -27
- package/src/zca-client.ts +0 -259
- package/src/zca-constants.ts +0 -55
- package/src/zca-js-exports.d.ts +0 -22
- package/test-api.ts +0 -21
- package/tsconfig.json +0 -16
package/src/test-helpers.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { RuntimeEnv } from "../runtime-api.js";
|
|
2
|
-
import type { ResolvedZalouserAccount } from "./types.js";
|
|
3
|
-
|
|
4
|
-
export function createZalouserRuntimeEnv(): RuntimeEnv {
|
|
5
|
-
return {
|
|
6
|
-
log: () => {},
|
|
7
|
-
error: () => {},
|
|
8
|
-
exit: ((code: number): never => {
|
|
9
|
-
throw new Error(`exit ${code}`);
|
|
10
|
-
}) as RuntimeEnv["exit"],
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function createDefaultResolvedZalouserAccount(
|
|
15
|
-
overrides: Partial<ResolvedZalouserAccount> = {},
|
|
16
|
-
): ResolvedZalouserAccount {
|
|
17
|
-
return {
|
|
18
|
-
accountId: "default",
|
|
19
|
-
profile: "default",
|
|
20
|
-
name: "test",
|
|
21
|
-
enabled: true,
|
|
22
|
-
authenticated: true,
|
|
23
|
-
config: {},
|
|
24
|
-
...overrides,
|
|
25
|
-
};
|
|
26
|
-
}
|
package/src/text-styles.test.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { parseZalouserTextStyles } from "./text-styles.js";
|
|
3
|
-
import { TextStyle } from "./zca-constants.js";
|
|
4
|
-
|
|
5
|
-
describe("parseZalouserTextStyles", () => {
|
|
6
|
-
it("renders inline markdown emphasis as Zalo style ranges", () => {
|
|
7
|
-
expect(parseZalouserTextStyles("**bold** *italic* ~~strike~~")).toEqual({
|
|
8
|
-
text: "bold italic strike",
|
|
9
|
-
styles: [
|
|
10
|
-
{ start: 0, len: 4, st: TextStyle.Bold },
|
|
11
|
-
{ start: 5, len: 6, st: TextStyle.Italic },
|
|
12
|
-
{ start: 12, len: 6, st: TextStyle.StrikeThrough },
|
|
13
|
-
],
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("keeps inline code and plain math markers literal", () => {
|
|
18
|
-
expect(parseZalouserTextStyles("before `inline *code*` after\n2 * 3 * 4")).toEqual({
|
|
19
|
-
text: "before `inline *code*` after\n2 * 3 * 4",
|
|
20
|
-
styles: [],
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("preserves backslash escapes inside code spans and fenced code blocks", () => {
|
|
25
|
-
expect(parseZalouserTextStyles("before `\\*` after\n```ts\n\\*\\_\\\\\n```")).toEqual({
|
|
26
|
-
text: "before `\\*` after\n\\*\\_\\\\",
|
|
27
|
-
styles: [],
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("closes fenced code blocks when the input uses CRLF newlines", () => {
|
|
32
|
-
expect(parseZalouserTextStyles("```\r\n*code*\r\n```\r\n**after**")).toEqual({
|
|
33
|
-
text: "*code*\nafter",
|
|
34
|
-
styles: [{ start: 7, len: 5, st: TextStyle.Bold }],
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("maps headings, block quotes, and lists into line styles", () => {
|
|
39
|
-
expect(parseZalouserTextStyles(["# Title", "> quoted", " - nested"].join("\n"))).toEqual({
|
|
40
|
-
text: "Title\nquoted\nnested",
|
|
41
|
-
styles: [
|
|
42
|
-
{ start: 0, len: 5, st: TextStyle.Bold },
|
|
43
|
-
{ start: 0, len: 5, st: TextStyle.Big },
|
|
44
|
-
{ start: 6, len: 6, st: TextStyle.Indent, indentSize: 1 },
|
|
45
|
-
{ start: 13, len: 6, st: TextStyle.UnorderedList },
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("treats 1-3 leading spaces as markdown padding for headings and lists", () => {
|
|
51
|
-
expect(parseZalouserTextStyles(" # Title\n 1. item\n - bullet")).toEqual({
|
|
52
|
-
text: "Title\nitem\nbullet",
|
|
53
|
-
styles: [
|
|
54
|
-
{ start: 0, len: 5, st: TextStyle.Bold },
|
|
55
|
-
{ start: 0, len: 5, st: TextStyle.Big },
|
|
56
|
-
{ start: 6, len: 4, st: TextStyle.OrderedList },
|
|
57
|
-
{ start: 11, len: 6, st: TextStyle.UnorderedList },
|
|
58
|
-
],
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("strips fenced code markers and preserves leading indentation with nbsp", () => {
|
|
63
|
-
expect(parseZalouserTextStyles("```ts\n const x = 1\n\treturn x\n```")).toEqual({
|
|
64
|
-
text: "\u00A0\u00A0const x = 1\n\u00A0\u00A0\u00A0\u00A0return x",
|
|
65
|
-
styles: [],
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("treats tilde fences as literal code blocks", () => {
|
|
70
|
-
expect(parseZalouserTextStyles("~~~bash\n*cmd*\n~~~")).toEqual({
|
|
71
|
-
text: "*cmd*",
|
|
72
|
-
styles: [],
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("treats fences indented under list items as literal code blocks", () => {
|
|
77
|
-
expect(parseZalouserTextStyles(" ```\n*cmd*\n ```")).toEqual({
|
|
78
|
-
text: "*cmd*",
|
|
79
|
-
styles: [],
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("treats quoted backtick fences as literal code blocks", () => {
|
|
84
|
-
expect(parseZalouserTextStyles("> ```js\n> *cmd*\n> ```")).toEqual({
|
|
85
|
-
text: "*cmd*",
|
|
86
|
-
styles: [],
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("treats quoted tilde fences as literal code blocks", () => {
|
|
91
|
-
expect(parseZalouserTextStyles("> ~~~\n> *cmd*\n> ~~~")).toEqual({
|
|
92
|
-
text: "*cmd*",
|
|
93
|
-
styles: [],
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("preserves quote-prefixed lines inside normal fenced code blocks", () => {
|
|
98
|
-
expect(parseZalouserTextStyles("```\n> prompt\n```")).toEqual({
|
|
99
|
-
text: "> prompt",
|
|
100
|
-
styles: [],
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it("does not treat quote-prefixed fence text inside code as a closing fence", () => {
|
|
105
|
-
expect(parseZalouserTextStyles("```\n> ```\n*still code*\n```")).toEqual({
|
|
106
|
-
text: "> ```\n*still code*",
|
|
107
|
-
styles: [],
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("treats indented blockquotes as quoted lines", () => {
|
|
112
|
-
expect(parseZalouserTextStyles(" > quoted")).toEqual({
|
|
113
|
-
text: "quoted",
|
|
114
|
-
styles: [{ start: 0, len: 6, st: TextStyle.Indent, indentSize: 1 }],
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("treats spaced nested blockquotes as deeper quoted lines", () => {
|
|
119
|
-
expect(parseZalouserTextStyles("> > quoted")).toEqual({
|
|
120
|
-
text: "quoted",
|
|
121
|
-
styles: [{ start: 0, len: 6, st: TextStyle.Indent, indentSize: 2 }],
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it("treats indented quoted fences as literal code blocks", () => {
|
|
126
|
-
expect(parseZalouserTextStyles(" > ```\n > *cmd*\n > ```")).toEqual({
|
|
127
|
-
text: "*cmd*",
|
|
128
|
-
styles: [],
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("treats spaced nested quoted fences as literal code blocks", () => {
|
|
133
|
-
expect(parseZalouserTextStyles("> > ```\n> > code\n> > ```")).toEqual({
|
|
134
|
-
text: "code",
|
|
135
|
-
styles: [],
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it("preserves inner quote markers inside quoted fenced code blocks", () => {
|
|
140
|
-
expect(parseZalouserTextStyles("> ```\n>> prompt\n> ```")).toEqual({
|
|
141
|
-
text: "> prompt",
|
|
142
|
-
styles: [],
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it("keeps quote indentation on heading lines", () => {
|
|
147
|
-
expect(parseZalouserTextStyles("> # Title")).toEqual({
|
|
148
|
-
text: "Title",
|
|
149
|
-
styles: [
|
|
150
|
-
{ start: 0, len: 5, st: TextStyle.Bold },
|
|
151
|
-
{ start: 0, len: 5, st: TextStyle.Big },
|
|
152
|
-
{ start: 0, len: 5, st: TextStyle.Indent, indentSize: 1 },
|
|
153
|
-
],
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it("keeps unmatched fences literal", () => {
|
|
158
|
-
expect(parseZalouserTextStyles("```python")).toEqual({
|
|
159
|
-
text: "```python",
|
|
160
|
-
styles: [],
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it("keeps unclosed fenced blocks literal until eof", () => {
|
|
165
|
-
expect(parseZalouserTextStyles("```python\n\\*not italic*\n_next_")).toEqual({
|
|
166
|
-
text: "```python\n\\*not italic*\n_next_",
|
|
167
|
-
styles: [],
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("supports nested markdown and tag styles regardless of order", () => {
|
|
172
|
-
expect(parseZalouserTextStyles("**{red}x{/red}** {red}**y**{/red}")).toEqual({
|
|
173
|
-
text: "x y",
|
|
174
|
-
styles: [
|
|
175
|
-
{ start: 0, len: 1, st: TextStyle.Bold },
|
|
176
|
-
{ start: 0, len: 1, st: TextStyle.Red },
|
|
177
|
-
{ start: 2, len: 1, st: TextStyle.Red },
|
|
178
|
-
{ start: 2, len: 1, st: TextStyle.Bold },
|
|
179
|
-
],
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it("treats small text tags as normal text", () => {
|
|
184
|
-
expect(parseZalouserTextStyles("{small}tiny{/small}")).toEqual({
|
|
185
|
-
text: "tiny",
|
|
186
|
-
styles: [],
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it("keeps escaped markers literal", () => {
|
|
191
|
-
expect(parseZalouserTextStyles("\\*literal\\* \\{underline}tag{/underline}")).toEqual({
|
|
192
|
-
text: "*literal* {underline}tag{/underline}",
|
|
193
|
-
styles: [],
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it("keeps indented code blocks literal", () => {
|
|
198
|
-
expect(parseZalouserTextStyles(" *cmd*")).toEqual({
|
|
199
|
-
text: "\u00A0\u00A0\u00A0\u00A0*cmd*",
|
|
200
|
-
styles: [],
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|