@wp-playground/blueprints 1.0.29 → 1.1.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.
Files changed (44) hide show
  1. package/LICENSE +339 -0
  2. package/blueprint-schema-validator.js +231 -52
  3. package/blueprint-schema.json +24 -15
  4. package/index.cjs +40 -472
  5. package/index.cjs.map +1 -1
  6. package/index.d.ts +3 -2
  7. package/index.js +3011 -3289
  8. package/index.js.map +1 -1
  9. package/lib/blueprint.d.ts +17 -5
  10. package/lib/compile.d.ts +10 -12
  11. package/lib/resolve-remote-blueprint.d.ts +8 -0
  12. package/lib/resources.d.ts +44 -20
  13. package/lib/steps/activate-plugin.d.ts +1 -1
  14. package/lib/steps/activate-theme.d.ts +1 -1
  15. package/lib/steps/cp.d.ts +1 -1
  16. package/lib/steps/define-site-url.d.ts +1 -1
  17. package/lib/steps/define-wp-config-consts.d.ts +2 -3
  18. package/lib/steps/enable-multisite.d.ts +1 -1
  19. package/lib/steps/export-wxr.d.ts +1 -1
  20. package/lib/steps/import-theme-starter-content.d.ts +1 -1
  21. package/lib/steps/import-wordpress-files.d.ts +1 -1
  22. package/lib/steps/import-wxr.d.ts +1 -1
  23. package/lib/steps/index.d.ts +31 -31
  24. package/lib/steps/install-plugin.d.ts +3 -3
  25. package/lib/steps/install-theme.d.ts +3 -3
  26. package/lib/steps/login.d.ts +1 -1
  27. package/lib/steps/mkdir.d.ts +1 -1
  28. package/lib/steps/mv.d.ts +1 -1
  29. package/lib/steps/request.d.ts +2 -2
  30. package/lib/steps/reset-data.d.ts +1 -1
  31. package/lib/steps/rm.d.ts +1 -1
  32. package/lib/steps/rmdir.d.ts +1 -1
  33. package/lib/steps/run-php-with-options.d.ts +2 -2
  34. package/lib/steps/run-php.d.ts +2 -2
  35. package/lib/steps/run-sql.d.ts +1 -1
  36. package/lib/steps/run-wp-installation-wizard.d.ts +1 -1
  37. package/lib/steps/set-site-language.d.ts +6 -4
  38. package/lib/steps/site-data.d.ts +1 -1
  39. package/lib/steps/unzip.d.ts +1 -1
  40. package/lib/steps/wp-cli.d.ts +4 -5
  41. package/lib/steps/write-file.d.ts +1 -1
  42. package/lib/steps/write-files.d.ts +2 -2
  43. package/lib/steps/zip-wp-content.d.ts +1 -1
  44. package/package.json +29 -22
@@ -3,9 +3,9 @@ export const validate = validate10;
3
3
  export default validate10;
