@highstate/restic 0.9.4 → 0.9.5

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "sourceHashes": {
3
- "./dist/index.js": "b6a90963aac6dea63367aa784e672275bf006000086a3543981148e4119d1bd1",
4
- "./dist/repo/index.js": "67ebab96719ca75c706a13dab3041164c003db54497dd20f2e85731b0882104c"
3
+ "./dist/index.js": "8f21fa7e7af9c10ce08ef55973084b0aea647a79ff674f1cb70126ba706ae601",
4
+ "./dist/repo/index.js": "94984771a19ba80aaa2d9a30319b357153015252a1ef8834324ba3097bf8afe9"
5
5
  }
6
6
  }
package/dist/index.js CHANGED
@@ -9022,13 +9022,20 @@ var Type = type_exports2;
9022
9022
  // ../contract/dist/index.js
9023
9023
  var import_ajv = __toESM(require_ajv(), 1);
9024
9024
  var boundaryInput = Symbol("boundaryInput");
9025
- function text(array, ...values) {
9026
- const str = array.reduce(
9027
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
9028
- (result, part, i) => result + part + (values[i] ? String(values[i]) : ""),
9029
- ""
9030
- );
9031
- return trimIndentation(str);
9025
+ function text(strings, ...values) {
9026
+ const stringValues = values.map(String);
9027
+ let result = "";
9028
+ for (let i = 0; i < strings.length; i++) {
9029
+ result += strings[i];
9030
+ if (i < stringValues.length) {
9031
+ const value = stringValues[i];
9032
+ const lines = value.split("\n");
9033
+ const lastLineIndentMatch = strings[i].match(/(?:^|\n)([ \t]*)$/);
9034
+ const indent = lastLineIndentMatch ? lastLineIndentMatch[1] : "";
9035
+ result += lines.map((line, j) => j === 0 ? line : indent + line).join("\n");
9036
+ }
9037
+ }
9038
+ return trimIndentation(result);
9032
9039
  }
9033
9040
  function trimIndentation(text2) {
9034
9041
  const lines = text2.split("\n");
@@ -9057,7 +9064,7 @@ var backupEnvironment = {
9057
9064
  ubuntu: {
9058
9065
  packages: ["restic"]
9059
9066
  },
9060
- scripts: {
9067
+ files: {
9061
9068
  "backup.sh": text`
9062
9069
  #!/bin/sh
9063
9070
  set -e
@@ -9147,7 +9154,7 @@ var BackupJobPair = class extends ComponentResource {
9147
9154
  "rclone.conf": args2.resticRepo.rcloneConfig
9148
9155
  }
9149
9156
  },
9150
- { parent: this, ...opts }
9157
+ { ...opts, parent: this }
9151
9158
  );
9152
9159
  });
9153
9160
  const environment = output(args).apply((args2) => {
@@ -9164,10 +9171,16 @@ var BackupJobPair = class extends ComponentResource {
9164
9171
 
9165
9172
  curl https://rclone.org/install.sh | bash
9166
9173
  `
9167
- }
9174
+ },
9175
+ allowedEndpoints: [
9176
+ "rclone.org:443",
9177
+ "downloads.rclone.org:443",
9178
+ ...args2.allowedEndpoints ?? [],
9179
+ ...args2.resticRepo.remoteEndpoints ?? []
9180
+ ]
9168
9181
  },
9169
9182
  environment: {
9170
- RESTIC_REPOSITORY: `rclone:${args2.resticRepo.remoteName}:${args2.resticRepo.basePath}/${args2.k8sCluster.info.name}/${name}`,
9183
+ RESTIC_REPOSITORY: `rclone:${args2.resticRepo.remoteName}:${args2.resticRepo.basePath}/${args2.cluster.name}/${name}`,
9171
9184
  RESTIC_PASSWORD_FILE: "/credentials/password",
9172
9185
  RESTIC_HOSTNAME: "default",
9173
9186
  RCLONE_CONFIG: "/credentials/rclone.conf",
@@ -9194,6 +9207,7 @@ var BackupJobPair = class extends ComponentResource {
9194
9207
  return new ScriptBundle(
9195
9208
  `${name}-backup-scripts`,
9196
9209
  {
9210
+ cluster: args2.cluster,
9197
9211
  namespace: args2.namespace,
9198
9212
  distribution: args2.distribution ?? "alpine",
9199
9213
  environments: [
@@ -9202,13 +9216,14 @@ var BackupJobPair = class extends ComponentResource {
9202
9216
  ...normalize(args2.environment, args2.environments)
9203
9217
  ]
9204
9218
  },
9205
- { parent: this, ...opts }
9219
+ { ...opts, parent: this }
9206
9220
  );
9207
9221
  });
9208
9222
  this.restoreJob = output(args).apply((args2) => {
9209
9223
  return new Job(
9210
9224
  `${name}-restore`,
9211
9225
  {
9226
+ cluster: args2.cluster,
9212
9227
  namespace: args2.namespace,
9213
9228
  container: createScriptContainer({
9214
9229
  ...args2.restoreContainer,
@@ -9216,7 +9231,7 @@ var BackupJobPair = class extends ComponentResource {
9216
9231
  bundle: this.scriptBundle
9217
9232
  })
9218
9233
  },
9219
- { parent: this, ...opts }
9234
+ { ...opts, parent: this }
9220
9235
  );
9221
9236
  });
9222
9237
  this.backupJob = output(args).apply((args2) => {
@@ -9224,6 +9239,7 @@ var BackupJobPair = class extends ComponentResource {
9224
9239
  `${name}-backup`,
9225
9240
  {
9226
9241
  namespace: args2.namespace,
9242
+ cluster: args2.cluster,
9227
9243
  container: createScriptContainer({
9228
9244
  ...args2.backupContainer,
9229
9245
  main: "backup.sh",
@@ -9242,15 +9258,9 @@ var BackupJobPair = class extends ComponentResource {
9242
9258
  }
9243
9259
  }
9244
9260
  },
9245
- { parent: this, ...opts }
9261
+ { ...opts, parent: this }
9246
9262
  );
9247
9263
  });
9248
- this.registerOutputs({
9249
- credentials: this.credentials,
9250
- scriptBundle: this.scriptBundle,
9251
- restoreJob: this.restoreJob,
9252
- backupJob: this.backupJob
9253
- });
9254
9264
  }
9255
9265
  /**
9256
9266
  * The credentials used to access the repository and encrypt the backups.
@@ -9294,7 +9304,7 @@ var BackupJobPair = class extends ComponentResource {
9294
9304
  },
9295
9305
  spec: this.backupJob.cronJob.spec.jobTemplate.spec
9296
9306
  },
9297
- { parent: this, ...this.opts }
9307
+ { ...this.opts, parent: this }
9298
9308
  );
9299
9309
  }
9300
9310
  };