@barekey/sdk 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +15 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/internal/evaluate.d.ts.map +1 -1
- package/dist/internal/evaluate.js +57 -7
- package/dist/internal/node-runtime.d.ts +3 -1
- package/dist/internal/node-runtime.d.ts.map +1 -1
- package/dist/internal/node-runtime.js +8 -4
- package/dist/internal/public-runtime.d.ts +14 -0
- package/dist/internal/public-runtime.d.ts.map +1 -0
- package/dist/internal/public-runtime.js +78 -0
- package/dist/internal/typegen.d.ts +16 -3
- package/dist/internal/typegen.d.ts.map +1 -1
- package/dist/internal/typegen.js +123 -12
- package/dist/public-client.d.ts +36 -0
- package/dist/public-client.d.ts.map +1 -0
- package/dist/public-client.js +150 -0
- package/dist/public-types.d.ts +26 -0
- package/dist/public-types.d.ts.map +1 -0
- package/dist/public-types.js +1 -0
- package/dist/public.d.ts +6 -0
- package/dist/public.d.ts.map +1 -0
- package/dist/public.js +3 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +3 -0
- package/dist/types.d.ts +14 -2
- package/dist/types.d.ts.map +1 -1
- package/generated.public.d.ts +8 -0
- package/{generated.d.ts → generated.server.d.ts} +8 -2
- package/index.d.ts +0 -1
- package/package.json +18 -3
- package/public.d.ts +2 -0
- package/server.d.ts +2 -0
- package/src/client.ts +17 -2
- package/src/index.ts +7 -0
- package/src/internal/evaluate.ts +83 -7
- package/src/internal/node-runtime.ts +11 -5
- package/src/internal/public-runtime.ts +123 -0
- package/src/internal/typegen.ts +203 -15
- package/src/public-client.ts +229 -0
- package/src/public-types.ts +57 -0
- package/src/public.ts +69 -0
- package/src/server.ts +60 -0
- package/src/types.ts +29 -2
package/src/public.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export { PublicBarekeyClient } from "./public-client.js";
|
|
2
|
+
export { BarekeyEnvHandle } from "./handle.js";
|
|
3
|
+
export {
|
|
4
|
+
BarekeyError,
|
|
5
|
+
BillingUnavailableError,
|
|
6
|
+
CoerceFailedError,
|
|
7
|
+
DeviceCodeExpiredError,
|
|
8
|
+
DeviceCodeNotFoundError,
|
|
9
|
+
EvaluationFailedError,
|
|
10
|
+
FsNotAvailableError,
|
|
11
|
+
InvalidConfigurationProvidedError,
|
|
12
|
+
InvalidCredentialsProvidedError,
|
|
13
|
+
InvalidDynamicOptionsError,
|
|
14
|
+
InvalidJsonError,
|
|
15
|
+
InvalidOrgScopeError,
|
|
16
|
+
InvalidRefreshTokenError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
NetworkError,
|
|
19
|
+
NoConfigurationProvidedError,
|
|
20
|
+
NoCredentialsProvidedError,
|
|
21
|
+
OrgScopeInvalidError,
|
|
22
|
+
RequirementsValidationFailedError,
|
|
23
|
+
SdkModuleNotFoundError,
|
|
24
|
+
TemporalNotAvailableError,
|
|
25
|
+
TypegenReadFailedError,
|
|
26
|
+
TypegenUnsupportedSdkError,
|
|
27
|
+
TypegenWriteFailedError,
|
|
28
|
+
UnauthorizedError,
|
|
29
|
+
UnknownError,
|
|
30
|
+
UsageLimitExceededError,
|
|
31
|
+
UserCodeInvalidError,
|
|
32
|
+
VariableNotFoundError,
|
|
33
|
+
createBarekeyErrorFromCode,
|
|
34
|
+
docsUrlForErrorCode,
|
|
35
|
+
formatBarekeyErrorMessage,
|
|
36
|
+
isBarekeyErrorCode,
|
|
37
|
+
normalizeErrorCode,
|
|
38
|
+
} from "./errors.js";
|
|
39
|
+
|
|
40
|
+
export type {
|
|
41
|
+
AB,
|
|
42
|
+
BarekeyCoerceTarget,
|
|
43
|
+
BarekeyDeclaredType,
|
|
44
|
+
BarekeyDecision,
|
|
45
|
+
BarekeyErrorCode,
|
|
46
|
+
BarekeyEvaluatedValue,
|
|
47
|
+
BarekeyGetOptions,
|
|
48
|
+
BarekeyJsonConfig,
|
|
49
|
+
BarekeyResolvedKind,
|
|
50
|
+
BarekeyRolloutFunction,
|
|
51
|
+
BarekeyRolloutMatchedRule,
|
|
52
|
+
BarekeyRolloutMilestone,
|
|
53
|
+
BarekeyStandardSchemaV1,
|
|
54
|
+
BarekeyTemporalInstant,
|
|
55
|
+
BarekeyTemporalInstantLike,
|
|
56
|
+
BarekeyTtlInput,
|
|
57
|
+
BarekeyVariableDefinition,
|
|
58
|
+
EaseInOut,
|
|
59
|
+
Env,
|
|
60
|
+
Linear,
|
|
61
|
+
Secret,
|
|
62
|
+
Step,
|
|
63
|
+
} from "./types.js";
|
|
64
|
+
|
|
65
|
+
export type {
|
|
66
|
+
BarekeyPublicGeneratedTypeMap,
|
|
67
|
+
BarekeyPublicKnownKey,
|
|
68
|
+
PublicBarekeyClientOptions,
|
|
69
|
+
} from "./public-types.js";
|
package/src/server.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export { BarekeyClient } from "./client.js";
|
|
2
|
+
export { BarekeyEnvHandle } from "./handle.js";
|
|
3
|
+
export {
|
|
4
|
+
BarekeyError,
|
|
5
|
+
BillingUnavailableError,
|
|
6
|
+
CoerceFailedError,
|
|
7
|
+
DeviceCodeExpiredError,
|
|
8
|
+
DeviceCodeNotFoundError,
|
|
9
|
+
EvaluationFailedError,
|
|
10
|
+
FsNotAvailableError,
|
|
11
|
+
InvalidConfigurationProvidedError,
|
|
12
|
+
InvalidCredentialsProvidedError,
|
|
13
|
+
InvalidDynamicOptionsError,
|
|
14
|
+
InvalidJsonError,
|
|
15
|
+
InvalidOrgScopeError,
|
|
16
|
+
InvalidRefreshTokenError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
NetworkError,
|
|
19
|
+
NoConfigurationProvidedError,
|
|
20
|
+
NoCredentialsProvidedError,
|
|
21
|
+
OrgScopeInvalidError,
|
|
22
|
+
RequirementsValidationFailedError,
|
|
23
|
+
SdkModuleNotFoundError,
|
|
24
|
+
TemporalNotAvailableError,
|
|
25
|
+
TypegenReadFailedError,
|
|
26
|
+
TypegenUnsupportedSdkError,
|
|
27
|
+
TypegenWriteFailedError,
|
|
28
|
+
UnauthorizedError,
|
|
29
|
+
UnknownError,
|
|
30
|
+
UsageLimitExceededError,
|
|
31
|
+
UserCodeInvalidError,
|
|
32
|
+
VariableNotFoundError,
|
|
33
|
+
createBarekeyErrorFromCode,
|
|
34
|
+
docsUrlForErrorCode,
|
|
35
|
+
formatBarekeyErrorMessage,
|
|
36
|
+
isBarekeyErrorCode,
|
|
37
|
+
normalizeErrorCode,
|
|
38
|
+
} from "./errors.js";
|
|
39
|
+
|
|
40
|
+
export type {
|
|
41
|
+
AB,
|
|
42
|
+
BarekeyClientOptions,
|
|
43
|
+
BarekeyCoerceTarget,
|
|
44
|
+
BarekeyDeclaredType,
|
|
45
|
+
BarekeyErrorCode,
|
|
46
|
+
BarekeyGeneratedTypeMap,
|
|
47
|
+
BarekeyGetOptions,
|
|
48
|
+
BarekeyJsonConfig,
|
|
49
|
+
BarekeyKnownKey,
|
|
50
|
+
BarekeyResolvedKind,
|
|
51
|
+
BarekeyRolloutMilestone,
|
|
52
|
+
BarekeyStandardSchemaV1,
|
|
53
|
+
BarekeyTemporalInstant,
|
|
54
|
+
BarekeyTemporalInstantLike,
|
|
55
|
+
BarekeyTtlInput,
|
|
56
|
+
BarekeyTypegenResult,
|
|
57
|
+
Env,
|
|
58
|
+
Linear,
|
|
59
|
+
Secret,
|
|
60
|
+
} from "./types.js";
|
package/src/types.ts
CHANGED
|
@@ -27,6 +27,24 @@ export type Linear<
|
|
|
27
27
|
readonly milestones: TMilestones;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
export type Step<
|
|
31
|
+
TMilestones extends ReadonlyArray<readonly [string, number]> = ReadonlyArray<
|
|
32
|
+
readonly [string, number]
|
|
33
|
+
>,
|
|
34
|
+
> = {
|
|
35
|
+
readonly kind: "step";
|
|
36
|
+
readonly milestones: TMilestones;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type EaseInOut<
|
|
40
|
+
TMilestones extends ReadonlyArray<readonly [string, number]> = ReadonlyArray<
|
|
41
|
+
readonly [string, number]
|
|
42
|
+
>,
|
|
43
|
+
> = {
|
|
44
|
+
readonly kind: "ease_in_out";
|
|
45
|
+
readonly milestones: TMilestones;
|
|
46
|
+
};
|
|
47
|
+
|
|
30
48
|
export type Env<TMode, TValue, TFunction = never> = TValue & {
|
|
31
49
|
readonly __barekey?: {
|
|
32
50
|
readonly mode: TMode;
|
|
@@ -45,12 +63,19 @@ export type BarekeyRolloutMilestone = {
|
|
|
45
63
|
percentage: number;
|
|
46
64
|
};
|
|
47
65
|
|
|
66
|
+
export type BarekeyRolloutFunction = "linear" | "step" | "ease_in_out";
|
|
67
|
+
|
|
68
|
+
export type BarekeyRolloutMatchedRule =
|
|
69
|
+
| "linear_rollout"
|
|
70
|
+
| "step_rollout"
|
|
71
|
+
| "ease_in_out_rollout";
|
|
72
|
+
|
|
48
73
|
export type BarekeyDecision = {
|
|
49
74
|
bucket: number;
|
|
50
75
|
chance: number;
|
|
51
76
|
seed?: string;
|
|
52
77
|
key?: string;
|
|
53
|
-
matchedRule: "ab_roll" |
|
|
78
|
+
matchedRule: "ab_roll" | BarekeyRolloutMatchedRule;
|
|
54
79
|
};
|
|
55
80
|
|
|
56
81
|
export type BarekeyEvaluatedValue = {
|
|
@@ -83,7 +108,7 @@ export type BarekeyVariableDefinition =
|
|
|
83
108
|
declaredType: BarekeyDeclaredType;
|
|
84
109
|
valueA: string;
|
|
85
110
|
valueB: string;
|
|
86
|
-
rolloutFunction:
|
|
111
|
+
rolloutFunction: BarekeyRolloutFunction;
|
|
87
112
|
rolloutMilestones: Array<BarekeyRolloutMilestone>;
|
|
88
113
|
};
|
|
89
114
|
|
|
@@ -135,6 +160,8 @@ type BarekeyBaseClientOptions = {
|
|
|
135
160
|
export type BarekeyTypegenResult = {
|
|
136
161
|
written: boolean;
|
|
137
162
|
path: string;
|
|
163
|
+
serverPath: string;
|
|
164
|
+
publicPath: string;
|
|
138
165
|
manifestVersion: string;
|
|
139
166
|
};
|
|
140
167
|
|