@kensio/yulin 1.21.28 → 1.21.30

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 (68) hide show
  1. package/dist/sdk/wire/sim-sdk-wire-bedrock-action.d.ts +18 -0
  2. package/dist/sdk/wire/sim-sdk-wire-bedrock-action.js +71 -0
  3. package/dist/sdk/wire/sim-sdk-wire-bedrock-input.d.ts +11 -0
  4. package/dist/sdk/wire/sim-sdk-wire-bedrock-input.js +45 -0
  5. package/dist/sdk/wire/sim-sdk-wire-bedrock.d.ts +10 -0
  6. package/dist/sdk/wire/sim-sdk-wire-bedrock.js +47 -0
  7. package/dist/sdk/wire/sim-sdk-wire-call.d.ts +30 -0
  8. package/dist/sdk/wire/sim-sdk-wire-call.js +32 -0
  9. package/dist/sdk/wire/sim-sdk-wire-dispatcher.js +7 -9
  10. package/dist/sdk/wire/sim-sdk-wire-event-stream.d.ts +16 -0
  11. package/dist/sdk/wire/sim-sdk-wire-event-stream.js +79 -0
  12. package/dist/sdk/wire/sim-sdk-wire-unbridged.js +2 -2
  13. package/dist/service/athena/engine/sim-athena-array-shims.js +1 -1
  14. package/dist/service/athena/engine/sim-athena-binary-text.d.ts +2 -2
  15. package/dist/service/athena/engine/sim-athena-binary-text.js +2 -2
  16. package/dist/service/athena/engine/sim-athena-cast-rewrite.d.ts +30 -0
  17. package/dist/service/athena/engine/sim-athena-cast-rewrite.js +107 -0
  18. package/dist/service/athena/engine/sim-athena-cast-shims.d.ts +12 -0
  19. package/dist/service/athena/engine/sim-athena-cast-shims.js +29 -0
  20. package/dist/service/athena/engine/sim-athena-cast-text.d.ts +13 -0
  21. package/dist/service/athena/engine/sim-athena-cast-text.js +66 -0
  22. package/dist/service/athena/engine/sim-athena-comparison-shims.js +1 -2
  23. package/dist/service/athena/engine/sim-athena-date-arithmetic-shims.d.ts +4 -5
  24. package/dist/service/athena/engine/sim-athena-date-arithmetic-shims.js +6 -14
  25. package/dist/service/athena/engine/sim-athena-date-units.d.ts +1 -1
  26. package/dist/service/athena/engine/sim-athena-date-units.js +1 -1
  27. package/dist/service/athena/engine/sim-athena-engine-answer.d.ts +10 -5
  28. package/dist/service/athena/engine/sim-athena-engine-answer.js +4 -4
  29. package/dist/service/athena/engine/sim-athena-engine-run.d.ts +4 -0
  30. package/dist/service/athena/engine/sim-athena-engine-run.js +10 -2
  31. package/dist/service/athena/engine/sim-athena-regexp-shims.js +2 -2
  32. package/dist/service/athena/engine/sim-athena-shim-refusal.d.ts +17 -0
  33. package/dist/service/athena/engine/sim-athena-shim-refusal.js +22 -0
  34. package/dist/service/athena/engine/sim-athena-shim-registry.d.ts +5 -1
  35. package/dist/service/athena/engine/sim-athena-shim-registry.js +14 -2
  36. package/dist/service/athena/engine/sim-athena-shims.js +2 -0
  37. package/dist/service/athena/engine/sim-athena-sql-translation.d.ts +1 -23
  38. package/dist/service/athena/engine/sim-athena-sql-translation.js +8 -23
  39. package/dist/service/athena/engine/sim-athena-translated-sql.d.ts +29 -0
  40. package/dist/service/athena/engine/sim-athena-translated-sql.js +12 -0
  41. package/dist/service/athena/engine/sim-athena-turn-down.d.ts +7 -0
  42. package/dist/service/athena/engine/sim-athena-turn-down.js +11 -0
  43. package/dist/service/athena/result/sim-athena-query-answer.d.ts +2 -1
  44. package/dist/service/athena/result/sim-athena-query-answer.js +2 -1
  45. package/dist/service/athena/sim-athena-snapshot-table.fixture.d.ts +10 -0
  46. package/dist/service/athena/sim-athena-snapshot-table.fixture.js +39 -0
  47. package/dist/service/bedrock/command/authorize/sim-bedrock-authorizer.js +7 -3
  48. package/dist/service/lambda/function/code/vm/sdk/sim-sdk-lambda-vm-module-provider.d.ts +2 -2
  49. package/dist/service/lambda/function/code/vm/sdk/sim-sdk-lambda-vm-module-provider.js +5 -9
  50. package/dist/service/lambda/function/code/vm/sim-lambda-vm-context.d.ts +1 -1
  51. package/dist/service/lambda/function/code/vm/sim-lambda-vm-context.js +11 -22
  52. package/dist/service/lambda/function/code/vm/sim-lambda-vm-host-globals.d.ts +4 -0
  53. package/dist/service/lambda/function/code/vm/sim-lambda-vm-host-globals.js +87 -0
  54. package/dist/service/lambda/function/invoke/sim-lambda-outbound-clients.d.ts +3 -0
  55. package/dist/service/lambda/function/invoke/sim-lambda-outbound-clients.js +10 -0
  56. package/dist/service/lambda/function/outbound/sim-lambda-http2-exchanges.d.ts +32 -0
  57. package/dist/service/lambda/function/outbound/sim-lambda-http2-exchanges.js +39 -0
  58. package/dist/service/lambda/function/outbound/sim-lambda-http2-messages.d.ts +33 -0
  59. package/dist/service/lambda/function/outbound/sim-lambda-http2-messages.js +87 -0
  60. package/dist/service/lambda/function/outbound/sim-lambda-http2-module.d.ts +27 -0
  61. package/dist/service/lambda/function/outbound/sim-lambda-http2-module.js +53 -0
  62. package/dist/service/lambda/function/outbound/sim-lambda-http2-session.d.ts +31 -0
  63. package/dist/service/lambda/function/outbound/sim-lambda-http2-session.js +57 -0
  64. package/dist/service/lambda/function/outbound/sim-lambda-transport-module.d.ts +11 -0
  65. package/dist/service/lambda/function/outbound/sim-lambda-transport-module.js +24 -0
  66. package/docs/services/athena/README.md +29 -8
  67. package/docs/services/lambda/README.md +18 -8
  68. package/package.json +1 -1
