@omnichar/contracts 0.5.0 → 0.6.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/dist/v1/index.d.ts +2 -0
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +2 -0
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/me.d.ts +5 -0
- package/dist/v1/me.d.ts.map +1 -1
- package/dist/v1/me.js +3 -0
- package/dist/v1/me.js.map +1 -1
- package/dist/v1/purchases.d.ts +40 -0
- package/dist/v1/purchases.d.ts.map +1 -0
- package/dist/v1/purchases.js +56 -0
- package/dist/v1/purchases.js.map +1 -0
- package/dist/v1/terms.d.ts +8 -0
- package/dist/v1/terms.d.ts.map +1 -0
- package/dist/v1/terms.js +15 -0
- package/dist/v1/terms.js.map +1 -0
- package/package.json +1 -1
package/dist/v1/index.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ export * from './runs.js';
|
|
|
6
6
|
export * from './assets.js';
|
|
7
7
|
export * from './plans.js';
|
|
8
8
|
export * from './me.js';
|
|
9
|
+
export * from './terms.js';
|
|
9
10
|
export * from './apiKeys.js';
|
|
10
11
|
export * from './datasets.js';
|
|
11
12
|
export * from './characters.js';
|
|
12
13
|
export * from './credits.js';
|
|
14
|
+
export * from './purchases.js';
|
|
13
15
|
export * from './capacity.js';
|
|
14
16
|
export * from './accessRequests.js';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/v1/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA"}
|
package/dist/v1/index.js
CHANGED
|
@@ -6,10 +6,12 @@ export * from './runs.js';
|
|
|
6
6
|
export * from './assets.js';
|
|
7
7
|
export * from './plans.js';
|
|
8
8
|
export * from './me.js';
|
|
9
|
+
export * from './terms.js';
|
|
9
10
|
export * from './apiKeys.js';
|
|
10
11
|
export * from './datasets.js';
|
|
11
12
|
export * from './characters.js';
|
|
12
13
|
export * from './credits.js';
|
|
14
|
+
export * from './purchases.js';
|
|
13
15
|
export * from './capacity.js';
|
|
14
16
|
export * from './accessRequests.js';
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/dist/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA"}
|
package/dist/v1/me.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ export declare const meSchema: z.ZodObject<{
|
|
|
19
19
|
member: "member";
|
|
20
20
|
user: "user";
|
|
21
21
|
}>;
|
|
22
|
+
terms: z.ZodObject<{
|
|
23
|
+
version: z.ZodNullable<z.ZodString>;
|
|
24
|
+
acceptedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
25
|
+
previousVersion: z.ZodNullable<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>;
|
|
22
27
|
}, z.core.$strip>;
|
|
23
28
|
export type Me = z.infer<typeof meSchema>;
|
|
24
29
|
//# sourceMappingURL=me.d.ts.map
|
package/dist/v1/me.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/v1/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/v1/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;iBAYnB,CAAA;AAEF,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAA"}
|
package/dist/v1/me.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { planSchema } from './plans.js';
|
|
3
|
+
import { termsAcceptanceSchema } from './terms.js';
|
|
3
4
|
// The signed-in person, as this service knows them. Name and picture come from their sign-in
|
|
4
5
|
// provider; both are optional because no provider guarantees either.
|
|
5
6
|
export const meSchema = z.object({
|
|
@@ -12,5 +13,7 @@ export const meSchema = z.object({
|
|
|
12
13
|
// What this person may do. The browser uses it to decide what to render; the control plane checks
|
|
13
14
|
// it again on every route, because a hidden button is not an authorization control.
|
|
14
15
|
role: z.enum(['admin', 'team', 'member', 'user']),
|
|
16
|
+
// Recorded at sign-in from the verified session. The browser never supplies it.
|
|
17
|
+
terms: termsAcceptanceSchema,
|
|
15
18
|
});
|
|
16
19
|
//# sourceMappingURL=me.js.map
|
package/dist/v1/me.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"me.js","sourceRoot":"","sources":["../../src/v1/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"me.js","sourceRoot":"","sources":["../../src/v1/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAElD,6FAA6F;AAC7F,qEAAqE;AACrE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC1B,IAAI,EAAE,UAAU;IAChB,kGAAkG;IAClG,oFAAoF;IACpF,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,gFAAgF;IAChF,KAAK,EAAE,qBAAqB;CAC7B,CAAC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PURCHASE_CURRENCY = "USD";
|
|
3
|
+
export declare const MIN_PURCHASE_CREDITS = 1000;
|
|
4
|
+
export declare const MAX_PURCHASE_CREDITS = 100000;
|
|
5
|
+
export declare const CREDIT_PACKS: readonly [2500, 5000, 10000];
|
|
6
|
+
/** Whole credits for a dollar figure. Rounded, because a third decimal is a fraction of a cent. */
|
|
7
|
+
export declare function creditsForDollars(dollars: number): number;
|
|
8
|
+
export declare function dollarsForCredits(credits: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* What the payment provider is told to charge, in the currency's smallest unit.
|
|
11
|
+
*
|
|
12
|
+
* A credit is one US cent, so this is the credit count itself. Kept as a named function rather than
|
|
13
|
+
* an equality nobody wrote down: if the rate ever moves, the call sites stay right and the test
|
|
14
|
+
* pinning this fails instead of the charge quietly drifting from the grant.
|
|
15
|
+
*/
|
|
16
|
+
export declare function smallestUnitForCredits(credits: number): number;
|
|
17
|
+
export declare const createCreditOrderBodySchema: z.ZodObject<{
|
|
18
|
+
credits: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const createCreditOrderResponseSchema: z.ZodObject<{
|
|
21
|
+
orderId: z.ZodString;
|
|
22
|
+
amount: z.ZodNumber;
|
|
23
|
+
currency: z.ZodLiteral<"USD">;
|
|
24
|
+
credits: z.ZodNumber;
|
|
25
|
+
keyId: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const confirmCreditOrderBodySchema: z.ZodObject<{
|
|
28
|
+
paymentId: z.ZodString;
|
|
29
|
+
signature: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const confirmCreditOrderResponseSchema: z.ZodObject<{
|
|
32
|
+
applied: z.ZodBoolean;
|
|
33
|
+
balance: z.ZodNumber;
|
|
34
|
+
credits: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type CreateCreditOrderBody = z.infer<typeof createCreditOrderBodySchema>;
|
|
37
|
+
export type CreateCreditOrderResponse = z.infer<typeof createCreditOrderResponseSchema>;
|
|
38
|
+
export type ConfirmCreditOrderBody = z.infer<typeof confirmCreditOrderBodySchema>;
|
|
39
|
+
export type ConfirmCreditOrderResponse = z.infer<typeof confirmCreditOrderResponseSchema>;
|
|
40
|
+
//# sourceMappingURL=purchases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purchases.d.ts","sourceRoot":"","sources":["../../src/v1/purchases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAKtC,eAAO,MAAM,oBAAoB,OAAQ,CAAA;AACzC,eAAO,MAAM,oBAAoB,SAAU,CAAA;AAG3C,eAAO,MAAM,YAAY,8BAAkC,CAAA;AAE3D,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D;AAID,eAAO,MAAM,2BAA2B;;iBAEtC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;iBAU1C,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;iBAK3C,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAC/E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AACvF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACjF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USD_PER_CREDIT } from './credits.js';
|
|
3
|
+
// Charged in US dollars, and hardcoded rather than taken from a request: INR and USD are both
|
|
4
|
+
// hundredths, so a substituted currency leaves the integer amount identical and changes the money.
|
|
5
|
+
export const PURCHASE_CURRENCY = 'USD';
|
|
6
|
+
// $10 and $1000. Held as credits because that is what the wire carries; dollars are a rendering
|
|
7
|
+
// concern, and `MAX_PURCHASE_CREDITS` must stay under the ledger's own MAX_GRANT_CREDITS or a legal
|
|
8
|
+
// purchase takes the money and then fails to grant it.
|
|
9
|
+
export const MIN_PURCHASE_CREDITS = 1_000;
|
|
10
|
+
export const MAX_PURCHASE_CREDITS = 100_000;
|
|
11
|
+
// $25 / $50 / $100. Offered amounts, not the only ones: anything inside the bounds above is valid.
|
|
12
|
+
export const CREDIT_PACKS = [2_500, 5_000, 10_000];
|
|
13
|
+
/** Whole credits for a dollar figure. Rounded, because a third decimal is a fraction of a cent. */
|
|
14
|
+
export function creditsForDollars(dollars) {
|
|
15
|
+
return Math.round(dollars / USD_PER_CREDIT);
|
|
16
|
+
}
|
|
17
|
+
export function dollarsForCredits(credits) {
|
|
18
|
+
return credits * USD_PER_CREDIT;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* What the payment provider is told to charge, in the currency's smallest unit.
|
|
22
|
+
*
|
|
23
|
+
* A credit is one US cent, so this is the credit count itself. Kept as a named function rather than
|
|
24
|
+
* an equality nobody wrote down: if the rate ever moves, the call sites stay right and the test
|
|
25
|
+
* pinning this fails instead of the charge quietly drifting from the grant.
|
|
26
|
+
*/
|
|
27
|
+
export function smallestUnitForCredits(credits) {
|
|
28
|
+
return Math.round(dollarsForCredits(credits) * 100);
|
|
29
|
+
}
|
|
30
|
+
// The browser sends credits and nothing else. The amount, the currency and the buyer are all
|
|
31
|
+
// decided server-side, so there is no field here worth tampering with.
|
|
32
|
+
export const createCreditOrderBodySchema = z.object({
|
|
33
|
+
credits: z.number().int().min(MIN_PURCHASE_CREDITS).max(MAX_PURCHASE_CREDITS),
|
|
34
|
+
});
|
|
35
|
+
export const createCreditOrderResponseSchema = z.object({
|
|
36
|
+
orderId: z.string().min(1),
|
|
37
|
+
// The smallest unit, exactly as the provider was told it. Echoed so the checkout modal is opened
|
|
38
|
+
// with the server's figure rather than one the browser recomputed.
|
|
39
|
+
amount: z.number().int().positive(),
|
|
40
|
+
currency: z.literal(PURCHASE_CURRENCY),
|
|
41
|
+
credits: z.number().int().positive(),
|
|
42
|
+
// The publishable key id, which is in the provider's own client snippet. Returned with the order
|
|
43
|
+
// so the key and the order cannot come from different accounts or different modes.
|
|
44
|
+
keyId: z.string().min(1),
|
|
45
|
+
});
|
|
46
|
+
export const confirmCreditOrderBodySchema = z.object({
|
|
47
|
+
paymentId: z.string().min(1).max(64),
|
|
48
|
+
signature: z.string().min(1).max(200),
|
|
49
|
+
});
|
|
50
|
+
export const confirmCreditOrderResponseSchema = z.object({
|
|
51
|
+
// False when the credits were already granted, which the webhook usually does first.
|
|
52
|
+
applied: z.boolean(),
|
|
53
|
+
balance: z.number(),
|
|
54
|
+
credits: z.number().int().positive(),
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=purchases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purchases.js","sourceRoot":"","sources":["../../src/v1/purchases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,8FAA8F;AAC9F,mGAAmG;AACnG,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAA;AAEtC,gGAAgG;AAChG,oGAAoG;AACpG,uDAAuD;AACvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAA;AACzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAE3C,mGAAmG;AACnG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAU,CAAA;AAE3D,mGAAmG;AACnG,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,OAAO,GAAG,cAAc,CAAA;AACjC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACpD,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAA;AACrD,CAAC;AAED,6FAA6F;AAC7F,uEAAuE;AACvE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;CAC9E,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,iGAAiG;IACjG,mEAAmE;IACnE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACpC,iGAAiG;IACjG,mFAAmF;IACnF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACzB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACtC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,qFAAqF;IACrF,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const termsAcceptanceSchema: z.ZodObject<{
|
|
3
|
+
version: z.ZodNullable<z.ZodString>;
|
|
4
|
+
acceptedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
5
|
+
previousVersion: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type TermsAcceptance = z.infer<typeof termsAcceptanceSchema>;
|
|
8
|
+
//# sourceMappingURL=terms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terms.d.ts","sourceRoot":"","sources":["../../src/v1/terms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,qBAAqB;;;;iBAOhC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
|
package/dist/v1/terms.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// What this service has recorded about someone agreeing to the Terms of Service.
|
|
3
|
+
//
|
|
4
|
+
// Every field is written server-side from the verified session and the server's own TERMS_VERSION.
|
|
5
|
+
// Nothing here is ever read from a request body, so a client cannot backdate an acceptance or
|
|
6
|
+
// claim one that did not happen.
|
|
7
|
+
export const termsAcceptanceSchema = z.object({
|
|
8
|
+
// The Terms version on record, as an ISO date. Null before anyone has signed in through the UI.
|
|
9
|
+
version: z.string().nullable(),
|
|
10
|
+
acceptedAt: z.iso.datetime().nullable(),
|
|
11
|
+
// The version this call replaced, so the dashboard can say the Terms changed. Null on a first
|
|
12
|
+
// acceptance, and on every later call that changed nothing.
|
|
13
|
+
previousVersion: z.string().nullable(),
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=terms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terms.js","sourceRoot":"","sources":["../../src/v1/terms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,iFAAiF;AACjF,EAAE;AACF,mGAAmG;AACnG,8FAA8F;AAC9F,iCAAiC;AACjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,gGAAgG;IAChG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACvC,8FAA8F;IAC9F,4DAA4D;IAC5D,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAA"}
|
package/package.json
CHANGED