@capybara-hq/testing 0.1.0-rc.4 → 0.1.0-rc.41

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 (99) hide show
  1. package/dist/containers.d.ts +7 -2
  2. package/dist/containers.js +7 -3
  3. package/dist/device-service-conformance.d.ts +38 -0
  4. package/dist/device-service-conformance.js +142 -0
  5. package/dist/dual-replica.d.ts +23 -1
  6. package/dist/dual-replica.js +53 -0
  7. package/dist/fake-channel.d.ts +44 -5
  8. package/dist/fake-channel.js +63 -2
  9. package/dist/fake-dial-in-machine.d.ts +173 -0
  10. package/dist/fake-dial-in-machine.js +429 -0
  11. package/dist/fake-e2b.d.ts +34 -0
  12. package/dist/fake-e2b.js +95 -1
  13. package/dist/fake-git-server.d.ts +32 -4
  14. package/dist/fake-git-server.js +87 -19
  15. package/dist/fake-lark.d.ts +12 -1
  16. package/dist/fake-lark.js +63 -10
  17. package/dist/fake-oauth-server.d.ts +62 -2
  18. package/dist/fake-oauth-server.js +86 -5
  19. package/dist/fake-slack.d.ts +17 -1
  20. package/dist/fake-slack.js +98 -0
  21. package/dist/fake-telegram.d.ts +173 -0
  22. package/dist/fake-telegram.js +632 -0
  23. package/dist/fixtures.d.ts +24 -8
  24. package/dist/fixtures.js +31 -8
  25. package/dist/index.d.ts +15 -9
  26. package/dist/index.js +10 -4
  27. package/dist/kernel-helpers.d.ts +16 -4
  28. package/dist/kernel-helpers.js +39 -4
  29. package/dist/media-samples.d.ts +2 -0
  30. package/dist/media-samples.js +2 -0
  31. package/dist/model-conformance.d.ts +15 -10
  32. package/dist/model-conformance.js +87 -14
  33. package/dist/push-conformance.d.ts +31 -0
  34. package/dist/push-conformance.js +160 -0
  35. package/dist/replica-runner.js +2 -0
  36. package/dist/sandbox-native-conformance.d.ts +31 -0
  37. package/dist/sandbox-native-conformance.js +153 -0
  38. package/dist/sandbox-permission-conformance.d.ts +310 -0
  39. package/dist/sandbox-permission-conformance.js +1491 -0
  40. package/fixtures/extensions/fake-bootstrap-a/src/index.ts +8 -4
  41. package/fixtures/extensions/fake-bootstrap-b/src/index.ts +8 -4
  42. package/fixtures/extensions/fake-client/.capybara-plugin/plugin.json +11 -0
  43. package/fixtures/extensions/fake-client/client/styles/fake.css +11 -0
  44. package/fixtures/extensions/fake-client/package.json +12 -0
  45. package/fixtures/extensions/fake-client/src/client.tsx +51 -0
  46. package/fixtures/extensions/fake-client/src/index.ts +43 -0
  47. package/fixtures/extensions/fake-client/themes/fake.json +11 -0
  48. package/fixtures/extensions/fake-client-broken/.capybara-plugin/plugin.json +7 -0
  49. package/fixtures/extensions/fake-client-broken/package.json +12 -0
  50. package/fixtures/extensions/fake-client-broken/src/client.tsx +22 -0
  51. package/fixtures/extensions/fake-client-broken/src/index.ts +27 -0
  52. package/fixtures/extensions/fake-config-form/src/index.ts +52 -46
  53. package/fixtures/extensions/fake-connector/src/index.ts +64 -34
  54. package/fixtures/extensions/fake-context/.capybara-plugin/plugin.json +7 -0
  55. package/fixtures/extensions/fake-context/package.json +12 -0
  56. package/fixtures/extensions/fake-context/src/index.ts +78 -0
  57. package/fixtures/extensions/fake-dep-provider/src/index.ts +1 -1
  58. package/fixtures/extensions/fake-dep-requirer/src/index.ts +1 -1
  59. package/fixtures/extensions/fake-embed/src/index.ts +26 -26
  60. package/fixtures/extensions/fake-im/.capybara-plugin/plugin.json +7 -1
  61. package/fixtures/extensions/fake-im/guides/fake-im-app.md +32 -0
  62. package/fixtures/extensions/fake-im/guides/fake-im-app.zh.md +32 -0
  63. package/fixtures/extensions/fake-im/src/channel.ts +22 -1
  64. package/fixtures/extensions/fake-im/src/checks.ts +94 -0
  65. package/fixtures/extensions/fake-im/src/directory.ts +44 -20
  66. package/fixtures/extensions/fake-im/src/index.ts +59 -11
  67. package/fixtures/extensions/fake-lifecycle/.capybara-plugin/plugin.json +7 -0
  68. package/fixtures/extensions/fake-lifecycle/migrations/0001_init.sql +16 -0
  69. package/fixtures/extensions/fake-lifecycle/package.json +12 -0
  70. package/fixtures/extensions/fake-lifecycle/src/index.ts +72 -0
  71. package/fixtures/extensions/fake-object-store/src/index.ts +12 -8
  72. package/fixtures/extensions/fake-openapi/src/index.ts +46 -34
  73. package/fixtures/extensions/fake-push/.capybara-plugin/plugin.json +13 -0
  74. package/fixtures/extensions/fake-push/guides/fake-push-key.md +6 -0
  75. package/fixtures/extensions/fake-push/guides/fake-push-key.zh.md +6 -0
  76. package/fixtures/extensions/fake-push/migrations/0001_sends.sql +9 -0
  77. package/fixtures/extensions/fake-push/package.json +12 -0
  78. package/fixtures/extensions/fake-push/src/check.ts +40 -0
  79. package/fixtures/extensions/fake-push/src/index.ts +56 -0
  80. package/fixtures/extensions/fake-push/src/push.ts +103 -0
  81. package/fixtures/extensions/fake-tools-ui/src/index.ts +61 -2
  82. package/fixtures/extensions/fake-web/src/index.ts +5 -4
  83. package/fixtures/extensions/fake-web/src/web.ts +11 -7
  84. package/fixtures/extensions/fake-web-2/src/index.ts +2 -2
  85. package/fixtures/extensions/fake-web-2/src/web.ts +11 -7
  86. package/fixtures/plugins/fake-theme/.capybara-plugin/plugin.json +7 -0
  87. package/fixtures/plugins/fake-theme/brand/app-512.png +0 -0
  88. package/fixtures/plugins/fake-theme/brand/app-mask-512.png +0 -0
  89. package/fixtures/plugins/fake-theme/brand/avatars/bot.svg +1 -0
  90. package/fixtures/plugins/fake-theme/brand/avatars/cat.png +0 -0
  91. package/fixtures/plugins/fake-theme/brand/illustration.svg +1 -0
  92. package/fixtures/plugins/fake-theme/brand/unnamed.svg +1 -0
  93. package/fixtures/plugins/fake-theme/fonts/FakeSans.woff2 +1 -0
  94. package/fixtures/plugins/fake-theme/logo.svg +1 -0
  95. package/fixtures/plugins/fake-theme/package.json +8 -0
  96. package/fixtures/plugins/fake-theme/themes/brand-kit.json +24 -0
  97. package/fixtures/plugins/fake-theme/themes/neon-grid.json +13 -0
  98. package/fixtures/plugins/fake-theme/themes/paper.json +12 -0
  99. package/package.json +6 -5
