@takeshape/schema 9.40.2 → 9.41.2

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 (29) hide show
  1. package/dist/builtin-schema.js +10 -10
  2. package/dist/schema-util.js +1 -1
  3. package/dist/template-shapes/templates.d.ts +1 -1
  4. package/dist/template-shapes/templates.d.ts.map +1 -1
  5. package/dist/template-shapes/templates.js +16 -8
  6. package/dist/template-shapes/where.js +2 -2
  7. package/es/builtin-schema.js +10 -10
  8. package/es/schema-util.js +1 -1
  9. package/es/template-shapes/templates.js +15 -7
  10. package/es/template-shapes/where.js +3 -3
  11. package/examples/latest/betzino.json +51 -51
  12. package/examples/latest/real-world-schema.json +0 -240
  13. package/examples/latest/rick-and-morty-ast.json +51 -51
  14. package/examples/latest/rick-and-morty-graphql.json +51 -51
  15. package/examples/latest/shopify-product-2022-07.json +201 -201
  16. package/examples/latest/shopify-product-2023-04.json +201 -201
  17. package/examples/latest/shopify-store-with-widget.json +51 -51
  18. package/examples/latest/stripe-product-runtime-schema.json +201 -201
  19. package/examples/latest/stripe-starter-resolved.json +51 -51
  20. package/examples/source/betzino.json +52 -52
  21. package/examples/source/real-world-schema.json +4 -172
  22. package/examples/source/rick-and-morty-ast.json +302 -117
  23. package/examples/source/rick-and-morty-graphql.json +213 -92
  24. package/examples/source/shopify-product-2022-07.json +202 -202
  25. package/examples/source/shopify-product-2023-04.json +202 -202
  26. package/examples/source/shopify-store-with-widget.json +485 -135
  27. package/examples/source/stripe-product-runtime-schema.json +202 -202
  28. package/examples/source/stripe-starter-resolved.json +52 -52
  29. package/package.json +5 -5
@@ -247,9 +247,9 @@ const builtInShapes = {
247
247
  required: ['filename', 'path']
248
248
  }
249
249
  },
