@fora-protocol/sdk 1.0.3
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/LICENSE +201 -0
- package/README.md +37 -0
- package/gen/ts/vocab/functiontokens.js +78 -0
- package/gen/ts/vocab/functiontokens.ts +84 -0
- package/gen/ts/vocab/geographytokens.js +30 -0
- package/gen/ts/vocab/geographytokens.ts +37 -0
- package/gen/ts/vocab/pricingunits.js +56 -0
- package/gen/ts/vocab/pricingunits.ts +63 -0
- package/gen/ts/vocab/quotametrics.js +40 -0
- package/gen/ts/vocab/quotametrics.ts +47 -0
- package/gen/ts/vocab/usertypes.js +40 -0
- package/gen/ts/vocab/usertypes.ts +46 -0
- package/gen/ts/wire/base.js +245 -0
- package/gen/ts/wire/base.ts +255 -0
- package/gen/ts/wire/names.js +41 -0
- package/gen/ts/wire/names.ts +42 -0
- package/gen/ts/wire/schemas.js +111 -0
- package/gen/ts/wire/schemas.ts +216 -0
- package/package.json +164 -0
- package/sdk/ts/client/content.d.ts +74 -0
- package/sdk/ts/client/content.js +466 -0
- package/sdk/ts/client/errors.d.ts +79 -0
- package/sdk/ts/client/errors.js +148 -0
- package/sdk/ts/client/index.d.ts +241 -0
- package/sdk/ts/client/index.js +740 -0
- package/sdk/ts/client/route.d.ts +41 -0
- package/sdk/ts/client/route.js +107 -0
- package/sdk/ts/client/send.d.ts +64 -0
- package/sdk/ts/client/send.js +142 -0
- package/sdk/ts/client/transport.d.ts +187 -0
- package/sdk/ts/client/transport.js +381 -0
- package/sdk/ts/core/multisig-parse.d.ts +47 -0
- package/sdk/ts/core/multisig-parse.js +234 -0
- package/sdk/ts/core/sign-request.d.ts +83 -0
- package/sdk/ts/core/sign-request.js +146 -0
- package/sdk/ts/core/sign.d.ts +31 -0
- package/sdk/ts/core/sign.js +82 -0
- package/sdk/ts/core/signing-transport.d.ts +75 -0
- package/sdk/ts/core/signing-transport.js +172 -0
- package/sdk/ts/core/verifier.d.ts +177 -0
- package/sdk/ts/core/verifier.js +269 -0
- package/sdk/ts/core/verify-multisig-request.d.ts +72 -0
- package/sdk/ts/core/verify-multisig-request.js +112 -0
- package/sdk/ts/core/verify-request.d.ts +181 -0
- package/sdk/ts/core/verify-request.js +284 -0
- package/sdk/ts/core/window.d.ts +22 -0
- package/sdk/ts/core/window.js +43 -0
- package/sdk/ts/core/wire-canon.d.ts +20 -0
- package/sdk/ts/core/wire-canon.js +174 -0
- package/sdk/ts/hono/middleware.d.ts +38 -0
- package/sdk/ts/hono/middleware.js +64 -0
- package/sdk/ts/resolvers/errors.d.ts +130 -0
- package/sdk/ts/resolvers/errors.js +150 -0
- package/sdk/ts/resolvers/http.d.ts +98 -0
- package/sdk/ts/resolvers/http.js +274 -0
- package/sdk/ts/resolvers/index.d.ts +9 -0
- package/sdk/ts/resolvers/index.js +15 -0
- package/sdk/ts/resolvers/jwks.d.ts +2 -0
- package/sdk/ts/resolvers/jwks.js +43 -0
- package/sdk/ts/resolvers/offer-key-cache.d.ts +68 -0
- package/sdk/ts/resolvers/offer-key-cache.js +152 -0
- package/sdk/ts/resolvers/registration-requirements.d.ts +47 -0
- package/sdk/ts/resolvers/registration-requirements.js +220 -0
- package/sdk/ts/resolvers/ssrf.d.ts +28 -0
- package/sdk/ts/resolvers/ssrf.js +235 -0
- package/sdk/ts/resolvers/static.d.ts +7 -0
- package/sdk/ts/resolvers/static.js +16 -0
- package/sdk/ts/resolvers/wba.d.ts +134 -0
- package/sdk/ts/resolvers/wba.js +506 -0
- package/sdk/ts/resolvers/wellknown.d.ts +28 -0
- package/sdk/ts/resolvers/wellknown.js +169 -0
- package/sdk/ts/src/acceptance.d.ts +46 -0
- package/sdk/ts/src/acceptance.js +162 -0
- package/sdk/ts/src/base64url.d.ts +19 -0
- package/sdk/ts/src/base64url.js +55 -0
- package/sdk/ts/src/crossfield.d.ts +28 -0
- package/sdk/ts/src/crossfield.js +215 -0
- package/sdk/ts/src/endpoint-rule.d.ts +30 -0
- package/sdk/ts/src/endpoint-rule.js +63 -0
- package/sdk/ts/src/errordetail.d.ts +115 -0
- package/sdk/ts/src/errordetail.js +256 -0
- package/sdk/ts/src/hashurl.d.ts +5 -0
- package/sdk/ts/src/hashurl.js +15 -0
- package/sdk/ts/src/host-ref.d.ts +70 -0
- package/sdk/ts/src/host-ref.js +320 -0
- package/sdk/ts/src/hosts.d.ts +138 -0
- package/sdk/ts/src/hosts.js +214 -0
- package/sdk/ts/src/idempotency.d.ts +11 -0
- package/sdk/ts/src/idempotency.js +27 -0
- package/sdk/ts/src/jsondepth.d.ts +27 -0
- package/sdk/ts/src/jsondepth.js +77 -0
- package/sdk/ts/src/licenseterm.d.ts +113 -0
- package/sdk/ts/src/licenseterm.js +433 -0
- package/sdk/ts/src/money.d.ts +21 -0
- package/sdk/ts/src/money.js +60 -0
- package/sdk/ts/src/offer-sign.d.ts +11 -0
- package/sdk/ts/src/offer-sign.js +31 -0
- package/sdk/ts/src/opaque-url.d.ts +3 -0
- package/sdk/ts/src/opaque-url.js +20 -0
- package/sdk/ts/src/pop.d.ts +51 -0
- package/sdk/ts/src/pop.js +166 -0
- package/sdk/ts/src/regschema.d.ts +229 -0
- package/sdk/ts/src/regschema.js +1315 -0
- package/sdk/ts/src/scopes.d.ts +20 -0
- package/sdk/ts/src/scopes.js +45 -0
- package/sdk/ts/src/signurl.d.ts +23 -0
- package/sdk/ts/src/signurl.js +107 -0
- package/sdk/ts/src/thumbprint.d.ts +14 -0
- package/sdk/ts/src/thumbprint.js +24 -0
- package/sdk/ts/src/verify.d.ts +49 -0
- package/sdk/ts/src/verify.js +109 -0
- package/sdk/ts/src/wire-names.d.ts +1 -0
- package/sdk/ts/src/wire-names.js +16 -0
- package/sdk/ts/src/wire.d.ts +68 -0
- package/sdk/ts/src/wire.js +114 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Recovering a proto field name from protojson's lowerCamelCase spelling of it.
|
|
2
|
+
// Hand-written; not regenerated. The Python twin is gen/python/wire/names.py, and the two
|
|
3
|
+
// are held to one answer by a shared vector set.
|
|
4
|
+
//
|
|
5
|
+
// This lives beside the generated schemas rather than in the SDK because the schema seam
|
|
6
|
+
// itself needs it: base.ts refuses an answer spelled in the json_name alias, and a rule
|
|
7
|
+
// the seam depends on cannot live in a tier above the seam. The SDK re-exports it, so
|
|
8
|
+
// there is one implementation per language rather than one per caller.
|
|
9
|
+
//
|
|
10
|
+
// The FORA wire is snake_case proto-JSON everywhere — proto field names, the corpus, the
|
|
11
|
+
// generated clients — and the camelCase alias is out of contract. Two places still have to
|
|
12
|
+
// reason about it:
|
|
13
|
+
//
|
|
14
|
+
// - Connect's error-detail `debug` projection IS lowerCamelCase and cannot be made
|
|
15
|
+
// otherwise. connect-go renders it with its own protojson codec at default options,
|
|
16
|
+
// inside a method on an unexported type, so the snake_case codec a FORA deployment
|
|
17
|
+
// registers reaches the response body and not the error beside it. That projection is
|
|
18
|
+
// normalized before parsing.
|
|
19
|
+
// - A response body from a server that registered no snake_case codec is lowerCamelCase
|
|
20
|
+
// throughout. That one is REFUSED rather than normalized: it is out of contract, and
|
|
21
|
+
// naming it is what turns a message with every multiword field silently missing into
|
|
22
|
+
// an error.
|
|
23
|
+
//
|
|
24
|
+
// The boundary test is ASCII `A-Z` and nothing else, deliberately. protojson builds
|
|
25
|
+
// json_name by uppercasing the character after each underscore, and a proto field name is
|
|
26
|
+
// [a-z_][a-z0-9_]*, so an ASCII uppercase letter is the only boundary protojson can
|
|
27
|
+
// produce. A broader test — "not equal to its own lowercase", or a Unicode uppercase
|
|
28
|
+
// predicate — answers differently for characters protojson never emits (titlecase `Dž` is
|
|
29
|
+
// the plain example), which is how three transcriptions of one rule drifted apart.
|
|
30
|
+
//
|
|
31
|
+
// The rewrite is textual. It is sound only while protojson's spelling inverts back to every
|
|
32
|
+
// field's name — it would not for a field like `field_2`, whose json_name is `field2` —
|
|
33
|
+
// which the conformance suite asserts for the whole contract.
|
|
34
|
+
|
|
35
|
+
/** Recover a proto field name from protojson's lowerCamelCase spelling of it. */
|
|
36
|
+
export function snakeFromJsonName(name: string): string {
|
|
37
|
+
let out = "";
|
|
38
|
+
for (const ch of name) {
|
|
39
|
+
out += ch >= "A" && ch <= "Z" ? `_${ch.toLowerCase()}` : ch;
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|