@vllnt/convex-progression 0.1.0-canary.0
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/CHANGELOG.md +19 -0
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/client/index.d.ts +61 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +64 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +20 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +3 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +40 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +82 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +133 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +80 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +4 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/mutations.d.ts +43 -0
- package/dist/component/mutations.d.ts.map +1 -0
- package/dist/component/mutations.js +179 -0
- package/dist/component/mutations.js.map +1 -0
- package/dist/component/queries.d.ts +14 -0
- package/dist/component/queries.d.ts.map +1 -0
- package/dist/component/queries.js +45 -0
- package/dist/component/queries.js.map +1 -0
- package/dist/component/schema.d.ts +32 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +21 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/validation.d.ts +4 -0
- package/dist/component/validation.d.ts.map +1 -0
- package/dist/component/validation.js +22 -0
- package/dist/component/validation.js.map +1 -0
- package/dist/component/validators.d.ts +52 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +20 -0
- package/dist/component/validators.js.map +1 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +36 -0
- package/dist/shared.js.map +1 -0
- package/docs/API.md +69 -0
- package/llms-full.txt +930 -0
- package/llms.txt +35 -0
- package/package.json +92 -0
- package/src/client/index.ts +191 -0
- package/src/client/types.ts +23 -0
- package/src/component/_generated/api.ts +56 -0
- package/src/component/_generated/component.ts +107 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +169 -0
- package/src/component/convex.config.ts +5 -0
- package/src/component/mutations.ts +205 -0
- package/src/component/queries.ts +50 -0
- package/src/component/schema.ts +21 -0
- package/src/component/validation.ts +30 -0
- package/src/component/validators.ts +23 -0
- package/src/shared.ts +47 -0
- package/src/test.ts +15 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Bound XP/streak arithmetic and reject silently lost awards.
|
|
12
|
+
- Validate query thresholds and all namespace/period refs.
|
|
13
|
+
- Clarify replay, erasure, simulation-test, and unreleased-candidate limitations.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Initial unpublished candidate of `@vllnt/convex-progression`.
|
|
18
|
+
- `accrue`, `recordActivity`, `get` (optional threshold recompute), `reset`,
|
|
19
|
+
`eraseSubject` (batched).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bntvllnt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<!-- Badges -->
|
|
2
|
+
[](https://www.convex.dev/components)
|
|
3
|
+
[](https://www.npmjs.com/package/@vllnt/convex-progression)
|
|
4
|
+
[](https://github.com/vllnt/convex-progression/actions/workflows/ci.yml)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
|
|
7
|
+
# @vllnt/convex-progression
|
|
8
|
+
|
|
9
|
+
XP → level and streak windows as a Convex component.
|
|
10
|
+
|
|
11
|
+
Not money (`@vllnt/convex-wallet`), not a resetting cap (`@vllnt/convex-quota`).
|
|
12
|
+
The host passes opaque `subjectRef` + `key` and the level `thresholds` on each write.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
const xp = new Progression(components.progression);
|
|
16
|
+
await xp.accrue(ctx, subjectRef, "solo", 10, [50, 150, 400]);
|
|
17
|
+
await xp.recordActivity(ctx, subjectRef, "solo", today, [], {
|
|
18
|
+
expectedPrevious: yesterday,
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **XP / level** — `accrue` adds XP; `level` is how many host `thresholds` that XP has reached.
|
|
25
|
+
- **Streaks** — `recordActivity` with a host `periodKey`; pass `expectedPrevious` to continue a streak or reset on a gap.
|
|
26
|
+
- **Opaque refs** — `subjectRef` and `key` are host strings (max 256 chars).
|
|
27
|
+
- **Recompute on read** — `get(..., thresholds)` can recompute `level` if the host changed the ladder.
|
|
28
|
+
- **Bounded erase** — `eraseSubject` deletes in batches and reschedules until clean.
|
|
29
|
+
- **Scopes** — default `"global"`.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Unreleased candidate (`0.1.0`); registry availability is not asserted. The command
|
|
34
|
+
below applies after publication. For pre-release evaluation, install a locally
|
|
35
|
+
built package tarball.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm add @vllnt/convex-progression
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Peer dependency: `convex@^1.45.0`; Node.js ≥20 (development toolchain:
|
|
42
|
+
Node 20.19+ or 22.12+).
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// convex/convex.config.ts
|
|
48
|
+
import { defineApp } from "convex/server";
|
|
49
|
+
import progression from "@vllnt/convex-progression/convex.config";
|
|
50
|
+
|
|
51
|
+
const app = defineApp();
|
|
52
|
+
app.use(progression);
|
|
53
|
+
export default app;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { components } from "./_generated/api";
|
|
58
|
+
import { mutation } from "./_generated/server";
|
|
59
|
+
import { Progression } from "@vllnt/convex-progression";
|
|
60
|
+
|
|
61
|
+
const xp = new Progression(components.progression);
|
|
62
|
+
const THRESHOLDS = [50, 150, 400];
|
|
63
|
+
|
|
64
|
+
export const onWin = mutation({
|
|
65
|
+
args: {},
|
|
66
|
+
handler: async (ctx) => {
|
|
67
|
+
const subjectRef = /* host-resolved identity */ "user_1";
|
|
68
|
+
await xp.accrue(ctx, subjectRef, "solo", 10, THRESHOLDS);
|
|
69
|
+
await xp.recordActivity(ctx, subjectRef, "solo", "2026-09-11", THRESHOLDS, {
|
|
70
|
+
expectedPrevious: "2026-09-10",
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Host rules:** never take `delta` or `thresholds` from the end-user.
|
|
77
|
+
|
|
78
|
+
## API Reference
|
|
79
|
+
|
|
80
|
+
| Method | Kind | Result |
|
|
81
|
+
|--------|------|--------|
|
|
82
|
+
| `accrue(ctx, subjectRef, key, delta, thresholds, scope?)` | mutation | `{ xp, level, streak, maxStreak, leveledUp, previousLevel, ... }` |
|
|
83
|
+
| `recordActivity(ctx, subjectRef, key, periodKey, thresholds, opts?)` | mutation | `{ streak, streakDelta, maxStreak, ... }` |
|
|
84
|
+
| `get(ctx, subjectRef, key, scope?, thresholds?)` | query | progress or `null` |
|
|
85
|
+
| `reset(ctx, subjectRef, key, scope?)` | mutation | `null` |
|
|
86
|
+
| `eraseSubject(ctx, subjectRef, scope?, batch?)` | mutation | `number` deleted this pass |
|
|
87
|
+
|
|
88
|
+
Full reference: [docs/API.md](docs/API.md).
|
|
89
|
+
|
|
90
|
+
## React
|
|
91
|
+
|
|
92
|
+
Backend-only — no `./react` entry.
|
|
93
|
+
|
|
94
|
+
## Security
|
|
95
|
+
|
|
96
|
+
- Auth-agnostic — the host resolves identity and passes an opaque `subjectRef`.
|
|
97
|
+
- Tables sandboxed — reached only through the exported functions.
|
|
98
|
+
- The host authorizes every read/write, derives scope and period keys, deduplicates
|
|
99
|
+
award events, and rejects late activity. See [lifecycle limits](docs/API.md#lifecycle-and-retries).
|
|
100
|
+
|
|
101
|
+
## Multiple mounts
|
|
102
|
+
|
|
103
|
+
Mount with `app.use(progression, { name: "gameProgress" })` and separately with
|
|
104
|
+
`{ name: "learningProgress" }`; construct a client for each generated component
|
|
105
|
+
reference. Each mount has isolated tables and scheduled work.
|
|
106
|
+
|
|
107
|
+
## Testing
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pnpm test
|
|
111
|
+
pnpm test:coverage
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Tests use the `convex-test` in-memory simulation (`@edge-runtime/vm`), not a real
|
|
115
|
+
Convex backend. They do not prove production OCC retries or scheduler behavior.
|
|
116
|
+
|
|
117
|
+
`node scripts/check-pack.mjs` checks tarball imports and NodeNext consumer types.
|
|
118
|
+
For a separate **local backend** concurrency/scheduler smoke test, provision an
|
|
119
|
+
anonymous deployment in an isolated HOME (never a cloud/production deployment):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
HOME=/tmp/progression-audit-home CONVEX_AGENT_MODE=anonymous pnpm convex dev --once --local-cloud-port 3320 --local-site-port 3321 --typecheck disable
|
|
123
|
+
HOME=/tmp/progression-audit-home CONVEX_AGENT_MODE=anonymous node scripts/check-local.mjs
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The probe starts/stops its own CLI and backend. This is bounded smoke evidence,
|
|
127
|
+
not proof of every conflict schedule or production workload. Example wrappers
|
|
128
|
+
accept raw refs and awards for testing only; they are not production auth gates.
|
|
129
|
+
|
|
130
|
+
## Contributing
|
|
131
|
+
|
|
132
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
133
|
+
|
|
134
|
+
## Author
|
|
135
|
+
|
|
136
|
+
Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
|
|
137
|
+
|
|
138
|
+
Part of the [@vllnt](https://github.com/vllnt) Convex component fleet — [vllnt.com](https://vllnt.com)
|
|
139
|
+
|
|
140
|
+
If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { FunctionArgs, FunctionReference, FunctionReturnType } from "convex/server";
|
|
2
|
+
import type { AccrueResult, ActivityResult, ProgressionOptions, ProgressState } from "./types.js";
|
|
3
|
+
export type ProgressionComponent = {
|
|
4
|
+
mutations: {
|
|
5
|
+
accrue: FunctionReference<"mutation", "internal", {
|
|
6
|
+
delta: number;
|
|
7
|
+
key: string;
|
|
8
|
+
scope: string;
|
|
9
|
+
subjectRef: string;
|
|
10
|
+
thresholds: number[];
|
|
11
|
+
}, AccrueResult>;
|
|
12
|
+
eraseSubject: FunctionReference<"mutation", "internal", {
|
|
13
|
+
batch?: number;
|
|
14
|
+
scope: string;
|
|
15
|
+
subjectRef: string;
|
|
16
|
+
}, number>;
|
|
17
|
+
recordActivity: FunctionReference<"mutation", "internal", {
|
|
18
|
+
expectedPrevious?: string;
|
|
19
|
+
key: string;
|
|
20
|
+
periodKey: string;
|
|
21
|
+
scope: string;
|
|
22
|
+
subjectRef: string;
|
|
23
|
+
thresholds: number[];
|
|
24
|
+
}, ActivityResult>;
|
|
25
|
+
reset: FunctionReference<"mutation", "internal", {
|
|
26
|
+
key: string;
|
|
27
|
+
scope: string;
|
|
28
|
+
subjectRef: string;
|
|
29
|
+
}, null>;
|
|
30
|
+
};
|
|
31
|
+
queries: {
|
|
32
|
+
get: FunctionReference<"query", "internal", {
|
|
33
|
+
key: string;
|
|
34
|
+
scope: string;
|
|
35
|
+
subjectRef: string;
|
|
36
|
+
thresholds?: number[];
|
|
37
|
+
}, null | ProgressState>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
type RunQueryCtx = {
|
|
41
|
+
runQuery<TQuery extends FunctionReference<"query", "internal">>(reference: TQuery, arguments_: FunctionArgs<TQuery>): Promise<FunctionReturnType<TQuery>>;
|
|
42
|
+
};
|
|
43
|
+
type RunMutationCtx = {
|
|
44
|
+
runMutation<TMutation extends FunctionReference<"mutation", "internal">>(reference: TMutation, arguments_: FunctionArgs<TMutation>): Promise<FunctionReturnType<TMutation>>;
|
|
45
|
+
};
|
|
46
|
+
export declare class Progression {
|
|
47
|
+
private readonly component;
|
|
48
|
+
private readonly defaultScope;
|
|
49
|
+
constructor(component: ProgressionComponent, options?: ProgressionOptions);
|
|
50
|
+
private scopeOf;
|
|
51
|
+
accrue(ctx: RunMutationCtx, subjectRef: string, key: string, delta: number, thresholds: number[], scope?: string): Promise<AccrueResult>;
|
|
52
|
+
recordActivity(ctx: RunMutationCtx, subjectRef: string, key: string, periodKey: string, thresholds: number[], options?: {
|
|
53
|
+
expectedPrevious?: string;
|
|
54
|
+
scope?: string;
|
|
55
|
+
}): Promise<ActivityResult>;
|
|
56
|
+
get(ctx: RunQueryCtx, subjectRef: string, key: string, scope?: string, thresholds?: number[]): Promise<null | ProgressState>;
|
|
57
|
+
reset(ctx: RunMutationCtx, subjectRef: string, key: string, scope?: string): Promise<null>;
|
|
58
|
+
eraseSubject(ctx: RunMutationCtx, subjectRef: string, scope?: string, batch?: number): Promise<number>;
|
|
59
|
+
}
|
|
60
|
+
export { type AccrueResult, type ActivityResult, type ProgressionOptions, type ProgressState, } from "./types.js";
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,i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AAG,EAAE,WAAW,EAChB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,GAAG,aAAa,CAAC,CAO/B;IAID,KAAK,CACH,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAMf;IAID,YAAY,CACV,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAMjB;CACF;AAED,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DEFAULT_SCOPE } from "../shared.js";
|
|
2
|
+
export class Progression {
|
|
3
|
+
component;
|
|
4
|
+
defaultScope;
|
|
5
|
+
constructor(component, options = {}) {
|
|
6
|
+
this.component = component;
|
|
7
|
+
this.defaultScope = options.defaultScope ?? DEFAULT_SCOPE;
|
|
8
|
+
}
|
|
9
|
+
scopeOf(scope) {
|
|
10
|
+
return scope ?? this.defaultScope;
|
|
11
|
+
}
|
|
12
|
+
// Public positional API retained for compatibility.
|
|
13
|
+
// eslint-disable-next-line max-params
|
|
14
|
+
accrue(ctx, subjectRef, key, delta, thresholds, scope) {
|
|
15
|
+
return ctx.runMutation(this.component.mutations.accrue, {
|
|
16
|
+
delta,
|
|
17
|
+
key,
|
|
18
|
+
scope: this.scopeOf(scope),
|
|
19
|
+
subjectRef,
|
|
20
|
+
thresholds,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
// Public positional API retained for compatibility.
|
|
24
|
+
// eslint-disable-next-line max-params
|
|
25
|
+
recordActivity(ctx, subjectRef, key, periodKey, thresholds, options = {}) {
|
|
26
|
+
return ctx.runMutation(this.component.mutations.recordActivity, {
|
|
27
|
+
expectedPrevious: options.expectedPrevious,
|
|
28
|
+
key,
|
|
29
|
+
periodKey,
|
|
30
|
+
scope: this.scopeOf(options.scope),
|
|
31
|
+
subjectRef,
|
|
32
|
+
thresholds,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// Public positional API retained for compatibility.
|
|
36
|
+
// eslint-disable-next-line max-params
|
|
37
|
+
get(ctx, subjectRef, key, scope, thresholds) {
|
|
38
|
+
return ctx.runQuery(this.component.queries.get, {
|
|
39
|
+
key,
|
|
40
|
+
scope: this.scopeOf(scope),
|
|
41
|
+
subjectRef,
|
|
42
|
+
thresholds,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// Public positional API retained for compatibility.
|
|
46
|
+
// eslint-disable-next-line max-params
|
|
47
|
+
reset(ctx, subjectRef, key, scope) {
|
|
48
|
+
return ctx.runMutation(this.component.mutations.reset, {
|
|
49
|
+
key,
|
|
50
|
+
scope: this.scopeOf(scope),
|
|
51
|
+
subjectRef,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Public positional API retained for compatibility.
|
|
55
|
+
// eslint-disable-next-line max-params
|
|
56
|
+
eraseSubject(ctx, subjectRef, scope, batch) {
|
|
57
|
+
return ctx.runMutation(this.component.mutations.eraseSubject, {
|
|
58
|
+
batch,
|
|
59
|
+
scope: this.scopeOf(scope),
|
|
60
|
+
subjectRef,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA8E7C,MAAM,OAAO,WAAW;IAIH,SAAS;I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AAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,oDAAoD;IACpD,sCAAsC;IACtC,KAAK,CACH,GAAmB,EACnB,UAAkB,EAClB,GAAW,EACX,KAAc;QAEd,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE;YACrD,GAAG;YACH,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAC1B,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,oDAAoD;IACpD,sCAAsC;IACtC,YAAY,CACV,GAAmB,EACnB,UAAkB,EAClB,KAAc,EACd,KAAc;QAEd,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE;YAC5D,KAAK;YACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAC1B,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Public TypeScript surface for the progression client. */
|
|
2
|
+
export type ProgressState = {
|
|
3
|
+
lastPeriodKey?: string;
|
|
4
|
+
level: number;
|
|
5
|
+
maxStreak: number;
|
|
6
|
+
streak: number;
|
|
7
|
+
updatedAt: number;
|
|
8
|
+
xp: number;
|
|
9
|
+
};
|
|
10
|
+
export type AccrueResult = {
|
|
11
|
+
leveledUp: boolean;
|
|
12
|
+
previousLevel: number;
|
|
13
|
+
} & ProgressState;
|
|
14
|
+
export type ActivityResult = {
|
|
15
|
+
streakDelta: number;
|
|
16
|
+
} & ProgressState;
|
|
17
|
+
export type ProgressionOptions = {
|
|
18
|
+
defaultScope?: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,aAAa,CAAC;AAElB,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,aAAa,CAAC;AAElB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,4DAA4D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `api` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type * as mutations from "../mutations.js";
|
|
10
|
+
import type * as queries from "../queries.js";
|
|
11
|
+
import type * as validation from "../validation.js";
|
|
12
|
+
import type * as validators from "../validators.js";
|
|
13
|
+
import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
|
|
14
|
+
declare const fullApi: ApiFromModules<{
|
|
15
|
+
mutations: typeof mutations;
|
|
16
|
+
queries: typeof queries;
|
|
17
|
+
validation: typeof validation;
|
|
18
|
+
validators: typeof validators;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* ```js
|
|
25
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
|
|
29
|
+
/**
|
|
30
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
31
|
+
*
|
|
32
|
+
* Usage:
|
|
33
|
+
* ```js
|
|
34
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
|
|
38
|
+
export declare const components: {};
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,KAAK,UAAU,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,UAAU,EAAE,OAAO,UAAU,CAAC;CAC/B,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `api` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { anyApi, componentsGeneric } from "convex/server";
|
|
11
|
+
const fullApi = anyApi;
|
|
12
|
+
/**
|
|
13
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```js
|
|
17
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const api = anyApi;
|
|
21
|
+
/**
|
|
22
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
23
|
+
*
|
|
24
|
+
* Usage:
|
|
25
|
+
* ```js
|
|
26
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const internal = anyApi;
|
|
30
|
+
export const components = componentsGeneric();
|
|
31
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAYH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAKR,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated `ComponentApi` utility.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { FunctionReference } from "convex/server";
|
|
10
|
+
/**
|
|
11
|
+
* A utility for referencing a Convex component's exposed API.
|
|
12
|
+
*
|
|
13
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```ts
|
|
16
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
17
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type ComponentApi<Name extends string | undefined = string | undefined> = {
|
|
22
|
+
mutations: {
|
|
23
|
+
accrue: FunctionReference<"mutation", "internal", {
|
|
24
|
+
delta: number;
|
|
25
|
+
key: string;
|
|
26
|
+
scope: string;
|
|
27
|
+
subjectRef: string;
|
|
28
|
+
thresholds: Array<number>;
|
|
29
|
+
}, {
|
|
30
|
+
lastPeriodKey?: string;
|
|
31
|
+
level: number;
|
|
32
|
+
leveledUp: boolean;
|
|
33
|
+
maxStreak: number;
|
|
34
|
+
previousLevel: number;
|
|
35
|
+
streak: number;
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
xp: number;
|
|
38
|
+
}, Name>;
|
|
39
|
+
eraseSubject: FunctionReference<"mutation", "internal", {
|
|
40
|
+
batch?: number;
|
|
41
|
+
scope: string;
|
|
42
|
+
subjectRef: string;
|
|
43
|
+
}, number, Name>;
|
|
44
|
+
recordActivity: FunctionReference<"mutation", "internal", {
|
|
45
|
+
expectedPrevious?: string;
|
|
46
|
+
key: string;
|
|
47
|
+
periodKey: string;
|
|
48
|
+
scope: string;
|
|
49
|
+
subjectRef: string;
|
|
50
|
+
thresholds: Array<number>;
|
|
51
|
+
}, {
|
|
52
|
+
lastPeriodKey?: string;
|
|
53
|
+
level: number;
|
|
54
|
+
maxStreak: number;
|
|
55
|
+
streak: number;
|
|
56
|
+
streakDelta: number;
|
|
57
|
+
updatedAt: number;
|
|
58
|
+
xp: number;
|
|
59
|
+
}, Name>;
|
|
60
|
+
reset: FunctionReference<"mutation", "internal", {
|
|
61
|
+
key: string;
|
|
62
|
+
scope: string;
|
|
63
|
+
subjectRef: string;
|
|
64
|
+
}, null, Name>;
|
|
65
|
+
};
|
|
66
|
+
queries: {
|
|
67
|
+
get: FunctionReference<"query", "internal", {
|
|
68
|
+
key: string;
|
|
69
|
+
scope: string;
|
|
70
|
+
subjectRef: string;
|
|
71
|
+
thresholds?: Array<number>;
|
|
72
|
+
}, null | {
|
|
73
|
+
lastPeriodKey?: string;
|
|
74
|
+
level: number;
|
|
75
|
+
maxStreak: number;
|
|
76
|
+
streak: number;
|
|
77
|
+
updatedAt: number;
|
|
78
|
+
xp: number;
|
|
79
|
+
}, Name>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,SAAS,EAAE;QACT,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,KAAK,EAAE,MAAM,CAAC;YACd,GAAG,EAAE,MAAM,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AM,CAAA;SAAE,EAClD,IAAI,EACJ,IAAI,CACL,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,GAAG,EAAE,iBAAiB,CACpB,OAAO,EACP,UAAU,EACV;YACE,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,UAAU,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;SAC5B,EACD,IAAI,GAAG;YACL,aAAa,CAAC,EAAE,MAAM,CAAC;YACvB,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,SAAS,EAAE,MAAM,CAAC;YAClB,EAAE,EAAE,MAAM,CAAC;SACZ,EACD,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated data model types.
|
|
3
|
+
*
|
|
4
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
5
|
+
*
|
|
6
|
+
* To regenerate, run `npx convex dev`.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
|
|
10
|
+
import type { GenericId } from "convex/values";
|
|
11
|
+
import schema from "../schema.js";
|
|
12
|
+
/**
|
|
13
|
+
* The names of all of your Convex tables.
|
|
14
|
+
*/
|
|
15
|
+
export type TableNames = TableNamesInDataModel<DataModel>;
|
|
16
|
+
/**
|
|
17
|
+
* The type of a document stored in Convex.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
20
|
+
*/
|
|
21
|
+
export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
|
|
22
|
+
/**
|
|
23
|
+
* An identifier for a document in Convex.
|
|
24
|
+
*
|
|
25
|
+
* Convex documents are uniquely identified by their `Id`, which is accessible
|
|
26
|
+
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
|
|
27
|
+
*
|
|
28
|
+
* Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
|
|
29
|
+
*
|
|
30
|
+
* IDs are just strings at runtime, but this type can be used to distinguish them from other
|
|
31
|
+
* strings when type checking.
|
|
32
|
+
*
|
|
33
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
34
|
+
*/
|
|
35
|
+
export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
|
|
36
|
+
/**
|
|
37
|
+
* A type describing your Convex data model.
|
|
38
|
+
*
|
|
39
|
+
* This type includes information about what tables you have, the type of
|
|
40
|
+
* documents stored in those tables, and the indexes defined on them.
|
|
41
|
+
*
|
|
42
|
+
* This type is used to parameterize methods like `queryGeneric` and
|
|
43
|
+
* `mutationGeneric` to make them type-safe.
|
|
44
|
+
*/
|
|
45
|
+
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
|
|
46
|
+
//# sourceMappingURL=dataModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAC5D,SAAS,EACT,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,GAAG,gBAAgB,IAC5D,SAAS,CAAC,SAAS,CAAC,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
|