@ocel/transforms 0.0.0 → 0.0.1
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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +3 -3
- package/dist/aws/index.d.ts +21 -2
- package/dist/aws/index.js +26 -0
- package/dist/define.d.ts +6 -6
- package/dist/define.js +1 -1
- package/dist/evaluate.d.ts +4 -4
- package/dist/evaluate.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/output.d.ts +4 -4
- package/dist/output.js +2 -2
- package/dist/vps/index.d.ts +18 -4
- package/dist/vps/index.js +4 -0
- package/package.json +5 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -22,11 +22,11 @@ Write a module, and list it in `ocel.json`:
|
|
|
22
22
|
```ts
|
|
23
23
|
import { defineTransform } from "@ocel/transforms";
|
|
24
24
|
|
|
25
|
-
export default defineTransform(({ bindings,
|
|
25
|
+
export default defineTransform(({ bindings, envTier }) => ({
|
|
26
26
|
aws: {
|
|
27
27
|
function: {
|
|
28
28
|
lambda: {
|
|
29
|
-
memorySize:
|
|
29
|
+
memorySize: envTier === "production" ? 2048 : 512,
|
|
30
30
|
vpcConfig: { subnetIds: bindings.custom.network.subnetIds },
|
|
31
31
|
},
|
|
32
32
|
},
|
|
@@ -44,4 +44,4 @@ to write those names and their types down.
|
|
|
44
44
|
|
|
45
45
|
## License
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Apache-2.0
|
package/dist/aws/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { cloudwatch, ec2, iam, lambda, rds, s3 } from "@pulumi/aws";
|
|
1
|
+
import type { cloudwatch, ec2, elasticache, iam, lambda, rds, s3 } from "@pulumi/aws";
|
|
2
2
|
import type { Unwrap } from "@pulumi/pulumi";
|
|
3
3
|
import type { Patch } from "../patch";
|
|
4
4
|
/**
|
|
@@ -32,6 +32,19 @@ export interface AwsResourceArgs {
|
|
|
32
32
|
cluster: rds.ClusterArgs;
|
|
33
33
|
instance: rds.ClusterInstanceArgs;
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* A kv store: a Valkey replication group of two nodes across zones, each the
|
|
37
|
+
* cheapest node that holds the store's declared memory. Setting
|
|
38
|
+
* `numCacheClusters: 1` with `automaticFailoverEnabled` and `multiAzEnabled`
|
|
39
|
+
* off halves its cost, and a store whose one node is replaced comes back empty.
|
|
40
|
+
* A deploy refuses one node with either flag left on.
|
|
41
|
+
*/
|
|
42
|
+
kv: {
|
|
43
|
+
securityGroup: ec2.SecurityGroupArgs;
|
|
44
|
+
subnetGroup: elasticache.SubnetGroupArgs;
|
|
45
|
+
parameterGroup: elasticache.ParameterGroupArgs;
|
|
46
|
+
replicationGroup: elasticache.ReplicationGroupArgs;
|
|
47
|
+
};
|
|
35
48
|
}
|
|
36
49
|
/** The ocel resource types the AWS provider renders patchable resources for. */
|
|
37
50
|
export type AwsResourceType = keyof AwsResourceArgs;
|
|
@@ -68,12 +81,18 @@ export declare const awsOwnedFields: {
|
|
|
68
81
|
readonly cluster: readonly ["clusterIdentifier", "clusterIdentifierPrefix", "databaseName", "dbSubnetGroupName", "engine", "manageMasterUserPassword", "masterPassword", "masterUsername", "tags", "vpcSecurityGroupIds"];
|
|
69
82
|
readonly instance: readonly ["clusterIdentifier", "engine", "engineVersion", "identifier", "identifierPrefix", "tags"];
|
|
70
83
|
};
|
|
84
|
+
readonly kv: {
|
|
85
|
+
readonly securityGroup: readonly ["name", "namePrefix", "tags", "vpcId"];
|
|
86
|
+
readonly subnetGroup: readonly ["name", "subnetIds", "tags"];
|
|
87
|
+
readonly parameterGroup: readonly ["family", "name", "parameters", "tags"];
|
|
88
|
+
readonly replicationGroup: readonly ["authToken", "authTokenUpdateStrategy", "clusterMode", "engine", "engineVersion", "globalReplicationGroupId", "nodeType", "numNodeGroups", "parameterGroupName", "port", "replicasPerNodeGroup", "replicationGroupId", "securityGroupIds", "securityGroupNames", "subnetGroupName", "tags", "transitEncryptionEnabled", "transitEncryptionMode", "userGroupIds"];
|
|
89
|
+
};
|
|
71
90
|
};
|
|
72
91
|
type AwsOwned = typeof awsOwnedFields;
|
|
73
92
|
type OwnedNames<L> = L extends readonly (infer F)[] ? Extract<F, string> : never;
|
|
74
93
|
/**
|
|
75
94
|
* What a rule may patch under `aws`, typed from the args pulumi-aws takes with
|
|
76
|
-
* the fields ocel owns removed. A binding output
|
|
95
|
+
* the fields ocel owns removed. A binding output can take the place of any leaf.
|
|
77
96
|
*/
|
|
78
97
|
export type AwsSurfaces = {
|
|
79
98
|
[T in AwsResourceType]: {
|
package/dist/aws/index.js
CHANGED
|
@@ -98,4 +98,30 @@ export const awsOwnedFields = {
|
|
|
98
98
|
"tags",
|
|
99
99
|
],
|
|
100
100
|
},
|
|
101
|
+
kv: {
|
|
102
|
+
securityGroup: ["name", "namePrefix", "tags", "vpcId"],
|
|
103
|
+
subnetGroup: ["name", "subnetIds", "tags"],
|
|
104
|
+
parameterGroup: ["family", "name", "parameters", "tags"],
|
|
105
|
+
replicationGroup: [
|
|
106
|
+
"authToken",
|
|
107
|
+
"authTokenUpdateStrategy",
|
|
108
|
+
"clusterMode",
|
|
109
|
+
"engine",
|
|
110
|
+
"engineVersion",
|
|
111
|
+
"globalReplicationGroupId",
|
|
112
|
+
"nodeType",
|
|
113
|
+
"numNodeGroups",
|
|
114
|
+
"parameterGroupName",
|
|
115
|
+
"port",
|
|
116
|
+
"replicasPerNodeGroup",
|
|
117
|
+
"replicationGroupId",
|
|
118
|
+
"securityGroupIds",
|
|
119
|
+
"securityGroupNames",
|
|
120
|
+
"subnetGroupName",
|
|
121
|
+
"tags",
|
|
122
|
+
"transitEncryptionEnabled",
|
|
123
|
+
"transitEncryptionMode",
|
|
124
|
+
"userGroupIds",
|
|
125
|
+
],
|
|
126
|
+
},
|
|
101
127
|
};
|
package/dist/define.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { AwsSurfaces } from "./aws";
|
|
2
2
|
import type { TransformBindings } from "./index";
|
|
3
3
|
import type { VpsSurfaces } from "./vps";
|
|
4
|
-
/** The environment
|
|
5
|
-
export type
|
|
4
|
+
/** The environment tiers a deploy can target. */
|
|
5
|
+
export type EnvTier = "development" | "preview" | "production";
|
|
6
6
|
/**
|
|
7
7
|
* What a rule's `if` gate is allowed to decide on: the environment being
|
|
8
8
|
* deployed and the app a candidate resource belongs to. Resources shared
|
|
9
|
-
* across apps
|
|
9
|
+
* across apps have no `app`, so `ctx.app === "api"` is false for them.
|
|
10
10
|
*/
|
|
11
11
|
export interface GateContext {
|
|
12
|
-
readonly
|
|
12
|
+
readonly envTier: EnvTier;
|
|
13
13
|
readonly env: string;
|
|
14
14
|
readonly app: string | undefined;
|
|
15
15
|
}
|
|
@@ -43,12 +43,12 @@ export type TransformRule = {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
/** Keys a rule may
|
|
46
|
+
/** Keys a rule may have besides the providers it targets. */
|
|
47
47
|
export declare const ruleKeywords: readonly ["if", "tags"];
|
|
48
48
|
/** What a callback form of `defineTransform` is handed, and nothing besides. */
|
|
49
49
|
export interface TransformInputs {
|
|
50
50
|
readonly bindings: TransformBindings;
|
|
51
|
-
readonly
|
|
51
|
+
readonly envTier: EnvTier;
|
|
52
52
|
readonly env: string;
|
|
53
53
|
}
|
|
54
54
|
/** The rules a module contributes, written down or returned from the callback. */
|
package/dist/define.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The prefix ocel reserves for the tags it writes itself. */
|
|
2
2
|
export const reservedTagPrefix = "ocel:";
|
|
3
|
-
/** Keys a rule may
|
|
3
|
+
/** Keys a rule may have besides the providers it targets. */
|
|
4
4
|
export const ruleKeywords = ["if", "tags"];
|
|
5
5
|
/**
|
|
6
6
|
* Declares the rules a transform module contributes. Rules apply in the order
|
package/dist/evaluate.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type EnvTier, type TagMap, type TransformDefinition } from "./define";
|
|
2
2
|
/**
|
|
3
3
|
* What one ocel resource's rules came to: a patch per underlying resource the
|
|
4
4
|
* provider constructs for it, keyed by the same key the rules were written
|
|
5
|
-
* under
|
|
5
|
+
* under, its properties keyed by the provider SDK's own names.
|
|
6
6
|
*/
|
|
7
7
|
export type Patches = Record<string, Record<string, unknown>>;
|
|
8
8
|
/** One resource the deploy offers the modules, as the deploy addresses it. */
|
|
@@ -14,7 +14,7 @@ export interface RequestResource {
|
|
|
14
14
|
/** What a deploy asks the modules about: the environment, and every candidate in it. */
|
|
15
15
|
export interface EvaluateRequest {
|
|
16
16
|
readonly provider: string;
|
|
17
|
-
readonly
|
|
17
|
+
readonly envTier: EnvTier;
|
|
18
18
|
readonly env: string;
|
|
19
19
|
readonly resources: readonly RequestResource[];
|
|
20
20
|
}
|
|
@@ -24,7 +24,7 @@ export interface EvaluatedResource {
|
|
|
24
24
|
readonly patches: Patches;
|
|
25
25
|
readonly tags: TagMap;
|
|
26
26
|
}
|
|
27
|
-
/** The answer to one request, one entry per candidate the request
|
|
27
|
+
/** The answer to one request, one entry per candidate the request named. */
|
|
28
28
|
export interface EvaluateResponse {
|
|
29
29
|
readonly resources: readonly EvaluatedResource[];
|
|
30
30
|
}
|
package/dist/evaluate.js
CHANGED
|
@@ -21,7 +21,7 @@ export function evaluate(request, modules) {
|
|
|
21
21
|
function load(request, module) {
|
|
22
22
|
const rules = module.definition.rules({
|
|
23
23
|
bindings: bindings,
|
|
24
|
-
|
|
24
|
+
envTier: request.envTier,
|
|
25
25
|
env: request.env,
|
|
26
26
|
});
|
|
27
27
|
const branches = new Set();
|
|
@@ -47,7 +47,7 @@ function evaluateResource(request, resource, modules) {
|
|
|
47
47
|
const patches = {};
|
|
48
48
|
const tags = {};
|
|
49
49
|
const ctx = Object.freeze({
|
|
50
|
-
|
|
50
|
+
envTier: request.envTier,
|
|
51
51
|
env: request.env,
|
|
52
52
|
app: resource.app,
|
|
53
53
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { EnvTier, Gate, GateContext, ProviderName, ProviderSurfaces, TagMap, TransformDefinition, TransformInputs, TransformRule, TransformRules, } from "./define";
|
|
2
2
|
export { defineTransform } from "./define";
|
|
3
3
|
export type { Patch } from "./patch";
|
|
4
4
|
import { type BindingPlaceholdersOf } from "./output";
|
|
5
5
|
/**
|
|
6
6
|
* The records this project's config binds, keyed by resource type and then by
|
|
7
|
-
* the name the config keys them under, with `custom`
|
|
7
|
+
* the name the config keys them under, with `custom` containing the records
|
|
8
8
|
* nothing declared. `ocel bindings generate` writes an augmentation of this
|
|
9
9
|
* interface from the records themselves; until something does, every name is
|
|
10
10
|
* open and the deploy is what checks it.
|
|
@@ -23,7 +23,7 @@ export type TransformBindings = BindingPlaceholdersOf<Bindings, BindingsGenerate
|
|
|
23
23
|
/**
|
|
24
24
|
* The records a transform module reads, one placeholder per property named.
|
|
25
25
|
* Nothing is resolved here: `bindings.custom.network.subnetIds` is the
|
|
26
|
-
* instruction the deploy
|
|
26
|
+
* instruction the deploy applies against the records published to the
|
|
27
27
|
* environment it targets.
|
|
28
28
|
*/
|
|
29
29
|
export declare const bindings: TransformBindings;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { bindings as openBindings } from "./output";
|
|
|
3
3
|
/**
|
|
4
4
|
* The records a transform module reads, one placeholder per property named.
|
|
5
5
|
* Nothing is resolved here: `bindings.custom.network.subnetIds` is the
|
|
6
|
-
* instruction the deploy
|
|
6
|
+
* instruction the deploy applies against the records published to the
|
|
7
7
|
* environment it targets.
|
|
8
8
|
*/
|
|
9
9
|
export const bindings = openBindings;
|
package/dist/output.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare const resolvedValue: unique symbol;
|
|
|
11
11
|
* A value the deploy reads from a record your own infrastructure published, in
|
|
12
12
|
* place of one a transform module could write down. It is resolved provider-side
|
|
13
13
|
* against the records published to the environment being deployed, so a module
|
|
14
|
-
* never
|
|
14
|
+
* never contains the value itself.
|
|
15
15
|
*/
|
|
16
16
|
export interface BindingOutput<T = unknown> {
|
|
17
17
|
readonly [outputPlaceholderKey]: BindingOutputRef;
|
|
@@ -19,7 +19,7 @@ export interface BindingOutput<T = unknown> {
|
|
|
19
19
|
}
|
|
20
20
|
/** A leaf a transform may fill with either an authored value or a binding output. */
|
|
21
21
|
export type Linked<T> = T | BindingOutput<T>;
|
|
22
|
-
/** The properties one record
|
|
22
|
+
/** The properties one record has, each read as a binding output. */
|
|
23
23
|
export type BindingProperties = {
|
|
24
24
|
readonly [property: string]: BindingOutput<any>;
|
|
25
25
|
};
|
|
@@ -33,7 +33,7 @@ export type BindingPlaceholders = {
|
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* The placeholders `B` describes: one property of one record per leaf, each
|
|
36
|
-
*
|
|
36
|
+
* typed as that record publishes it. `G` is what marks `B` as
|
|
37
37
|
* written down; while nothing has augmented it — nothing has run
|
|
38
38
|
* `ocel bindings generate` — every name stays open and the deploy is the check.
|
|
39
39
|
*/
|
|
@@ -49,7 +49,7 @@ export declare function isBindingOutput(value: unknown): value is BindingOutput;
|
|
|
49
49
|
/**
|
|
50
50
|
* The records a transform module reads, one placeholder per property named.
|
|
51
51
|
* Nothing is resolved here: `bindings.postgres.orders.host` is the instruction
|
|
52
|
-
* the deploy
|
|
52
|
+
* the deploy applies against the records published to the environment it
|
|
53
53
|
* targets, and `bindings.custom.network.subnetIds` reads a record nothing
|
|
54
54
|
* declared.
|
|
55
55
|
*/
|
package/dist/output.js
CHANGED
|
@@ -7,7 +7,7 @@ export function isBindingOutput(value) {
|
|
|
7
7
|
/**
|
|
8
8
|
* The records a transform module reads, one placeholder per property named.
|
|
9
9
|
* Nothing is resolved here: `bindings.postgres.orders.host` is the instruction
|
|
10
|
-
* the deploy
|
|
10
|
+
* the deploy applies against the records published to the environment it
|
|
11
11
|
* targets, and `bindings.custom.network.subnetIds` reads a record nothing
|
|
12
12
|
* declared.
|
|
13
13
|
*/
|
|
@@ -41,7 +41,7 @@ function placeholder(type, name, property) {
|
|
|
41
41
|
throw new Error(`a binding output of ${type} names no binding — name the resource your config binds, or the record your own infrastructure published under \`custom\``);
|
|
42
42
|
}
|
|
43
43
|
if (property === "") {
|
|
44
|
-
throw new Error(`a binding output of ${type}.${name} names no property — name the property that record
|
|
44
|
+
throw new Error(`a binding output of ${type}.${name} names no property — name the property that record has`);
|
|
45
45
|
}
|
|
46
46
|
return Object.freeze({
|
|
47
47
|
[outputPlaceholderKey]: Object.freeze({ type, name, property }),
|
package/dist/vps/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface VpsContainerArgs {
|
|
|
6
6
|
name: string;
|
|
7
7
|
/** The project network the container joins, and the only thing that reaches it. */
|
|
8
8
|
network: string;
|
|
9
|
-
/** The labels a teardown and a
|
|
9
|
+
/** The labels a teardown and a tier destroy find the container by. */
|
|
10
10
|
labels: Record<string, string>;
|
|
11
11
|
/** Ports published on the box. A resource publishes none. */
|
|
12
12
|
publish: string[];
|
|
@@ -14,7 +14,7 @@ export interface VpsContainerArgs {
|
|
|
14
14
|
mounts: string[];
|
|
15
15
|
/**
|
|
16
16
|
* The image to run, pinned by digest (`…@sha256:…`). Swap it for a build of
|
|
17
|
-
* the same engine that
|
|
17
|
+
* the same engine that includes what you need, such as pgvector.
|
|
18
18
|
*/
|
|
19
19
|
image: string;
|
|
20
20
|
/** Arguments handed to the image's entrypoint, such as `["-c", "max_connections=200"]`. */
|
|
@@ -34,7 +34,7 @@ export interface VpsContainerArgs {
|
|
|
34
34
|
export interface VpsVolumeArgs {
|
|
35
35
|
/** The volume's name, which a teardown removes it by. */
|
|
36
36
|
name: string;
|
|
37
|
-
/** The labels a
|
|
37
|
+
/** The labels a tier destroy finds the volume by. */
|
|
38
38
|
labels: Record<string, string>;
|
|
39
39
|
/** The volume driver. Defaults to the engine's own `local`. */
|
|
40
40
|
driver: string;
|
|
@@ -42,7 +42,7 @@ export interface VpsVolumeArgs {
|
|
|
42
42
|
driverOpts: Record<string, string>;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* One key per thing the vps provider
|
|
45
|
+
* One key per thing the vps provider provisions on the box for an ocel resource.
|
|
46
46
|
*/
|
|
47
47
|
export interface VpsResourceArgs {
|
|
48
48
|
postgres: {
|
|
@@ -53,6 +53,16 @@ export interface VpsResourceArgs {
|
|
|
53
53
|
container: VpsContainerArgs;
|
|
54
54
|
volume: VpsVolumeArgs;
|
|
55
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* A kv store's Valkey container. `args` are appended after the settings ocel
|
|
58
|
+
* renders, and a deploy refuses one that sets any of them, such as
|
|
59
|
+
* `--maxmemory` or `--user`; `memory` caps the whole container, so give it
|
|
60
|
+
* well over twice the store's `memory`, which a background save can need.
|
|
61
|
+
*/
|
|
62
|
+
kv: {
|
|
63
|
+
container: VpsContainerArgs;
|
|
64
|
+
volume: VpsVolumeArgs;
|
|
65
|
+
};
|
|
56
66
|
}
|
|
57
67
|
/** The ocel resource types the vps provider renders patchable resources for. */
|
|
58
68
|
export type VpsResourceType = keyof VpsResourceArgs;
|
|
@@ -71,6 +81,10 @@ export declare const vpsOwnedFields: {
|
|
|
71
81
|
readonly container: readonly ["name", "network", "labels", "publish", "mounts"];
|
|
72
82
|
readonly volume: readonly ["name", "labels"];
|
|
73
83
|
};
|
|
84
|
+
readonly kv: {
|
|
85
|
+
readonly container: readonly ["name", "network", "labels", "publish", "mounts"];
|
|
86
|
+
readonly volume: readonly ["name", "labels"];
|
|
87
|
+
};
|
|
74
88
|
};
|
|
75
89
|
type VpsOwned = typeof vpsOwnedFields;
|
|
76
90
|
type OwnedNames<L> = L extends readonly (infer F)[] ? Extract<F, string> : never;
|
package/dist/vps/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocel/transforms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Patches the underlying cloud resources ocel provisions, typed from the provider's own SDK",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist/",
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE",
|
|
11
|
+
"NOTICE"
|
|
10
12
|
],
|
|
11
13
|
"exports": {
|
|
12
14
|
".": {
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
"vite": "^8.1.3",
|
|
38
40
|
"vitest": "^4.1.9"
|
|
39
41
|
},
|
|
40
|
-
"license": "
|
|
42
|
+
"license": "Apache-2.0",
|
|
41
43
|
"repository": {
|
|
42
44
|
"type": "git",
|
|
43
45
|
"url": "git+https://github.com/ocelhq/ocel.git",
|