250
- TsStaticSite: {
250
+ TSStaticSite: {
251
251
  id: 'SITE',
252
- name: 'TsStaticSite',
252
+ name: 'TSStaticSite',
253
253
  title: 'Static Site',
254
254
  model: {
255
255
  type: 'multiple'
@@ -330,7 +330,7 @@ const builtInShapes = {
330
330
  title: 'Environment Variables',
331
331
  '@l10n': false,
332
332
  items: {
333
- $ref: '#/shapes/TsStaticSiteEnvironmentVariables/schema'
333
+ $ref: '#/shapes/TSStaticSiteEnvironmentVariables/schema'
334
334
  },
335
335
  '@mapping': 'shapedb:TsStaticSite.9fj4UiNxY'
336
336
  },
@@ -339,7 +339,7 @@ const builtInShapes = {
339
339
  title: 'Publish Triggers',
340
340
  '@l10n': false,
341
341
  items: {
342
- $ref: '#/shapes/TsStaticSiteTriggers/schema'
342
+ $ref: '#/shapes/TSStaticSiteTriggers/schema'
343
343
  }
344
344
  },
345
345
  templateHash: {
@@ -352,9 +352,9 @@ const builtInShapes = {
352
352
  required: ['title', 'provider', 'destination']
353
353
  }
354
354
  },
355
- TsStaticSiteEnvironmentVariables: {
355
+ TSStaticSiteEnvironmentVariables: {
356
356
  id: '9fj4UiNxY',
357
- name: 'TsStaticSiteEnvironmentVariables',
357
+ name: 'TSStaticSiteEnvironmentVariables',
358
358
  title: 'Static Site EnvironmentVariables',
359
359
  schema: {
360
360
  type: 'object',
@@ -372,9 +372,9 @@ const builtInShapes = {
372
372
  }
373
373
  }
374
374
  },
375
- TsStaticSiteTriggers: {
376
- id: 'TsStaticSiteTriggers',
377
- name: 'TsStaticSiteTriggers',
375
+ TSStaticSiteTriggers: {
376
+ id: 'TSStaticSiteTriggers',
377
+ name: 'TSStaticSiteTriggers',
378
378
  title: 'Static Site Triggers',
379
379
  schema: {
380
380
  type: 'object',
@@ -436,7 +436,7 @@ const builtInForms = {
436
436
  }
437
437
  }
438
438
  },
439
- TsStaticSite: {
439
+ TSStaticSite: {
440
440
  default: {
441
441
  order: ['title', 'provider', 'destination', 'idKey', 'secretKey', 'environmentVariables'],
442
442
  properties: {
@@ -480,7 +480,7 @@ function applyBuiltinPropertiesToShape(projectSchema, shape) {
480
480
  } // Dependencies of these built-in shapes are automatically added by getBuiltinsUsed
481
481
 
482
482
 
483
- const requiredBuiltinShapes = ['Asset', 'TSRelationship', 'TsStaticSite', 'TSUser'];
483
+ const requiredBuiltinShapes = ['Asset', 'TSRelationship', 'TSStaticSite', 'TSUser'];
484
484
  /**
485
485
  * Get all built-in shapes that are depended on by the given project schema.
486
486
  * Required built-in shapes are always included.
@@ -19,7 +19,7 @@ export declare const TSSearchSortInput: Shape;
19
19
  export declare const commonSearchProps: Record<string, PropertySchema>;
20
20
  export declare const localeProps: ObjectSchema;
21
21
  export declare const termsProps: ObjectSchema;
22
- export declare const ContentStructureInput: Shape;
22
+ export declare const TSContentStructureInput: Shape;
23
23
  export declare function getPaginatedListShape(context: unknown, shape: Shape): ResolvedTemplate;
24
24
  export declare function getSearchResultsShape(context: unknown, shape: Shape): ResolvedTemplate;
25
25
  export declare function getIDQueryArgs(templateName: string): (context: unknown, shape: Shape) => ResolvedTemplate;
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAiB,cAAc,EAAE,KAAK,EAAc,MAAM,mBAAmB,CAAC;AACvG,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAWtC,eAAO,MAAM,SAAS,YAoJH,OAAO,SAAS,KAAK,KAAG,gBAAgB,AApJP,CAAC;AACrD,eAAO,MAAM,kBAAkB,YAmJZ,OAAO,SAAS,KAAK,KAAG,gBAAgB,AAnJW,CAAC;AACvE,eAAO,MAAM,UAAU,YAsWJ,eAAe,SAAS,KAAK,KAAG,gBAAgB,AAtWA,CAAC;AACpE,eAAO,MAAM,YAAY,YAqWN,eAAe,SAAS,KAAK,KAAG,gBAAgB,AArWK,CAAC;AACzE,eAAO,MAAM,UAAU,sBAkNI,eAAe,SAAS,KAAK,KAAG,gBAAgB,AAlNE,CAAC;AAC9E,eAAO,MAAM,UAAU,sBAiNI,eAA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,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AA2BD;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,uBAM9C,eAAe,SAAS,KAAK,KAAG,gBAAgB,CA4E1E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,aACtC,OAAO,SAAS,KAAK,KAAG,gBAAgB,CAiB1D;AAED,eAAO,MAAM,gBAAgB,EAAE,YAwB9B,CAAC;AAuBF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,aAC5D,eAAe,SAAS,KAAK,KAAG,gBAAgB,CA0BlE"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.commonSearchProps = exports.commonSearchArgs = exports.UpdateResult = exports.UpdateArgs = exports.TSSearchSortInput = exports.TSSearchArgs = exports.TSListArgs = exports.TSGetSingletonArgs = exports.TSGetArgs = exports.SearchResults = exports.PaginatedList = exports.DuplicateResult = exports.DuplicateArgs = exports.DeleteResult = exports.DeleteArgs = exports.CreateResult = exports.CreateArgs = exports.ContentStructureInput = void 0;
6
+ exports.commonSearchProps = exports.commonSearchArgs = exports.UpdateResult = exports.UpdateArgs = exports.TSSearchSortInput = exports.TSSearchArgs = exports.TSListArgs = exports.TSGetSingletonArgs = exports.TSGetArgs = exports.TSContentStructureInput = exports.SearchResults = exports.PaginatedList = exports.DuplicateResult = exports.DuplicateArgs = exports.DeleteResult = exports.DeleteArgs = exports.CreateResult = exports.CreateArgs = void 0;
7
7
  exports.getIDQueryArgs = getIDQueryArgs;
8
8
  exports.getInputShapeName = getInputShapeName;
9
9
  exports.getMutationArgs = getMutationArgs;
@@ -126,7 +126,7 @@ const termsProps = {
126
126
  }
127
127
  };
128
128
  exports.termsProps = termsProps;
129
- const ContentStructureInput = (0, _schemaUtil.createShape)('ContentStructureInput', {
129
+ const TSContentStructureInput = (0, _schemaUtil.createShape)('TSContentStructureInput', {
130
130
  type: 'object',
131
131
  properties: {
132
132
  path: {
@@ -145,7 +145,7 @@ const ContentStructureInput = (0, _schemaUtil.createShape)('ContentStructureInpu
145
145
  }, {
146
146
  description: 'Describes a structural update to an array of data.'
147
147
  });
148
- exports.ContentStructureInput = ContentStructureInput;
148
+ exports.TSContentStructureInput = TSContentStructureInput;
149
149
 
150
150
  function getPaginatedListShape(context, shape) {
151
151
  const shapeName = `${shape.name}${_migration.listTypePrefix}`;
@@ -203,7 +203,7 @@ const contentStructureFields = {
203
203
  structure: {
204
204
  type: 'array',
205
205
  items: {
206
- '@ref': 'local:ContentStructureInput'
206
+ '@ref': 'local:TSContentStructureInput'
207
207
  }
208
208
  }
209
209
  }
@@ -239,7 +239,9 @@ function getIDQueryArgs(templateName) {
239
239
 
240
240
  function getMutationInputShapeName(verb) {
241
241
  return shapeName => {
242
- return (0, _util.pascalCase)([verb, shapeName, 'input']);
242
+ return (0, _util.formatShapeName)([verb, shapeName, 'input'], {
243
+ shapeNameIndex: 1
244
+ });
243
245
  };
244
246
  }
245
247
  /**
@@ -248,7 +250,11 @@ function getMutationInputShapeName(verb) {
248
250
 
249
251
 
250
252
  function getInputShapeName(shapeName) {
251
- return shapeName === 'TSRelationship' ? shapeName : `${shapeName}Input`;
253
+ if (shapeName === 'TSRelationship') {
254
+ return shapeName;
255
+ }
256
+
257
+ return `${shapeName}Input`;
252
258
  }
253
259
 
254
260
  function getOutputShapeName(name) {
@@ -341,7 +347,7 @@ function getMutationArgs(templateName, verb) {
341
347
  return (0, _schemaUtil.createShape)(getInputShapeName(shapeName), rewriteRefs(projectSchema, (0, _createInputSchema.createInputSchema)(shape.schema), getInputShapeName));
342
348
  }), 'name')),
343
349
  ...(addStructure ? {
344
- ContentStructureInput
350
+ TSContentStructureInput
345
351
  } : {})
346
352
  }
347
353
  };
@@ -350,7 +356,9 @@ function getMutationArgs(templateName, verb) {
350
356
 
351
357
  function getMutationResultType(verb) {
352
358
  return (context, shape) => {
353
- const shapeName = (0, _util.pascalCase)([verb, shape.name, 'result']);
359
+ const shapeName = (0, _util.formatShapeName)([verb, shape.name, 'result'], {
360
+ shapeNameIndex: 1
361
+ });
354
362
  const result = verb === _types.TemplateVerbs.Delete ? {
355
363
  type: 'boolean'
356
364
  } : {
@@ -242,7 +242,7 @@ function truncateNames(names) {
242
242
  function getRelationshipShapeName(refs) {
243
243
  return refs.map(ref => {
244
244
  const shapeName = ref.split(':')[1];
245
- return (0, _util.pascalCase)(shapeName);
245
+ return (0, _util.formatShapeName)(shapeName);
246
246
  }).sort().join('');
247
247
  }
248
248
 
@@ -287,7 +287,7 @@ function getTypeName(name, prop, shapeName, context) {
287
287
 
288
288
  if (type === 'object' || type === 'array') {
289
289
  const prefix = `TS${relationshipDepth >= MAX_RELATIONSHIP_DEPTH ? 'Shallow' : ''}Where`;
290
- const fieldName = `${conflictingProperties !== null && conflictingProperties !== void 0 && conflictingProperties.has(name) ? '_' : ''}${(0, _util.pascalCase)(name)}`;
290
+ const fieldName = `${conflictingProperties !== null && conflictingProperties !== void 0 && conflictingProperties.has(name) ? '_' : ''}${(0, _util.formatShapeName)(name)}`;
291
291
  const refItem = (0, _refs.getRefOrItemsRef)(projectSchema, prop);
292
292
  const suffix = refItem ? (0, _refs.refItemToShapeName)(refItem) : `${shapeName}${fieldName}`;
293
293
  return `${prefix}${suffix}`;
@@ -233,9 +233,9 @@ export const builtInShapes = {
233
233
  required: ['filename', 'path']
234
234
  }
235
235
  },
236
- TsStaticSite: {
236
+ TSStaticSite: {
237
237
  id: 'SITE',
238
- name: 'TsStaticSite',
238
+ name: 'TSStaticSite',
239
239
  title: 'Static Site',
240
240
  model: {
241
241
  type: 'multiple'
@@ -316,7 +316,7 @@ export const builtInShapes = {
316
316
  title: 'Environment Variables',
317
317
  '@l10n': false,
318
318
  items: {
319
- $ref: '#/shapes/TsStaticSiteEnvironmentVariables/schema'
319
+ $ref: '#/shapes/TSStaticSiteEnvironmentVariables/schema'
320
320
  },
321
321
  '@mapping': 'shapedb:TsStaticSite.9fj4UiNxY'
322
322
  },
@@ -325,7 +325,7 @@ export const builtInShapes = {
325
325
  title: 'Publish Triggers',
326
326
  '@l10n': false,
327
327
  items: {
328
- $ref: '#/shapes/TsStaticSiteTriggers/schema'
328
+ $ref: '#/shapes/TSStaticSiteTriggers/schema'
329
329
  }
330
330
  },
331
331
  templateHash: {
@@ -338,9 +338,9 @@ export const builtInShapes = {
338
338
  required: ['title', 'provider', 'destination']
339
339
  }
340
340
  },
341
- TsStaticSiteEnvironmentVariables: {
341
+ TSStaticSiteEnvironmentVariables: {
342
342
  id: '9fj4UiNxY',
343
- name: 'TsStaticSiteEnvironmentVariables',
343
+ name: 'TSStaticSiteEnvironmentVariables',
344
344
  title: 'Static Site EnvironmentVariables',
345
345
  schema: {
346
346
  type: 'object',
@@ -358,9 +358,9 @@ export const builtInShapes = {
358
358
  }
359
359
  }
360
360
  },
361
- TsStaticSiteTriggers: {
362
- id: 'TsStaticSiteTriggers',
363
- name: 'TsStaticSiteTriggers',
361
+ TSStaticSiteTriggers: {
362
+ id: 'TSStaticSiteTriggers',
363
+ name: 'TSStaticSiteTriggers',
364
364
  title: 'Static Site Triggers',
365
365
  schema: {
366
366
  type: 'object',
@@ -421,7 +421,7 @@ export const builtInForms = {
421
421
  }
422
422
  }
423
423
  },
424
- TsStaticSite: {
424
+ TSStaticSite: {
425
425
  default: {
426
426
  order: ['title', 'provider', 'destination', 'idKey', 'secretKey', 'environmentVariables'],
427
427
  properties: {
package/es/schema-util.js CHANGED
@@ -363,7 +363,7 @@ export function applyBuiltinPropertiesToShape(projectSchema, shape) {
363
363
  };
364
364
  } // Dependencies of these built-in shapes are automatically added by getBuiltinsUsed
365
365
 
366
- const requiredBuiltinShapes = ['Asset', 'TSRelationship', 'TsStaticSite', 'TSUser'];
366
+ const requiredBuiltinShapes = ['Asset', 'TSRelationship', 'TSStaticSite', 'TSUser'];
367
367
  /**
368
368
  * Get all built-in shapes that are depended on by the given project schema.
369
369
  * Required built-in shapes are always included.
@@ -1,6 +1,6 @@
1
1
  import { TemplateVerbs } from './types';
2
2
  import { listTypePrefix } from '../migration';
3
- import { deepClone, pascalCase, visit } from '@takeshape/util';
3
+ import { deepClone, formatShapeName, visit } from '@takeshape/util';
4
4
  import keyBy from 'lodash/keyBy';
5
5
  import { createShape, getShapeDependencies, isCachedShape } from '../schema-util';
6
6
  import { getFlattenedTemplateShapeName, getRef, getRefShapeName, refItemToAtRef, refItemToShapeName } from '../refs';
@@ -79,7 +79,7 @@ export const termsProps = {
79
79
  }
80
80
  }
81
81
  };
82
- export const ContentStructureInput = createShape('ContentStructureInput', {
82
+ export const TSContentStructureInput = createShape('TSContentStructureInput', {
83
83
  type: 'object',
84
84
  properties: {
85
85
  path: {
@@ -152,7 +152,7 @@ const contentStructureFields = {
152
152
  structure: {
153
153
  type: 'array',
154
154
  items: {
155
- '@ref': 'local:ContentStructureInput'
155
+ '@ref': 'local:TSContentStructureInput'
156
156
  }
157
157
  }
158
158
  }
@@ -186,7 +186,9 @@ export function getIDQueryArgs(templateName) {
186
186
 
187
187
  export function getMutationInputShapeName(verb) {
188
188
  return shapeName => {
189
- return pascalCase([verb, shapeName, 'input']);
189
+ return formatShapeName([verb, shapeName, 'input'], {
190
+ shapeNameIndex: 1
191
+ });
190
192
  };
191
193
  }
192
194
  /**
@@ -194,7 +196,11 @@ export function getMutationInputShapeName(verb) {
194
196
  */
195
197
 
196
198
  export function getInputShapeName(shapeName) {
197
- return shapeName === 'TSRelationship' ? shapeName : `${shapeName}Input`;
199
+ if (shapeName === 'TSRelationship') {
200
+ return shapeName;
201
+ }
202
+
203
+ return `${shapeName}Input`;
198
204
  }
199
205
  export function getOutputShapeName(name) {
200
206
  return name.replace(/(?:Input|PartialInput)$/, '');
@@ -286,7 +292,7 @@ export function getMutationArgs(templateName, verb) {
286
292
  return createShape(getInputShapeName(shapeName), rewriteRefs(projectSchema, createInputSchema(shape.schema), getInputShapeName));
287
293
  }), 'name')),
288
294
  ...(addStructure ? {
289
- ContentStructureInput
295
+ TSContentStructureInput
290
296
  } : {})
291
297
  }
292
298
  };
@@ -294,7 +300,9 @@ export function getMutationArgs(templateName, verb) {
294
300
  }
295
301
  export function getMutationResultType(verb) {
296
302
  return (context, shape) => {
297
- const shapeName = pascalCase([verb, shape.name, 'result']);
303
+ const shapeName = formatShapeName([verb, shape.name, 'result'], {
304
+ shapeNameIndex: 1
305
+ });
298
306
  const result = verb === TemplateVerbs.Delete ? {
299
307
  type: 'boolean'
300
308
  } : {
@@ -3,7 +3,7 @@ import isFunction from 'lodash/isFunction';
3
3
  import { createSchemaPropertyList, createShape, getAllRefsInShapes, isCachedShape } from '../schema-util';
4
4
  import uniqBy from 'lodash/uniqBy';
5
5
  import md5 from 'blueimp-md5';
6
- import { pascalCase, isDefined } from '@takeshape/util';
6
+ import { pascalCase, isDefined, formatShapeName } from '@takeshape/util';
7
7
  import { workflowsEnabled } from '../api-version';
8
8
  import { followRef, getRef, getRefOrItemsRef, hasRefProperty, hasResolvableRef, refItemToShape, refItemToShapeName } from '../refs';
9
9
  import { enumerateOneOfKeys, isUnionSchema } from '../unions';
@@ -209,7 +209,7 @@ function truncateNames(names) {
209
209
  function getRelationshipShapeName(refs) {
210
210
  return refs.map(ref => {
211
211
  const shapeName = ref.split(':')[1];
212
- return pascalCase(shapeName);
212
+ return formatShapeName(shapeName);
213
213
  }).sort().join('');
214
214
  }
215
215
 
@@ -254,7 +254,7 @@ function getTypeName(name, prop, shapeName, context) {
254
254
 
255
255
  if (type === 'object' || type === 'array') {
256
256
  const prefix = `TS${relationshipDepth >= MAX_RELATIONSHIP_DEPTH ? 'Shallow' : ''}Where`;
257
- const fieldName = `${conflictingProperties !== null && conflictingProperties !== void 0 && conflictingProperties.has(name) ? '_' : ''}${pascalCase(name)}`;
257
+ const fieldName = `${conflictingProperties !== null && conflictingProperties !== void 0 && conflictingProperties.has(name) ? '_' : ''}${formatShapeName(name)}`;
258
258
  const refItem = getRefOrItemsRef(projectSchema, prop);
259
259
  const suffix = refItem ? refItemToShapeName(refItem) : `${shapeName}${fieldName}`;
260
260
  return `${prefix}${suffix}`;
@@ -7241,7 +7241,7 @@
7241
7241
  ]
7242
7242
  }
7243
7243
  },
7244
- "TsStaticSite": {
7244
+ "TSStaticSite": {
7245
7245
  "default": {
7246
7246
  "order": [
7247
7247
  "title",
@@ -10317,27 +10317,27 @@
10317
10317
  "shape": "PaginatedList<DismissibleNotification>",
10318
10318
  "description": "Returns a list DismissibleNotification in natural order."
10319
10319
  },
10320
- "getTsStaticSite": {
10321
- "args": "TSGetArgs<TsStaticSite>",
10320
+ "getTSStaticSite": {
10321
+ "args": "TSGetArgs<TSStaticSite>",
10322
10322
  "resolver": {
10323
10323
  "name": "shapedb:get",
10324
10324
  "service": "shapedb",
10325
10325
  "options": {},
10326
- "shapeName": "TsStaticSite"
10326
+ "shapeName": "TSStaticSite"
10327
10327
  },
10328
- "shape": "TsStaticSite",
10329
- "description": "Get a TsStaticSite by ID"
10328
+ "shape": "TSStaticSite",
10329
+ "description": "Get a TSStaticSite by ID"
10330
10330
  },
10331
- "getTsStaticSiteList": {
10332
- "args": "TSListArgs<TsStaticSite>",
10331
+ "getTSStaticSiteList": {
10332
+ "args": "TSListArgs<TSStaticSite>",
10333
10333
  "resolver": {
10334
10334
  "name": "shapedb:list",
10335
10335
  "service": "shapedb",
10336
10336
  "options": {},
10337
- "shapeName": "TsStaticSite"
10337
+ "shapeName": "TSStaticSite"
10338
10338
  },
10339
- "shape": "PaginatedList<TsStaticSite>",
10340
- "description": "Returns a list TsStaticSite in natural order."
10339
+ "shape": "PaginatedList<TSStaticSite>",
10340
+ "description": "Returns a list TSStaticSite in natural order."
10341
10341
  },
10342
10342
  "getQuickDeposit": {
10343
10343
  "args": "TSGetArgs<QuickDeposit>",
@@ -15699,49 +15699,49 @@
15699
15699
  "shape": "DeleteResult<DismissibleNotification>",
15700
15700
  "description": "Delete DismissibleNotification"
15701
15701
  },
15702
- "updateTsStaticSite": {
15703
- "args": "UpdateArgs<TsStaticSite>",
15702
+ "updateTSStaticSite": {
15703
+ "args": "UpdateArgs<TSStaticSite>",
15704
15704
  "resolver": {
15705
15705
  "name": "shapedb:update",
15706
15706
  "service": "shapedb",
15707
15707
  "options": {},
15708
- "shapeName": "TsStaticSite"
15708
+ "shapeName": "TSStaticSite"
15709
15709
  },
15710
- "shape": "UpdateResult<TsStaticSite>",
15711
- "description": "Update TsStaticSite"
15710
+ "shape": "UpdateResult<TSStaticSite>",
15711
+ "description": "Update TSStaticSite"
15712
15712
  },
15713
- "createTsStaticSite": {
15714
- "args": "CreateArgs<TsStaticSite>",
15713
+ "createTSStaticSite": {
15714
+ "args": "CreateArgs<TSStaticSite>",
15715
15715
  "resolver": {
15716
15716
  "name": "shapedb:create",
15717
15717
  "service": "shapedb",
15718
15718
  "options": {},
15719
- "shapeName": "TsStaticSite"
15719
+ "shapeName": "TSStaticSite"
15720
15720
  },
15721
- "shape": "CreateResult<TsStaticSite>",
15722
- "description": "Create TsStaticSite"
15721
+ "shape": "CreateResult<TSStaticSite>",
15722
+ "description": "Create TSStaticSite"
15723
15723
  },
15724
- "duplicateTsStaticSite": {
15725
- "args": "DuplicateArgs<TsStaticSite>",
15724
+ "duplicateTSStaticSite": {
15725
+ "args": "DuplicateArgs<TSStaticSite>",
15726
15726
  "resolver": {
15727
15727
  "name": "shapedb:duplicate",
15728
15728
  "service": "shapedb",
15729
15729
  "options": {},
15730
- "shapeName": "TsStaticSite"
15730
+ "shapeName": "TSStaticSite"
15731
15731
  },
15732
- "shape": "DuplicateResult<TsStaticSite>",
15733
- "description": "Duplicate TsStaticSite"
15732
+ "shape": "DuplicateResult<TSStaticSite>",
15733
+ "description": "Duplicate TSStaticSite"
15734
15734
  },
15735
- "deleteTsStaticSite": {
15736
- "args": "DeleteArgs<TsStaticSite>",
15735
+ "deleteTSStaticSite": {
15736
+ "args": "DeleteArgs<TSStaticSite>",
15737
15737
  "resolver": {
15738
15738
  "name": "shapedb:delete",
15739
15739
  "service": "shapedb",
15740
15740
  "options": {},
15741
- "shapeName": "TsStaticSite"
15741
+ "shapeName": "TSStaticSite"
15742
15742
  },
15743
- "shape": "DeleteResult<TsStaticSite>",
15744
- "description": "Delete TsStaticSite"
15743
+ "shape": "DeleteResult<TSStaticSite>",
15744
+ "description": "Delete TSStaticSite"
15745
15745
  },
15746
15746
  "updateQuickDeposit": {
15747
15747
  "args": "UpdateArgs<QuickDeposit>",
@@ -51496,9 +51496,9 @@
51496
51496
  }
51497
51497
  }
51498
51498
  },
51499
- "TsStaticSite": {
51499
+ "TSStaticSite": {
51500
51500
  "id": "SITE",
51501
- "name": "TsStaticSite",
51501
+ "name": "TSStaticSite",
51502
51502
  "title": "Static Site",
51503
51503
  "model": {
51504
51504
  "type": "multiple"
@@ -51511,14 +51511,14 @@
51511
51511
  "title": "Title",
51512
51512
  "@l10n": false,
51513
51513
  "minLength": 1,
51514
- "@mapping": "shapedb:TsStaticSite.Ski9jLuXg"
51514
+ "@mapping": "shapedb:TSStaticSite.Ski9jLuXg"
51515
51515
  },
51516
51516
  "baseUrl": {
51517
51517
  "type": "string",
51518
51518
  "title": "Base URL",
51519
51519
  "@l10n": false,
51520
51520
  "minLength": 1,
51521
- "@mapping": "shapedb:TsStaticSite.Bk3tNmrfE"
51521
+ "@mapping": "shapedb:TSStaticSite.Bk3tNmrfE"
51522
51522
  },
51523
51523
  "provider": {
51524
51524
  "type": "string",
@@ -51563,14 +51563,14 @@
51563
51563
  "title": "Vercel"
51564
51564
  }
51565
51565
  ],
51566
- "@mapping": "shapedb:TsStaticSite.SkwbT2hqe"
51566
+ "@mapping": "shapedb:TSStaticSite.SkwbT2hqe"
51567
51567
  },
51568
51568
  "idKey": {
51569
51569
  "type": "string",
51570
51570
  "title": "Id Key",
51571
51571
  "@l10n": false,
51572
51572
  "minLength": 1,
51573
- "@mapping": "shapedb:TsStaticSite.SyRhi8_me"
51573
+ "@mapping": "shapedb:TSStaticSite.SyRhi8_me"
51574
51574
  },
51575
51575
  "secretKey": {
51576
51576
  "type": "string",
@@ -51578,43 +51578,43 @@
51578
51578
  "@l10n": false,
51579
51579
  "@sensitive": true,
51580
51580
  "minLength": 1,
51581
- "@mapping": "shapedb:TsStaticSite.BkIajLdXl"
51581
+ "@mapping": "shapedb:TSStaticSite.BkIajLdXl"
51582
51582
  },
51583
51583
  "destination": {
51584
51584
  "type": "string",
51585
51585
  "title": "Destination",
51586
51586
  "@l10n": false,
51587
51587
  "minLength": 1,
51588
- "@mapping": "shapedb:TsStaticSite.Hk6TsIdXl"
51588
+ "@mapping": "shapedb:TSStaticSite.Hk6TsIdXl"
51589
51589
  },
51590
51590
  "privateAcl": {
51591
51591
  "type": "boolean",
51592
51592
  "title": "Private ACL",
51593
51593
  "@l10n": false,
51594
- "@mapping": "shapedb:TsStaticSite.ByFe48wWU"
51594
+ "@mapping": "shapedb:TSStaticSite.ByFe48wWU"
51595
51595
  },
51596
51596
  "environmentVariables": {
51597
51597
  "type": "array",
51598
51598
  "title": "Environment Variables",
51599
51599
  "@l10n": false,
51600
51600
  "items": {
51601
- "$ref": "#/shapes/TsStaticSiteEnvironmentVariables/schema"
51601
+ "$ref": "#/shapes/TSStaticSiteEnvironmentVariables/schema"
51602
51602
  },
51603
- "@mapping": "shapedb:TsStaticSite.9fj4UiNxY"
51603
+ "@mapping": "shapedb:TSStaticSite.9fj4UiNxY"
51604
51604
  },
51605
51605
  "triggers": {
51606
51606
  "type": "array",
51607
51607
  "title": "Publish Triggers",
51608
51608
  "@l10n": false,
51609
51609
  "items": {
51610
- "$ref": "#/shapes/TsStaticSiteTriggers/schema"
51610
+ "$ref": "#/shapes/TSStaticSiteTriggers/schema"
51611
51611
  }
51612
51612
  },
51613
51613
  "templateHash": {
51614
51614
  "type": "string",
51615
51615
  "title": "Template Hash",
51616
51616
  "@l10n": false,
51617
- "@mapping": "shapedb:TsStaticSite.S1QA3GYI8"
51617
+ "@mapping": "shapedb:TSStaticSite.S1QA3GYI8"
51618
51618
  },
51619
51619
  "_id": {
51620
51620
  "title": "Id",
@@ -51692,9 +51692,9 @@
51692
51692
  ]
51693
51693
  }
51694
51694
  },
51695
- "TsStaticSiteEnvironmentVariables": {
51695
+ "TSStaticSiteEnvironmentVariables": {
51696
51696
  "id": "9fj4UiNxY",
51697
- "name": "TsStaticSiteEnvironmentVariables",
51697
+ "name": "TSStaticSiteEnvironmentVariables",
51698
51698
  "title": "Static Site EnvironmentVariables",
51699
51699
  "schema": {
51700
51700
  "type": "object",
@@ -51702,19 +51702,19 @@
51702
51702
  "name": {
51703
51703
  "type": "string",
51704
51704
  "title": "Name",
51705
- "@mapping": "shapedb:TsStaticSite.J8sbHgfdI"
51705
+ "@mapping": "shapedb:TSStaticSite.J8sbHgfdI"
51706
51706
  },
51707
51707
  "value": {
51708
51708
  "type": "string",
51709
51709
  "title": "Value",
51710
- "@mapping": "shapedb:TsStaticSite.ndhh88DvG"
51710
+ "@mapping": "shapedb:TSStaticSite.ndhh88DvG"
51711
51711
  }
51712
51712
  }
51713
51713
  }
51714
51714
  },
51715
- "TsStaticSiteTriggers": {
51716
- "id": "TsStaticSiteTriggers",
51717
- "name": "TsStaticSiteTriggers",
51715
+ "TSStaticSiteTriggers": {
51716
+ "id": "TSStaticSiteTriggers",
51717
+ "name": "TSStaticSiteTriggers",
51718
51718
  "title": "Static Site Triggers",
51719
51719
  "schema": {
51720
51720
  "type": "object",