@@ -383,8 +383,8 @@ test's own statement about a query the engine gets wrong.
383
383
 
384
384
  ### Failing a statement Athena refuses
385
385
 
386
- One failure ignores strict mode. Where the engine can see that Athena would refuse a statement
387
- outright, the query fails whether strict mode is on or off. A turn-down means the engine reached its
386
+ Two failures ignore strict mode. This section covers the first. Where the engine can see that
387
+ Athena would refuse a statement outright, the query fails whether strict mode is on or off. A turn-down means the engine reached its
388
388
  limits, and a declaration is a fair answer to that. A rejection means the SQL is invalid, and
389
389
  answering from a declaration would leave a test green on a query that fails against AWS.
390
390
 
@@ -411,6 +411,18 @@ well, since the two names differ and nothing shadows.
411
411
  Trino and SQLite resolve names by different rules in other places too, and the engine catches this
412
412
  one. A statement that behaves differently under the two is worth reporting.
413
413
 
414
+ ### Failing a value a function cannot read
415
+
416
+ The second failure that ignores strict mode comes from a Trino function the engine runs. Where one
417
+ cannot answer faithfully for a value the statement hands it, the query fails with a
418
+ `StateChangeReason` naming the function and the value. `date_add('fortnight', ...)` fails this way,
419
+ and so does `CAST(sku AS DATE)` over a column holding no date.
420
+
421
+ The engine took the statement on and ran it, so falling back would answer from rows a declaration
422
+ wrote for some other purpose. A query with no declaration of its own would answer from the
423
+ default, which is often no rows at all, and a test reading it would see an empty result with no
424
+ error. A declaration written against the exact query text still answers it.
425
+
414
426
  ### The objects it reads
415
427
 
416
428
  The SerDe class name in the table's storage descriptor says how its objects are decoded.
@@ -560,7 +572,7 @@ call written inside a string literal is left alone as well.
560
572
  instant it froze, and the same test answers the same way on every machine. Athena reads both at the
561
573
  instant the query started, which is what the execution records.
562
574
 
563
- A function that cannot answer faithfully raises rather than guessing, and the query falls back.
575
+ A function that cannot answer faithfully raises rather than guessing, and the query fails.
564
576
  `date_add` with a unit Trino does not name, `slice` starting at zero, `array_join` over an array of
565
577
  objects, `least` over a `varbinary`, and `regexp_extract` naming a capture group the pattern has not
566
578
  got all land there. A null
@@ -1064,7 +1076,7 @@ Current documented limitations:
1064
1076
  statement comparing the answer against a bare string matches on one and not the other.
1065
1077
  - A timestamp carrying a numeric UTC offset falls outside the date functions, and so does one
