@superbuilders/primer-tives 4.0.0 → 4.0.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/README.md +12 -11
- package/dist/client/auth/access-token.d.ts.map +1 -1
- package/dist/client/auth/provider.d.ts +1 -0
- package/dist/client/auth/provider.d.ts.map +1 -1
- package/dist/client/consumed.d.ts.map +1 -1
- package/dist/client/index.js +6715 -234
- package/dist/client/index.js.map +87 -20
- package/dist/client/session.d.ts +1 -0
- package/dist/client/session.d.ts.map +1 -1
- package/dist/client/start.d.ts.map +1 -1
- package/dist/client/transport.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +2 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +6528 -121
- package/dist/contracts/index.js.map +72 -5
- package/dist/contracts/pci-schemas.d.ts +100 -28
- package/dist/contracts/pci-schemas.d.ts.map +1 -1
- package/dist/contracts/types.d.ts +1 -0
- package/dist/contracts/types.d.ts.map +1 -1
- package/dist/contracts/validation.d.ts +379 -89
- package/dist/contracts/validation.d.ts.map +1 -1
- package/dist/errors.js +32 -1
- package/dist/errors.js.map +2 -2
- package/dist/grade-level.js +32 -1
- package/dist/grade-level.js.map +2 -2
- package/dist/logger.d.ts +2 -6
- package/dist/logger.d.ts.map +1 -1
- package/dist/subject-pcis.js +32 -1
- package/dist/subject-pcis.js.map +2 -2
- package/dist/subject.js +32 -1
- package/dist/subject.js.map +2 -2
- package/dist/version.d.ts +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ bun add @superbuilders/primer-tives
|
|
|
17
17
|
|
|
18
18
|
## Version
|
|
19
19
|
|
|
20
|
-
The current SDK version is `4.0.
|
|
20
|
+
The current SDK version is `4.0.2`.
|
|
21
21
|
|
|
22
22
|
## Entrypoints
|
|
23
23
|
|
|
@@ -38,7 +38,7 @@ There is no package-root export. Import from the public subpath that owns the su
|
|
|
38
38
|
Math content can require the fraction-input PCI capability, so a math renderer must declare it.
|
|
39
39
|
|
|
40
40
|
```ts
|
|
41
|
-
import
|
|
41
|
+
import { logger } from "@/logger"
|
|
42
42
|
import { start, type PrimerOptions } from "@superbuilders/primer-tives/client"
|
|
43
43
|
|
|
44
44
|
const options = {
|
|
@@ -133,7 +133,7 @@ Always switch on `state.phase`. Do not assume the first state is renderable lear
|
|
|
133
133
|
|
|
134
134
|
```ts
|
|
135
135
|
import * as errors from "@superbuilders/errors"
|
|
136
|
-
import
|
|
136
|
+
import { logger } from "@/logger"
|
|
137
137
|
import { start, type PrimerOptions } from "@superbuilders/primer-tives/client"
|
|
138
138
|
import { ErrAuthUnavailable, ErrMalformedAccessToken } from "@superbuilders/primer-tives/errors"
|
|
139
139
|
|
|
@@ -222,7 +222,7 @@ Applications should handle user-actionable auth failures directly and log unexpe
|
|
|
222
222
|
|
|
223
223
|
```ts
|
|
224
224
|
import * as errors from "@superbuilders/errors"
|
|
225
|
-
import
|
|
225
|
+
import { logger } from "@/logger"
|
|
226
226
|
import {
|
|
227
227
|
ErrAuthCancelled,
|
|
228
228
|
ErrAuthPopupBlocked,
|
|
@@ -309,7 +309,7 @@ The runtime also protects the trust boundary. If Primer presents a portable cust
|
|
|
309
309
|
Every renderer should switch on `state.phase`. Interaction rendering should then switch on `state.kind`.
|
|
310
310
|
|
|
311
311
|
```ts
|
|
312
|
-
import
|
|
312
|
+
import { logger } from "@/logger"
|
|
313
313
|
import type { PrimerState } from "@superbuilders/primer-tives/client"
|
|
314
314
|
|
|
315
315
|
async function runPrimer(initialState: PrimerState): Promise<void> {
|
|
@@ -912,14 +912,15 @@ Public schemas:
|
|
|
912
912
|
| `FractionInputPciSubmissionSchema` | fraction-input PCI submission shape |
|
|
913
913
|
| `RendererSubmissionSchema` | union of all supported submission shapes |
|
|
914
914
|
|
|
915
|
-
Always use
|
|
915
|
+
Always use the exported AJV-backed Draft 7 validator when parsing arbitrary input.
|
|
916
916
|
|
|
917
917
|
```ts
|
|
918
918
|
import * as errors from "@superbuilders/errors"
|
|
919
|
-
import
|
|
919
|
+
import { logger } from "@/logger"
|
|
920
|
+
import * as validate from "@superbuilders/validate"
|
|
920
921
|
import { RendererSubmissionSchema } from "@superbuilders/primer-tives/contracts"
|
|
921
922
|
|
|
922
|
-
const parsed = RendererSubmissionSchema.
|
|
923
|
+
const parsed = RendererSubmissionSchema.parse(payload)
|
|
923
924
|
if (!parsed.success) {
|
|
924
925
|
logger.error("submission payload invalid", { error: parsed.error })
|
|
925
926
|
throw errors.wrap(parsed.error, "submission payload")
|
|
@@ -965,7 +966,7 @@ The built-in standard interaction state methods call this before submitting. Cus
|
|
|
965
966
|
|
|
966
967
|
```ts
|
|
967
968
|
import * as errors from "@superbuilders/errors"
|
|
968
|
-
import
|
|
969
|
+
import { logger } from "@/logger"
|
|
969
970
|
import {
|
|
970
971
|
submissionValidationMessage,
|
|
971
972
|
validateSubmissionForInteraction
|
|
@@ -1274,10 +1275,10 @@ interface PrimerLogger {
|
|
|
1274
1275
|
}
|
|
1275
1276
|
```
|
|
1276
1277
|
|
|
1277
|
-
|
|
1278
|
+
Pino through the central `@/logger` module matches this interface directly.
|
|
1278
1279
|
|
|
1279
1280
|
```ts
|
|
1280
|
-
import
|
|
1281
|
+
import { logger } from "@/logger"
|
|
1281
1282
|
import { start, type PrimerOptions } from "@superbuilders/primer-tives/client"
|
|
1282
1283
|
|
|
1283
1284
|
const options = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-token.d.ts","sourceRoot":"","sources":["../../../src/client/auth/access-token.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"access-token.d.ts","sourceRoot":"","sources":["../../../src/client/auth/access-token.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAItE,QAAA,MAAM,wBAAwB,EAAE,OAAO,MAA+C,CAAA;AAEtF,KAAK,mBAAmB,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,CAAC,wBAAwB,CAAC,EAAE,IAAI,CAAA;CACzC,CAAA;AAmED,iBAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,mBAAmB,CAUpF;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAC7B,YAAY,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -11,6 +11,7 @@ type AccessTokenResolverOptions = {
|
|
|
11
11
|
type ResolvedAccessTokenResult = {
|
|
12
12
|
readonly kind: "resolved";
|
|
13
13
|
readonly accessToken: ResolvedAccessToken;
|
|
14
|
+
readonly invalidate?: () => void;
|
|
14
15
|
};
|
|
15
16
|
type UnauthenticatedAccessTokenResult = {
|
|
16
17
|
readonly kind: "unauthenticated";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/client/auth/provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAIN,KAAK,iBAAiB,EACtB,MAAM,iDAAiD,CAAA;AAExD,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,sDAAsD,CAAA;AAS7D,KAAK,0BAA0B,GAAG;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAA;IACvC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAC7B,CAAA;AAED,KAAK,yBAAyB,GAAG;IAChC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAA;
|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CAAC,iBAAiB,CAAC,CAwC/F;AAED,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,CAAA;AACvD,YAAY,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumed.d.ts","sourceRoot":"","sources":["../../src/client/consumed.ts"],"names":[],"mappings":"AAEA,iBAAS,YAAY,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"consumed.d.ts","sourceRoot":"","sources":["../../src/client/consumed.ts"],"names":[],"mappings":"AAEA,iBAAS,YAAY,IAAI,KAAK,CAE7B;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|