@barekey/sdk 0.4.4 → 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/README.md +84 -7
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +61 -15
- package/dist/handle.d.ts +1 -1
- package/dist/handle.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/config.d.ts +5 -0
- package/dist/internal/config.d.ts.map +1 -0
- package/dist/internal/config.js +26 -0
- package/dist/internal/node-runtime.d.ts +11 -0
- package/dist/internal/node-runtime.d.ts.map +1 -1
- package/dist/internal/node-runtime.js +2 -1
- package/dist/internal/public-runtime.d.ts.map +1 -1
- package/dist/internal/public-runtime.js +17 -3
- package/dist/internal/runtime.d.ts +15 -1
- package/dist/internal/runtime.d.ts.map +1 -1
- package/dist/internal/runtime.js +49 -7
- package/dist/internal/singleton.d.ts.map +1 -1
- package/dist/internal/singleton.js +14 -0
- package/dist/internal/standalone.d.ts +10 -0
- package/dist/internal/standalone.d.ts.map +1 -0
- package/dist/internal/standalone.js +246 -0
- package/dist/internal/typegen.d.ts +6 -3
- package/dist/internal/typegen.d.ts.map +1 -1
- package/dist/internal/typegen.js +45 -13
- package/dist/key-types.typecheck.d.ts +5 -5
- package/dist/key-types.typecheck.d.ts.map +1 -1
- package/dist/public-client.d.ts +4 -0
- package/dist/public-client.d.ts.map +1 -1
- package/dist/public-types.d.ts +1 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/public.d.ts +1 -1
- package/dist/public.d.ts.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/types.d.ts +34 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +86 -15
- package/src/handle.ts +1 -1
- package/src/index.ts +2 -0
- package/src/internal/config.ts +34 -0
- package/src/internal/node-runtime.ts +4 -2
- package/src/internal/public-runtime.ts +25 -4
- package/src/internal/runtime.ts +91 -7
- package/src/internal/singleton.ts +37 -4
- package/src/internal/standalone.ts +309 -0
- package/src/internal/typegen.ts +68 -15
- package/src/key-types.typecheck.ts +20 -4
- package/src/public-client.ts +4 -0
- package/src/public-types.ts +1 -0
- package/src/public.ts +2 -0
- package/src/server.ts +2 -0
- package/src/types.ts +81 -8
package/src/types.ts
CHANGED
|
@@ -3,6 +3,9 @@ export type BarekeyVisibility = "private" | "public";
|
|
|
3
3
|
|
|
4
4
|
export type BarekeyDeclaredType = "string" | "boolean" | "int64" | "float" | "date" | "json";
|
|
5
5
|
|
|
6
|
+
export type BarekeyTypegenMode = "semantic" | "minimal";
|
|
7
|
+
export type BarekeyMode = "centralized" | "standalone";
|
|
8
|
+
|
|
6
9
|
export type BarekeyTemporalInstant = {
|
|
7
10
|
readonly epochMilliseconds: number;
|
|
8
11
|
toJSON(): string;
|
|
@@ -19,6 +22,8 @@ export type Secret = "secret";
|
|
|
19
22
|
|
|
20
23
|
export type AB = "ab";
|
|
21
24
|
|
|
25
|
+
type BarekeyLegacyEnvMode = Secret | AB;
|
|
26
|
+
|
|
22
27
|
export type Linear<
|
|
23
28
|
TMilestones extends ReadonlyArray<readonly [string, number]> = ReadonlyArray<
|
|
24
29
|
readonly [string, number]
|
|
@@ -46,7 +51,28 @@ export type EaseInOut<
|
|
|
46
51
|
readonly milestones: TMilestones;
|
|
47
52
|
};
|
|
48
53
|
|
|
54
|
+
type BarekeySemanticEnvDescriptor<
|
|
55
|
+
TKind = never,
|
|
56
|
+
TVisibility = never,
|
|
57
|
+
TRollout = never,
|
|
58
|
+
TType = unknown,
|
|
59
|
+
> = {
|
|
60
|
+
Kind: TKind;
|
|
61
|
+
Visibility: TVisibility;
|
|
62
|
+
Rollout: TRollout;
|
|
63
|
+
Type: TType;
|
|
64
|
+
};
|
|
65
|
+
|
|
49
66
|
export type BarekeyEnvDescriptor<
|
|
67
|
+
TKindOrMode = never,
|
|
68
|
+
TVisibility = never,
|
|
69
|
+
TRollout = never,
|
|
70
|
+
TType = unknown,
|
|
71
|
+
> = TKindOrMode extends BarekeyLegacyEnvMode
|
|
72
|
+
? BarekeyLegacyEnvDescriptor<TKindOrMode, TVisibility, TRollout, TType>
|
|
73
|
+
: BarekeySemanticEnvDescriptor<TKindOrMode, TVisibility, TRollout, TType>;
|
|
74
|
+
|
|
75
|
+
export type BarekeyLegacyEnvDescriptor<
|
|
50
76
|
TMode = never,
|
|
51
77
|
TVisibility = never,
|
|
52
78
|
TRollout = never,
|
|
@@ -58,11 +84,47 @@ export type BarekeyEnvDescriptor<
|
|
|
58
84
|
Type: TType;
|
|
59
85
|
};
|
|
60
86
|
|
|
61
|
-
type BarekeyAnyEnvDescriptor =
|
|
87
|
+
type BarekeyAnyEnvDescriptor =
|
|
88
|
+
| BarekeySemanticEnvDescriptor<unknown, unknown, unknown, unknown>
|
|
89
|
+
| BarekeyLegacyEnvDescriptor<unknown, unknown, unknown, unknown>;
|
|
62
90
|
|
|
63
|
-
type
|
|
91
|
+
type BarekeyKindFromLegacyMode<TMode> = TMode extends Secret
|
|
92
|
+
? "secret"
|
|
93
|
+
: TMode extends AB
|
|
94
|
+
? "ab_roll" | "rollout"
|
|
95
|
+
: never;
|
|
96
|
+
|
|
97
|
+
type BarekeyDescriptorKind<TDescriptor> = TDescriptor extends {
|
|
98
|
+
Kind: infer TKind;
|
|
99
|
+
}
|
|
100
|
+
? TKind
|
|
101
|
+
: TDescriptor extends {
|
|
102
|
+
Mode: infer TMode;
|
|
103
|
+
}
|
|
104
|
+
? BarekeyKindFromLegacyMode<TMode>
|
|
105
|
+
: never;
|
|
106
|
+
|
|
107
|
+
type BarekeyDescriptorVisibility<TDescriptor> = TDescriptor extends {
|
|
108
|
+
Visibility: infer TVisibility;
|
|
109
|
+
}
|
|
110
|
+
? TVisibility
|
|
111
|
+
: never;
|
|
112
|
+
|
|
113
|
+
type BarekeyDescriptorRollout<TDescriptor> = TDescriptor extends {
|
|
114
|
+
Rollout: infer TRollout;
|
|
115
|
+
}
|
|
116
|
+
? TRollout
|
|
117
|
+
: never;
|
|
118
|
+
|
|
119
|
+
type BarekeyDescriptorValue<TDescriptor> = TDescriptor extends {
|
|
120
|
+
Type: infer TValue;
|
|
121
|
+
}
|
|
122
|
+
? TValue
|
|
123
|
+
: never;
|
|
124
|
+
|
|
125
|
+
type BarekeyEnvMarker<TKind, TVisibility, TRollout> = {
|
|
64
126
|
readonly __barekey?: {
|
|
65
|
-
readonly
|
|
127
|
+
readonly kind: TKind;
|
|
66
128
|
readonly visibility: TVisibility;
|
|
67
129
|
readonly rollout: TRollout;
|
|
68
130
|
};
|
|
@@ -75,14 +137,21 @@ export type Env<
|
|
|
75
137
|
TVisibility = never,
|
|
76
138
|
> = [TValue] extends [never]
|
|
77
139
|
? TDescriptorOrMode extends BarekeyAnyEnvDescriptor
|
|
78
|
-
? TDescriptorOrMode
|
|
140
|
+
? BarekeyDescriptorValue<TDescriptorOrMode> &
|
|
79
141
|
BarekeyEnvMarker<
|
|
80
|
-
TDescriptorOrMode
|
|
81
|
-
TDescriptorOrMode
|
|
82
|
-
TDescriptorOrMode
|
|
142
|
+
BarekeyDescriptorKind<TDescriptorOrMode>,
|
|
143
|
+
BarekeyDescriptorVisibility<TDescriptorOrMode>,
|
|
144
|
+
BarekeyDescriptorRollout<TDescriptorOrMode>
|
|
83
145
|
>
|
|
84
146
|
: never
|
|
85
|
-
: TValue &
|
|
147
|
+
: TValue &
|
|
148
|
+
BarekeyEnvMarker<
|
|
149
|
+
TDescriptorOrMode extends BarekeyLegacyEnvMode
|
|
150
|
+
? BarekeyKindFromLegacyMode<TDescriptorOrMode>
|
|
151
|
+
: TDescriptorOrMode,
|
|
152
|
+
TVisibility,
|
|
153
|
+
TRollout
|
|
154
|
+
>;
|
|
86
155
|
|
|
87
156
|
export type BarekeyCoerceTarget = "string" | "boolean" | "int64" | "float" | "date" | "json";
|
|
88
157
|
|
|
@@ -195,6 +264,10 @@ export type BarekeyJsonConfig = {
|
|
|
195
264
|
environment?: string;
|
|
196
265
|
org?: string;
|
|
197
266
|
stage?: string;
|
|
267
|
+
config?: {
|
|
268
|
+
typegen?: BarekeyTypegenMode;
|
|
269
|
+
mode?: BarekeyMode;
|
|
270
|
+
};
|
|
198
271
|
};
|
|
199
272
|
|
|
200
273
|
export type BarekeyStandardSchemaResult =
|