1066
1078
  written finer than the millisecond. A value written with a `Z` or with no zone at all reads as
1067
- UTC, and a value the date functions cannot read turns the query down.
1079
+ UTC, and a value the date functions cannot read fails the query.
1068
1080
  - A JSON number beyond about fifteen significant digits loses the digits past that, wherever the
1069
1081
  engine reads JSON. An identifier of that size in a JSON lines object comes back rounded, and a
1070
1082
  filter on it can then match the wrong row.
@@ -1088,9 +1100,9 @@ Current documented limitations:
1088
1100
  written any other way gets whatever slicing that text comes to.
1089
1101
  - A `varbinary` in a result row reads as its bytes decoded as UTF-8. A digest read that way loses
1090
1102
  whatever in it was no UTF-8. A query answering with one wants `to_hex` or `to_base64` around it.
1091
- - `from_hex` and `from_base64` turn the query down over text the encoding cannot carry. Trino fails
1092
- the query, and reading as much of the text as parses would answer with bytes nobody wrote.
1093
- - `from_utf8` with a replacement named turns the query down where the bytes already carry the
1103
+ - `from_hex` and `from_base64` fail the query over text the encoding cannot carry, as Trino does.
1104
+ The alternative, reading as much of the text as parses, would answer with bytes nobody wrote.
1105
+ - `from_utf8` with a replacement named fails the query where the bytes already carry the
1094
1106
  replacement character. Trino writes the replacement only where a sequence was broken, and nothing
1095
1107
  survives decoding to tell one of those apart from a character the bytes held.
1096
1108
  - `spooky_hash_v2_32` and `spooky_hash_v2_64` are absent, and so are the other Trino hashes with no
@@ -1107,7 +1119,16 @@ Current documented limitations:
1107
1119
  runs.
1108
1120
  - `try_cast` runs as a plain cast. `try_cast('abc' AS integer)` therefore answers 0 where real
1109
1121
  Athena answers null, which is the same forgiving direction as the cast above. Reading the
1110
- statement without the rewrite would turn the whole query down.
1122
+ statement without the rewrite would turn the whole query down. A `try_cast` to `DATE` or
1123
+ `TIMESTAMP` over text the cast cannot read fails the query, where Athena answers null.
1124
+ - `CAST(x AS DATE)`, `date(x)` and `CAST(x AS TIMESTAMP)` read text the way Trino's cast from
1125
+ `varchar` does. A date is `yyyy-MM-dd` and nothing else. A timestamp is a date, optionally
1126
+ followed by a space and a time, with no `T` and no zone. A timestamp renders as
1127
+ `2026-08-15 10:00:00.000`, and a fraction finer than the millisecond is rounded.
1128
+ - A cast reads its value as text only where it is a string literal or a column the catalog declares
1129
+ as `string`, `varchar` or `char`. Anything else, such as a `timestamp` column or the answer of a
1130
+ function, is taken to be a date or a timestamp already, and any ISO-8601 form of it is accepted.
1131
+ The answer is text in a `varchar` column, where Athena reports a `date` or a `timestamp`.
1111
1132
  - A `decimal` column is held as a double. A value carrying more than about fifteen significant
1112
1133
  digits loses the ones past that, and a filter, a sum or a group on it can then answer
1113
1134
  differently from Athena's exact arithmetic.
@@ -152,6 +152,9 @@ The vm runtime models the real Node.js runtime closely:
152
152
  (`AWS_REGION`, `AWS_LAMBDA_FUNCTION_NAME`, `AWS_LAMBDA_FUNCTION_MEMORY_SIZE`, ...).
153
153
  - The sandbox provides writable `process.stdout` and `process.stderr`, with its `console` built
