@microagi/alchemy-gcp 0.3.0 → 0.5.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/CHANGELOG.md +100 -0
- package/lib/ArtifactRegistry/Operations.d.ts +47 -0
- package/lib/ArtifactRegistry/Operations.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Operations.js +47 -0
- package/lib/ArtifactRegistry/Operations.js.map +1 -0
- package/lib/ArtifactRegistry/Repository.d.ts +263 -0
- package/lib/ArtifactRegistry/Repository.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Repository.js +257 -0
- package/lib/ArtifactRegistry/Repository.js.map +1 -0
- package/lib/ArtifactRegistry/Types.d.ts +32 -0
- package/lib/ArtifactRegistry/Types.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Types.js +12 -0
- package/lib/ArtifactRegistry/Types.js.map +1 -0
- package/lib/ArtifactRegistry/Validation.d.ts +43 -0
- package/lib/ArtifactRegistry/Validation.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Validation.js +95 -0
- package/lib/ArtifactRegistry/Validation.js.map +1 -0
- package/lib/ArtifactRegistry/index.d.ts +4 -0
- package/lib/ArtifactRegistry/index.d.ts.map +1 -0
- package/lib/ArtifactRegistry/index.js +2 -0
- package/lib/ArtifactRegistry/index.js.map +1 -0
- package/lib/Providers.d.ts.map +1 -1
- package/lib/Providers.js +9 -1
- package/lib/Providers.js.map +1 -1
- package/lib/Sqladmin/Database.d.ts +82 -0
- package/lib/Sqladmin/Database.d.ts.map +1 -0
- package/lib/Sqladmin/Database.js +87 -0
- package/lib/Sqladmin/Database.js.map +1 -0
- package/lib/Sqladmin/Instance.d.ts +234 -0
- package/lib/Sqladmin/Instance.d.ts.map +1 -0
- package/lib/Sqladmin/Instance.js +251 -0
- package/lib/Sqladmin/Instance.js.map +1 -0
- package/lib/Sqladmin/Operations.d.ts +41 -0
- package/lib/Sqladmin/Operations.d.ts.map +1 -0
- package/lib/Sqladmin/Operations.js +42 -0
- package/lib/Sqladmin/Operations.js.map +1 -0
- package/lib/Sqladmin/Types.d.ts +82 -0
- package/lib/Sqladmin/Types.d.ts.map +1 -0
- package/lib/Sqladmin/Types.js +28 -0
- package/lib/Sqladmin/Types.js.map +1 -0
- package/lib/Sqladmin/User.d.ts +110 -0
- package/lib/Sqladmin/User.d.ts.map +1 -0
- package/lib/Sqladmin/User.js +156 -0
- package/lib/Sqladmin/User.js.map +1 -0
- package/lib/Sqladmin/Validation.d.ts +60 -0
- package/lib/Sqladmin/Validation.d.ts.map +1 -0
- package/lib/Sqladmin/Validation.js +125 -0
- package/lib/Sqladmin/Validation.js.map +1 -0
- package/lib/Sqladmin/index.d.ts +9 -0
- package/lib/Sqladmin/index.d.ts.map +1 -0
- package/lib/Sqladmin/index.js +5 -0
- package/lib/Sqladmin/index.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/ArtifactRegistry/Operations.ts +79 -0
- package/src/ArtifactRegistry/Repository.ts +624 -0
- package/src/ArtifactRegistry/Types.ts +49 -0
- package/src/ArtifactRegistry/Validation.ts +112 -0
- package/src/ArtifactRegistry/index.ts +10 -0
- package/src/Providers.ts +15 -0
- package/src/Sqladmin/Database.ts +209 -0
- package/src/Sqladmin/Instance.ts +620 -0
- package/src/Sqladmin/Operations.ts +73 -0
- package/src/Sqladmin/Types.ts +101 -0
- package/src/Sqladmin/User.ts +333 -0
- package/src/Sqladmin/Validation.ts +148 -0
- package/src/Sqladmin/index.ts +19 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import * as ar from "@distilled.cloud/gcp/artifactregistry-v1";
|
|
2
|
+
import { Resource } from "alchemy";
|
|
3
|
+
import { Unowned } from "alchemy/AdoptPolicy";
|
|
4
|
+
import { deepEqual, isResolved, somePropsAreDifferent } from "alchemy/Diff";
|
|
5
|
+
import { createPhysicalName } from "alchemy/PhysicalName";
|
|
6
|
+
import * as Provider from "alchemy/Provider";
|
|
7
|
+
import { diffTags } from "alchemy/Tags";
|
|
8
|
+
import * as Duration from "effect/Duration";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Schedule from "effect/Schedule";
|
|
11
|
+
import { gcpInternalLabels, hasAlchemyLabels } from "../Tags.js";
|
|
12
|
+
import { makeAwaitOperation } from "./Operations.js";
|
|
13
|
+
import { reshapeBadRequest, validateModeConfig, validateRepositoryName, } from "./Validation.js";
|
|
14
|
+
export const ArtifactRegistryRepository = Resource("GCP.ArtifactRegistryRepository");
|
|
15
|
+
const fqName = (project, location, name) => `projects/${project}/locations/${location}/repositories/${name}`;
|
|
16
|
+
const parent = (project, location) => `projects/${project}/locations/${location}`;
|
|
17
|
+
const toDockerRepositoryBody = (upstream) => {
|
|
18
|
+
if (upstream.publicRepository !== undefined) {
|
|
19
|
+
return { publicRepository: upstream.publicRepository };
|
|
20
|
+
}
|
|
21
|
+
if (upstream.customRepository !== undefined) {
|
|
22
|
+
return { customRepository: { uri: upstream.customRepository.uri } };
|
|
23
|
+
}
|
|
24
|
+
// Unreachable per the discriminated union, but validation also
|
|
25
|
+
// rejects an empty dockerRepository at plan time.
|
|
26
|
+
return {};
|
|
27
|
+
};
|
|
28
|
+
const toRemoteRepositoryConfigBody = (cfg) => ({
|
|
29
|
+
...(cfg.description !== undefined ? { description: cfg.description } : {}),
|
|
30
|
+
...(cfg.dockerRepository
|
|
31
|
+
? { dockerRepository: toDockerRepositoryBody(cfg.dockerRepository) }
|
|
32
|
+
: {}),
|
|
33
|
+
...(cfg.disableUpstreamValidation !== undefined
|
|
34
|
+
? { disableUpstreamValidation: cfg.disableUpstreamValidation }
|
|
35
|
+
: {}),
|
|
36
|
+
...(cfg.upstreamCredentials
|
|
37
|
+
? {
|
|
38
|
+
upstreamCredentials: {
|
|
39
|
+
...(cfg.upstreamCredentials.usernamePasswordCredentials
|
|
40
|
+
? {
|
|
41
|
+
usernamePasswordCredentials: {
|
|
42
|
+
...(cfg.upstreamCredentials.usernamePasswordCredentials
|
|
43
|
+
.username !== undefined
|
|
44
|
+
? {
|
|
45
|
+
username: cfg.upstreamCredentials.usernamePasswordCredentials
|
|
46
|
+
.username,
|
|
47
|
+
}
|
|
48
|
+
: {}),
|
|
49
|
+
...(cfg.upstreamCredentials.usernamePasswordCredentials
|
|
50
|
+
.passwordSecretVersion !== undefined
|
|
51
|
+
? {
|
|
52
|
+
passwordSecretVersion: cfg.upstreamCredentials.usernamePasswordCredentials
|
|
53
|
+
.passwordSecretVersion,
|
|
54
|
+
}
|
|
55
|
+
: {}),
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
: {}),
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
: {}),
|
|
62
|
+
});
|
|
63
|
+
const toRepositoryBody = (props, desiredLabels) => ({
|
|
64
|
+
format: props.format,
|
|
65
|
+
...(props.mode ? { mode: props.mode } : {}),
|
|
66
|
+
...(props.description !== undefined
|
|
67
|
+
? { description: props.description }
|
|
68
|
+
: {}),
|
|
69
|
+
labels: desiredLabels,
|
|
70
|
+
...(props.kmsKeyName ? { kmsKeyName: props.kmsKeyName } : {}),
|
|
71
|
+
...(props.dockerConfig
|
|
72
|
+
? {
|
|
73
|
+
dockerConfig: {
|
|
74
|
+
...(props.dockerConfig.immutableTags !== undefined
|
|
75
|
+
? { immutableTags: props.dockerConfig.immutableTags }
|
|
76
|
+
: {}),
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
: {}),
|
|
80
|
+
...(props.remoteRepositoryConfig
|
|
81
|
+
? {
|
|
82
|
+
remoteRepositoryConfig: toRemoteRepositoryConfigBody(props.remoteRepositoryConfig),
|
|
83
|
+
}
|
|
84
|
+
: {}),
|
|
85
|
+
...(props.cleanupPolicies
|
|
86
|
+
? { cleanupPolicies: props.cleanupPolicies }
|
|
87
|
+
: {}),
|
|
88
|
+
...(props.cleanupPolicyDryRun !== undefined
|
|
89
|
+
? { cleanupPolicyDryRun: props.cleanupPolicyDryRun }
|
|
90
|
+
: {}),
|
|
91
|
+
});
|
|
92
|
+
const toAttributes = (r, parentArgs) => ({
|
|
93
|
+
name: parentArgs.name,
|
|
94
|
+
fullyQualifiedName: fqName(parentArgs.project, parentArgs.location, parentArgs.name),
|
|
95
|
+
project: parentArgs.project,
|
|
96
|
+
location: parentArgs.location,
|
|
97
|
+
format: r.format ?? "",
|
|
98
|
+
mode: r.mode ?? "STANDARD_REPOSITORY",
|
|
99
|
+
registryUri: r.registryUri,
|
|
100
|
+
sizeBytes: r.sizeBytes,
|
|
101
|
+
satisfiesPzs: r.satisfiesPzs,
|
|
102
|
+
satisfiesPzi: r.satisfiesPzi,
|
|
103
|
+
labels: { ...(r.labels ?? {}) },
|
|
104
|
+
createTime: r.createTime ?? "",
|
|
105
|
+
updateTime: r.updateTime ?? "",
|
|
106
|
+
});
|
|
107
|
+
export const ArtifactRegistryRepositoryProvider = () => Provider.effect(ArtifactRegistryRepository, Effect.gen(function* () {
|
|
108
|
+
const getRepository = yield* ar.getProjectsLocationsRepositories;
|
|
109
|
+
const createRepository = yield* ar.createProjectsLocationsRepositories;
|
|
110
|
+
const patchRepository = yield* ar.patchProjectsLocationsRepositories;
|
|
111
|
+
const deleteRepository = yield* ar.deleteProjectsLocationsRepositories;
|
|
112
|
+
const getOperations = yield* ar.getProjectsLocationsOperations;
|
|
113
|
+
const awaitOperation = makeAwaitOperation(getOperations);
|
|
114
|
+
const observe = (project, location, name) => getRepository({ name: fqName(project, location, name) }).pipe(Effect.catchTag("NotFound", () => Effect.succeed(undefined)), Effect.catchTag("Forbidden", () => Effect.succeed(undefined)));
|
|
115
|
+
const syncMutable = Effect.fn(function* (args) {
|
|
116
|
+
const fields = [];
|
|
117
|
+
const body = {};
|
|
118
|
+
if ((args.observed.description ?? "") !== (args.news.description ?? "")) {
|
|
119
|
+
fields.push("description");
|
|
120
|
+
body.description = args.news.description ?? "";
|
|
121
|
+
}
|
|
122
|
+
const labelDiff = diffTags({ ...(args.observed.labels ?? {}) }, args.desiredLabels);
|
|
123
|
+
if (labelDiff.removed.length > 0 || labelDiff.upsert.length > 0) {
|
|
124
|
+
fields.push("labels");
|
|
125
|
+
body.labels = args.desiredLabels;
|
|
126
|
+
}
|
|
127
|
+
const desiredDockerConfig = args.news.dockerConfig
|
|
128
|
+
? {
|
|
129
|
+
...(args.news.dockerConfig.immutableTags !== undefined
|
|
130
|
+
? { immutableTags: args.news.dockerConfig.immutableTags }
|
|
131
|
+
: {}),
|
|
132
|
+
}
|
|
133
|
+
: undefined;
|
|
134
|
+
if (!deepEqual(args.observed.dockerConfig, desiredDockerConfig)) {
|
|
135
|
+
fields.push("dockerConfig");
|
|
136
|
+
if (desiredDockerConfig)
|
|
137
|
+
body.dockerConfig = desiredDockerConfig;
|
|
138
|
+
}
|
|
139
|
+
if (!deepEqual(args.observed.cleanupPolicies ?? {}, args.news.cleanupPolicies ?? {})) {
|
|
140
|
+
fields.push("cleanupPolicies");
|
|
141
|
+
if (args.news.cleanupPolicies)
|
|
142
|
+
body.cleanupPolicies = args.news.cleanupPolicies;
|
|
143
|
+
}
|
|
144
|
+
if ((args.observed.cleanupPolicyDryRun ?? false) !==
|
|
145
|
+
(args.news.cleanupPolicyDryRun ?? false)) {
|
|
146
|
+
fields.push("cleanupPolicyDryRun");
|
|
147
|
+
body.cleanupPolicyDryRun = args.news.cleanupPolicyDryRun ?? false;
|
|
148
|
+
}
|
|
149
|
+
if (fields.length === 0)
|
|
150
|
+
return;
|
|
151
|
+
// Patch returns the Repository synchronously (NOT an LRO per
|
|
152
|
+
// `PatchProjectsLocationsRepositoriesResponse = Repository`).
|
|
153
|
+
// No operation to await.
|
|
154
|
+
yield* patchRepository({
|
|
155
|
+
name: args.name,
|
|
156
|
+
updateMask: fields.join(","),
|
|
157
|
+
body,
|
|
158
|
+
}).pipe(Effect.catchTag("BadRequest", reshapeBadRequest("patch")));
|
|
159
|
+
});
|
|
160
|
+
return {
|
|
161
|
+
stables: [
|
|
162
|
+
"name",
|
|
163
|
+
"fullyQualifiedName",
|
|
164
|
+
"project",
|
|
165
|
+
"location",
|
|
166
|
+
"format",
|
|
167
|
+
"mode",
|
|
168
|
+
],
|
|
169
|
+
diff: Effect.fn(function* ({ news, olds = {} }) {
|
|
170
|
+
if (!isResolved(news))
|
|
171
|
+
return undefined;
|
|
172
|
+
if (somePropsAreDifferent(olds, news, [
|
|
173
|
+
"project",
|
|
174
|
+
"location",
|
|
175
|
+
"name",
|
|
176
|
+
"format",
|
|
177
|
+
"mode",
|
|
178
|
+
"kmsKeyName",
|
|
179
|
+
"remoteRepositoryConfig",
|
|
180
|
+
])) {
|
|
181
|
+
return { action: "replace" };
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
}),
|
|
185
|
+
reconcile: Effect.fn(function* ({ id, news, session }) {
|
|
186
|
+
const internalLabels = yield* gcpInternalLabels(id);
|
|
187
|
+
const desiredName = news.name ??
|
|
188
|
+
(yield* createPhysicalName({ id, maxLength: 63 })).toLowerCase();
|
|
189
|
+
yield* validateRepositoryName(desiredName);
|
|
190
|
+
yield* validateModeConfig(news);
|
|
191
|
+
const desiredLabels = {
|
|
192
|
+
...(news.labels ?? {}),
|
|
193
|
+
...internalLabels,
|
|
194
|
+
};
|
|
195
|
+
const name = fqName(news.project, news.location, desiredName);
|
|
196
|
+
// 1. Observe — collapse 403 to "missing" alongside 404.
|
|
197
|
+
let observed = yield* observe(news.project, news.location, desiredName);
|
|
198
|
+
// 2. Ensure — create LRO. Same API-enable race as Cloud Run /
|
|
199
|
+
// Cloud SQL: a create can fire before ApiEnable's effect
|
|
200
|
+
// propagates and the server returns 403 with "If you
|
|
201
|
+
// enabled this API recently, wait …". Retry that specific
|
|
202
|
+
// 403 for ~5 min; other Forbiddens propagate.
|
|
203
|
+
if (!observed) {
|
|
204
|
+
const op = yield* createRepository({
|
|
205
|
+
parent: parent(news.project, news.location),
|
|
206
|
+
repositoryId: desiredName,
|
|
207
|
+
body: toRepositoryBody(news, desiredLabels),
|
|
208
|
+
}).pipe(Effect.retry({
|
|
209
|
+
while: (e) => e?._tag === "Forbidden" &&
|
|
210
|
+
/enabled this API recently|has not been used/i.test(e.message ?? ""),
|
|
211
|
+
schedule: Schedule.spaced(Duration.seconds(15)).pipe(Schedule.both(Schedule.recurs(20)), Schedule.tapOutput(() => session.note("Waiting for Artifact Registry API enablement to propagate…"))),
|
|
212
|
+
}), Effect.catchTag("Conflict", () => Effect.succeed(undefined)), Effect.catchTag("BadRequest", reshapeBadRequest("create")));
|
|
213
|
+
if (op?.name)
|
|
214
|
+
yield* awaitOperation(op.name, session);
|
|
215
|
+
observed = yield* getRepository({ name });
|
|
216
|
+
}
|
|
217
|
+
// 3. Sync — single patch with an updateMask of changed
|
|
218
|
+
// top-level fields. `remoteRepositoryConfig` is NOT
|
|
219
|
+
// patched here: GCP refuses updates to it, so changes
|
|
220
|
+
// trigger a replace via `diff` above.
|
|
221
|
+
yield* syncMutable({
|
|
222
|
+
name,
|
|
223
|
+
observed,
|
|
224
|
+
news,
|
|
225
|
+
desiredLabels,
|
|
226
|
+
session,
|
|
227
|
+
});
|
|
228
|
+
const final = yield* getRepository({ name });
|
|
229
|
+
return toAttributes(final, {
|
|
230
|
+
project: news.project,
|
|
231
|
+
location: news.location,
|
|
232
|
+
name: desiredName,
|
|
233
|
+
});
|
|
234
|
+
}),
|
|
235
|
+
delete: Effect.fn(function* ({ output, session }) {
|
|
236
|
+
const name = fqName(output.project, output.location, output.name);
|
|
237
|
+
yield* deleteRepository({ name }).pipe(Effect.flatMap((op) => op.name ? awaitOperation(op.name, session) : Effect.succeed(op)), Effect.catchTag("NotFound", () => Effect.void), Effect.catchTag("BadRequest", reshapeBadRequest("delete")));
|
|
238
|
+
}),
|
|
239
|
+
read: Effect.fn(function* ({ id, output, olds }) {
|
|
240
|
+
const project = output?.project ?? olds?.project;
|
|
241
|
+
const location = output?.location ?? olds?.location;
|
|
242
|
+
if (!project || !location)
|
|
243
|
+
return undefined;
|
|
244
|
+
const name = output?.name ??
|
|
245
|
+
olds?.name ??
|
|
246
|
+
(yield* createPhysicalName({ id, maxLength: 63 })).toLowerCase();
|
|
247
|
+
const observed = yield* observe(project, location, name);
|
|
248
|
+
if (!observed)
|
|
249
|
+
return undefined;
|
|
250
|
+
const attrs = toAttributes(observed, { project, location, name });
|
|
251
|
+
return (yield* hasAlchemyLabels(id, observed.labels))
|
|
252
|
+
? attrs
|
|
253
|
+
: Unowned(attrs);
|
|
254
|
+
}),
|
|
255
|
+
};
|
|
256
|
+
}));
|
|
257
|
+
//# sourceMappingURL=Repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Repository.js","sourceRoot":"","sources":["../../src/ArtifactRegistry/Repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,iBAA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;YACpD,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAC5C,MAAM,IAAI,GACR,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;gBACV,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACnE,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YACzD,IAAI,CAAC,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAChC,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAClE,OAAO,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACnD,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded literal-union types for Artifact Registry repository props.
|
|
3
|
+
*
|
|
4
|
+
* Distilled's generated `format` and `mode` fields are open-tailed
|
|
5
|
+
* unions (`"DOCKER" | … | (string & {})`) so the GCP server can ship
|
|
6
|
+
* new variants without breaking SDK consumers. We mirror that shape
|
|
7
|
+
* here so consumers get autocomplete for the values we expect to use
|
|
8
|
+
* while still leaving the tail open for forward compatibility.
|
|
9
|
+
*
|
|
10
|
+
* @see https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories#Repository
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Repository package format. Artifact Registry supports many formats
|
|
14
|
+
* (Maven, NPM, APT, …); we keep the full enum-tail open but only
|
|
15
|
+
* exercise `DOCKER` in this provider today. Other formats are still
|
|
16
|
+
* reachable via the `(string & {})` tail.
|
|
17
|
+
*
|
|
18
|
+
* @see https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories#Format
|
|
19
|
+
*/
|
|
20
|
+
export type ArtifactRegistryFormat = "DOCKER" | "MAVEN" | "NPM" | "APT" | "YUM" | "GOOGET" | "PYTHON" | "KFP" | "GO" | "GENERIC" | "RUBY" | (string & {});
|
|
21
|
+
/**
|
|
22
|
+
* Repository mode. `STANDARD_REPOSITORY` hosts artifacts uploaded by
|
|
23
|
+
* the user; `REMOTE_REPOSITORY` is a pull-through cache for an
|
|
24
|
+
* upstream registry; `VIRTUAL_REPOSITORY` aggregates multiple upstreams
|
|
25
|
+
* behind one URL. The provider does not type-check `VIRTUAL_REPOSITORY`
|
|
26
|
+
* config today — pass it through via the `remoteRepositoryConfig`
|
|
27
|
+
* field with a mode override, or wait for explicit support.
|
|
28
|
+
*
|
|
29
|
+
* @see https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories#Mode
|
|
30
|
+
*/
|
|
31
|
+
export type ArtifactRegistryMode = "STANDARD_REPOSITORY" | "REMOTE_REPOSITORY" | "VIRTUAL_REPOSITORY" | (string & {});
|
|
32
|
+
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/ArtifactRegistry/Types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,OAAO,GACP,KAAK,GACL,KAAK,GACL,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,IAAI,GACJ,SAAS,GACT,MAAM,GACN,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,GAC5B,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,GACpB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded literal-union types for Artifact Registry repository props.
|
|
3
|
+
*
|
|
4
|
+
* Distilled's generated `format` and `mode` fields are open-tailed
|
|
5
|
+
* unions (`"DOCKER" | … | (string & {})`) so the GCP server can ship
|
|
6
|
+
* new variants without breaking SDK consumers. We mirror that shape
|
|
7
|
+
* here so consumers get autocomplete for the values we expect to use
|
|
8
|
+
* while still leaving the tail open for forward compatibility.
|
|
9
|
+
*
|
|
10
|
+
* @see https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories#Repository
|
|
11
|
+
*/
|
|
12
|
+
//# sourceMappingURL=Types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../src/ArtifactRegistry/Types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ConfigError } from "@distilled.cloud/gcp";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import type { ArtifactRegistryRepositoryProps } from "./Repository.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Validate an Artifact Registry repository ID.
|
|
6
|
+
*
|
|
7
|
+
* @see https://cloud.google.com/artifact-registry/docs/repositories/create-repos#create
|
|
8
|
+
*/
|
|
9
|
+
export declare const validateRepositoryName: (name: string) => Effect.Effect<void, ConfigError>;
|
|
10
|
+
/**
|
|
11
|
+
* Validate the `mode` ↔ `remoteRepositoryConfig` invariant. Artifact
|
|
12
|
+
* Registry rejects (with an opaque 400) any combination where:
|
|
13
|
+
*
|
|
14
|
+
* - `mode === "REMOTE_REPOSITORY"` but no `remoteRepositoryConfig`
|
|
15
|
+
* is supplied — the server has no upstream to point at.
|
|
16
|
+
* - `mode === "STANDARD_REPOSITORY"` but a `remoteRepositoryConfig`
|
|
17
|
+
* IS supplied — standard repositories don't have an upstream.
|
|
18
|
+
*
|
|
19
|
+
* `VIRTUAL_REPOSITORY` is not validated here; pass-through for now.
|
|
20
|
+
*
|
|
21
|
+
* @see https://cloud.google.com/artifact-registry/docs/repositories/remote-repo
|
|
22
|
+
*/
|
|
23
|
+
export declare const validateModeConfig: (props: ArtifactRegistryRepositoryProps) => Effect.Effect<void, ConfigError>;
|
|
24
|
+
/**
|
|
25
|
+
* Reshape a `BadRequest` from an Artifact Registry create/patch/delete
|
|
26
|
+
* into a `ConfigError` with a remediation hint for the top failure
|
|
27
|
+
* modes:
|
|
28
|
+
*
|
|
29
|
+
* 1. **Upstream validation failure** — `disableUpstreamValidation` is
|
|
30
|
+
* `false` (default) and AR's pre-flight HEAD request against the
|
|
31
|
+
* remote upstream failed. Surface the underlying message; the user
|
|
32
|
+
* can retry with `disableUpstreamValidation: true` if the upstream
|
|
33
|
+
* is intentionally gated.
|
|
34
|
+
* 2. **KMS key not accessible** — the AR service agent does not have
|
|
35
|
+
* `cloudkms.cryptoKeyEncrypterDecrypter` on the supplied key.
|
|
36
|
+
*
|
|
37
|
+
* Anything else propagates verbatim — the underlying GCP message is
|
|
38
|
+
* usually clear enough.
|
|
39
|
+
*/
|
|
40
|
+
export declare const reshapeBadRequest: (op: "create" | "patch" | "delete") => (e: {
|
|
41
|
+
message?: string;
|
|
42
|
+
}) => Effect.Effect<never, ConfigError>;
|
|
43
|
+
//# sourceMappingURL=Validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validation.d.ts","sourceRoot":"","sources":["../../src/ArtifactRegistry/Validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAsBvE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,KACX,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAOjC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,+BAA+B,KACrC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAqBjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,GAC3B,IAAI,QAAQ,GAAG,OAAO,GAAG,QAAQ,MACjC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAe1D,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ConfigError } from "@distilled.cloud/gcp";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
/**
|
|
4
|
+
* Plan-time validation for Artifact Registry resource props. Failing
|
|
5
|
+
* fast with a typed `ConfigError` is friendlier than letting the user
|
|
6
|
+
* wait for the API to reject the request, and unlike server-side
|
|
7
|
+
* errors these surface before any state mutation happens.
|
|
8
|
+
*
|
|
9
|
+
* @see https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Repository ID regex per
|
|
13
|
+
* <https://cloud.google.com/artifact-registry/docs/repositories/create-repos#create>:
|
|
14
|
+
* lowercase letters, digits and hyphens; must start with a letter or
|
|
15
|
+
* digit; 1–63 chars total. The REST API documents up to 63; we cap at
|
|
16
|
+
* 63 to match.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
const REPOSITORY_NAME_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
21
|
+
/**
|
|
22
|
+
* Validate an Artifact Registry repository ID.
|
|
23
|
+
*
|
|
24
|
+
* @see https://cloud.google.com/artifact-registry/docs/repositories/create-repos#create
|
|
25
|
+
*/
|
|
26
|
+
export const validateRepositoryName = (name) => {
|
|
27
|
+
if (REPOSITORY_NAME_RE.test(name))
|
|
28
|
+
return Effect.void;
|
|
29
|
+
return Effect.fail(new ConfigError({
|
|
30
|
+
message: `Artifact Registry repository name ${JSON.stringify(name)} is invalid: must match /^[a-z0-9][a-z0-9-]{0,62}$/ (1–63 lowercase letters/digits/hyphens, starting with a letter or digit).`,
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Validate the `mode` ↔ `remoteRepositoryConfig` invariant. Artifact
|
|
35
|
+
* Registry rejects (with an opaque 400) any combination where:
|
|
36
|
+
*
|
|
37
|
+
* - `mode === "REMOTE_REPOSITORY"` but no `remoteRepositoryConfig`
|
|
38
|
+
* is supplied — the server has no upstream to point at.
|
|
39
|
+
* - `mode === "STANDARD_REPOSITORY"` but a `remoteRepositoryConfig`
|
|
40
|
+
* IS supplied — standard repositories don't have an upstream.
|
|
41
|
+
*
|
|
42
|
+
* `VIRTUAL_REPOSITORY` is not validated here; pass-through for now.
|
|
43
|
+
*
|
|
44
|
+
* @see https://cloud.google.com/artifact-registry/docs/repositories/remote-repo
|
|
45
|
+
*/
|
|
46
|
+
export const validateModeConfig = (props) => {
|
|
47
|
+
const mode = props.mode ?? "STANDARD_REPOSITORY";
|
|
48
|
+
if (mode === "REMOTE_REPOSITORY") {
|
|
49
|
+
const docker = props.remoteRepositoryConfig?.dockerRepository;
|
|
50
|
+
if (!docker) {
|
|
51
|
+
return Effect.fail(new ConfigError({
|
|
52
|
+
message: `Artifact Registry repository has mode "REMOTE_REPOSITORY" but no \`remoteRepositoryConfig.dockerRepository\` was provided. Pass either \`{ publicRepository: "DOCKER_HUB" }\` or \`{ customRepository: { uri: "https://nvcr.io" } }\`.`,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
return Effect.void;
|
|
56
|
+
}
|
|
57
|
+
if (mode === "STANDARD_REPOSITORY" && props.remoteRepositoryConfig) {
|
|
58
|
+
return Effect.fail(new ConfigError({
|
|
59
|
+
message: `Artifact Registry repository has mode "STANDARD_REPOSITORY" but \`remoteRepositoryConfig\` was supplied. Drop \`remoteRepositoryConfig\` or set \`mode: "REMOTE_REPOSITORY"\`.`,
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
return Effect.void;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Reshape a `BadRequest` from an Artifact Registry create/patch/delete
|
|
66
|
+
* into a `ConfigError` with a remediation hint for the top failure
|
|
67
|
+
* modes:
|
|
68
|
+
*
|
|
69
|
+
* 1. **Upstream validation failure** — `disableUpstreamValidation` is
|
|
70
|
+
* `false` (default) and AR's pre-flight HEAD request against the
|
|
71
|
+
* remote upstream failed. Surface the underlying message; the user
|
|
72
|
+
* can retry with `disableUpstreamValidation: true` if the upstream
|
|
73
|
+
* is intentionally gated.
|
|
74
|
+
* 2. **KMS key not accessible** — the AR service agent does not have
|
|
75
|
+
* `cloudkms.cryptoKeyEncrypterDecrypter` on the supplied key.
|
|
76
|
+
*
|
|
77
|
+
* Anything else propagates verbatim — the underlying GCP message is
|
|
78
|
+
* usually clear enough.
|
|
79
|
+
*/
|
|
80
|
+
export const reshapeBadRequest = (op) => (e) => {
|
|
81
|
+
const underlying = e.message ?? `unknown 400 from Repository ${op}`;
|
|
82
|
+
let hint = "";
|
|
83
|
+
if (/upstream|remote.*validation|HEAD/i.test(underlying)) {
|
|
84
|
+
hint =
|
|
85
|
+
" Artifact Registry validates the upstream remote on create. If the upstream rejects unauthenticated HEAD requests (private nvcr.io paths, etc.), supply `remoteRepositoryConfig.disableUpstreamValidation: true` or attach credentials via `upstreamCredentials`.";
|
|
86
|
+
}
|
|
87
|
+
else if (/kms|crypto.*key|encrypt/i.test(underlying)) {
|
|
88
|
+
hint =
|
|
89
|
+
" Grant `roles/cloudkms.cryptoKeyEncrypterDecrypter` on the supplied `kmsKeyName` to the Artifact Registry service agent (`service-{projectNumber}@gcp-sa-artifactregistry.iam.gserviceaccount.com`).";
|
|
90
|
+
}
|
|
91
|
+
return Effect.fail(new ConfigError({
|
|
92
|
+
message: `Artifact Registry Repository ${op} rejected: ${underlying}.${hint}`,
|
|
93
|
+
}));
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=Validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validation.js","sourceRoot":"","sources":["../../src/ArtifactRegistry/Validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,IAAY,EACsB,EAAE;IACpC,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACtD,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,WAAW,CAAC;QACd,OAAO,EAAE,qCAAqC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,+HAA+H;KAClM,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAsC,EACJ,EAAE;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,qBAAqB,CAAC;IACjD,IAAI,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,KAAK,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;QAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,WAAW,CAAC;gBACd,OAAO,EAAE,wOAAwO;aAClP,CAAC,CACH,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,IAAI,IAAI,KAAK,qBAAqB,IAAI,KAAK,CAAC,sBAAsB,EAAE,CAAC;QACnE,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,WAAW,CAAC;YACd,OAAO,EAAE,gLAAgL;SAC1L,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,CAAC,EAAiC,EAAE,EAAE,CACtC,CAAC,CAAuB,EAAqC,EAAE;IAC7D,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,IAAI,+BAA+B,EAAE,EAAE,CAAC;IACpE,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,mCAAmC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACzD,IAAI;YACF,mQAAmQ,CAAC;IACxQ,CAAC;SAAM,IAAI,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACvD,IAAI;YACF,sMAAsM,CAAC;IAC3M,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,WAAW,CAAC;QACd,OAAO,EAAE,gCAAgC,EAAE,cAAc,UAAU,IAAI,IAAI,EAAE;KAC9E,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ArtifactRegistryRepository, ArtifactRegistryRepositoryProvider, } from "./Repository.ts";
|
|
2
|
+
export type { ArtifactRegistryDockerUpstream, ArtifactRegistryRepositoryAttributes, ArtifactRegistryRepositoryProps, } from "./Repository.ts";
|
|
3
|
+
export type { ArtifactRegistryFormat, ArtifactRegistryMode } from "./Types.ts";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ArtifactRegistry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,8BAA8B,EAC9B,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ArtifactRegistry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,iBAAiB,CAAC"}
|
package/lib/Providers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Providers.d.ts","sourceRoot":"","sources":["../src/Providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;;
|
|
1
|
+
{"version":3,"file":"Providers.d.ts","sourceRoot":"","sources":["../src/Providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;;AAiCtC,qBAAa,SAAU,SAAQ,cAA+C;CAAG;AAEjF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,uQAmDnB,CAAC"}
|
package/lib/Providers.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Provider from "alchemy/Provider";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
+
import { ArtifactRegistryRepository, ArtifactRegistryRepositoryProvider, } from "./ArtifactRegistry/Repository.js";
|
|
3
4
|
import { GCPAuth } from "./Auth/AuthProvider.js";
|
|
4
5
|
import { fromAuthProvider } from "./Auth/Credentials.js";
|
|
5
6
|
import { Project, ProjectProvider } from "./CloudResourceManager/Project.js";
|
|
@@ -15,6 +16,9 @@ import { Job, JobProvider } from "./Run/Job.js";
|
|
|
15
16
|
import { Service, ServiceProvider } from "./Run/Service.js";
|
|
16
17
|
import { PsaConnection, PsaConnectionProvider, } from "./ServiceNetworking/PsaConnection.js";
|
|
17
18
|
import { ApiEnable, ApiEnableProvider } from "./ServiceUsage/ApiEnable.js";
|
|
19
|
+
import { SqlDatabase, SqlDatabaseProvider } from "./Sqladmin/Database.js";
|
|
20
|
+
import { SqlInstance, SqlInstanceProvider } from "./Sqladmin/Instance.js";
|
|
21
|
+
import { SqlUser, SqlUserProvider } from "./Sqladmin/User.js";
|
|
18
22
|
export class Providers extends Provider.ProviderCollection()("GCP") {
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
@@ -46,7 +50,11 @@ export const providers = () => Layer.effect(Providers, Provider.collection([
|
|
|
46
50
|
ManagedLustreInstance,
|
|
47
51
|
Service,
|
|
48
52
|
Job,
|
|
49
|
-
|
|
53
|
+
SqlInstance,
|
|
54
|
+
SqlDatabase,
|
|
55
|
+
SqlUser,
|
|
56
|
+
ArtifactRegistryRepository,
|
|
57
|
+
])).pipe(Layer.provide(Layer.mergeAll(ProjectProvider(), ClusterProvider(), NodePoolProvider(), ApiEnableProvider(), NetworkProvider(), SubnetworkProvider(), GlobalAddressProvider(), SharedVpcHostProvider(), SharedVpcServiceProjectProvider(), PsaConnectionProvider(), ManagedLustreInstanceProvider(), ServiceProvider(), JobProvider(), SqlInstanceProvider(), SqlDatabaseProvider(), SqlUserProvider(), ArtifactRegistryRepositoryProvider())), Layer.provideMerge(fromAuthProvider()), Layer.provideMerge(GCPAuth),
|
|
50
58
|
// Auth/config failures (missing ADC, malformed profile) become
|
|
51
59
|
// unrecoverable defects rather than typed errors — mirrors
|
|
52
60
|
// `AWS/Providers.ts` and `Cloudflare/Providers.ts`. Resource lifecycle
|
package/lib/Providers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Providers.js","sourceRoot":"","sources":["../src/Providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EACL,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EACL,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"Providers.js","source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3
|
+
import type * as GCP from "../Providers.ts";
|
|
4
|
+
/**
|
|
5
|
+
* A logical Postgres database inside a Cloud SQL instance.
|
|
6
|
+
*
|
|
7
|
+
* Cloud SQL `databases` resources are extremely thin — name, charset,
|
|
8
|
+
* collation, parent instance. Use this resource to declaratively
|
|
9
|
+
* create a tenant database (one per app, one per team, etc.) and let
|
|
10
|
+
* alchemy track its lifecycle.
|
|
11
|
+
*
|
|
12
|
+
* **Adoption.** Cloud SQL databases carry NO labels. There is no
|
|
13
|
+
* server-side adoption marker we can stamp without polluting the
|
|
14
|
+
* collation field, so `read` is best-effort: it returns the observed
|
|
15
|
+
* shape if the database exists at the same logical address, and
|
|
16
|
+
* `undefined` otherwise. The caller is responsible for `--adopt` if
|
|
17
|
+
* they want to take over an existing physical database; we do not
|
|
18
|
+
* gate on labels here.
|
|
19
|
+
*
|
|
20
|
+
* **Replace triggers.** `project`, `instance`, `name`. Charset and
|
|
21
|
+
* collation are immutable post-create in practice — the API accepts
|
|
22
|
+
* a `patch` but ignores collation/charset drift, so we treat them as
|
|
23
|
+
* "set once, then forgotten" and only diff name/parent.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const db = yield* GCP.SqlDatabase("AppDb", {
|
|
28
|
+
* project: instance.project,
|
|
29
|
+
* instance: instance.name,
|
|
30
|
+
* name: "app",
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/databases
|
|
35
|
+
*/
|
|
36
|
+
export type SqlDatabaseProps = {
|
|
37
|
+
/**
|
|
38
|
+
* GCP project ID hosting the parent instance. Immutable — replace.
|
|
39
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/databases#Database
|
|
40
|
+
*/
|
|
41
|
+
project: string;
|
|
42
|
+
/**
|
|
43
|
+
* Parent Cloud SQL instance name (NOT the fully-qualified resource
|
|
44
|
+
* name; just the bare `name`). Immutable — replace.
|
|
45
|
+
*/
|
|
46
|
+
instance: string;
|
|
47
|
+
/**
|
|
48
|
+
* Database name. 1–64 chars; Postgres-specific naming applies (no
|
|
49
|
+
* reserved words, etc.). Immutable — replace if changed.
|
|
50
|
+
*/
|
|
51
|
+
name: string;
|
|
52
|
+
/**
|
|
53
|
+
* Server-side character set. Postgres-default is `UTF8`. Set at
|
|
54
|
+
* create; not honoured on patch.
|
|
55
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/databases#Database.FIELDS.charset
|
|
56
|
+
*/
|
|
57
|
+
charset?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Collation. Postgres-default is `en_US.UTF8`. Set at create; not
|
|
60
|
+
* honoured on patch.
|
|
61
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/databases#Database.FIELDS.collation
|
|
62
|
+
*/
|
|
63
|
+
collation?: string;
|
|
64
|
+
};
|
|
65
|
+
export type SqlDatabaseAttributes = {
|
|
66
|
+
/** Database name. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Parent instance name. */
|
|
69
|
+
instance: string;
|
|
70
|
+
/** Project ID. */
|
|
71
|
+
project: string;
|
|
72
|
+
/** Server-defined URL. */
|
|
73
|
+
selfLink: string;
|
|
74
|
+
/** Effective charset (server may default to `UTF8`). */
|
|
75
|
+
charset: string | undefined;
|
|
76
|
+
/** Effective collation. */
|
|
77
|
+
collation: string | undefined;
|
|
78
|
+
};
|
|
79
|
+
export type SqlDatabase = Resource<"GCP.SqlDatabase", SqlDatabaseProps, SqlDatabaseAttributes, never, GCP.Providers>;
|
|
80
|
+
export declare const SqlDatabase: import("alchemy").ResourceClass<SqlDatabase>;
|
|
81
|
+
export declare const SqlDatabaseProvider: () => import("effect/Layer").Layer<Provider.Provider<SqlDatabase>, never, import("effect/unstable/http/HttpClient").HttpClient | import("@distilled.cloud/gcp").Credentials>;
|
|
82
|
+
//# sourceMappingURL=Database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Database.d.ts","sourceRoot":"","sources":["../../src/Sqladmin/Database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,2BAA2B;IAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAChC,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,GAAG,CAAC,SAAS,CACd,CAAC;AACF,eAAO,MAAM,WAAW,8CAA2C,CAAC;AAcpE,eAAO,MAAM,mBAAmB,8KAqG7B,CAAC"}
|