@prismatic-io/spectral 10.5.4 → 10.5.6

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.
@@ -239,6 +239,9 @@ const convertComponentReference = (componentReference, componentRegistry, refere
239
239
  if ("configVar" in value) {
240
240
  return Object.assign(Object.assign({}, result), { [key]: { type: "configVar", value: value.configVar } });
241
241
  }
242
+ if ("template" in value) {
243
+ return Object.assign(Object.assign({}, result), { [key]: { type: "template", value: value.template } });
244
+ }
242
245
  return result;
243
246
  }, {});
244
247
  return {
@@ -472,7 +475,8 @@ const convertConfigVar = (key, configVar, referenceKey, componentRegistry) => {
472
475
  }
473
476
  if ((0, types_1.isDataSourceReferenceConfigVar)(configVar)) {
474
477
  const { ref, inputs } = convertComponentReference(configVar.dataSource, componentRegistry, "dataSources");
475
- result.dataType = componentRegistry[ref.component.key].dataSources[ref.key].dataSourceType;
478
+ result.dataType =
479
+ componentRegistry[configVar.dataSource.component].dataSources[ref.key].dataSourceType;
476
480
  result.dataSource = ref;
477
481
  result.inputs = inputs;
478
482
  if (configVar.validationMode) {
@@ -22,6 +22,15 @@ export type ComponentRegistry = keyof IntegrationDefinitionComponentRegistry ext
22
22
  export type ConfigVarExpression = {
23
23
  configVar: string;
24
24
  };
25
+ export type TemplateExpression = {
26
+ /**
27
+ * Use a template to concatenate strings and other config variables together.
28
+ * For example, if you have a config variable named "Sharepoint Site", you
29
+ * can provide a value `/sites/{{#Sharepoint Site}}/drives`, and your `{{#}}`
30
+ * config variable will be concatenated with `/sites/` and `/drives`.
31
+ */
32
+ template: string;
33
+ };
25
34
  export type ValueExpression<TValueType = unknown> = {
26
35
  value: TValueType;
27
36
  };
@@ -29,7 +38,7 @@ type ComponentReferenceType = Extract<keyof ComponentManifest, "actions" | "trig
29
38
  type ComponentReferenceTypeValueMap<TValue, TMap extends Record<ComponentReferenceType, unknown> = {
30
39
  actions: ValueExpression<TValue>;
31
40
  triggers: ValueExpression<TValue> | ConfigVarExpression;
32
- dataSources: ValueExpression<TValue> | ConfigVarExpression;
41
+ dataSources: ValueExpression<TValue> | ConfigVarExpression | TemplateExpression;
33
42
  connections: (ValueExpression<TValue> | ConfigVarExpression) & ConfigVarVisibility & {
34
43
  writeOnly?: true;
35
44
  };
@@ -38,14 +47,14 @@ export type ComponentReference<TComponentReference extends {
38
47
  component: string;
39
48
  key: string;
40
49
  values?: {
41
- [key: string]: ValueExpression | ConfigVarExpression;
50
+ [key: string]: ValueExpression | ConfigVarExpression | TemplateExpression;
42
51
  };
43
52
  template?: string;
44
53
  } = {
45
54
  component: string;
46
55
  key: string;
47
56
  values?: {
48
- [key: string]: ValueExpression | ConfigVarExpression;
57
+ [key: string]: ValueExpression | ConfigVarExpression | TemplateExpression;
49
58
  };
50
59
  template?: string;
51
60
  }> = TComponentReference;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "10.5.4",
3
+ "version": "10.5.6",
4
4
  "description": "Utility library for building Prismatic connectors and code-native integrations",
5
5
  "keywords": ["prismatic"],
6
6
  "main": "dist/index.js",