154
154
  over them, as the real runtime does. See [What a handler prints](#what-a-handler-prints).
155
+ - The sandbox provides the other globals of the Node.js runtime, including `global`, the WHATWG
156
+ streams, `EventTarget`, `atob`, `performance` and `navigator`. `Date` and the timers follow the
157
+ simulated clock. `performance.now()` reads host time.
155
158
  - Import and handler problems surface as invocation errors, with the real runtime error types
156
159
  (`Runtime.ImportModuleError`, `Runtime.HandlerNotFound`, `Runtime.UserCodeSyntaxError`,
157
160
  `Runtime.MalformedHandlerName`). Creation succeeds either way.
@@ -728,8 +731,8 @@ Some deployment packages inline the SDK rather than relying on the runtime to pr
728
731
  `NodejsFunction` does that when given `bundling: { externalModules: [] }`. There is then no
729
732
  `@aws-sdk/*` module left for the runtime to provide, and nothing to intercept.
730
733
 
731
- Those functions reach the simulation anyway. The runtime provides their HTTP transport, `node:http`
732
- and `node:https`, and a request addressed to an AWS API endpoint is answered from the same
734
+ Those functions reach the simulation anyway. The runtime provides their HTTP transport, `node:http`,
735
+ `node:https` and `node:http2`, and a request addressed to an AWS API endpoint is answered from the same
733
736
  simulated services, as the same execution role, instead of going to the network. The execution
734
737
  role credentials are in the function's environment, as real Lambda puts them there. The SDK resolves
735
738
  credentials inside the sandbox, where it would otherwise fail with `CredentialsProviderError`.
@@ -746,6 +749,13 @@ sends. A function can read and write Objects with an `S3Client` its archive inli
746
749
  Role authorizes each request, and a read it holds no `s3:GetObject` for comes back to the SDK as
747
750
  `AccessDenied`.
748
751
 
752
+ Bedrock Runtime states its operation and its model in the path, and its client sends over HTTP/2.
753
+ `Converse`, `ConverseStream`, `InvokeModel` and `InvokeModelWithResponseStream` from a bundled
754
+ `BedrockRuntimeClient` return what `simAws.bedrock().responses()` declares, and the SDK reads the
755
+ two streaming operations as it reads a real event stream. A model id given as an inference profile
756
+ ARN works too. The execution Role authorizes each call, and a denial reaches the handler as
757
+ `AccessDeniedException`.
758
+
749
759
  A bundled call to any other simulated service, such as SNS, SES or Lambda itself, fails with an
750
760
  error naming the service. Leaving the SDK out of that archive puts it back
751
761
  on the module interception path above, which every simulated service is reachable through.
@@ -761,8 +771,8 @@ hostname, along with everything else a handler asks for over HTTP.
761
771
  ## The HTTP requests function code makes
762
772
 
763
773
  A request from a handler to a hostname the simulation serves is answered by the simulation. It
764
- never leaves the process. `fetch`, `node:http` and `node:https` all reach it, so it makes no
765
- difference which client the handler was written with.
774
+ never leaves the process. `fetch`, `node:http`, `node:https` and `node:http2` all reach it, so it
775
+ makes no difference which client the handler was written with.
766
776
 
767
777
  Two kinds of hostname are served. Everything simulated Route53 resolves is answered over the same
768
778
  in-process HTTP entry point a browser on localhost reaches. That covers a
@@ -4358,9 +4368,9 @@ Sim Lambda currently supports:
4358
4368
  - Per-function environment variables with `Environment.Variables`
4359
4369
  - Runtime-provided `@aws-sdk/*` packages inside function code, routed into the owning simulated AWS
4360
4370
  environment
4361
- - `fetch`, `node:http` and `node:https` requests from function code, answered by the simulation for
4362
- every hostname it serves, including a Cognito user pool domain's OAuth endpoints and the JWKS a
4363
- token verifier fetches from the regional Cognito endpoint
4371
+ - `fetch`, `node:http`, `node:https` and `node:http2` requests from function code, answered by the
4372
+ simulation for every hostname it serves, including a Cognito user pool domain's OAuth endpoints
4373
+ and the JWKS a token verifier fetches from the regional Cognito endpoint
4364
4374
  - Execution roles, evaluated against simulated IAM
4365
4375
  - Published versions and aliases, with `PublishVersion`, `ListVersionsByFunction`, `CreateAlias`,
4366
4376
  `UpdateAlias`, `GetAlias`, `ListAliases` and `DeleteAlias`, and a `Qualifier` on `Invoke`,
@@ -4470,7 +4480,7 @@ Current documented limitations:
4470
4480
  - Environment variables declared with `Environment.Variables` reach a real in-process handler
4471
4481
  function only while it runs, so a variable read at module scope sees the host process value
4472
4482
  instead. See [Environment variables](#environment-variables).
4473
- - Outbound HTTP is routed for `fetch`, `node:http` and `node:https` alone. A handler using another
4483
+ - Outbound HTTP is routed for `fetch`, `node:http`, `node:https` and `node:http2` alone. A handler using another
4474
4484
  client, or a request made from a handler module while it is being imported, reaches the network.
4475
4485
  A routed response comes back as the simulation answered it, with redirects left for the caller to
4476
4486
  follow. See [The HTTP requests function code makes](#the-http-requests-function-code-makes).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kensio/yulin",
3
- "version": "1.21.28",
3
+ "version": "1.21.30",
4
4
  "description": "AWS system behaviour simulation for isolated unit testing",
5
5
  "repository": "https://github.com/KensioSoftware/yulin",
6
6
  "homepage": "https://yulinsim.dev/",