@omnichar/contracts 0.0.0-01d940d → 0.0.0-0509ece
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/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +3 -0
- package/dist/errors.js.map +1 -1
- package/dist/v1/credits.d.ts +13 -1
- package/dist/v1/credits.d.ts.map +1 -1
- package/dist/v1/credits.js +6 -0
- package/dist/v1/credits.js.map +1 -1
- package/dist/v1/index.d.ts +3 -0
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +3 -0
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/me.d.ts +1 -1
- package/dist/v1/planPresets.d.ts +93 -0
- package/dist/v1/planPresets.d.ts.map +1 -0
- package/dist/v1/planPresets.js +80 -0
- package/dist/v1/planPresets.js.map +1 -0
- package/dist/v1/teamKeys.d.ts +144 -0
- package/dist/v1/teamKeys.d.ts.map +1 -0
- package/dist/v1/teamKeys.js +57 -0
- package/dist/v1/teamKeys.js.map +1 -0
- package/dist/v1/teams.d.ts +254 -0
- package/dist/v1/teams.d.ts.map +1 -0
- package/dist/v1/teams.js +105 -0
- package/dist/v1/teams.js.map +1 -0
- package/package.json +1 -1
package/dist/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const ERROR_CODES: readonly ["bad_request", "unauthorized", "forbidden", "not_found", "conflict", "unprocessable", "rate_limited", "insufficient_credits", "storage_limit_reached", "upstream_unavailable", "internal"];
|
|
2
|
+
export declare const ERROR_CODES: readonly ["bad_request", "unauthorized", "forbidden", "not_found", "conflict", "unprocessable", "rate_limited", "insufficient_credits", "storage_limit_reached", "team_not_found", "upstream_unavailable", "internal"];
|
|
3
3
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
4
4
|
export declare const errorCodeSchema: z.ZodEnum<{
|
|
5
5
|
bad_request: "bad_request";
|
|
@@ -11,6 +11,7 @@ export declare const errorCodeSchema: z.ZodEnum<{
|
|
|
11
11
|
rate_limited: "rate_limited";
|
|
12
12
|
insufficient_credits: "insufficient_credits";
|
|
13
13
|
storage_limit_reached: "storage_limit_reached";
|
|
14
|
+
team_not_found: "team_not_found";
|
|
14
15
|
upstream_unavailable: "upstream_unavailable";
|
|
15
16
|
internal: "internal";
|
|
16
17
|
}>;
|
|
@@ -26,6 +27,7 @@ export declare const apiErrorSchema: z.ZodObject<{
|
|
|
26
27
|
rate_limited: "rate_limited";
|
|
27
28
|
insufficient_credits: "insufficient_credits";
|
|
28
29
|
storage_limit_reached: "storage_limit_reached";
|
|
30
|
+
team_not_found: "team_not_found";
|
|
29
31
|
upstream_unavailable: "upstream_unavailable";
|
|
30
32
|
internal: "internal";
|
|
31
33
|
}>;
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,wNAgBd,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,eAAO,MAAM,eAAe;;;;;;;;;;;;;EAAsB,CAAA;AAElD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;iBAQzB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAa1D,CAAA"}
|
package/dist/errors.js
CHANGED
|
@@ -13,6 +13,8 @@ export const ERROR_CODES = [
|
|
|
13
13
|
// Storage is an entitlement, not a purchase. Somebody at their cap with a full credit balance
|
|
14
14
|
// needs to be told about storage, so this is deliberately not insufficient_credits.
|
|
15
15
|
'storage_limit_reached',
|
|
16
|
+
// A 404 of its own, so a studio holding a stale team choice can drop it and fall back to personal.
|
|
17
|
+
'team_not_found',
|
|
16
18
|
'upstream_unavailable',
|
|
17
19
|
'internal',
|
|
18
20
|
];
|
|
@@ -36,6 +38,7 @@ export const HTTP_STATUS_FOR_CODE = {
|
|
|
36
38
|
rate_limited: 429,
|
|
37
39
|
insufficient_credits: 402,
|
|
38
40
|
storage_limit_reached: 409,
|
|
41
|
+
team_not_found: 404,
|
|
39
42
|
upstream_unavailable: 503,
|
|
40
43
|
internal: 500,
|
|
41
44
|
};
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gGAAgG;AAChG,4FAA4F;AAC5F,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,aAAa;IACb,cAAc;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,eAAe;IACf,cAAc;IACd,sBAAsB;IACtB,8FAA8F;IAC9F,oFAAoF;IACpF,uBAAuB;IACvB,sBAAsB;IACtB,UAAU;CACF,CAAA;AAIV,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,+FAA+F;QAC/F,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAA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AAIF,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,WAAW,EAAE,GAAG;IAChB,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,GAAG;IACb,aAAa,EAAE,GAAG;IAClB,YAAY,EAAE,GAAG;IACjB,oBAAoB,EAAE,GAAG;IACzB,qBAAqB,EAAE,GAAG;IAC1B,cAAc,EAAE,GAAG;IACnB,oBAAoB,EAAE,GAAG;IACzB,QAAQ,EAAE,GAAG;CACd,CAAA"}
|
package/dist/v1/credits.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const MICRO_PER_CREDIT = 1000000;
|
|
3
3
|
export declare const USD_PER_CREDIT = 0.01;
|
|
4
|
-
export declare const LEDGER_KINDS: readonly ["grant", "hold", "hold_release", "charge", "refund", "adjustment"];
|
|
4
|
+
export declare const LEDGER_KINDS: readonly ["grant", "hold", "hold_release", "charge", "refund", "adjustment", "expire"];
|
|
5
5
|
export declare const ledgerKindSchema: z.ZodEnum<{
|
|
6
6
|
grant: "grant";
|
|
7
7
|
hold: "hold";
|
|
@@ -9,6 +9,7 @@ export declare const ledgerKindSchema: z.ZodEnum<{
|
|
|
9
9
|
charge: "charge";
|
|
10
10
|
refund: "refund";
|
|
11
11
|
adjustment: "adjustment";
|
|
12
|
+
expire: "expire";
|
|
12
13
|
}>;
|
|
13
14
|
export declare const LEDGER_SOURCES: readonly ["purchase", "subscription", "promo", "refund", "system"];
|
|
14
15
|
export declare const ledgerSourceSchema: z.ZodEnum<{
|
|
@@ -27,6 +28,7 @@ export declare const ledgerEntrySchema: z.ZodObject<{
|
|
|
27
28
|
charge: "charge";
|
|
28
29
|
refund: "refund";
|
|
29
30
|
adjustment: "adjustment";
|
|
31
|
+
expire: "expire";
|
|
30
32
|
}>;
|
|
31
33
|
credits: z.ZodNumber;
|
|
32
34
|
runId: z.ZodNullable<z.ZodUUID>;
|
|
@@ -40,6 +42,10 @@ export declare const ledgerEntrySchema: z.ZodObject<{
|
|
|
40
42
|
system: "system";
|
|
41
43
|
}>>;
|
|
42
44
|
reference: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
45
|
+
unit: z.ZodDefault<z.ZodEnum<{
|
|
46
|
+
credits: "credits";
|
|
47
|
+
builds: "builds";
|
|
48
|
+
}>>;
|
|
43
49
|
}, z.core.$strip>;
|
|
44
50
|
export type LedgerEntry = z.infer<typeof ledgerEntrySchema>;
|
|
45
51
|
export declare const creditBalanceSchema: z.ZodObject<{
|
|
@@ -47,6 +53,7 @@ export declare const creditBalanceSchema: z.ZodObject<{
|
|
|
47
53
|
low: z.ZodBoolean;
|
|
48
54
|
spent30d: z.ZodNumber;
|
|
49
55
|
imagesLeft: z.ZodNullable<z.ZodNumber>;
|
|
56
|
+
builds: z.ZodDefault<z.ZodNumber>;
|
|
50
57
|
}, z.core.$strip>;
|
|
51
58
|
export type CreditBalance = z.infer<typeof creditBalanceSchema>;
|
|
52
59
|
export declare const usagePointSchema: z.ZodObject<{
|
|
@@ -70,6 +77,7 @@ export declare const ledgerPageSchema: z.ZodObject<{
|
|
|
70
77
|
charge: "charge";
|
|
71
78
|
refund: "refund";
|
|
72
79
|
adjustment: "adjustment";
|
|
80
|
+
expire: "expire";
|
|
73
81
|
}>;
|
|
74
82
|
credits: z.ZodNumber;
|
|
75
83
|
runId: z.ZodNullable<z.ZodUUID>;
|
|
@@ -83,6 +91,10 @@ export declare const ledgerPageSchema: z.ZodObject<{
|
|
|
83
91
|
system: "system";
|
|
84
92
|
}>>;
|
|
85
93
|
reference: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
94
|
+
unit: z.ZodDefault<z.ZodEnum<{
|
|
95
|
+
credits: "credits";
|
|
96
|
+
builds: "builds";
|
|
97
|
+
}>>;
|
|
86
98
|
}, z.core.$strip>>;
|
|
87
99
|
}, z.core.$strip>;
|
|
88
100
|
/**
|
package/dist/v1/credits.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credits.d.ts","sourceRoot":"","sources":["../../src/v1/credits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB,UAAY,CAAA;AAIzC,eAAO,MAAM,cAAc,OAAO,CAAA;AAElC,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"credits.d.ts","sourceRoot":"","sources":["../../src/v1/credits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB,UAAY,CAAA;AAIzC,eAAO,MAAM,cAAc,OAAO,CAAA;AAElC,eAAO,MAAM,YAAY,wFASf,CAAA;AACV,eAAO,MAAM,gBAAgB;;;;;;;;EAAuB,CAAA;AAEpD,eAAO,MAAM,cAAc,oEAAqE,CAAA;AAChG,eAAO,MAAM,kBAAkB;;;;;;EAAyB,CAAA;AAExD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgB5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,eAAO,MAAM,mBAAmB;;;;;;iBAa9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,eAAO,MAAM,gBAAgB;;;iBAAsD,CAAA;AACnF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,WAAW;;;;;iBAAkD,CAAA;AAE1E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAkD,CAAA;AAE/E;;;;;GAKG;AAIH,eAAO,MAAM,aAAa,+BAAgC,CAAA;AAC1D,eAAO,MAAM,iBAAiB;;;EAAwB,CAAA;AACtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAU3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,sBAAsB;;;;;iBAMjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,eAAO,MAAM,0BAA0B;;;iBAGrC,CAAA"}
|
package/dist/v1/credits.js
CHANGED
|
@@ -12,6 +12,8 @@ export const LEDGER_KINDS = [
|
|
|
12
12
|
'charge',
|
|
13
13
|
'refund',
|
|
14
14
|
'adjustment',
|
|
15
|
+
// Unused prepaid builds leaving the balance when their grant lapses.
|
|
16
|
+
'expire',
|
|
15
17
|
];
|
|
16
18
|
export const ledgerKindSchema = z.enum(LEDGER_KINDS);
|
|
17
19
|
export const LEDGER_SOURCES = ['purchase', 'subscription', 'promo', 'refund', 'system'];
|
|
@@ -30,6 +32,8 @@ export const ledgerEntrySchema = z.object({
|
|
|
30
32
|
// The payment provider's own order id, on a purchase, and null on everything else. Derived
|
|
31
33
|
// rather than the raw idempotency key, so the internal key format stays server-side.
|
|
32
34
|
reference: z.string().nullable().default(null),
|
|
35
|
+
// A row in builds counts whole builds in `credits`; everything else is credits.
|
|
36
|
+
unit: z.enum(['credits', 'builds']).default('credits'),
|
|
33
37
|
});
|
|
34
38
|
export const creditBalanceSchema = z.object({
|
|
35
39
|
balance: z.number(),
|
|
@@ -42,6 +46,8 @@ export const creditBalanceSchema = z.object({
|
|
|
42
46
|
// Roughly how many more images this balance buys, from this account's own recent runs rather
|
|
43
47
|
// than a global average. Null until there is history to derive it from.
|
|
44
48
|
imagesLeft: z.number().int().nullable(),
|
|
49
|
+
// Prepaid character builds left, spent before credits. Zero for anyone without a pilot grant.
|
|
50
|
+
builds: z.number().int().default(0),
|
|
45
51
|
});
|
|
46
52
|
export const usagePointSchema = z.object({ date: z.string(), credits: z.number() });
|
|
47
53
|
export const usageSchema = z.object({ points: z.array(usagePointSchema) });
|
package/dist/v1/credits.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credits.js","sourceRoot":"","sources":["../../src/v1/credits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,kGAAkG;AAClG,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAA;AAEzC,iGAAiG;AACjG,iCAAiC;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAA;AAElC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO;IACP,MAAM;IACN,cAAc;IACd,QAAQ;IACR,QAAQ;IACR,YAAY;
|
|
1
|
+
{"version":3,"file":"credits.js","sourceRoot":"","sources":["../../src/v1/credits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,kGAAkG;AAClG,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAA;AAEzC,iGAAiG;AACjG,iCAAiC;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAA;AAElC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO;IACP,MAAM;IACN,cAAc;IACd,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,qEAAqE;IACrE,QAAQ;CACA,CAAA;AACV,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAEpD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAU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EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC1C,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACpC,2FAA2F;IAC3F,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CAC3C,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAA"}
|
package/dist/v1/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './uploads.js';
|
|
|
5
5
|
export * from './runs.js';
|
|
6
6
|
export * from './assets.js';
|
|
7
7
|
export * from './plans.js';
|
|
8
|
+
export * from './planPresets.js';
|
|
8
9
|
export * from './me.js';
|
|
9
10
|
export * from './usernames.js';
|
|
10
11
|
export * from './terms.js';
|
|
@@ -21,4 +22,6 @@ export * from './sessions.js';
|
|
|
21
22
|
export * from './accessRequests.js';
|
|
22
23
|
export * from './featureRequests.js';
|
|
23
24
|
export * from './guest.js';
|
|
25
|
+
export * from './teams.js';
|
|
26
|
+
export * from './teamKeys.js';
|
|
24
27
|
//# 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,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C,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA"}
|
package/dist/v1/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './uploads.js';
|
|
|
5
5
|
export * from './runs.js';
|
|
6
6
|
export * from './assets.js';
|
|
7
7
|
export * from './plans.js';
|
|
8
|
+
export * from './planPresets.js';
|
|
8
9
|
export * from './me.js';
|
|
9
10
|
export * from './usernames.js';
|
|
10
11
|
export * from './terms.js';
|
|
@@ -21,4 +22,6 @@ export * from './sessions.js';
|
|
|
21
22
|
export * from './accessRequests.js';
|
|
22
23
|
export * from './featureRequests.js';
|
|
23
24
|
export * from './guest.js';
|
|
25
|
+
export * from './teams.js';
|
|
26
|
+
export * from './teamKeys.js';
|
|
24
27
|
//# 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,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,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,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA"}
|
package/dist/v1/me.d.ts
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export declare const GIB: number;
|
|
2
|
+
export type PlanPreset = {
|
|
3
|
+
name: string;
|
|
4
|
+
priceUsd: number | null;
|
|
5
|
+
workspace: 'personal' | 'team' | 'any';
|
|
6
|
+
includedSeats: number;
|
|
7
|
+
extraSeatUsd: number | null;
|
|
8
|
+
extraSeatInr: number | null;
|
|
9
|
+
maxSeats: number | null;
|
|
10
|
+
monthlyCredits: number;
|
|
11
|
+
storageBytes: number;
|
|
12
|
+
flags: {
|
|
13
|
+
api_access?: true;
|
|
14
|
+
sandbox?: true;
|
|
15
|
+
};
|
|
16
|
+
selfServe: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const PLAN_PRESETS: {
|
|
19
|
+
readonly free: {
|
|
20
|
+
readonly name: "Free";
|
|
21
|
+
readonly priceUsd: null;
|
|
22
|
+
readonly workspace: "any";
|
|
23
|
+
readonly includedSeats: 5;
|
|
24
|
+
readonly extraSeatUsd: null;
|
|
25
|
+
readonly extraSeatInr: null;
|
|
26
|
+
readonly maxSeats: null;
|
|
27
|
+
readonly monthlyCredits: 0;
|
|
28
|
+
readonly storageBytes: number;
|
|
29
|
+
readonly flags: {};
|
|
30
|
+
readonly selfServe: false;
|
|
31
|
+
};
|
|
32
|
+
readonly starter: {
|
|
33
|
+
readonly name: "Starter";
|
|
34
|
+
readonly priceUsd: 12;
|
|
35
|
+
readonly workspace: "personal";
|
|
36
|
+
readonly includedSeats: 1;
|
|
37
|
+
readonly extraSeatUsd: null;
|
|
38
|
+
readonly extraSeatInr: null;
|
|
39
|
+
readonly maxSeats: 1;
|
|
40
|
+
readonly monthlyCredits: 1500;
|
|
41
|
+
readonly storageBytes: number;
|
|
42
|
+
readonly flags: {};
|
|
43
|
+
readonly selfServe: true;
|
|
44
|
+
};
|
|
45
|
+
readonly team: {
|
|
46
|
+
readonly name: "Team";
|
|
47
|
+
readonly priceUsd: 39;
|
|
48
|
+
readonly workspace: "team";
|
|
49
|
+
readonly includedSeats: 5;
|
|
50
|
+
readonly extraSeatUsd: 7;
|
|
51
|
+
readonly extraSeatInr: 658;
|
|
52
|
+
readonly maxSeats: 25;
|
|
53
|
+
readonly monthlyCredits: 5200;
|
|
54
|
+
readonly storageBytes: number;
|
|
55
|
+
readonly flags: {
|
|
56
|
+
readonly api_access: true;
|
|
57
|
+
readonly sandbox: true;
|
|
58
|
+
};
|
|
59
|
+
readonly selfServe: true;
|
|
60
|
+
};
|
|
61
|
+
readonly partner: {
|
|
62
|
+
readonly name: "Partner";
|
|
63
|
+
readonly priceUsd: null;
|
|
64
|
+
readonly workspace: "team";
|
|
65
|
+
readonly includedSeats: 25;
|
|
66
|
+
readonly extraSeatUsd: null;
|
|
67
|
+
readonly extraSeatInr: null;
|
|
68
|
+
readonly maxSeats: null;
|
|
69
|
+
readonly monthlyCredits: 0;
|
|
70
|
+
readonly storageBytes: number;
|
|
71
|
+
readonly flags: {
|
|
72
|
+
readonly api_access: true;
|
|
73
|
+
readonly sandbox: true;
|
|
74
|
+
};
|
|
75
|
+
readonly selfServe: false;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export type PresetPlan = keyof typeof PLAN_PRESETS;
|
|
79
|
+
export declare const SELF_SERVE_PLANS: readonly ["starter", "team"];
|
|
80
|
+
export type SelfServePlan = (typeof SELF_SERVE_PLANS)[number];
|
|
81
|
+
export declare const TOPUP_USD_PER_CREDIT = 0.01;
|
|
82
|
+
/** Dollars per monthly credit, or null for a plan without a self-serve price. */
|
|
83
|
+
export declare const usdPerCredit: (plan: PresetPlan, bonus?: number) => number | null;
|
|
84
|
+
/** Whole-percent saving against top-ups, e.g. 20 for Starter. */
|
|
85
|
+
export declare const savingVsTopUp: (plan: PresetPlan) => number | null;
|
|
86
|
+
export declare const WELCOME_OFFER: {
|
|
87
|
+
readonly bonusCredits: 500;
|
|
88
|
+
readonly hours: 24;
|
|
89
|
+
};
|
|
90
|
+
export declare const LOW_BALANCE_CREDITS = 100;
|
|
91
|
+
export declare const RECENT_CANCEL_DAYS = 30;
|
|
92
|
+
export declare const HALTED_GRACE_DAYS = 7;
|
|
93
|
+
//# sourceMappingURL=planPresets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planPresets.d.ts","sourceRoot":"","sources":["../../src/v1/planPresets.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,GAAG,QAAqB,CAAA;AAErC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IAEZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAEvB,SAAS,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAE3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IAEpB,KAAK,EAAE;QAAE,UAAU,CAAC,EAAE,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,IAAI,CAAA;KAAE,CAAA;IAE5C,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDsB,CAAA;AAE/C,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,YAAY,CAAA;AAClD,eAAO,MAAM,gBAAgB,8BAA+B,CAAA;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAI7D,eAAO,MAAM,oBAAoB,OAAO,CAAA;AAExC,iFAAiF;AACjF,eAAO,MAAM,YAAY,GAAI,MAAM,UAAU,EAAE,cAAS,KAAG,MAAM,GAAG,IAInE,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,GAAI,MAAM,UAAU,KAAG,MAAM,GAAG,IAGzD,CAAA;AAED,eAAO,MAAM,aAAa;;;CAA4C,CAAA;AAEtE,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC,eAAO,MAAM,iBAAiB,IAAI,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// What each workspace plan includes. Prices, credits, storage and seats are read from here, never retyped.
|
|
2
|
+
export const GIB = 1024 * 1024 * 1024;
|
|
3
|
+
export const PLAN_PRESETS = {
|
|
4
|
+
free: {
|
|
5
|
+
name: 'Free',
|
|
6
|
+
priceUsd: null,
|
|
7
|
+
workspace: 'any',
|
|
8
|
+
includedSeats: 5,
|
|
9
|
+
extraSeatUsd: null,
|
|
10
|
+
extraSeatInr: null,
|
|
11
|
+
maxSeats: null,
|
|
12
|
+
monthlyCredits: 0,
|
|
13
|
+
storageBytes: 5 * GIB,
|
|
14
|
+
flags: {},
|
|
15
|
+
selfServe: false,
|
|
16
|
+
},
|
|
17
|
+
starter: {
|
|
18
|
+
name: 'Starter',
|
|
19
|
+
priceUsd: 12,
|
|
20
|
+
workspace: 'personal',
|
|
21
|
+
includedSeats: 1,
|
|
22
|
+
extraSeatUsd: null,
|
|
23
|
+
extraSeatInr: null,
|
|
24
|
+
maxSeats: 1,
|
|
25
|
+
monthlyCredits: 1_500,
|
|
26
|
+
storageBytes: 20 * GIB,
|
|
27
|
+
flags: {},
|
|
28
|
+
selfServe: true,
|
|
29
|
+
},
|
|
30
|
+
team: {
|
|
31
|
+
name: 'Team',
|
|
32
|
+
priceUsd: 39,
|
|
33
|
+
workspace: 'team',
|
|
34
|
+
includedSeats: 5,
|
|
35
|
+
extraSeatUsd: 7,
|
|
36
|
+
extraSeatInr: 658,
|
|
37
|
+
maxSeats: 25,
|
|
38
|
+
monthlyCredits: 5_200,
|
|
39
|
+
storageBytes: 50 * GIB,
|
|
40
|
+
flags: { api_access: true, sandbox: true },
|
|
41
|
+
selfServe: true,
|
|
42
|
+
},
|
|
43
|
+
partner: {
|
|
44
|
+
name: 'Partner',
|
|
45
|
+
priceUsd: null,
|
|
46
|
+
workspace: 'team',
|
|
47
|
+
includedSeats: 25,
|
|
48
|
+
extraSeatUsd: null,
|
|
49
|
+
extraSeatInr: null,
|
|
50
|
+
maxSeats: null,
|
|
51
|
+
monthlyCredits: 0,
|
|
52
|
+
storageBytes: 100 * GIB,
|
|
53
|
+
flags: { api_access: true, sandbox: true },
|
|
54
|
+
selfServe: false,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export const SELF_SERVE_PLANS = ['starter', 'team'];
|
|
58
|
+
// The welcome offer shown once, after a person's first generation.
|
|
59
|
+
// Top-ups cost a cent a credit on every plan; a plan's monthly credits come cheaper.
|
|
60
|
+
export const TOPUP_USD_PER_CREDIT = 0.01;
|
|
61
|
+
/** Dollars per monthly credit, or null for a plan without a self-serve price. */
|
|
62
|
+
export const usdPerCredit = (plan, bonus = 0) => {
|
|
63
|
+
const preset = PLAN_PRESETS[plan];
|
|
64
|
+
if (preset.priceUsd === null || preset.monthlyCredits === 0)
|
|
65
|
+
return null;
|
|
66
|
+
return preset.priceUsd / (preset.monthlyCredits + bonus);
|
|
67
|
+
};
|
|
68
|
+
/** Whole-percent saving against top-ups, e.g. 20 for Starter. */
|
|
69
|
+
export const savingVsTopUp = (plan) => {
|
|
70
|
+
const rate = usdPerCredit(plan);
|
|
71
|
+
return rate === null ? null : Math.round((1 - rate / TOPUP_USD_PER_CREDIT) * 100);
|
|
72
|
+
};
|
|
73
|
+
export const WELCOME_OFFER = { bonusCredits: 500, hours: 24 };
|
|
74
|
+
// A Free personal workspace below this sees the low-balance banner once.
|
|
75
|
+
export const LOW_BALANCE_CREDITS = 100;
|
|
76
|
+
// A cancelled subscription within this many days means no welcome popup.
|
|
77
|
+
export const RECENT_CANCEL_DAYS = 30;
|
|
78
|
+
// Days a halted subscription keeps its plan before the workspace moves to Free.
|
|
79
|
+
export const HALTED_GRACE_DAYS = 7;
|
|
80
|
+
//# sourceMappingURL=planPresets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planPresets.js","sourceRoot":"","sources":["../../src/v1/planPresets.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAqBrC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,I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mEAAmE;AACnE,qFAAqF;AACrF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAA;AAExC,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAgB,EAAE,KAAK,GAAG,CAAC,EAAiB,EAAE;IACzE,MAAM,MAAM,GAAe,YAAY,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,cAAc,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACxE,OAAO,MAAM,CAAC,QAAQ,GAAG,CAAC,MAAM,CAAC,cAAc,GAAG,KAAK,CAAC,CAAA;AAC1D,CAAC,CAAA;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAgB,EAAiB,EAAE;IAC/D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,oBAAoB,CAAC,GAAG,GAAG,CAAC,CAAA;AACnF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAW,CAAA;AACtE,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AACtC,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAA;AACpC,gFAAgF;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAA"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TEAM_ENVS: readonly ["production", "sandbox"];
|
|
3
|
+
export declare const teamEnvSchema: z.ZodEnum<{
|
|
4
|
+
sandbox: "sandbox";
|
|
5
|
+
production: "production";
|
|
6
|
+
}>;
|
|
7
|
+
export type TeamEnv = z.infer<typeof teamEnvSchema>;
|
|
8
|
+
export declare const KEY_SCOPES: readonly ["chars:read", "chars:write", "licenses:read", "licenses:write", "usage:read"];
|
|
9
|
+
export declare const keyScopeSchema: z.ZodEnum<{
|
|
10
|
+
"chars:read": "chars:read";
|
|
11
|
+
"chars:write": "chars:write";
|
|
12
|
+
"licenses:read": "licenses:read";
|
|
13
|
+
"licenses:write": "licenses:write";
|
|
14
|
+
"usage:read": "usage:read";
|
|
15
|
+
}>;
|
|
16
|
+
export type KeyScope = z.infer<typeof keyScopeSchema>;
|
|
17
|
+
export declare const TEAM_KEY_PREFIX: Record<TeamEnv, string>;
|
|
18
|
+
export declare const teamKeySecretSchema: z.ZodString;
|
|
19
|
+
export declare const TEAM_KEY_STATUSES: readonly ["active", "expiring", "revoked"];
|
|
20
|
+
export declare const teamKeySchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodUUID;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
env: z.ZodEnum<{
|
|
24
|
+
sandbox: "sandbox";
|
|
25
|
+
production: "production";
|
|
26
|
+
}>;
|
|
27
|
+
prefix: z.ZodString;
|
|
28
|
+
hint: z.ZodString;
|
|
29
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
30
|
+
"chars:read": "chars:read";
|
|
31
|
+
"chars:write": "chars:write";
|
|
32
|
+
"licenses:read": "licenses:read";
|
|
33
|
+
"licenses:write": "licenses:write";
|
|
34
|
+
"usage:read": "usage:read";
|
|
35
|
+
}>>;
|
|
36
|
+
createdBy: z.ZodObject<{
|
|
37
|
+
name: z.ZodNullable<z.ZodString>;
|
|
38
|
+
email: z.ZodNullable<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
createdAt: z.ZodISODateTime;
|
|
41
|
+
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
42
|
+
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
active: "active";
|
|
45
|
+
expiring: "expiring";
|
|
46
|
+
revoked: "revoked";
|
|
47
|
+
}>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type TeamKey = z.infer<typeof teamKeySchema>;
|
|
50
|
+
export declare const teamKeyListSchema: z.ZodObject<{
|
|
51
|
+
items: z.ZodArray<z.ZodObject<{
|
|
52
|
+
id: z.ZodUUID;
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
env: z.ZodEnum<{
|
|
55
|
+
sandbox: "sandbox";
|
|
56
|
+
production: "production";
|
|
57
|
+
}>;
|
|
58
|
+
prefix: z.ZodString;
|
|
59
|
+
hint: z.ZodString;
|
|
60
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
61
|
+
"chars:read": "chars:read";
|
|
62
|
+
"chars:write": "chars:write";
|
|
63
|
+
"licenses:read": "licenses:read";
|
|
64
|
+
"licenses:write": "licenses:write";
|
|
65
|
+
"usage:read": "usage:read";
|
|
66
|
+
}>>;
|
|
67
|
+
createdBy: z.ZodObject<{
|
|
68
|
+
name: z.ZodNullable<z.ZodString>;
|
|
69
|
+
email: z.ZodNullable<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
createdAt: z.ZodISODateTime;
|
|
72
|
+
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
73
|
+
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
74
|
+
status: z.ZodEnum<{
|
|
75
|
+
active: "active";
|
|
76
|
+
expiring: "expiring";
|
|
77
|
+
revoked: "revoked";
|
|
78
|
+
}>;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export declare const createTeamKeyBodySchema: z.ZodObject<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
env: z.ZodEnum<{
|
|
84
|
+
sandbox: "sandbox";
|
|
85
|
+
production: "production";
|
|
86
|
+
}>;
|
|
87
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
88
|
+
"chars:read": "chars:read";
|
|
89
|
+
"chars:write": "chars:write";
|
|
90
|
+
"licenses:read": "licenses:read";
|
|
91
|
+
"licenses:write": "licenses:write";
|
|
92
|
+
"usage:read": "usage:read";
|
|
93
|
+
}>>>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export type CreateTeamKeyBody = z.infer<typeof createTeamKeyBodySchema>;
|
|
96
|
+
export declare const createTeamKeyResponseSchema: z.ZodObject<{
|
|
97
|
+
key: z.ZodObject<{
|
|
98
|
+
id: z.ZodUUID;
|
|
99
|
+
name: z.ZodString;
|
|
100
|
+
env: z.ZodEnum<{
|
|
101
|
+
sandbox: "sandbox";
|
|
102
|
+
production: "production";
|
|
103
|
+
}>;
|
|
104
|
+
prefix: z.ZodString;
|
|
105
|
+
hint: z.ZodString;
|
|
106
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
107
|
+
"chars:read": "chars:read";
|
|
108
|
+
"chars:write": "chars:write";
|
|
109
|
+
"licenses:read": "licenses:read";
|
|
110
|
+
"licenses:write": "licenses:write";
|
|
111
|
+
"usage:read": "usage:read";
|
|
112
|
+
}>>;
|
|
113
|
+
createdBy: z.ZodObject<{
|
|
114
|
+
name: z.ZodNullable<z.ZodString>;
|
|
115
|
+
email: z.ZodNullable<z.ZodString>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
createdAt: z.ZodISODateTime;
|
|
118
|
+
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
119
|
+
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
120
|
+
status: z.ZodEnum<{
|
|
121
|
+
active: "active";
|
|
122
|
+
expiring: "expiring";
|
|
123
|
+
revoked: "revoked";
|
|
124
|
+
}>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
secret: z.ZodString;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export type CreateTeamKeyResponse = z.infer<typeof createTeamKeyResponseSchema>;
|
|
129
|
+
export declare const teamInfoSchema: z.ZodObject<{
|
|
130
|
+
id: z.ZodUUID;
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
plan: z.ZodEnum<{
|
|
133
|
+
free: "free";
|
|
134
|
+
team: "team";
|
|
135
|
+
starter: "starter";
|
|
136
|
+
partner: "partner";
|
|
137
|
+
}>;
|
|
138
|
+
env: z.ZodEnum<{
|
|
139
|
+
sandbox: "sandbox";
|
|
140
|
+
production: "production";
|
|
141
|
+
}>;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
export type TeamInfo = z.infer<typeof teamInfoSchema>;
|
|
144
|
+
//# sourceMappingURL=teamKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teamKeys.d.ts","sourceRoot":"","sources":["../../src/v1/teamKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,SAAS,oCAAqC,CAAA;AAC3D,eAAO,MAAM,aAAa;;;EAAoB,CAAA;AAC9C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEnD,eAAO,MAAM,UAAU,yFAMb,CAAA;AACV,eAAO,MAAM,cAAc;;;;;;EAAqB,CAAA;AAChD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAGrD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAGnD,CAAA;AACD,eAAO,MAAM,mBAAmB,aAE0B,CAAA;AAE1D,eAAO,MAAM,iBAAiB,4CAA6C,CAAA;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAaxB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8C,CAAA;AAE5E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;iBAOlC,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAGvE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGtC,CAAA;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAG/E,eAAO,MAAM,cAAc;;;;;;;;;;;;;iBAKzB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Two logical environments per team in one deployment; the web app is always production.
|
|
3
|
+
export const TEAM_ENVS = ['production', 'sandbox'];
|
|
4
|
+
export const teamEnvSchema = z.enum(TEAM_ENVS);
|
|
5
|
+
export const KEY_SCOPES = [
|
|
6
|
+
'chars:read',
|
|
7
|
+
'chars:write',
|
|
8
|
+
'licenses:read',
|
|
9
|
+
'licenses:write',
|
|
10
|
+
'usage:read',
|
|
11
|
+
];
|
|
12
|
+
export const keyScopeSchema = z.enum(KEY_SCOPES);
|
|
13
|
+
// The environment is read from the prefix, so a request can never name its own.
|
|
14
|
+
export const TEAM_KEY_PREFIX = {
|
|
15
|
+
production: 'sk_live_',
|
|
16
|
+
sandbox: 'sk_test_',
|
|
17
|
+
};
|
|
18
|
+
export const teamKeySecretSchema = z
|
|
19
|
+
.string()
|
|
20
|
+
.regex(/^sk_(live|test)_[a-z0-9]{8}_[A-Za-z0-9_-]{43}$/);
|
|
21
|
+
export const TEAM_KEY_STATUSES = ['active', 'expiring', 'revoked'];
|
|
22
|
+
export const teamKeySchema = z.object({
|
|
23
|
+
id: z.uuid(),
|
|
24
|
+
name: z.string(),
|
|
25
|
+
env: teamEnvSchema,
|
|
26
|
+
prefix: z.string(),
|
|
27
|
+
hint: z.string().length(4),
|
|
28
|
+
scopes: z.array(keyScopeSchema),
|
|
29
|
+
createdBy: z.object({ name: z.string().nullable(), email: z.string().nullable() }),
|
|
30
|
+
createdAt: z.iso.datetime(),
|
|
31
|
+
lastUsedAt: z.iso.datetime().nullable(),
|
|
32
|
+
// Set on the old key of a rotation, which keeps working until then.
|
|
33
|
+
expiresAt: z.iso.datetime().nullable(),
|
|
34
|
+
status: z.enum(TEAM_KEY_STATUSES),
|
|
35
|
+
});
|
|
36
|
+
export const teamKeyListSchema = z.object({ items: z.array(teamKeySchema) });
|
|
37
|
+
export const createTeamKeyBodySchema = z.object({
|
|
38
|
+
name: z.string().trim().min(1).max(60),
|
|
39
|
+
env: teamEnvSchema,
|
|
40
|
+
scopes: z
|
|
41
|
+
.array(keyScopeSchema)
|
|
42
|
+
.min(1)
|
|
43
|
+
.default([...KEY_SCOPES]),
|
|
44
|
+
});
|
|
45
|
+
// The only response that ever carries the secret; only its hash is stored.
|
|
46
|
+
export const createTeamKeyResponseSchema = z.object({
|
|
47
|
+
key: teamKeySchema,
|
|
48
|
+
secret: teamKeySecretSchema,
|
|
49
|
+
});
|
|
50
|
+
// What GET /v1/team answers, so an integrator can check which team and environment a key reaches.
|
|
51
|
+
export const teamInfoSchema = z.object({
|
|
52
|
+
id: z.uuid(),
|
|
53
|
+
name: z.string(),
|
|
54
|
+
plan: z.enum(['free', 'starter', 'team', 'partner']),
|
|
55
|
+
env: teamEnvSchema,
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=teamKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teamKeys.js","sourceRoot":"","sources":["../../src/v1/teamKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,yFAAyF;AACzF,MAAM,CAA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x-omnichar-team";
|
|
3
|
+
export declare const TEAM_ROLES: readonly ["owner", "admin", "developer", "member"];
|
|
4
|
+
export declare const teamRoleSchema: z.ZodEnum<{
|
|
5
|
+
admin: "admin";
|
|
6
|
+
member: "member";
|
|
7
|
+
owner: "owner";
|
|
8
|
+
developer: "developer";
|
|
9
|
+
}>;
|
|
10
|
+
export type TeamRole = z.infer<typeof teamRoleSchema>;
|
|
11
|
+
export declare const INVITE_ROLES: readonly ["admin", "developer", "member"];
|
|
12
|
+
export declare const inviteRoleSchema: z.ZodEnum<{
|
|
13
|
+
admin: "admin";
|
|
14
|
+
member: "member";
|
|
15
|
+
developer: "developer";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const TEAM_PLANS: readonly ["free", "starter", "team", "partner"];
|
|
18
|
+
export declare const teamPlanSchema: z.ZodEnum<{
|
|
19
|
+
free: "free";
|
|
20
|
+
team: "team";
|
|
21
|
+
starter: "starter";
|
|
22
|
+
partner: "partner";
|
|
23
|
+
}>;
|
|
24
|
+
export type TeamPlan = z.infer<typeof teamPlanSchema>;
|
|
25
|
+
export declare const TEAM_ACTIONS: readonly ["generate", "manage_members", "view_billing", "delete_team", "transfer_ownership", "manage_keys"];
|
|
26
|
+
export type TeamAction = (typeof TEAM_ACTIONS)[number];
|
|
27
|
+
/** The permission table. The control plane enforces it; the studio uses it to hide controls. */
|
|
28
|
+
export declare function teamCan(role: TeamRole, action: TeamAction): boolean;
|
|
29
|
+
export declare const teamFlagsSchema: z.ZodObject<{
|
|
30
|
+
provider: z.ZodDefault<z.ZodBoolean>;
|
|
31
|
+
api_access: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
sandbox: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
billing_subscriptions: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type TeamFlags = z.infer<typeof teamFlagsSchema>;
|
|
36
|
+
export declare const teamSlugSchema: z.ZodString;
|
|
37
|
+
export declare const teamSchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodUUID;
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
slug: z.ZodString;
|
|
41
|
+
personal: z.ZodBoolean;
|
|
42
|
+
plan: z.ZodEnum<{
|
|
43
|
+
free: "free";
|
|
44
|
+
team: "team";
|
|
45
|
+
starter: "starter";
|
|
46
|
+
partner: "partner";
|
|
47
|
+
}>;
|
|
48
|
+
role: z.ZodEnum<{
|
|
49
|
+
admin: "admin";
|
|
50
|
+
member: "member";
|
|
51
|
+
owner: "owner";
|
|
52
|
+
developer: "developer";
|
|
53
|
+
}>;
|
|
54
|
+
flags: z.ZodObject<{
|
|
55
|
+
provider: z.ZodDefault<z.ZodBoolean>;
|
|
56
|
+
api_access: z.ZodDefault<z.ZodBoolean>;
|
|
57
|
+
sandbox: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
billing_subscriptions: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export type Team = z.infer<typeof teamSchema>;
|
|
62
|
+
export declare const teamListSchema: z.ZodObject<{
|
|
63
|
+
items: z.ZodArray<z.ZodObject<{
|
|
64
|
+
id: z.ZodUUID;
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
slug: z.ZodString;
|
|
67
|
+
personal: z.ZodBoolean;
|
|
68
|
+
plan: z.ZodEnum<{
|
|
69
|
+
free: "free";
|
|
70
|
+
team: "team";
|
|
71
|
+
starter: "starter";
|
|
72
|
+
partner: "partner";
|
|
73
|
+
}>;
|
|
74
|
+
role: z.ZodEnum<{
|
|
75
|
+
admin: "admin";
|
|
76
|
+
member: "member";
|
|
77
|
+
owner: "owner";
|
|
78
|
+
developer: "developer";
|
|
79
|
+
}>;
|
|
80
|
+
flags: z.ZodObject<{
|
|
81
|
+
provider: z.ZodDefault<z.ZodBoolean>;
|
|
82
|
+
api_access: z.ZodDefault<z.ZodBoolean>;
|
|
83
|
+
sandbox: z.ZodDefault<z.ZodBoolean>;
|
|
84
|
+
billing_subscriptions: z.ZodDefault<z.ZodBoolean>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export declare const createTeamBodySchema: z.ZodObject<{
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export declare const renameTeamBodySchema: z.ZodObject<{
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export declare const transferTeamBodySchema: z.ZodObject<{
|
|
95
|
+
userId: z.ZodUUID;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
export declare const memberSchema: z.ZodObject<{
|
|
98
|
+
userId: z.ZodUUID;
|
|
99
|
+
role: z.ZodEnum<{
|
|
100
|
+
admin: "admin";
|
|
101
|
+
member: "member";
|
|
102
|
+
owner: "owner";
|
|
103
|
+
developer: "developer";
|
|
104
|
+
}>;
|
|
105
|
+
email: z.ZodNullable<z.ZodString>;
|
|
106
|
+
name: z.ZodNullable<z.ZodString>;
|
|
107
|
+
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
108
|
+
joinedAt: z.ZodISODateTime;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
export type Member = z.infer<typeof memberSchema>;
|
|
111
|
+
export declare const memberListSchema: z.ZodObject<{
|
|
112
|
+
items: z.ZodArray<z.ZodObject<{
|
|
113
|
+
userId: z.ZodUUID;
|
|
114
|
+
role: z.ZodEnum<{
|
|
115
|
+
admin: "admin";
|
|
116
|
+
member: "member";
|
|
117
|
+
owner: "owner";
|
|
118
|
+
developer: "developer";
|
|
119
|
+
}>;
|
|
120
|
+
email: z.ZodNullable<z.ZodString>;
|
|
121
|
+
name: z.ZodNullable<z.ZodString>;
|
|
122
|
+
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
123
|
+
joinedAt: z.ZodISODateTime;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export declare const changeRoleBodySchema: z.ZodObject<{
|
|
127
|
+
role: z.ZodEnum<{
|
|
128
|
+
admin: "admin";
|
|
129
|
+
member: "member";
|
|
130
|
+
owner: "owner";
|
|
131
|
+
developer: "developer";
|
|
132
|
+
}>;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
export declare const inviteSchema: z.ZodObject<{
|
|
135
|
+
id: z.ZodUUID;
|
|
136
|
+
email: z.ZodString;
|
|
137
|
+
role: z.ZodEnum<{
|
|
138
|
+
admin: "admin";
|
|
139
|
+
member: "member";
|
|
140
|
+
developer: "developer";
|
|
141
|
+
}>;
|
|
142
|
+
createdAt: z.ZodISODateTime;
|
|
143
|
+
expiresAt: z.ZodISODateTime;
|
|
144
|
+
lastSentAt: z.ZodISODateTime;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
export type Invite = z.infer<typeof inviteSchema>;
|
|
147
|
+
export declare const inviteListSchema: z.ZodObject<{
|
|
148
|
+
items: z.ZodArray<z.ZodObject<{
|
|
149
|
+
id: z.ZodUUID;
|
|
150
|
+
email: z.ZodString;
|
|
151
|
+
role: z.ZodEnum<{
|
|
152
|
+
admin: "admin";
|
|
153
|
+
member: "member";
|
|
154
|
+
developer: "developer";
|
|
155
|
+
}>;
|
|
156
|
+
createdAt: z.ZodISODateTime;
|
|
157
|
+
expiresAt: z.ZodISODateTime;
|
|
158
|
+
lastSentAt: z.ZodISODateTime;
|
|
159
|
+
}, z.core.$strip>>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export declare const createInviteBodySchema: z.ZodObject<{
|
|
162
|
+
email: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
|
|
163
|
+
role: z.ZodDefault<z.ZodEnum<{
|
|
164
|
+
admin: "admin";
|
|
165
|
+
member: "member";
|
|
166
|
+
developer: "developer";
|
|
167
|
+
}>>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
export declare const inviteResultSchema: z.ZodObject<{
|
|
170
|
+
invite: z.ZodObject<{
|
|
171
|
+
id: z.ZodUUID;
|
|
172
|
+
email: z.ZodString;
|
|
173
|
+
role: z.ZodEnum<{
|
|
174
|
+
admin: "admin";
|
|
175
|
+
member: "member";
|
|
176
|
+
developer: "developer";
|
|
177
|
+
}>;
|
|
178
|
+
createdAt: z.ZodISODateTime;
|
|
179
|
+
expiresAt: z.ZodISODateTime;
|
|
180
|
+
lastSentAt: z.ZodISODateTime;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
emailSent: z.ZodBoolean;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
export declare const adminTeamSchema: z.ZodObject<{
|
|
185
|
+
id: z.ZodUUID;
|
|
186
|
+
name: z.ZodString;
|
|
187
|
+
slug: z.ZodString;
|
|
188
|
+
personal: z.ZodBoolean;
|
|
189
|
+
plan: z.ZodEnum<{
|
|
190
|
+
free: "free";
|
|
191
|
+
team: "team";
|
|
192
|
+
starter: "starter";
|
|
193
|
+
partner: "partner";
|
|
194
|
+
}>;
|
|
195
|
+
flags: z.ZodObject<{
|
|
196
|
+
provider: z.ZodDefault<z.ZodBoolean>;
|
|
197
|
+
api_access: z.ZodDefault<z.ZodBoolean>;
|
|
198
|
+
sandbox: z.ZodDefault<z.ZodBoolean>;
|
|
199
|
+
billing_subscriptions: z.ZodDefault<z.ZodBoolean>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
members: z.ZodNumber;
|
|
202
|
+
createdAt: z.ZodISODateTime;
|
|
203
|
+
}, z.core.$strip>;
|
|
204
|
+
export type AdminTeam = z.infer<typeof adminTeamSchema>;
|
|
205
|
+
export declare const adminTeamListSchema: z.ZodObject<{
|
|
206
|
+
items: z.ZodArray<z.ZodObject<{
|
|
207
|
+
id: z.ZodUUID;
|
|
208
|
+
name: z.ZodString;
|
|
209
|
+
slug: z.ZodString;
|
|
210
|
+
personal: z.ZodBoolean;
|
|
211
|
+
plan: z.ZodEnum<{
|
|
212
|
+
free: "free";
|
|
213
|
+
team: "team";
|
|
214
|
+
starter: "starter";
|
|
215
|
+
partner: "partner";
|
|
216
|
+
}>;
|
|
217
|
+
flags: z.ZodObject<{
|
|
218
|
+
provider: z.ZodDefault<z.ZodBoolean>;
|
|
219
|
+
api_access: z.ZodDefault<z.ZodBoolean>;
|
|
220
|
+
sandbox: z.ZodDefault<z.ZodBoolean>;
|
|
221
|
+
billing_subscriptions: z.ZodDefault<z.ZodBoolean>;
|
|
222
|
+
}, z.core.$strip>;
|
|
223
|
+
members: z.ZodNumber;
|
|
224
|
+
createdAt: z.ZodISODateTime;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
export declare const adminTeamQuerySchema: z.ZodObject<{
|
|
228
|
+
q: z.ZodString;
|
|
229
|
+
}, z.core.$strip>;
|
|
230
|
+
export declare const adminTeamPatchSchema: z.ZodObject<{
|
|
231
|
+
plan: z.ZodOptional<z.ZodEnum<{
|
|
232
|
+
free: "free";
|
|
233
|
+
team: "team";
|
|
234
|
+
starter: "starter";
|
|
235
|
+
partner: "partner";
|
|
236
|
+
}>>;
|
|
237
|
+
flags: z.ZodOptional<z.ZodObject<{
|
|
238
|
+
provider: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
239
|
+
api_access: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
240
|
+
sandbox: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
241
|
+
billing_subscriptions: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
242
|
+
}, z.core.$strip>>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
export declare const adminTeamGrantBodySchema: z.ZodObject<{
|
|
245
|
+
credits: z.ZodNumber;
|
|
246
|
+
note: z.ZodOptional<z.ZodString>;
|
|
247
|
+
idempotencyKey: z.ZodString;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
export type AdminTeamGrantBody = z.infer<typeof adminTeamGrantBodySchema>;
|
|
250
|
+
export type CreateTeamBody = z.infer<typeof createTeamBodySchema>;
|
|
251
|
+
export type CreateInviteBody = z.infer<typeof createInviteBodySchema>;
|
|
252
|
+
export type InviteResult = z.infer<typeof inviteResultSchema>;
|
|
253
|
+
export type AdminTeamPatch = z.infer<typeof adminTeamPatchSchema>;
|
|
254
|
+
//# sourceMappingURL=teams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/v1/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,oBAAoB,CAAA;AAG5C,eAAO,MAAM,UAAU,oDAAqD,CAAA;AAC5E,eAAO,MAAM,cAAc;;;;;EAAqB,CAAA;AAChD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAGrD,eAAO,MAAM,YAAY,2CAA4C,CAAA;AACrE,eAAO,MAAM,gBAAgB;;;;EAAuB,CAAA;AAEpD,eAAO,MAAM,UAAU,iDAAkD,CAAA;AACzE,eAAO,MAAM,cAAc;;;;;EAAqB,CAAA;AAChD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,eAAO,MAAM,YAAY,6GAOf,CAAA;AACV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAWtD,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAEnE;AAED,eAAO,MAAM,eAAe;;;;;iBAM1B,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,eAAO,MAA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;AACrF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
|
package/dist/v1/teams.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { grantCreditsBodySchema } from './credits.js';
|
|
3
|
+
// Which team a request acts for; membership is proven before use, and a non-member gets 404.
|
|
4
|
+
export const TEAM_HEADER = 'x-omnichar-team';
|
|
5
|
+
// Named teamRole because the person-level role (admin, team, member, user) means staff access.
|
|
6
|
+
export const TEAM_ROLES = ['owner', 'admin', 'developer', 'member'];
|
|
7
|
+
export const teamRoleSchema = z.enum(TEAM_ROLES);
|
|
8
|
+
// Ownership moves by transfer, never by invite, so an invite cannot hand someone the team.
|
|
9
|
+
export const INVITE_ROLES = ['admin', 'developer', 'member'];
|
|
10
|
+
export const inviteRoleSchema = z.enum(INVITE_ROLES);
|
|
11
|
+
export const TEAM_PLANS = ['free', 'starter', 'team', 'partner'];
|
|
12
|
+
export const teamPlanSchema = z.enum(TEAM_PLANS);
|
|
13
|
+
export const TEAM_ACTIONS = [
|
|
14
|
+
'generate',
|
|
15
|
+
'manage_members',
|
|
16
|
+
'view_billing',
|
|
17
|
+
'delete_team',
|
|
18
|
+
'transfer_ownership',
|
|
19
|
+
'manage_keys',
|
|
20
|
+
];
|
|
21
|
+
const ALLOWED = {
|
|
22
|
+
generate: ['owner', 'admin', 'developer', 'member'],
|
|
23
|
+
manage_members: ['owner', 'admin'],
|
|
24
|
+
view_billing: ['owner', 'admin'],
|
|
25
|
+
delete_team: ['owner'],
|
|
26
|
+
transfer_ownership: ['owner'],
|
|
27
|
+
manage_keys: ['owner', 'admin', 'developer'],
|
|
28
|
+
};
|
|
29
|
+
/** The permission table. The control plane enforces it; the studio uses it to hide controls. */
|
|
30
|
+
export function teamCan(role, action) {
|
|
31
|
+
return ALLOWED[action].includes(role);
|
|
32
|
+
}
|
|
33
|
+
export const teamFlagsSchema = z.object({
|
|
34
|
+
provider: z.boolean().default(false),
|
|
35
|
+
api_access: z.boolean().default(true),
|
|
36
|
+
sandbox: z.boolean().default(true),
|
|
37
|
+
// Plans and checkout for this workspace; staff turn it on while subscriptions are tested.
|
|
38
|
+
billing_subscriptions: z.boolean().default(false),
|
|
39
|
+
});
|
|
40
|
+
export const teamSlugSchema = z.string().regex(/^[a-z0-9-]{3,40}$/);
|
|
41
|
+
export const teamSchema = z.object({
|
|
42
|
+
id: z.uuid(),
|
|
43
|
+
name: z.string(),
|
|
44
|
+
slug: z.string(),
|
|
45
|
+
personal: z.boolean(),
|
|
46
|
+
plan: teamPlanSchema,
|
|
47
|
+
role: teamRoleSchema,
|
|
48
|
+
flags: teamFlagsSchema,
|
|
49
|
+
});
|
|
50
|
+
// Personal first, then shared teams by name.
|
|
51
|
+
export const teamListSchema = z.object({ items: z.array(teamSchema) });
|
|
52
|
+
export const createTeamBodySchema = z.object({ name: z.string().trim().min(2).max(60) });
|
|
53
|
+
export const renameTeamBodySchema = createTeamBodySchema;
|
|
54
|
+
export const transferTeamBodySchema = z.object({ userId: z.uuid() });
|
|
55
|
+
export const memberSchema = z.object({
|
|
56
|
+
userId: z.uuid(),
|
|
57
|
+
role: teamRoleSchema,
|
|
58
|
+
email: z.string().nullable(),
|
|
59
|
+
name: z.string().nullable(),
|
|
60
|
+
avatarUrl: z.url().nullable(),
|
|
61
|
+
joinedAt: z.iso.datetime(),
|
|
62
|
+
});
|
|
63
|
+
export const memberListSchema = z.object({ items: z.array(memberSchema) });
|
|
64
|
+
export const changeRoleBodySchema = z.object({ role: teamRoleSchema });
|
|
65
|
+
export const inviteSchema = z.object({
|
|
66
|
+
id: z.uuid(),
|
|
67
|
+
email: z.string(),
|
|
68
|
+
role: inviteRoleSchema,
|
|
69
|
+
createdAt: z.iso.datetime(),
|
|
70
|
+
expiresAt: z.iso.datetime(),
|
|
71
|
+
lastSentAt: z.iso.datetime(),
|
|
72
|
+
});
|
|
73
|
+
export const inviteListSchema = z.object({ items: z.array(inviteSchema) });
|
|
74
|
+
// Lowercased here so the stored value, the duplicate check and the sign-in match agree on one form.
|
|
75
|
+
export const createInviteBodySchema = z.object({
|
|
76
|
+
email: z
|
|
77
|
+
.email()
|
|
78
|
+
.max(254)
|
|
79
|
+
.transform((v) => v.toLowerCase()),
|
|
80
|
+
role: inviteRoleSchema.default('member'),
|
|
81
|
+
});
|
|
82
|
+
// Whether the email left. The invite is stored either way, since sign-in accepts it by address.
|
|
83
|
+
export const inviteResultSchema = z.object({ invite: inviteSchema, emailSent: z.boolean() });
|
|
84
|
+
// Staff only. Each field is optional, so a change touches only what it names.
|
|
85
|
+
export const adminTeamSchema = z.object({
|
|
86
|
+
id: z.uuid(),
|
|
87
|
+
name: z.string(),
|
|
88
|
+
slug: z.string(),
|
|
89
|
+
personal: z.boolean(),
|
|
90
|
+
plan: teamPlanSchema,
|
|
91
|
+
flags: teamFlagsSchema,
|
|
92
|
+
members: z.number().int(),
|
|
93
|
+
createdAt: z.iso.datetime(),
|
|
94
|
+
});
|
|
95
|
+
export const adminTeamListSchema = z.object({ items: z.array(adminTeamSchema) });
|
|
96
|
+
export const adminTeamQuerySchema = z.object({ q: z.string().trim().min(1).max(60) });
|
|
97
|
+
export const adminTeamPatchSchema = z
|
|
98
|
+
.object({
|
|
99
|
+
plan: teamPlanSchema.optional(),
|
|
100
|
+
flags: teamFlagsSchema.partial().optional(),
|
|
101
|
+
})
|
|
102
|
+
.refine((v) => v.plan !== undefined || v.flags !== undefined, 'Nothing to change.');
|
|
103
|
+
// Staff loading a team's balance: the user grant without a user, since a team id is its account id.
|
|
104
|
+
export const adminTeamGrantBodySchema = grantCreditsBodySchema.omit({ userId: true });
|
|
105
|
+
//# sourceMappingURL=teams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/v1/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAErD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAA;AAE5C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAA;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAGhD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAA;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAEpD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAU,CAAA;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAGhD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,oBAAoB;IACpB,aAAa;CACL,CAAA;AAGV,MAAM,OAAO,GAA4C;IACvD,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC;IACnD,cAAc,EAAE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AQ,EAAE;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;AACrF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,IAAI,EAAE,cAAc,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC5C,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,EAAE,oBAAoB,CAAC,CAAA;AAErF,oGAAoG;AACpG,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnichar/contracts",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-0509ece",
|
|
4
4
|
"description": "The wire contract between Cloud-Studio and Cloud-Control-Plane. Zod schemas and the types inferred from them.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|