@@ -1,5 +1,5 @@
1
1
  import { defineExtension } from "@capybara-hq/plugin-sdk";
2
- import { FakeWebOrgConfig, makeFakeWeb } from "./web.js";
2
+ import { FakeWebConfig, makeFakeWeb } from "./web.js";
3
3
 
4
4
  /** Test fake: `fake-web` under another name (a second provider of `web-search@1` / `web-fetch@1`). */
5
5
  export default defineExtension({
@@ -7,7 +7,7 @@ export default defineExtension({
7
7
  version: "0.1.0",
8
8
  sdk: "^0.1.0-rc.0",
9
9
  provides: ["web-search@1", "web-fetch@1"],
10
- config: { org: FakeWebOrgConfig },
10
+ config: { deployment: FakeWebConfig },
11
11
  setup(ctx) {
12
12
  const { search, fetch } = makeFakeWeb("fake-web-2");
13
13
  ctx.provide("web-search@1", search);
@@ -13,10 +13,11 @@ import { z } from "zod";
13
13
  // own directory); test/fixtures.test.ts of @capybara-hq/testing keeps them equal.
14
14
 
15
15
  /**
16
- * Org config of the fake web providers: `configured()` is true iff `token` is set (and throws for
17
- * the token `throw:configured`).
16
+ * Deployment config of the fake web providers: a required, org-overridable secret `token`. The
17
+ * platform may leave it empty (orgs then need their own copy); `configured()` is false for the
18
+ * token `unconfigured` and throws for the token `throw:configured`.
18
19
  */
19
- export const FakeWebOrgConfig = z.object({ token: secret(z.string().min(1)).optional() });
20
+ export const FakeWebConfig = z.object({ token: secret(z.string().min(1)) });
20
21
 
21
22
  /** One provider call, recorded on `globalThis.__fakeWeb` (in-process kernels only). */
22
23
  export interface FakeWebCall {
@@ -43,11 +44,14 @@ const KINDS: readonly WebProviderErrorKind[] = [
43
44
  "invalid",
44
45
  ];
45
46
 
46
- /** True iff the token is set; the token `throw:configured` makes it throw. */
47
- const configured = (orgConfig: unknown): boolean => {
48
- const token = (orgConfig as { token?: unknown } | null)?.token;
47
+ /**
48
+ * True iff the effective config's token is set and is not `unconfigured`; the token
49
+ * `throw:configured` makes it throw.
50
+ */
51
+ const configured = (config: unknown): boolean => {
52
+ const token = (config as { token?: unknown } | null)?.token;
49
53
  if (token === "throw:configured") throw new Error("fake web: configured() failed");
50
- return typeof token === "string" && token.length > 0;
54
+ return typeof token === "string" && token.length > 0 && token !== "unconfigured";
51
55
  };
52
56
 
53
57
  /** The script of a fetch: the decoded URL path (and query) after the first `/`. */
@@ -0,0 +1,7 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "fake-theme",
4
+ "version": "0.1.0",
5
+ "publisher": "Capybara",
6
+ "description": "Fixture: a declarative plugin with themes and no extension"
7
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>Bot</title><rect width="32" height="32" fill="#2B6CB0"/><rect x="8" y="10" width="16" height="12" fill="#FFFFFF"/><circle cx="13" cy="16" r="2" fill="#2B6CB0"/><circle cx="19" cy="16" r="2" fill="#2B6CB0"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 80"><title>Brand kit illustration</title><rect width="120" height="80" fill="#2B6CB0"/><circle cx="60" cy="40" r="20" fill="#F6E05E"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><title>Unnamed</title><rect width="10" height="10" fill="#888888"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><title>Fake theme</title><path d="M0 0h10v10z" fill="#FCE300"/></svg>
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@capybara-hq/plugin-fake-theme",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "description": "Fixture: a declarative plugin with themes and no extension",
6
+ "license": "Apache-2.0",
7
+ "type": "module"
8
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": { "en": "Brand Kit", "zh": "品牌套件" },
3
+ "schemes": {
4
+ "dark": {
5
+ "color": { "bg": "#05070D", "panel": "#0A0E18", "accent": "#63B3ED", "on-accent": "#05121F" }
6
+ },
7
+ "light": {
8
+ "color": { "bg": "#F7FAFC", "panel": "#FFFFFF", "accent": "#2B6CB0", "on-accent": "#FFFFFF" }
9
+ }
10
+ },
11
+ "logo": {
12
+ "mark": "./logo.svg",
13
+ "wordmark": "BRAND KIT",
14
+ "illustration": "./brand/illustration.svg",
15
+ "appIcon": "./brand/app-512.png",
16
+ "appIconMaskable": "./brand/app-mask-512.png"
17
+ },
18
+ "decoration": "none",
19
+ "avatars": [
20
+ { "id": "bot", "name": { "en": "Bot", "zh": "机器人" }, "file": "./brand/avatars/bot.svg" },
21
+ { "id": "cat", "name": { "en": "Cat", "zh": "猫" }, "file": "./brand/avatars/cat.png" }
22
+ ],
23
+ "hideAvatarPresets": ["capybara"]
24
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": { "en": "Neon Grid", "zh": "霓虹网格" },
3
+ "schemes": {
4
+ "dark": {
5
+ "color": { "bg": "#05070D", "panel": "#0A0E18", "accent": "#FCE300", "on-accent": "#141200" },
6
+ "radius": { "sm": 0, "md": 2 }
7
+ }
8
+ },
9
+ "fonts": [
10
+ { "family": "FakeSans", "file": "./fonts/FakeSans.woff2", "weight": 400, "role": "prose" }
11
+ ],
12
+ "logo": { "mark": "./logo.svg", "wordmark": "NEON GRID" }
13
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": { "en": "Paper", "zh": "纸张" },
3
+ "schemes": {
4
+ "light": {
5
+ "color": { "accent": "#8A3B12", "on-accent": "#FFFFFF" },
6
+ "radius": { "md": 6 }
7
+ },
8
+ "dark": {
9
+ "color": { "accent": "#E0A070", "on-accent": "#1B1915" }
10
+ }
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/testing",
3
- "version": "0.1.0-rc.4",
3
+ "version": "0.1.0-rc.41",
4
4
  "description": "Test helpers for Capybara: test containers, dual-replica harness and fake third-party servers",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -47,17 +47,18 @@
47
47
  "tsx": "^4.23.15",
48
48
  "ws": "^8.22.0",
49
49
  "zod": "^4.6.7",
50
- "@capybara-hq/kernel": "^0.1.0-rc.4"
50
+ "@capybara-hq/kernel": "^0.1.0-rc.90"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/pg": "^8.23.1",
54
54
  "@types/ws": "^8.18.2",
55
- "@capybara-hq/plugin-sdk": "^0.1.0-rc.2"
55
+ "@capybara-hq/plugin-sdk": "^0.1.0-rc.72",
56
+ "@capybara-hq/plugin-client": "^0.1.0-rc.9"
56
57
  },
57
58
  "peerDependencies": {
58
59
  "vitest": "^5.0.5",
59
- "@capybara-hq/plugin-sdk": "^0.1.0-rc.2",
60
- "@capybara-hq/plugin-tools": "^0.1.0-rc.4"
60
+ "@capybara-hq/plugin-tools": "^0.1.0-rc.25",
61
+ "@capybara-hq/plugin-sdk": "^0.1.0-rc.72"
61
62
  },
62
63
  "peerDependenciesMeta": {
63
64
  "@capybara-hq/plugin-tools": {