wrangler 0.0.0-e043479 → 0.0.0-e0a0509
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/README.md +27 -14
- package/bin/wrangler.js +13 -1
- package/miniflare-dist/index.mjs +4886 -0
- package/package.json +38 -25
- package/pages/functions/buildPlugin.ts +92 -0
- package/pages/functions/buildWorker.ts +80 -4
- package/pages/functions/filepath-routing.test.ts +136 -25
- package/pages/functions/filepath-routing.ts +14 -3
- package/pages/functions/routes.ts +6 -1
- package/pages/functions/template-plugin.ts +146 -0
- package/pages/functions/template-worker.ts +21 -8
- package/src/__tests__/config-cache.test.ts +36 -0
- package/src/__tests__/configuration.test.ts +1294 -355
- package/src/__tests__/dev.test.tsx +592 -12
- package/src/__tests__/guess-worker-format.test.ts +37 -18
- package/src/__tests__/helpers/mock-account-id.ts +4 -0
- package/src/__tests__/helpers/mock-cfetch.ts +8 -4
- package/src/__tests__/helpers/mock-console.ts +20 -3
- package/src/__tests__/helpers/mock-dialogs.ts +26 -1
- package/src/__tests__/helpers/mock-http-server.ts +46 -0
- package/src/__tests__/helpers/mock-istty.ts +27 -0
- package/src/__tests__/helpers/mock-kv.ts +9 -16
- package/src/__tests__/helpers/mock-oauth-flow.ts +255 -0
- package/src/__tests__/helpers/run-in-tmp.ts +10 -0
- package/src/__tests__/helpers/write-worker-source.ts +31 -0
- package/src/__tests__/https-options.test.ts +130 -0
- package/src/__tests__/index.test.ts +129 -753
- package/src/__tests__/init.test.ts +1516 -0
- package/src/__tests__/jest.setup.ts +13 -5
- package/src/__tests__/kv.test.ts +208 -174
- package/src/__tests__/logger.test.ts +115 -0
- package/src/__tests__/pages.test.ts +327 -0
- package/src/__tests__/parse.test.ts +4 -0
- package/src/__tests__/publish.test.ts +3313 -505
- package/src/__tests__/r2.test.ts +38 -26
- package/src/__tests__/route.test.ts +45 -0
- package/src/__tests__/secret.test.ts +55 -34
- package/src/__tests__/tail.test.ts +146 -20
- package/src/__tests__/user.test.ts +131 -0
- package/src/__tests__/whoami.test.tsx +26 -7
- package/src/bundle.ts +43 -7
- package/src/cfetch/internal.ts +9 -5
- package/src/cli.ts +5 -11
- package/src/config/README.md +7 -7
- package/src/config/config.ts +69 -105
- package/src/config/environment.ts +93 -4
- package/src/config/index.ts +15 -4
- package/src/config/validation-helpers.ts +228 -23
- package/src/config/validation.ts +559 -154
- package/src/config-cache.ts +45 -0
- package/src/{api/preview.ts → create-worker-preview.ts} +41 -13
- package/src/{api/form_data.ts → create-worker-upload-form.ts} +33 -10
- package/src/dev/dev-vars.ts +36 -0
- package/src/dev/dev.tsx +418 -0
- package/src/dev/local.tsx +312 -0
- package/src/dev/remote.tsx +213 -0
- package/src/dev/use-esbuild.ts +118 -0
- package/src/dialogs.tsx +16 -6
- package/src/entry.ts +222 -12
- package/src/environment-variables.ts +3 -1
- package/src/errors.ts +11 -0
- package/src/https-options.ts +123 -0
- package/src/index.tsx +878 -482
- package/src/inspect.ts +25 -11
- package/src/intl-polyfill.d.ts +139 -0
- package/src/{kv.tsx → kv.ts} +7 -27
- package/src/logger.ts +66 -0
- package/src/miniflare-cli/README.md +30 -0
- package/src/miniflare-cli/enum-keys.ts +17 -0
- package/src/miniflare-cli/index.ts +41 -0
- package/src/miniflare-cli/request-context.ts +40 -0
- package/src/module-collection.ts +94 -6
- package/src/open-in-browser.ts +18 -5
- package/src/package-manager.ts +9 -8
- package/src/pages.tsx +892 -62
- package/src/parse.ts +4 -2
- package/src/proxy.ts +128 -55
- package/src/publish.ts +305 -199
- package/src/selfsigned.d.ts +29 -0
- package/src/sites.tsx +88 -33
- package/src/tail/index.ts +2 -2
- package/src/tail/printing.ts +13 -8
- package/src/update-check.ts +19 -0
- package/src/user.tsx +244 -104
- package/src/whoami.tsx +2 -1
- package/src/{api/worker.ts → worker.ts} +15 -29
- package/templates/gitignore +171 -0
- package/templates/static-asset-facade.js +1 -1
- package/wrangler-dist/cli.js +23568 -50489
- package/src/__tests__/helpers/mock-user.ts +0 -27
- package/src/__tests__/logout.test.ts +0 -50
- package/src/__tests__/sentry.test.ts +0 -146
- package/src/dev.tsx +0 -960
- package/src/guess-worker-format.ts +0 -68
- package/src/reporting.ts +0 -115
- package/wrangler-dist/cli.js.map +0 -7
package/src/__tests__/kv.test.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
setMockFetchKVGetValue,
|
|
9
9
|
} from "./helpers/mock-cfetch";
|
|
10
10
|
import { mockConsoleMethods } from "./helpers/mock-console";
|
|
11
|
-
import { mockConfirm } from "./helpers/mock-dialogs";
|
|
11
|
+
import { clearConfirmMocks, mockConfirm } from "./helpers/mock-dialogs";
|
|
12
12
|
import { mockKeyListRequest } from "./helpers/mock-kv";
|
|
13
13
|
import { runInTempDir } from "./helpers/run-in-tmp";
|
|
14
14
|
import { runWrangler } from "./helpers/run-wrangler";
|
|
@@ -22,6 +22,7 @@ describe("wrangler", () => {
|
|
|
22
22
|
|
|
23
23
|
afterEach(() => {
|
|
24
24
|
unsetAllMocks();
|
|
25
|
+
clearConfirmMocks();
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
describe("kv:namespace", () => {
|
|
@@ -45,7 +46,10 @@ describe("wrangler", () => {
|
|
|
45
46
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
46
47
|
`"Not enough non-option arguments: got 0, need at least 1"`
|
|
47
48
|
);
|
|
48
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
49
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
50
|
+
"
|
|
51
|
+
"
|
|
52
|
+
`);
|
|
49
53
|
expect(std.err).toMatchInlineSnapshot(`
|
|
50
54
|
"wrangler kv:namespace create <namespace>
|
|
51
55
|
|
|
@@ -55,16 +59,16 @@ describe("wrangler", () => {
|
|
|
55
59
|
namespace The name of the new namespace [string] [required]
|
|
56
60
|
|
|
57
61
|
Flags:
|
|
58
|
-
-c, --config
|
|
59
|
-
-h, --help
|
|
60
|
-
-v, --version
|
|
61
|
-
--legacy-env Use legacy environments [boolean]
|
|
62
|
+
-c, --config Path to .toml configuration file [string]
|
|
63
|
+
-h, --help Show help [boolean]
|
|
64
|
+
-v, --version Show version number [boolean]
|
|
62
65
|
|
|
63
66
|
Options:
|
|
64
|
-
|
|
67
|
+
-e, --env Perform on a specific environment [string]
|
|
65
68
|
--preview Interact with a preview namespace [boolean]
|
|
69
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough non-option arguments: got 0, need at least 1[0m
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
"
|
|
68
72
|
`);
|
|
69
73
|
});
|
|
70
74
|
|
|
@@ -72,9 +76,12 @@ describe("wrangler", () => {
|
|
|
72
76
|
await expect(
|
|
73
77
|
runWrangler("kv:namespace create abc def ghi")
|
|
74
78
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
75
|
-
`"
|
|
79
|
+
`"Unknown arguments: def, ghi"`
|
|
76
80
|
);
|
|
77
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
81
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
82
|
+
"
|
|
83
|
+
"
|
|
84
|
+
`);
|
|
78
85
|
expect(std.err).toMatchInlineSnapshot(`
|
|
79
86
|
"wrangler kv:namespace create <namespace>
|
|
80
87
|
|
|
@@ -84,16 +91,16 @@ describe("wrangler", () => {
|
|
|
84
91
|
namespace The name of the new namespace [string] [required]
|
|
85
92
|
|
|
86
93
|
Flags:
|
|
87
|
-
-c, --config
|
|
88
|
-
-h, --help
|
|
89
|
-
-v, --version
|
|
90
|
-
--legacy-env Use legacy environments [boolean]
|
|
94
|
+
-c, --config Path to .toml configuration file [string]
|
|
95
|
+
-h, --help Show help [boolean]
|
|
96
|
+
-v, --version Show version number [boolean]
|
|
91
97
|
|
|
92
98
|
Options:
|
|
93
|
-
|
|
99
|
+
-e, --env Perform on a specific environment [string]
|
|
94
100
|
--preview Interact with a preview namespace [boolean]
|
|
101
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mUnknown arguments: def, ghi[0m
|
|
95
102
|
|
|
96
|
-
|
|
103
|
+
"
|
|
97
104
|
`);
|
|
98
105
|
});
|
|
99
106
|
|
|
@@ -104,7 +111,10 @@ describe("wrangler", () => {
|
|
|
104
111
|
`"The namespace binding name \\"abc-def\\" is invalid. It can only have alphanumeric and _ characters, and cannot begin with a number."`
|
|
105
112
|
);
|
|
106
113
|
|
|
107
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
114
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
115
|
+
"
|
|
116
|
+
"
|
|
117
|
+
`);
|
|
108
118
|
expect(std.err).toMatchInlineSnapshot(`
|
|
109
119
|
"wrangler kv:namespace create <namespace>
|
|
110
120
|
|
|
@@ -114,16 +124,16 @@ describe("wrangler", () => {
|
|
|
114
124
|
namespace The name of the new namespace [string] [required]
|
|
115
125
|
|
|
116
126
|
Flags:
|
|
117
|
-
-c, --config
|
|
118
|
-
-h, --help
|
|
119
|
-
-v, --version
|
|
120
|
-
--legacy-env Use legacy environments [boolean]
|
|
127
|
+
-c, --config Path to .toml configuration file [string]
|
|
128
|
+
-h, --help Show help [boolean]
|
|
129
|
+
-v, --version Show version number [boolean]
|
|
121
130
|
|
|
122
131
|
Options:
|
|
123
|
-
|
|
132
|
+
-e, --env Perform on a specific environment [string]
|
|
124
133
|
--preview Interact with a preview namespace [boolean]
|
|
134
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mThe namespace binding name \\"abc-def\\" is invalid. It can only have alphanumeric and _ characters, and cannot begin with a number.[0m
|
|
125
135
|
|
|
126
|
-
|
|
136
|
+
"
|
|
127
137
|
`);
|
|
128
138
|
});
|
|
129
139
|
|
|
@@ -150,11 +160,11 @@ describe("wrangler", () => {
|
|
|
150
160
|
});
|
|
151
161
|
|
|
152
162
|
it("should create a namespace using configured worker name", async () => {
|
|
153
|
-
writeFileSync("./wrangler.toml", 'name = "
|
|
154
|
-
mockCreateRequest("
|
|
163
|
+
writeFileSync("./wrangler.toml", 'name = "other-worker"', "utf-8");
|
|
164
|
+
mockCreateRequest("other-worker-UnitTestNamespace");
|
|
155
165
|
await runWrangler("kv:namespace create UnitTestNamespace");
|
|
156
166
|
expect(std.out).toMatchInlineSnapshot(`
|
|
157
|
-
"🌀 Creating namespace with title \\"
|
|
167
|
+
"🌀 Creating namespace with title \\"other-worker-UnitTestNamespace\\"
|
|
158
168
|
✨ Success!
|
|
159
169
|
Add the following to your configuration file in your kv_namespaces array:
|
|
160
170
|
{ binding = \\"UnitTestNamespace\\", id = \\"some-namespace-id\\" }"
|
|
@@ -278,19 +288,20 @@ describe("wrangler", () => {
|
|
|
278
288
|
Deletes a given namespace.
|
|
279
289
|
|
|
280
290
|
Flags:
|
|
281
|
-
-c, --config
|
|
282
|
-
-h, --help
|
|
283
|
-
-v, --version
|
|
284
|
-
--legacy-env Use legacy environments [boolean]
|
|
291
|
+
-c, --config Path to .toml configuration file [string]
|
|
292
|
+
-h, --help Show help [boolean]
|
|
293
|
+
-v, --version Show version number [boolean]
|
|
285
294
|
|
|
286
295
|
Options:
|
|
287
296
|
--binding The name of the namespace to delete [string]
|
|
288
297
|
--namespace-id The id of the namespace to delete [string]
|
|
289
|
-
|
|
298
|
+
-e, --env Perform on a specific environment [string]
|
|
290
299
|
--preview Interact with a preview namespace [boolean]
|
|
300
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot able to delete namespace.[0m
|
|
291
301
|
|
|
292
|
-
|
|
293
|
-
|
|
302
|
+
A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".
|
|
303
|
+
|
|
304
|
+
"
|
|
294
305
|
`);
|
|
295
306
|
});
|
|
296
307
|
|
|
@@ -365,7 +376,7 @@ describe("wrangler", () => {
|
|
|
365
376
|
|
|
366
377
|
expect(requests.count).toEqual(1);
|
|
367
378
|
expect(std.out).toMatchInlineSnapshot(
|
|
368
|
-
`"
|
|
379
|
+
`"Writing the value \\"my-value\\" to key \\"my-key\\" on namespace some-namespace-id."`
|
|
369
380
|
);
|
|
370
381
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
371
382
|
});
|
|
@@ -381,7 +392,7 @@ describe("wrangler", () => {
|
|
|
381
392
|
);
|
|
382
393
|
|
|
383
394
|
expect(std.out).toMatchInlineSnapshot(
|
|
384
|
-
`"
|
|
395
|
+
`"Writing the value \\"my-value\\" to key \\"my-key\\" on namespace bound-id."`
|
|
385
396
|
);
|
|
386
397
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
387
398
|
expect(requests.count).toEqual(1);
|
|
@@ -399,7 +410,7 @@ describe("wrangler", () => {
|
|
|
399
410
|
);
|
|
400
411
|
|
|
401
412
|
expect(std.out).toMatchInlineSnapshot(
|
|
402
|
-
`"
|
|
413
|
+
`"Writing the value \\"my-value\\" to key \\"my-key\\" on namespace preview-bound-id."`
|
|
403
414
|
);
|
|
404
415
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
405
416
|
expect(requests.count).toEqual(1);
|
|
@@ -417,7 +428,7 @@ describe("wrangler", () => {
|
|
|
417
428
|
);
|
|
418
429
|
expect(requests.count).toEqual(1);
|
|
419
430
|
expect(std.out).toMatchInlineSnapshot(
|
|
420
|
-
`"
|
|
431
|
+
`"Writing the value \\"my-value\\" to key \\"my-key\\" on namespace some-namespace-id."`
|
|
421
432
|
);
|
|
422
433
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
423
434
|
});
|
|
@@ -432,7 +443,7 @@ describe("wrangler", () => {
|
|
|
432
443
|
"kv:key put my-key my-value --binding someBinding --env some-environment --preview false"
|
|
433
444
|
);
|
|
434
445
|
expect(std.out).toMatchInlineSnapshot(
|
|
435
|
-
`"
|
|
446
|
+
`"Writing the value \\"my-value\\" to key \\"my-key\\" on namespace env-bound-id."`
|
|
436
447
|
);
|
|
437
448
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
438
449
|
expect(requests.count).toEqual(1);
|
|
@@ -448,7 +459,7 @@ describe("wrangler", () => {
|
|
|
448
459
|
"kv:key put my-key --namespace-id some-namespace-id --path foo.txt"
|
|
449
460
|
);
|
|
450
461
|
expect(std.out).toMatchInlineSnapshot(
|
|
451
|
-
`"
|
|
462
|
+
`"Writing the contents of foo.txt to the key \\"my-key\\" on namespace some-namespace-id."`
|
|
452
463
|
);
|
|
453
464
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
454
465
|
expect(requests.count).toEqual(1);
|
|
@@ -461,7 +472,10 @@ describe("wrangler", () => {
|
|
|
461
472
|
`"Not enough non-option arguments: got 0, need at least 1"`
|
|
462
473
|
);
|
|
463
474
|
|
|
464
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
475
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
476
|
+
"
|
|
477
|
+
"
|
|
478
|
+
`);
|
|
465
479
|
expect(std.err).toMatchInlineSnapshot(`
|
|
466
480
|
"wrangler kv:key put <key> [value]
|
|
467
481
|
|
|
@@ -472,21 +486,21 @@ describe("wrangler", () => {
|
|
|
472
486
|
value The value to write [string]
|
|
473
487
|
|
|
474
488
|
Flags:
|
|
475
|
-
-c, --config
|
|
476
|
-
-h, --help
|
|
477
|
-
-v, --version
|
|
478
|
-
--legacy-env Use legacy environments [boolean]
|
|
489
|
+
-c, --config Path to .toml configuration file [string]
|
|
490
|
+
-h, --help Show help [boolean]
|
|
491
|
+
-v, --version Show version number [boolean]
|
|
479
492
|
|
|
480
493
|
Options:
|
|
481
494
|
--binding The binding of the namespace to write to [string]
|
|
482
495
|
--namespace-id The id of the namespace to write to [string]
|
|
483
|
-
|
|
496
|
+
-e, --env Perform on a specific environment [string]
|
|
484
497
|
--preview Interact with a preview namespace [boolean]
|
|
485
498
|
--ttl Time for which the entries should be visible [number]
|
|
486
499
|
--expiration Time since the UNIX epoch after which the entry expires [number]
|
|
487
500
|
--path Read value from the file at a given path [string]
|
|
501
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough non-option arguments: got 0, need at least 1[0m
|
|
488
502
|
|
|
489
|
-
|
|
503
|
+
"
|
|
490
504
|
`);
|
|
491
505
|
});
|
|
492
506
|
|
|
@@ -497,7 +511,10 @@ describe("wrangler", () => {
|
|
|
497
511
|
`"Exactly one of the arguments binding and namespace-id is required"`
|
|
498
512
|
);
|
|
499
513
|
|
|
500
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
514
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
515
|
+
"
|
|
516
|
+
"
|
|
517
|
+
`);
|
|
501
518
|
expect(std.err).toMatchInlineSnapshot(`
|
|
502
519
|
"wrangler kv:key put <key> [value]
|
|
503
520
|
|
|
@@ -508,21 +525,21 @@ describe("wrangler", () => {
|
|
|
508
525
|
value The value to write [string]
|
|
509
526
|
|
|
510
527
|
Flags:
|
|
511
|
-
-c, --config
|
|
512
|
-
-h, --help
|
|
513
|
-
-v, --version
|
|
514
|
-
--legacy-env Use legacy environments [boolean]
|
|
528
|
+
-c, --config Path to .toml configuration file [string]
|
|
529
|
+
-h, --help Show help [boolean]
|
|
530
|
+
-v, --version Show version number [boolean]
|
|
515
531
|
|
|
516
532
|
Options:
|
|
517
533
|
--binding The binding of the namespace to write to [string]
|
|
518
534
|
--namespace-id The id of the namespace to write to [string]
|
|
519
|
-
|
|
535
|
+
-e, --env Perform on a specific environment [string]
|
|
520
536
|
--preview Interact with a preview namespace [boolean]
|
|
521
537
|
--ttl Time for which the entries should be visible [number]
|
|
522
538
|
--expiration Time since the UNIX epoch after which the entry expires [number]
|
|
523
539
|
--path Read value from the file at a given path [string]
|
|
540
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mExactly one of the arguments binding and namespace-id is required[0m
|
|
524
541
|
|
|
525
|
-
|
|
542
|
+
"
|
|
526
543
|
`);
|
|
527
544
|
});
|
|
528
545
|
|
|
@@ -533,7 +550,10 @@ describe("wrangler", () => {
|
|
|
533
550
|
`"Arguments binding and namespace-id are mutually exclusive"`
|
|
534
551
|
);
|
|
535
552
|
|
|
536
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
553
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
554
|
+
"
|
|
555
|
+
"
|
|
556
|
+
`);
|
|
537
557
|
expect(std.err).toMatchInlineSnapshot(`
|
|
538
558
|
"wrangler kv:key put <key> [value]
|
|
539
559
|
|
|
@@ -544,21 +564,21 @@ describe("wrangler", () => {
|
|
|
544
564
|
value The value to write [string]
|
|
545
565
|
|
|
546
566
|
Flags:
|
|
547
|
-
-c, --config
|
|
548
|
-
-h, --help
|
|
549
|
-
-v, --version
|
|
550
|
-
--legacy-env Use legacy environments [boolean]
|
|
567
|
+
-c, --config Path to .toml configuration file [string]
|
|
568
|
+
-h, --help Show help [boolean]
|
|
569
|
+
-v, --version Show version number [boolean]
|
|
551
570
|
|
|
552
571
|
Options:
|
|
553
572
|
--binding The binding of the namespace to write to [string]
|
|
554
573
|
--namespace-id The id of the namespace to write to [string]
|
|
555
|
-
|
|
574
|
+
-e, --env Perform on a specific environment [string]
|
|
556
575
|
--preview Interact with a preview namespace [boolean]
|
|
557
576
|
--ttl Time for which the entries should be visible [number]
|
|
558
577
|
--expiration Time since the UNIX epoch after which the entry expires [number]
|
|
559
578
|
--path Read value from the file at a given path [string]
|
|
579
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mArguments binding and namespace-id are mutually exclusive[0m
|
|
560
580
|
|
|
561
|
-
|
|
581
|
+
"
|
|
562
582
|
`);
|
|
563
583
|
});
|
|
564
584
|
|
|
@@ -569,7 +589,10 @@ describe("wrangler", () => {
|
|
|
569
589
|
`"Exactly one of the arguments value and path is required"`
|
|
570
590
|
);
|
|
571
591
|
|
|
572
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
592
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
593
|
+
"
|
|
594
|
+
"
|
|
595
|
+
`);
|
|
573
596
|
expect(std.err).toMatchInlineSnapshot(`
|
|
574
597
|
"wrangler kv:key put <key> [value]
|
|
575
598
|
|
|
@@ -580,21 +603,21 @@ describe("wrangler", () => {
|
|
|
580
603
|
value The value to write [string]
|
|
581
604
|
|
|
582
605
|
Flags:
|
|
583
|
-
-c, --config
|
|
584
|
-
-h, --help
|
|
585
|
-
-v, --version
|
|
586
|
-
--legacy-env Use legacy environments [boolean]
|
|
606
|
+
-c, --config Path to .toml configuration file [string]
|
|
607
|
+
-h, --help Show help [boolean]
|
|
608
|
+
-v, --version Show version number [boolean]
|
|
587
609
|
|
|
588
610
|
Options:
|
|
589
611
|
--binding The binding of the namespace to write to [string]
|
|
590
612
|
--namespace-id The id of the namespace to write to [string]
|
|
591
|
-
|
|
613
|
+
-e, --env Perform on a specific environment [string]
|
|
592
614
|
--preview Interact with a preview namespace [boolean]
|
|
593
615
|
--ttl Time for which the entries should be visible [number]
|
|
594
616
|
--expiration Time since the UNIX epoch after which the entry expires [number]
|
|
595
617
|
--path Read value from the file at a given path [string]
|
|
618
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mExactly one of the arguments value and path is required[0m
|
|
596
619
|
|
|
597
|
-
|
|
620
|
+
"
|
|
598
621
|
`);
|
|
599
622
|
});
|
|
600
623
|
|
|
@@ -605,7 +628,10 @@ describe("wrangler", () => {
|
|
|
605
628
|
`"Arguments value and path are mutually exclusive"`
|
|
606
629
|
);
|
|
607
630
|
|
|
608
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
631
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
632
|
+
"
|
|
633
|
+
"
|
|
634
|
+
`);
|
|
609
635
|
expect(std.err).toMatchInlineSnapshot(`
|
|
610
636
|
"wrangler kv:key put <key> [value]
|
|
611
637
|
|
|
@@ -616,21 +642,21 @@ describe("wrangler", () => {
|
|
|
616
642
|
value The value to write [string]
|
|
617
643
|
|
|
618
644
|
Flags:
|
|
619
|
-
-c, --config
|
|
620
|
-
-h, --help
|
|
621
|
-
-v, --version
|
|
622
|
-
--legacy-env Use legacy environments [boolean]
|
|
645
|
+
-c, --config Path to .toml configuration file [string]
|
|
646
|
+
-h, --help Show help [boolean]
|
|
647
|
+
-v, --version Show version number [boolean]
|
|
623
648
|
|
|
624
649
|
Options:
|
|
625
650
|
--binding The binding of the namespace to write to [string]
|
|
626
651
|
--namespace-id The id of the namespace to write to [string]
|
|
627
|
-
|
|
652
|
+
-e, --env Perform on a specific environment [string]
|
|
628
653
|
--preview Interact with a preview namespace [boolean]
|
|
629
654
|
--ttl Time for which the entries should be visible [number]
|
|
630
655
|
--expiration Time since the UNIX epoch after which the entry expires [number]
|
|
631
656
|
--path Read value from the file at a given path [string]
|
|
657
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mArguments value and path are mutually exclusive[0m
|
|
632
658
|
|
|
633
|
-
|
|
659
|
+
"
|
|
634
660
|
`);
|
|
635
661
|
});
|
|
636
662
|
|
|
@@ -642,11 +668,14 @@ describe("wrangler", () => {
|
|
|
642
668
|
`"A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\"."`
|
|
643
669
|
);
|
|
644
670
|
|
|
645
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
671
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
672
|
+
"
|
|
673
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
674
|
+
`);
|
|
646
675
|
expect(std.err).toMatchInlineSnapshot(`
|
|
647
|
-
"
|
|
676
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".[0m
|
|
648
677
|
|
|
649
|
-
|
|
678
|
+
"
|
|
650
679
|
`);
|
|
651
680
|
});
|
|
652
681
|
|
|
@@ -661,11 +690,14 @@ describe("wrangler", () => {
|
|
|
661
690
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
662
691
|
`"someBinding has both a namespace ID and a preview ID. Specify \\"--preview\\" or \\"--preview false\\" to avoid writing data to the wrong namespace."`
|
|
663
692
|
);
|
|
664
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
693
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
694
|
+
"
|
|
695
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
696
|
+
`);
|
|
665
697
|
expect(std.err).toMatchInlineSnapshot(`
|
|
666
|
-
"
|
|
698
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1msomeBinding has both a namespace ID and a preview ID. Specify \\"--preview\\" or \\"--preview false\\" to avoid writing data to the wrong namespace.[0m
|
|
667
699
|
|
|
668
|
-
|
|
700
|
+
"
|
|
669
701
|
`);
|
|
670
702
|
expect(requests.count).toEqual(0);
|
|
671
703
|
});
|
|
@@ -673,26 +705,26 @@ describe("wrangler", () => {
|
|
|
673
705
|
|
|
674
706
|
describe("list", () => {
|
|
675
707
|
it("should list the keys of a namespace specified by namespace-id", async () => {
|
|
676
|
-
const keys = [
|
|
708
|
+
const keys = [
|
|
709
|
+
{ name: "key-1" },
|
|
710
|
+
{ name: "key-2", expiration: 123456789 },
|
|
711
|
+
{ name: "key-3", expiration_ttl: 666 },
|
|
712
|
+
];
|
|
677
713
|
mockKeyListRequest("some-namespace-id", keys);
|
|
678
714
|
await runWrangler("kv:key list --namespace-id some-namespace-id");
|
|
679
715
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
680
716
|
expect(std.out).toMatchInlineSnapshot(`
|
|
681
717
|
"[
|
|
682
718
|
{
|
|
683
|
-
\\"name\\": \\"key-1\\"
|
|
684
|
-
\\"expiration\\": 123456789,
|
|
685
|
-
\\"metadata\\": {}
|
|
719
|
+
\\"name\\": \\"key-1\\"
|
|
686
720
|
},
|
|
687
721
|
{
|
|
688
722
|
\\"name\\": \\"key-2\\",
|
|
689
|
-
\\"expiration\\": 123456789
|
|
690
|
-
\\"metadata\\": {}
|
|
723
|
+
\\"expiration\\": 123456789
|
|
691
724
|
},
|
|
692
725
|
{
|
|
693
726
|
\\"name\\": \\"key-3\\",
|
|
694
|
-
\\"
|
|
695
|
-
\\"metadata\\": {}
|
|
727
|
+
\\"expiration_ttl\\": 666
|
|
696
728
|
}
|
|
697
729
|
]"
|
|
698
730
|
`);
|
|
@@ -700,7 +732,7 @@ describe("wrangler", () => {
|
|
|
700
732
|
|
|
701
733
|
it("should list the keys of a namespace specified by binding", async () => {
|
|
702
734
|
writeWranglerConfig();
|
|
703
|
-
const keys = ["key-1", "key-2", "key-3"];
|
|
735
|
+
const keys = [{ name: "key-1" }, { name: "key-2" }, { name: "key-3" }];
|
|
704
736
|
mockKeyListRequest("bound-id", keys);
|
|
705
737
|
|
|
706
738
|
await runWrangler("kv:key list --binding someBinding");
|
|
@@ -708,19 +740,13 @@ describe("wrangler", () => {
|
|
|
708
740
|
expect(std.out).toMatchInlineSnapshot(`
|
|
709
741
|
"[
|
|
710
742
|
{
|
|
711
|
-
\\"name\\": \\"key-1\\"
|
|
712
|
-
\\"expiration\\": 123456789,
|
|
713
|
-
\\"metadata\\": {}
|
|
743
|
+
\\"name\\": \\"key-1\\"
|
|
714
744
|
},
|
|
715
745
|
{
|
|
716
|
-
\\"name\\": \\"key-2\\"
|
|
717
|
-
\\"expiration\\": 123456789,
|
|
718
|
-
\\"metadata\\": {}
|
|
746
|
+
\\"name\\": \\"key-2\\"
|
|
719
747
|
},
|
|
720
748
|
{
|
|
721
|
-
\\"name\\": \\"key-3\\"
|
|
722
|
-
\\"expiration\\": 123456789,
|
|
723
|
-
\\"metadata\\": {}
|
|
749
|
+
\\"name\\": \\"key-3\\"
|
|
724
750
|
}
|
|
725
751
|
]"
|
|
726
752
|
`);
|
|
@@ -728,26 +754,20 @@ describe("wrangler", () => {
|
|
|
728
754
|
|
|
729
755
|
it("should list the keys of a preview namespace specified by binding", async () => {
|
|
730
756
|
writeWranglerConfig();
|
|
731
|
-
const keys = ["key-1", "key-2", "key-3"];
|
|
757
|
+
const keys = [{ name: "key-1" }, { name: "key-2" }, { name: "key-3" }];
|
|
732
758
|
mockKeyListRequest("preview-bound-id", keys);
|
|
733
759
|
await runWrangler("kv:key list --binding someBinding --preview");
|
|
734
760
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
735
761
|
expect(std.out).toMatchInlineSnapshot(`
|
|
736
762
|
"[
|
|
737
763
|
{
|
|
738
|
-
\\"name\\": \\"key-1\\"
|
|
739
|
-
\\"expiration\\": 123456789,
|
|
740
|
-
\\"metadata\\": {}
|
|
764
|
+
\\"name\\": \\"key-1\\"
|
|
741
765
|
},
|
|
742
766
|
{
|
|
743
|
-
\\"name\\": \\"key-2\\"
|
|
744
|
-
\\"expiration\\": 123456789,
|
|
745
|
-
\\"metadata\\": {}
|
|
767
|
+
\\"name\\": \\"key-2\\"
|
|
746
768
|
},
|
|
747
769
|
{
|
|
748
|
-
\\"name\\": \\"key-3\\"
|
|
749
|
-
\\"expiration\\": 123456789,
|
|
750
|
-
\\"metadata\\": {}
|
|
770
|
+
\\"name\\": \\"key-3\\"
|
|
751
771
|
}
|
|
752
772
|
]"
|
|
753
773
|
`);
|
|
@@ -755,7 +775,7 @@ describe("wrangler", () => {
|
|
|
755
775
|
|
|
756
776
|
it("should list the keys of a namespace specified by binding, in a given environment", async () => {
|
|
757
777
|
writeWranglerConfig();
|
|
758
|
-
const keys = ["key-1", "key-2", "key-3"];
|
|
778
|
+
const keys = [{ name: "key-1" }, { name: "key-2" }, { name: "key-3" }];
|
|
759
779
|
mockKeyListRequest("env-bound-id", keys);
|
|
760
780
|
await runWrangler(
|
|
761
781
|
"kv:key list --binding someBinding --env some-environment"
|
|
@@ -764,19 +784,13 @@ describe("wrangler", () => {
|
|
|
764
784
|
expect(std.out).toMatchInlineSnapshot(`
|
|
765
785
|
"[
|
|
766
786
|
{
|
|
767
|
-
\\"name\\": \\"key-1\\"
|
|
768
|
-
\\"expiration\\": 123456789,
|
|
769
|
-
\\"metadata\\": {}
|
|
787
|
+
\\"name\\": \\"key-1\\"
|
|
770
788
|
},
|
|
771
789
|
{
|
|
772
|
-
\\"name\\": \\"key-2\\"
|
|
773
|
-
\\"expiration\\": 123456789,
|
|
774
|
-
\\"metadata\\": {}
|
|
790
|
+
\\"name\\": \\"key-2\\"
|
|
775
791
|
},
|
|
776
792
|
{
|
|
777
|
-
\\"name\\": \\"key-3\\"
|
|
778
|
-
\\"expiration\\": 123456789,
|
|
779
|
-
\\"metadata\\": {}
|
|
793
|
+
\\"name\\": \\"key-3\\"
|
|
780
794
|
}
|
|
781
795
|
]"
|
|
782
796
|
`);
|
|
@@ -784,7 +798,7 @@ describe("wrangler", () => {
|
|
|
784
798
|
|
|
785
799
|
it("should list the keys of a preview namespace specified by binding, in a given environment", async () => {
|
|
786
800
|
writeWranglerConfig();
|
|
787
|
-
const keys = ["key-1", "key-2", "key-3"];
|
|
801
|
+
const keys = [{ name: "key-1" }, { name: "key-2" }, { name: "key-3" }];
|
|
788
802
|
mockKeyListRequest("preview-env-bound-id", keys);
|
|
789
803
|
await runWrangler(
|
|
790
804
|
"kv:key list --binding someBinding --preview --env some-environment"
|
|
@@ -793,19 +807,13 @@ describe("wrangler", () => {
|
|
|
793
807
|
expect(std.out).toMatchInlineSnapshot(`
|
|
794
808
|
"[
|
|
795
809
|
{
|
|
796
|
-
\\"name\\": \\"key-1\\"
|
|
797
|
-
\\"expiration\\": 123456789,
|
|
798
|
-
\\"metadata\\": {}
|
|
810
|
+
\\"name\\": \\"key-1\\"
|
|
799
811
|
},
|
|
800
812
|
{
|
|
801
|
-
\\"name\\": \\"key-2\\"
|
|
802
|
-
\\"expiration\\": 123456789,
|
|
803
|
-
\\"metadata\\": {}
|
|
813
|
+
\\"name\\": \\"key-2\\"
|
|
804
814
|
},
|
|
805
815
|
{
|
|
806
|
-
\\"name\\": \\"key-3\\"
|
|
807
|
-
\\"expiration\\": 123456789,
|
|
808
|
-
\\"metadata\\": {}
|
|
816
|
+
\\"name\\": \\"key-3\\"
|
|
809
817
|
}
|
|
810
818
|
]"
|
|
811
819
|
`);
|
|
@@ -822,9 +830,9 @@ describe("wrangler", () => {
|
|
|
822
830
|
describe(`cursor - ${blankCursorValue}`, () => {
|
|
823
831
|
it("should make multiple requests for paginated results", async () => {
|
|
824
832
|
// Create a lot of mock keys, so that the fetch requests will be paginated
|
|
825
|
-
const keys:
|
|
833
|
+
const keys: NamespaceKeyInfo[] = [];
|
|
826
834
|
for (let i = 0; i < 550; i++) {
|
|
827
|
-
keys.push("key-" + i);
|
|
835
|
+
keys.push({ name: "key-" + i });
|
|
828
836
|
}
|
|
829
837
|
// Ask for the keys in pages of size 100.
|
|
830
838
|
const requests = mockKeyListRequest(
|
|
@@ -833,13 +841,9 @@ describe("wrangler", () => {
|
|
|
833
841
|
100,
|
|
834
842
|
blankCursorValue
|
|
835
843
|
);
|
|
836
|
-
await runWrangler(
|
|
837
|
-
"kv:key list --namespace-id some-namespace-id --limit 100"
|
|
838
|
-
);
|
|
844
|
+
await runWrangler("kv:key list --namespace-id some-namespace-id");
|
|
839
845
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
840
|
-
expect(
|
|
841
|
-
JSON.parse(std.out).map((k: NamespaceKeyInfo) => k.name)
|
|
842
|
-
).toEqual(keys);
|
|
846
|
+
expect(JSON.parse(std.out)).toEqual(keys);
|
|
843
847
|
expect(requests.count).toEqual(6);
|
|
844
848
|
});
|
|
845
849
|
});
|
|
@@ -853,11 +857,14 @@ describe("wrangler", () => {
|
|
|
853
857
|
`"A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\"."`
|
|
854
858
|
);
|
|
855
859
|
expect(std.err).toMatchInlineSnapshot(`
|
|
856
|
-
"
|
|
860
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".[0m
|
|
857
861
|
|
|
858
|
-
|
|
862
|
+
"
|
|
863
|
+
`);
|
|
864
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
865
|
+
"
|
|
866
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
859
867
|
`);
|
|
860
|
-
expect(std.out).toMatchInlineSnapshot(`""`);
|
|
861
868
|
});
|
|
862
869
|
});
|
|
863
870
|
|
|
@@ -915,7 +922,7 @@ describe("wrangler", () => {
|
|
|
915
922
|
"my-value"
|
|
916
923
|
);
|
|
917
924
|
await runWrangler(
|
|
918
|
-
"kv:key get my-key
|
|
925
|
+
"kv:key get my-key --binding someBinding --env some-environment --preview false"
|
|
919
926
|
);
|
|
920
927
|
expect(std.out).toMatchInlineSnapshot(`"my-value"`);
|
|
921
928
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
@@ -927,7 +934,10 @@ describe("wrangler", () => {
|
|
|
927
934
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
928
935
|
`"Not enough non-option arguments: got 0, need at least 1"`
|
|
929
936
|
);
|
|
930
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
937
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
938
|
+
"
|
|
939
|
+
"
|
|
940
|
+
`);
|
|
931
941
|
expect(std.err).toMatchInlineSnapshot(`
|
|
932
942
|
"wrangler kv:key get <key>
|
|
933
943
|
|
|
@@ -937,18 +947,18 @@ describe("wrangler", () => {
|
|
|
937
947
|
key The key value to get. [string] [required]
|
|
938
948
|
|
|
939
949
|
Flags:
|
|
940
|
-
-c, --config
|
|
941
|
-
-h, --help
|
|
942
|
-
-v, --version
|
|
943
|
-
--legacy-env Use legacy environments [boolean]
|
|
950
|
+
-c, --config Path to .toml configuration file [string]
|
|
951
|
+
-h, --help Show help [boolean]
|
|
952
|
+
-v, --version Show version number [boolean]
|
|
944
953
|
|
|
945
954
|
Options:
|
|
946
955
|
--binding The name of the namespace to get from [string]
|
|
947
956
|
--namespace-id The id of the namespace to get from [string]
|
|
948
|
-
|
|
957
|
+
-e, --env Perform on a specific environment [string]
|
|
949
958
|
--preview Interact with a preview namespace [boolean] [default: false]
|
|
959
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mNot enough non-option arguments: got 0, need at least 1[0m
|
|
950
960
|
|
|
951
|
-
|
|
961
|
+
"
|
|
952
962
|
`);
|
|
953
963
|
});
|
|
954
964
|
|
|
@@ -958,7 +968,10 @@ describe("wrangler", () => {
|
|
|
958
968
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
959
969
|
`"Exactly one of the arguments binding and namespace-id is required"`
|
|
960
970
|
);
|
|
961
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
971
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
972
|
+
"
|
|
973
|
+
"
|
|
974
|
+
`);
|
|
962
975
|
expect(std.err).toMatchInlineSnapshot(`
|
|
963
976
|
"wrangler kv:key get <key>
|
|
964
977
|
|
|
@@ -968,18 +981,18 @@ describe("wrangler", () => {
|
|
|
968
981
|
key The key value to get. [string] [required]
|
|
969
982
|
|
|
970
983
|
Flags:
|
|
971
|
-
-c, --config
|
|
972
|
-
-h, --help
|
|
973
|
-
-v, --version
|
|
974
|
-
--legacy-env Use legacy environments [boolean]
|
|
984
|
+
-c, --config Path to .toml configuration file [string]
|
|
985
|
+
-h, --help Show help [boolean]
|
|
986
|
+
-v, --version Show version number [boolean]
|
|
975
987
|
|
|
976
988
|
Options:
|
|
977
989
|
--binding The name of the namespace to get from [string]
|
|
978
990
|
--namespace-id The id of the namespace to get from [string]
|
|
979
|
-
|
|
991
|
+
-e, --env Perform on a specific environment [string]
|
|
980
992
|
--preview Interact with a preview namespace [boolean] [default: false]
|
|
993
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mExactly one of the arguments binding and namespace-id is required[0m
|
|
981
994
|
|
|
982
|
-
|
|
995
|
+
"
|
|
983
996
|
`);
|
|
984
997
|
});
|
|
985
998
|
|
|
@@ -990,7 +1003,10 @@ describe("wrangler", () => {
|
|
|
990
1003
|
`"Arguments binding and namespace-id are mutually exclusive"`
|
|
991
1004
|
);
|
|
992
1005
|
|
|
993
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
1006
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
1007
|
+
"
|
|
1008
|
+
"
|
|
1009
|
+
`);
|
|
994
1010
|
expect(std.err).toMatchInlineSnapshot(`
|
|
995
1011
|
"wrangler kv:key get <key>
|
|
996
1012
|
|
|
@@ -1000,18 +1016,18 @@ describe("wrangler", () => {
|
|
|
1000
1016
|
key The key value to get. [string] [required]
|
|
1001
1017
|
|
|
1002
1018
|
Flags:
|
|
1003
|
-
-c, --config
|
|
1004
|
-
-h, --help
|
|
1005
|
-
-v, --version
|
|
1006
|
-
--legacy-env Use legacy environments [boolean]
|
|
1019
|
+
-c, --config Path to .toml configuration file [string]
|
|
1020
|
+
-h, --help Show help [boolean]
|
|
1021
|
+
-v, --version Show version number [boolean]
|
|
1007
1022
|
|
|
1008
1023
|
Options:
|
|
1009
1024
|
--binding The name of the namespace to get from [string]
|
|
1010
1025
|
--namespace-id The id of the namespace to get from [string]
|
|
1011
|
-
|
|
1026
|
+
-e, --env Perform on a specific environment [string]
|
|
1012
1027
|
--preview Interact with a preview namespace [boolean] [default: false]
|
|
1028
|
+
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mArguments binding and namespace-id are mutually exclusive[0m
|
|
1013
1029
|
|
|
1014
|
-
|
|
1030
|
+
"
|
|
1015
1031
|
`);
|
|
1016
1032
|
});
|
|
1017
1033
|
|
|
@@ -1022,11 +1038,14 @@ describe("wrangler", () => {
|
|
|
1022
1038
|
).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
1023
1039
|
`"A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\"."`
|
|
1024
1040
|
);
|
|
1025
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
1041
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
1042
|
+
"
|
|
1043
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
1044
|
+
`);
|
|
1026
1045
|
expect(std.err).toMatchInlineSnapshot(`
|
|
1027
|
-
"
|
|
1046
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".[0m
|
|
1028
1047
|
|
|
1029
|
-
|
|
1048
|
+
"
|
|
1030
1049
|
`);
|
|
1031
1050
|
});
|
|
1032
1051
|
});
|
|
@@ -1086,9 +1105,9 @@ describe("wrangler", () => {
|
|
|
1086
1105
|
);
|
|
1087
1106
|
|
|
1088
1107
|
expect(std.err).toMatchInlineSnapshot(`
|
|
1089
|
-
"
|
|
1108
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mA namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".[0m
|
|
1090
1109
|
|
|
1091
|
-
|
|
1110
|
+
"
|
|
1092
1111
|
`);
|
|
1093
1112
|
});
|
|
1094
1113
|
|
|
@@ -1099,7 +1118,7 @@ describe("wrangler", () => {
|
|
|
1099
1118
|
`kv:key delete --binding someBinding --env some-environment --preview false someKey`
|
|
1100
1119
|
);
|
|
1101
1120
|
expect(std.out).toMatchInlineSnapshot(
|
|
1102
|
-
`"
|
|
1121
|
+
`"Deleting the key \\"someKey\\" on namespace env-bound-id."`
|
|
1103
1122
|
);
|
|
1104
1123
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
1105
1124
|
expect(requests.count).toEqual(1);
|
|
@@ -1191,7 +1210,10 @@ describe("wrangler", () => {
|
|
|
1191
1210
|
"Unexpected JSON input from \\"keys.json\\".
|
|
1192
1211
|
Expected an array of key-value objects but got type \\"object\\"."
|
|
1193
1212
|
`);
|
|
1194
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
1213
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
1214
|
+
"
|
|
1215
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
1216
|
+
`);
|
|
1195
1217
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
1196
1218
|
});
|
|
1197
1219
|
|
|
@@ -1225,10 +1247,16 @@ describe("wrangler", () => {
|
|
|
1225
1247
|
The item at index 3 is {\\"value\\":\\"someValue\\"}"
|
|
1226
1248
|
`);
|
|
1227
1249
|
|
|
1228
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
1250
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
1251
|
+
"
|
|
1252
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
1253
|
+
`);
|
|
1229
1254
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
1230
|
-
"
|
|
1231
|
-
|
|
1255
|
+
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mUnexpected key-value properties in \\"keys.json\\".[0m
|
|
1256
|
+
|
|
1257
|
+
The item at index 4 contains unexpected properties: [\\"invalid\\"].
|
|
1258
|
+
|
|
1259
|
+
"
|
|
1232
1260
|
`);
|
|
1233
1261
|
});
|
|
1234
1262
|
});
|
|
@@ -1360,7 +1388,10 @@ describe("wrangler", () => {
|
|
|
1360
1388
|
Expected an array of strings but got:
|
|
1361
1389
|
12354"
|
|
1362
1390
|
`);
|
|
1363
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
1391
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
1392
|
+
"
|
|
1393
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
1394
|
+
`);
|
|
1364
1395
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
1365
1396
|
});
|
|
1366
1397
|
|
|
@@ -1382,7 +1413,10 @@ describe("wrangler", () => {
|
|
|
1382
1413
|
The item at index 2 is type: \\"object\\" - {\\"key\\":\\"someKey\\"}
|
|
1383
1414
|
The item at index 3 is type: \\"object\\" - null"
|
|
1384
1415
|
`);
|
|
1385
|
-
expect(std.out).toMatchInlineSnapshot(`
|
|
1416
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
1417
|
+
"
|
|
1418
|
+
[32mIf you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.[0m"
|
|
1419
|
+
`);
|
|
1386
1420
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
1387
1421
|
});
|
|
1388
1422
|
});
|
|
@@ -1393,7 +1427,7 @@ function writeWranglerConfig() {
|
|
|
1393
1427
|
writeFileSync(
|
|
1394
1428
|
"./wrangler.toml",
|
|
1395
1429
|
[
|
|
1396
|
-
'name = "
|
|
1430
|
+
'name = "other-worker"',
|
|
1397
1431
|
"kv_namespaces = [",
|
|
1398
1432
|
' { binding = "someBinding", id = "bound-id", preview_id = "preview-bound-id" }',
|
|
1399
1433
|
"]",
|