4
4
  const schema11 = {
5
5
  $schema: 'http://json-schema.org/schema',
6
- $ref: '#/definitions/Blueprint',
6
+ $ref: '#/definitions/BlueprintDeclaration',
7
7
  definitions: {
8
- Blueprint: {
8
+ BlueprintDeclaration: {
9
9
  type: 'object',
10
10
  properties: {
11
11
  landingPage: {
@@ -150,21 +150,12 @@ const schema11 = {
150
150
  $schema: { type: 'string' },
151
151
  },
152
152
  additionalProperties: false,
153
+ description:
154
+ 'The Blueprint declaration, typically stored in a blueprint.json file.',
153
155
  },
154
156
  SupportedPHPVersion: {
155
157
  type: 'string',
156
- enum: [
157
- '8.4',
158
- '8.3',
159
- '8.2',
160
- '8.1',
161
- '8.0',
162
- '7.4',
163
- '7.3',
164
- '7.2',
165
- '7.1',
166
- '7.0',
167
- ],
158
+ enum: ['8.4', '8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2'],
168
159
  },
169
160
  ExtraLibrary: { type: 'string', const: 'wp-cli' },
170
161
  PHPConstants: {
@@ -178,6 +169,7 @@ const schema11 = {
178
169
  { $ref: '#/definitions/CoreThemeReference' },
179
170
  { $ref: '#/definitions/CorePluginReference' },
180
171
  { $ref: '#/definitions/UrlReference' },
172
+ { $ref: '#/definitions/BundledReference' },
181
173
  ],
182
174
  },
183
175
  VFSReference: {
@@ -294,6 +286,23 @@ const schema11 = {
294
286
  required: ['resource', 'url'],
295
287
  additionalProperties: false,
296
288
  },
289
+ BundledReference: {
290
+ type: 'object',
291
+ properties: {
292
+ resource: {
293
+ type: 'string',
294
+ const: 'bundled',
295
+ description:
296
+ 'Identifies the file resource as a Blueprint file',
297
+ },
298
+ path: {
299
+ type: 'string',
300
+ description: 'The path to the file in the Blueprint',
301
+ },
302
+ },
303
+ required: ['resource', 'path'],
304
+ additionalProperties: false,
305
+ },
297
306
  StepDefinition: {
298
307
  type: 'object',
299
308
  discriminator: { propertyName: 'step' },
@@ -1474,21 +1483,12 @@ const schema12 = {
1474
1483
  $schema: { type: 'string' },
1475
1484
  },
1476
1485
  additionalProperties: false,
1486
+ description:
1487
+ 'The Blueprint declaration, typically stored in a blueprint.json file.',
1477
1488
  };
1478
1489
  const schema13 = {
1479
1490
  type: 'string',
1480
- enum: [
1481
- '8.4',
1482
- '8.3',
1483
- '8.2',
1484
- '8.1',
1485
- '8.0',
1486
- '7.4',
1487
- '7.3',
1488
- '7.2',
1489
- '7.1',
1490
- '7.0',
1491
- ],
1491
+ enum: ['8.4', '8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2'],
1492
1492
  };
1493
1493
  const schema14 = { type: 'string', const: 'wp-cli' };
1494
1494
  const schema15 = {
@@ -1503,6 +1503,7 @@ const schema16 = {
1503
1503
  { $ref: '#/definitions/CoreThemeReference' },
1504
1504
  { $ref: '#/definitions/CorePluginReference' },
1505
1505
  { $ref: '#/definitions/UrlReference' },
1506
+ { $ref: '#/definitions/BundledReference' },
1506
1507
  ],
1507
1508
  };
1508
1509
  const schema17 = {
@@ -1615,6 +1616,22 @@ const schema21 = {
1615
1616
  required: ['resource', 'url'],
1616
1617
  additionalProperties: false,
1617
1618
  };
1619
+ const schema22 = {
1620
+ type: 'object',
1621
+ properties: {
1622
+ resource: {
1623
+ type: 'string',
1624
+ const: 'bundled',
1625
+ description: 'Identifies the file resource as a Blueprint file',
1626
+ },
1627
+ path: {
1628
+ type: 'string',
1629
+ description: 'The path to the file in the Blueprint',
1630
+ },
1631
+ },
1632
+ required: ['resource', 'path'],
1633
+ additionalProperties: false,
1634
+ };
1618
1635
  function validate12(
1619
1636
  data,
1620
1637
  { instancePath = '', parentData, parentDataProperty, rootData = data } = {}
@@ -2977,12 +2994,176 @@ function validate12(
2977
2994
  }
2978
2995
  var _valid0 = _errs55 === errors;
2979
2996
  valid0 = valid0 || _valid0;
2997
+ if (!valid0) {
2998
+ const _errs65 = errors;
2999
+ const _errs66 = errors;
3000
+ if (errors === _errs66) {
3001
+ if (
3002
+ data &&
3003
+ typeof data == 'object' &&
3004
+ !Array.isArray(data)
3005
+ ) {
3006
+ let missing7;
3007
+ if (
3008
+ (data.resource === undefined &&
3009
+ (missing7 = 'resource')) ||
3010
+ (data.path === undefined &&
3011
+ (missing7 = 'path'))
3012
+ ) {
3013
+ const err44 = {
3014
+ instancePath,
3015
+ schemaPath:
3016
+ '#/definitions/BundledReference/required',
3017
+ keyword: 'required',
3018
+ params: { missingProperty: missing7 },
3019
+ message:
3020
+ "must have required property '" +
3021
+ missing7 +
3022
+ "'",
3023
+ };
3024
+ if (vErrors === null) {
3025
+ vErrors = [err44];
3026
+ } else {
3027
+ vErrors.push(err44);
3028
+ }
3029
+ errors++;
3030
+ } else {
3031
+ const _errs68 = errors;
3032
+ for (const key7 in data) {
3033
+ if (
3034
+ !(
3035
+ key7 === 'resource' ||
3036
+ key7 === 'path'
3037
+ )
3038
+ ) {
3039
+ const err45 = {
3040
+ instancePath,
3041
+ schemaPath:
3042
+ '#/definitions/BundledReference/additionalProperties',
3043
+ keyword: 'additionalProperties',
3044
+ params: {
3045
+ additionalProperty: key7,
3046
+ },
3047
+ message:
3048
+ 'must NOT have additional properties',
3049
+ };
3050
+ if (vErrors === null) {
3051
+ vErrors = [err45];
3052
+ } else {
3053
+ vErrors.push(err45);
3054
+ }
3055
+ errors++;
3056
+ break;
3057
+ }
3058
+ }
3059
+ if (_errs68 === errors) {
3060
+ if (data.resource !== undefined) {
3061
+ let data19 = data.resource;
3062
+ const _errs69 = errors;
3063
+ if (typeof data19 !== 'string') {
3064
+ const err46 = {
3065
+ instancePath:
3066
+ instancePath +
3067
+ '/resource',
3068
+ schemaPath:
3069
+ '#/definitions/BundledReference/properties/resource/type',
3070
+ keyword: 'type',
3071
+ params: { type: 'string' },
3072
+ message: 'must be string',
3073
+ };
3074
+ if (vErrors === null) {
3075
+ vErrors = [err46];
3076
+ } else {
3077
+ vErrors.push(err46);
3078
+ }
3079
+ errors++;
3080
+ }
3081
+ if ('bundled' !== data19) {
3082
+ const err47 = {
3083
+ instancePath:
3084
+ instancePath +
3085
+ '/resource',
3086
+ schemaPath:
3087
+ '#/definitions/BundledReference/properties/resource/const',
3088
+ keyword: 'const',
3089
+ params: {
3090
+ allowedValue: 'bundled',
3091
+ },
3092
+ message:
3093
+ 'must be equal to constant',
3094
+ };
3095
+ if (vErrors === null) {
3096
+ vErrors = [err47];
3097
+ } else {
3098
+ vErrors.push(err47);
3099
+ }
3100
+ errors++;
3101
+ }
3102
+ var valid16 = _errs69 === errors;
3103
+ } else {
3104
+ var valid16 = true;
3105
+ }
3106
+ if (valid16) {
3107
+ if (data.path !== undefined) {
3108
+ const _errs71 = errors;
3109
+ if (
3110
+ typeof data.path !==
3111
+ 'string'
3112
+ ) {
3113
+ const err48 = {
3114
+ instancePath:
3115
+ instancePath +
3116
+ '/path',
3117
+ schemaPath:
3118
+ '#/definitions/BundledReference/properties/path/type',
3119
+ keyword: 'type',
3120
+ params: {
3121
+ type: 'string',
3122
+ },
3123
+ message:
3124
+ 'must be string',
3125
+ };
3126
+ if (vErrors === null) {
3127
+ vErrors = [err48];
3128
+ } else {
3129
+ vErrors.push(err48);
3130
+ }
3131
+ errors++;
3132
+ }
3133
+ var valid16 =
3134
+ _errs71 === errors;
3135
+ } else {
3136
+ var valid16 = true;
3137
+ }
3138
+ }
3139
+ }
3140
+ }
3141
+ } else {
3142
+ const err49 = {
3143
+ instancePath,
3144
+ schemaPath:
3145
+ '#/definitions/BundledReference/type',
3146
+ keyword: 'type',
3147
+ params: { type: 'object' },
3148
+ message: 'must be object',
3149
+ };
3150
+ if (vErrors === null) {
3151
+ vErrors = [err49];
3152
+ } else {
3153
+ vErrors.push(err49);
3154
+ }
3155
+ errors++;
3156
+ }
3157
+ }
3158
+ var _valid0 = _errs65 === errors;
3159
+ valid0 = valid0 || _valid0;
3160
+ }
2980
3161
  }
2981
3162
  }
2982
3163
  }
2983
3164
  }
2984
3165
  if (!valid0) {
2985
- const err44 = {
3166
+ const err50 = {
2986
3167
  instancePath,
2987
3168
  schemaPath: '#/anyOf',
2988
3169
  keyword: 'anyOf',
@@ -2990,9 +3171,9 @@ function validate12(
2990
3171
  message: 'must match a schema in anyOf',
2991
3172
  };
2992
3173
  if (vErrors === null) {
2993
- vErrors = [err44];
3174
+ vErrors = [err50];
2994
3175
  } else {
2995
- vErrors.push(err44);
3176
+ vErrors.push(err50);
2996
3177
  }
2997
3178
  errors++;
2998
3179
  validate12.errors = vErrors;
@@ -3010,7 +3191,7 @@ function validate12(
3010
3191
  validate12.errors = vErrors;
3011
3192
  return errors === 0;
3012
3193
  }
3013
- const schema22 = {
3194
+ const schema23 = {
3014
3195
  type: 'object',
3015
3196
  discriminator: { propertyName: 'step' },
3016
3197
  required: ['step'],
@@ -3729,7 +3910,7 @@ const schema22 = {
3729
3910
  },
3730
3911
  ],
3731
3912
  };
3732
- const schema27 = {
3913
+ const schema28 = {
3733
3914
  type: 'object',
3734
3915
  properties: {
3735
3916
  activate: {
@@ -3744,7 +3925,7 @@ const schema27 = {
3744
3925
  },
3745
3926
  additionalProperties: false,
3746
3927
  };
3747
- const schema28 = {
3928
+ const schema29 = {
3748
3929
  type: 'object',
3749
3930
  properties: {
3750
3931
  activate: {
@@ -3764,7 +3945,7 @@ const schema28 = {
3764
3945
  },
3765
3946
  additionalProperties: false,
3766
3947
  };
3767
- const schema35 = {
3948
+ const schema36 = {
3768
3949
  type: 'object',
3769
3950
  properties: {
3770
3951
  adminUsername: { type: 'string' },
@@ -3772,13 +3953,13 @@ const schema35 = {
3772
3953
  },
3773
3954
  additionalProperties: false,
3774
3955
  };
3775
- const schema23 = {
3956
+ const schema24 = {
3776
3957
  anyOf: [
3777
3958
  { $ref: '#/definitions/GitDirectoryReference' },
3778
3959
  { $ref: '#/definitions/DirectoryLiteralReference' },
3779
3960
  ],
3780
3961
  };
3781
- const schema24 = {
3962
+ const schema25 = {
3782
3963
  type: 'object',
3783
3964
  properties: {
3784
3965
  resource: {
@@ -3799,7 +3980,7 @@ const schema24 = {
3799
3980
  required: ['resource', 'url', 'ref', 'path'],
3800
3981
  additionalProperties: false,
3801
3982
  };
3802
- const schema25 = {
3983
+ const schema26 = {
3803
3984
  type: 'object',
3804
3985
  additionalProperties: false,
3805
3986
  properties: {
@@ -3813,7 +3994,7 @@ const schema25 = {
3813
3994
  },
3814
3995
  required: ['files', 'name', 'resource'],
3815
3996
  };
3816
- const schema26 = {
3997
+ const schema27 = {
3817
3998
  type: 'object',
3818
3999
  additionalProperties: {
3819
4000
  anyOf: [
@@ -3875,7 +4056,7 @@ function validate20(
3875
4056
  schemaPath: '#/additionalProperties/anyOf/1/type',
3876
4057
  keyword: 'type',
3877
4058
  params: {
3878
- type: schema26.additionalProperties.anyOf[1]
4059
+ type: schema27.additionalProperties.anyOf[1]
3879
4060
  .type,
3880
4061
  },
3881
4062
  message: 'must be object,string',
@@ -4325,7 +4506,7 @@ function validate18(
4325
4506
  validate18.errors = vErrors;
4326
4507
  return errors === 0;
4327
4508
  }
4328
- const schema29 = {
4509
+ const schema30 = {
4329
4510
  type: 'object',
4330
4511
  properties: {
4331
4512
  method: {
@@ -4422,11 +4603,11 @@ const schema29 = {
4422
4603
  required: ['url'],
4423
4604
  additionalProperties: false,
4424
4605
  };
4425
- const schema30 = {
4606
+ const schema31 = {
4426
4607
  type: 'string',
4427
4608
  enum: ['GET', 'POST', 'HEAD', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'],
4428
4609
  };
4429
- const schema31 = { type: 'object', additionalProperties: { type: 'string' } };
4610
+ const schema32 = { type: 'object', additionalProperties: { type: 'string' } };
4430
4611
  function validate28(
4431
4612
  data,
4432
4613
  { instancePath = '', parentData, parentDataProperty, rootData = data } = {}
@@ -4504,7 +4685,7 @@ function validate28(
4504
4685
  instancePath: instancePath + '/method',
4505
4686
  schemaPath: '#/definitions/HTTPMethod/enum',
4506
4687
  keyword: 'enum',
4507
- params: { allowedValues: schema30.enum },
4688
+ params: { allowedValues: schema31.enum },
4508
4689
  message:
4509
4690
  'must be equal to one of the allowed values',
4510
4691
  },
@@ -6608,7 +6789,7 @@ function validate28(
6608
6789
  validate28.errors = vErrors;
6609
6790
  return errors === 0;
6610
6791
  }
6611
- const schema32 = {
6792
+ const schema33 = {
6612
6793
  type: 'object',
6613
6794
  properties: {
6614
6795
  relativeUri: {
@@ -6684,7 +6865,7 @@ function validate30(
6684
6865
  if (data && typeof data == 'object' && !Array.isArray(data)) {
6685
6866
  const _errs1 = errors;
6686
6867
  for (const key0 in data) {
6687
- if (!func2.call(schema32.properties, key0)) {
6868
+ if (!func2.call(schema33.properties, key0)) {
6688
6869
  validate30.errors = [
6689
6870
  {
6690
6871
  instancePath,
@@ -6794,7 +6975,7 @@ function validate30(
6794
6975
  '#/definitions/HTTPMethod/enum',
6795
6976
  keyword: 'enum',
6796
6977
  params: {
6797
- allowedValues: schema30.enum,
6978
+ allowedValues: schema31.enum,
6798
6979
  },
6799
6980
  message:
6800
6981
  'must be equal to one of the allowed values',
@@ -9070,7 +9251,7 @@ function validate14(
9070
9251
  'enum',
9071
9252
  params: {
9072
9253
  allowedValues:
9073
- schema22
9254
+ schema23
9074
9255
  .oneOf[3]
9075
9256
  .properties
9076
9257
  .method
@@ -10078,7 +10259,7 @@ function validate14(
10078
10259
  'enum',
10079
10260
  params: {
10080
10261
  allowedValues:
10081
- schema22
10262
+ schema23
10082
10263
  .oneOf[6]
10083
10264
  .properties
10084
10265
  .importer
@@ -11013,7 +11194,7 @@ function validate14(
11013
11194
  keyword: 'enum',
11014
11195
  params: {
11015
11196
  allowedValues:
11016
- schema22
11197
+ schema23
11017
11198
  .oneOf[9]
11018
11199
  .properties
11019
11200
  .ifAlreadyInstalled
@@ -11679,7 +11860,7 @@ function validate14(
11679
11860
  keyword: 'enum',
11680
11861
  params: {
11681
11862
  allowedValues:
11682
- schema22
11863
+ schema23
11683
11864
  .oneOf[10]
11684
11865
  .properties
11685
11866
  .ifAlreadyInstalled
@@ -19340,9 +19521,7 @@ function validate11(
19340
19521
  data9 === '8.0' ||
19341
19522
  data9 === '7.4' ||
19342
19523
  data9 === '7.3' ||
19343
- data9 === '7.2' ||
19344
- data9 === '7.1' ||
19345
- data9 === '7.0'
19524
+ data9 === '7.2'
19346
19525
  )
19347
19526
  ) {
19348
19527
  const err1 = {
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$ref": "#/definitions/Blueprint",
3
+ "$ref": "#/definitions/BlueprintDeclaration",
4
4
  "definitions": {
5
- "Blueprint": {
5
+ "BlueprintDeclaration": {
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "landingPage": {
@@ -165,22 +165,12 @@
165
165
  "type": "string"
166
166
  }
167
167
  },
168
- "additionalProperties": false
168
+ "additionalProperties": false,
169
+ "description": "The Blueprint declaration, typically stored in a blueprint.json file."
169
170
  },
170
171
  "SupportedPHPVersion": {
171
172
  "type": "string",
172
- "enum": [
173
- "8.4",
174
- "8.3",
175
- "8.2",
176
- "8.1",
177
- "8.0",
178
- "7.4",
179
- "7.3",
180
- "7.2",
181
- "7.1",
182
- "7.0"
183
- ]
173
+ "enum": ["8.4", "8.3", "8.2", "8.1", "8.0", "7.4", "7.3", "7.2"]
184
174
  },
185
175
  "ExtraLibrary": {
186
176
  "type": "string",
@@ -208,6 +198,9 @@
208
198
  },
209
199
  {
210
200
  "$ref": "#/definitions/UrlReference"
201
+ },
202
+ {
203
+ "$ref": "#/definitions/BundledReference"
211
204
  }
212
205
  ]
213
206
  },
@@ -340,6 +333,22 @@
340
333
  "required": ["resource", "url"],
341
334
  "additionalProperties": false
342
335
  },
336
+ "BundledReference": {
337
+ "type": "object",
338
+ "properties": {
339
+ "resource": {
340
+ "type": "string",
341
+ "const": "bundled",
342
+ "description": "Identifies the file resource as a Blueprint file"
343
+ },
344
+ "path": {
345
+ "type": "string",
346
+ "description": "The path to the file in the Blueprint"
347
+ }
348
+ },
349
+ "required": ["resource", "path"],
350
+ "additionalProperties": false
351
+ },
343
352
  "StepDefinition": {
344
353
  "type": "object",
345
354
  "discriminator": {