great 1.3.0 → 1.4.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 (69) hide show
  1. package/README.md +32 -16
  2. package/dist/explode/transform.js +3 -4
  3. package/dist/explode/transform.js.map +1 -1
  4. package/dist/explode/unescapeMongo.js +33 -0
  5. package/dist/explode/unescapeMongo.js.map +1 -1
  6. package/dist/generated/operations.d.ts +23 -1
  7. package/dist/generated/schema.d.ts +16 -0
  8. package/dist/generated/schema.js.map +1 -1
  9. package/dist/import/index.d.ts +3 -1
  10. package/dist/import/index.js +27 -6
  11. package/dist/import/index.js.map +1 -1
  12. package/dist/include/index.d.ts +3 -1
  13. package/dist/include/index.js +129 -11
  14. package/dist/include/index.js.map +1 -1
  15. package/dist/index.js +3 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/integrations/index.js +5 -0
  18. package/dist/integrations/index.js.map +1 -1
  19. package/dist/integrations/list.d.ts +2 -0
  20. package/dist/integrations/list.js +30 -16
  21. package/dist/integrations/list.js.map +1 -1
  22. package/dist/push/index.js +262 -42
  23. package/dist/push/index.js.map +1 -1
  24. package/dist/remove/index.d.ts +5 -0
  25. package/dist/remove/index.js +71 -0
  26. package/dist/remove/index.js.map +1 -0
  27. package/dist/rename/index.js +4 -3
  28. package/dist/rename/index.js.map +1 -1
  29. package/dist/run/index.d.ts +1 -1
  30. package/dist/utils/detectPullConflicts.js +13 -3
  31. package/dist/utils/detectPullConflicts.js.map +1 -1
  32. package/dist/utils/elementFiles.d.ts +8 -0
  33. package/dist/utils/elementFiles.js +33 -0
  34. package/dist/utils/elementFiles.js.map +1 -1
  35. package/dist/utils/graphqlError.js +16 -2
  36. package/dist/utils/graphqlError.js.map +1 -1
  37. package/dist/utils/hashContent.d.ts +1 -0
  38. package/dist/utils/hashContent.js +6 -3
  39. package/dist/utils/hashContent.js.map +1 -1
  40. package/dist/utils/integrationConfig.d.ts +13 -0
  41. package/dist/utils/integrationConfig.js +29 -0
  42. package/dist/utils/integrationConfig.js.map +1 -0
  43. package/dist/utils/mergeEndpointLists.d.ts +7 -0
  44. package/dist/utils/mergeEndpointLists.js +32 -0
  45. package/dist/utils/mergeEndpointLists.js.map +1 -0
  46. package/dist/utils/promptForEndpoints.d.ts +5 -0
  47. package/dist/utils/promptForEndpoints.js +37 -0
  48. package/dist/utils/promptForEndpoints.js.map +1 -0
  49. package/dist/utils/promptForReplaceLocal.d.ts +5 -0
  50. package/dist/utils/promptForReplaceLocal.js +18 -0
  51. package/dist/utils/promptForReplaceLocal.js.map +1 -0
  52. package/dist/utils/promptForValue.d.ts +2 -0
  53. package/dist/utils/promptForValue.js +6 -3
  54. package/dist/utils/promptForValue.js.map +1 -1
  55. package/dist/utils/resolveElementIncludes.d.ts +6 -0
  56. package/dist/utils/resolveElementIncludes.js +113 -0
  57. package/dist/utils/resolveElementIncludes.js.map +1 -0
  58. package/dist/utils/saveIntegration.js +7 -2
  59. package/dist/utils/saveIntegration.js.map +1 -1
  60. package/dist/utils/serviceFile.d.ts +3 -0
  61. package/dist/utils/serviceFile.js +7 -1
  62. package/dist/utils/serviceFile.js.map +1 -1
  63. package/dist/utils/writeShadowElement.d.ts +10 -7
  64. package/dist/utils/writeShadowElement.js +89 -50
  65. package/dist/utils/writeShadowElement.js.map +1 -1
  66. package/package.json +7 -7
  67. package/dist/utils/resolveElementInclude.d.ts +0 -3
  68. package/dist/utils/resolveElementInclude.js +0 -27
  69. package/dist/utils/resolveElementInclude.js.map +0 -1
package/README.md CHANGED
@@ -63,8 +63,10 @@ commands never silently fall back to the current folder in that case.
63
63
  ### Integration Management
64
64
 
65
65
  - `great integrations` or `great integrations list`: Display list of
66
- integrations. Supports `-a` to filter by account, or `--all` to list all
67
- integrations ignoring the default account.
66
+ integrations, with their type and account. Supports `-a` to filter by account,
67
+ or `--all` to list all integrations ignoring the default account. Use
68
+ `-t <type>` to only list integrations of a given type (`integration`,
69
+ `library`, or `template`).
68
70
  - `great integrations create <name>`: Create a new integration in Integreat.
69
71
  Requires `-a`. Returns integration ID to add to local `integration.json` for
70
72
  linking with workspace.
@@ -88,20 +90,26 @@ commands never silently fall back to the current folder in that case.
88
90
  an `integration.json` file; supports `-a` when creating a new integration, to
89
91
  create it in the right account. Will check for conflicts and abort.
90
92
  - `great import <template>`: Import a template, creating a local **shadow file**
91
- for each of its elements. A shadow file is an ordinary element file carrying a
92
- `$shadow: true` marker; it does not own its content (that lives in the source
93
- element) — the link to the source and the template import are recorded in
94
- `.great.json`. Several templates may import the same element; re-importing
95
- updates the existing shadow. Editing a shadow's content locally and pushing
96
- detaches it from its source (push asks first). Aborts without writing anything
97
- if any imported element clashes with a local element or a shadow of a
98
- different source. Must be run from a folder with an `integration.json` file
99
- (no push required first).
93
+ for each of its elements. `<template>` can be a template id or key; supports
94
+ `-a`. A shadow file is an ordinary element file carrying a `$shadow: true`
95
+ marker; it does not own its content (that lives in the source element) — the
96
+ link to the source and the template import are recorded in `.great.json`.
97
+ Several templates may import the same element; re-importing updates the
98
+ existing shadow. Editing a shadow's content locally and pushing detaches it
99
+ from its source (push asks first). When templates share a service with
100
+ different endpoint lists, the lists are merged into a local endpoint list that
101
+ remembers every template it came from. This fails only when the lists order
102
+ their endpoints differently.Must be run from a folder with an
103
+ `integration.json` file (no push required first).
100
104
  - `great include <element>`: Include a single element from another integration
101
- as a shadow file, like `great import` but for one element and with no template
102
- bookkeeping. Use `-p, --pinned-at <timestamp>` to pin the shadow to the source
103
- as it stood at that ISO timestamp; omit it to follow the source's latest
104
- content. Must be run from a folder with an `integration.json` file.
105
+ as a shadow file. Use `-p, --pinned-at <timestamp>` to pin the shadow to the
106
+ source as it stood at that ISO timestamp; omit it to follow the source's
107
+ latest content. Including a service with an endpoint list, you're asked which
108
+ endpoints to include with it as shadow elements. Leaving any out makes the
109
+ endpoint list a local element with only the selected endpoints, detached from
110
+ its source. Including an element that already exists replaces it with a
111
+ shadow. You're asked first when local content would be overwritten. Must be
112
+ run from a folder with an `integration.json` file.
105
113
  - `great rename <target> <new-key>`: Rename an element or the account key,
106
114
  keeping the link to the remote element intact. `<target>` is
107
115
  `"<folder>/<key>"` for an element (e.g. `schemas/entry`), or the literal
@@ -112,6 +120,13 @@ commands never silently fall back to the current folder in that case.
112
120
  every service listing it. An endpoint list can't be renamed on its own. (To
113
121
  rename the integration itself, rename its folder — the folder name is the
114
122
  integration key.)
123
+ - `great remove <target>`: Remove an element file and its link in `.great.json`.
124
+ `<target>` is `"<folder>/<key>"` (e.g. `schemas/entry`). Removing an endpoint
125
+ also drops it from every service listing it. Nothing is changed in Integreat
126
+ right away: the next `great push` deletes the removed elements there. Use this
127
+ instead of deleting an element file by hand, which leaves a stale link behind
128
+ for an element that hasn't been pushed. Must be run from a folder with an
129
+ `integration.json` file.
115
130
 
116
131
  ### Deployment & Runtime
117
132
 
@@ -195,7 +210,8 @@ An integration folder contains:
195
210
  with one JSON file per element. These hold only configuration. Keys come from
196
211
  names, not stored fields: an element's key is its file name without the
197
212
  extension (e.g. `schemas/entry.json` has key `entry`). Rename an element with
198
- `great rename` (a plain file rename is treated as delete + recreate).
213
+ `great rename` (a plain file rename is treated as delete + recreate), and
214
+ remove one with `great remove`.
199
215
  - `.great.json` at the folder root. This holds the sync bookkeeping that links
200
216
  local files to their remote counterparts — the integration and element ids,
201
217
  the owning account, the last-synced timestamps and content hashes. It is
@@ -36,14 +36,13 @@ export function transformValues(values) {
36
36
  return Object.entries(values).map(([key, val]) => {
37
37
  const isSecret = key.endsWith('$secret');
38
38
  const cleanKey = isSecret ? key.slice(0, -7) : key;
39
- const type = detectValueType(val, isSecret);
39
+ const value = unescapeMongo(val);
40
+ const type = detectValueType(value, isSecret);
40
41
  return {
41
42
  id: '',
42
43
  key: cleanKey,
43
44
  content: {
44
- ...(isSecret
45
- ? { ref: String(val).replaceAll(':', '_') }
46
- : { value: unescapeMongo(val) }),
45
+ ...(isSecret ? { ref: String(val).replaceAll(':', '_') } : { value }),
47
46
  type,
48
47
  },
49
48
  create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B,CACjB;QACD,GAAG,UAAU,CACX,WAAW,EAAE,YAAY;YACvB,CAAC,CAAC,qBAAqB,CAAC,WAAW,CAAC,YAAY,CAAC;YACjD,CAAC,CAAC,EAAE,EACN,YAAY,CACb;QACD,GAAG,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC;QACpE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC;QAC7D,GAAG,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,WAAW,CAAC;KACpE,CAAA;IAGD,IAAI,WAAW,EAAE,KAAK,EAAE,CAAC;QACvB,QAAQ,CAAC,IAAI,CAAC;YACZ,GAAG,EAAE,QAAQ;YACb,UAAU,EAAE,eAAe;YAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE;SACrC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL;YACE,GAAG,EAAE,SAAS;YACd,IAAI;YACJ,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,MAAgB;YACxB,IAAI,EAAE,wBAAwB;SAC/B;QACD;YACE,SAAS,EAAE,SAAS;YACpB,QAAQ;SACT;KACF,CAAA;AACH,CAAC"}
@@ -6,6 +6,35 @@ function unescapeKey(key) {
6
6
  .replaceAll('\\$', '$')
7
7
  .replaceAll('\\\\', '\\');
8
8
  }
9
+ const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
10
+ function decodeNumber(value) {
11
+ const num = Number(value);
12
+ return typeof value === 'string' && Number.isFinite(num) ? num : undefined;
13
+ }
14
+ function decodeDate(value) {
15
+ const raw = isObject(value) ? decodeNumber(value.$numberLong) : value;
16
+ if (typeof raw !== 'string' && typeof raw !== 'number')
17
+ return undefined;
18
+ const date = new Date(raw);
19
+ return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
20
+ }
21
+ const extendedJsonDecoders = {
22
+ $numberLong: decodeNumber,
23
+ $numberInt: decodeNumber,
24
+ $numberDouble: decodeNumber,
25
+ $numberDecimal: decodeNumber,
26
+ $date: decodeDate,
27
+ };
28
+ function decodeExtendedJson(obj) {
29
+ const entries = Object.entries(obj);
30
+ if (entries.length !== 1)
31
+ return undefined;
32
+ const [[key, value]] = entries;
33
+ return Object.hasOwn(extendedJsonDecoders, key)
34
+ ?
35
+ extendedJsonDecoders[key](value)
36
+ : undefined;
37
+ }
9
38
  export function unescapeMongo(obj) {
10
39
  if (obj === null || typeof obj !== 'object') {
11
40
  return obj;
@@ -13,6 +42,10 @@ export function unescapeMongo(obj) {
13
42
  if (Array.isArray(obj)) {
14
43
  return obj.map((item) => unescapeMongo(item));
15
44
  }
45
+ const decoded = decodeExtendedJson(obj);
46
+ if (decoded !== undefined) {
47
+ return decoded;
48
+ }
16
49
  const result = {};
17
50
  for (const key in obj) {
18
51
  const unescapedKey = unescapeKey(key);
@@ -1 +1 @@
1
- {"version":3,"file":"unescapeMongo.js","sourceRoot":"","sources":["../../src/explode/unescapeMongo.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,GAAG,KAAK,WAAW;QAAE,OAAO,EAAE,CAAA;IAClC,OAAO,GAAG;SACP,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC;SACtB,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC;SACtB,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAC7B,CAAC;AAED,MAAM,UAAU,aAAa,CAAI,GAAM;IAErC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAA;IACZ,CAAC;IAGD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,G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AAkB,CAAC,GAAG,CAAC,CAAA;IACvC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,OAAY,CAAA;IACrB,CAAC;IAGD,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QAGrC,MAAM,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IAChD,CAAC;IAED,OAAO,MAAW,CAAA;AACpB,CAAC"}
@@ -108,7 +108,7 @@ export type CreateIntegrationMutation = {
108
108
  };
109
109
  };
110
110
  export type IntegrationsQueryVariables = Exact<{
111
- [key: string]: never;
111
+ type?: Types.IntegrationType | null | undefined;
112
112
  }>;
113
113
  export type IntegrationsQuery = {
114
114
  integrations: {
@@ -117,21 +117,28 @@ export type IntegrationsQuery = {
117
117
  id: string;
118
118
  name: string;
119
119
  key: string;
120
+ type: Types.IntegrationType;
121
+ account: {
122
+ key: string;
123
+ };
120
124
  }>;
121
125
  };
122
126
  };
123
127
  export type IntegrationsForAccountQueryVariables = Exact<{
124
128
  accountId: string | number;
129
+ type?: Types.IntegrationType | null | undefined;
125
130
  }>;
126
131
  export type IntegrationsForAccountQuery = {
127
132
  account: {
128
133
  name: string;
134
+ key: string;
129
135
  integrations: {
130
136
  totalCount: number;
131
137
  nodes: Array<{
132
138
  id: string;
133
139
  name: string;
134
140
  key: string;
141
+ type: Types.IntegrationType;
135
142
  }>;
136
143
  };
137
144
  } | null;
@@ -163,6 +170,7 @@ export type IntegrationForPushQuery = {
163
170
  content: {
164
171
  checksum: string | null;
165
172
  createdAt: string;
173
+ sourceId: string | null;
166
174
  sourceTimestamp: string | null;
167
175
  provenance: Array<string>;
168
176
  } | null;
@@ -245,6 +253,7 @@ export type UpdateElementMutation = {
245
253
  export type SetElementContentMutationVariables = Exact<{
246
254
  id: string | number;
247
255
  content?: Record<string, unknown> | null | undefined;
256
+ provenance?: Array<string | number> | string | number | null | undefined;
248
257
  }>;
249
258
  export type SetElementContentMutation = {
250
259
  setElementContent: {
@@ -511,6 +520,9 @@ export type ResolveElementIncludeQuery = {
511
520
  name: string;
512
521
  description: string | null;
513
522
  type: Types.ElementType;
523
+ integration: {
524
+ id: string;
525
+ } | null;
514
526
  content: {
515
527
  sourceId: string | null;
516
528
  sourceTimestamp: string | null;
@@ -519,6 +531,16 @@ export type ResolveElementIncludeQuery = {
519
531
  } | null;
520
532
  };
521
533
  };
534
+ export type ElementIdByKeyQueryVariables = Exact<{
535
+ integrationId: string | number;
536
+ key: string | number;
537
+ type: Types.ElementType;
538
+ }>;
539
+ export type ElementIdByKeyQuery = {
540
+ elementByKey: {
541
+ id: string;
542
+ };
543
+ };
522
544
  export type IntegrationQueryVariables = Exact<{
523
545
  id: string | number;
524
546
  }>;
@@ -103,6 +103,7 @@ export type Auth = Element & {
103
103
  createdAt: Scalars['DateTime']['output'];
104
104
  description?: Maybe<Scalars['String']['output']>;
105
105
  id: Scalars['ID']['output'];
106
+ integration?: Maybe<Integration>;
106
107
  key: Scalars['ID']['output'];
107
108
  name: Scalars['String']['output'];
108
109
  updatedAt: Scalars['DateTime']['output'];
@@ -113,6 +114,7 @@ export type ConfigElement = Element & {
113
114
  createdAt: Scalars['DateTime']['output'];
114
115
  description?: Maybe<Scalars['String']['output']>;
115
116
  id: Scalars['ID']['output'];
117
+ integration?: Maybe<Integration>;
116
118
  key: Scalars['ID']['output'];
117
119
  name: Scalars['String']['output'];
118
120
  updatedAt: Scalars['DateTime']['output'];
@@ -123,6 +125,7 @@ export type Dictionary = Element & {
123
125
  createdAt: Scalars['DateTime']['output'];
124
126
  description?: Maybe<Scalars['String']['output']>;
125
127
  id: Scalars['ID']['output'];
128
+ integration?: Maybe<Integration>;
126
129
  key: Scalars['ID']['output'];
127
130
  name: Scalars['String']['output'];
128
131
  updatedAt: Scalars['DateTime']['output'];
@@ -136,6 +139,7 @@ export type Element = {
136
139
  createdAt: Scalars['DateTime']['output'];
137
140
  description?: Maybe<Scalars['String']['output']>;
138
141
  id: Scalars['ID']['output'];
142
+ integration?: Maybe<Integration>;
139
143
  key: Scalars['ID']['output'];
140
144
  name: Scalars['String']['output'];
141
145
  updatedAt: Scalars['DateTime']['output'];
@@ -170,6 +174,7 @@ export type Endpoint = Element & {
170
174
  createdAt: Scalars['DateTime']['output'];
171
175
  description?: Maybe<Scalars['String']['output']>;
172
176
  id: Scalars['ID']['output'];
177
+ integration?: Maybe<Integration>;
173
178
  key: Scalars['ID']['output'];
174
179
  name: Scalars['String']['output'];
175
180
  updatedAt: Scalars['DateTime']['output'];
@@ -180,6 +185,7 @@ export type EndpointList = Element & {
180
185
  createdAt: Scalars['DateTime']['output'];
181
186
  description?: Maybe<Scalars['String']['output']>;
182
187
  id: Scalars['ID']['output'];
188
+ integration?: Maybe<Integration>;
183
189
  key: Scalars['ID']['output'];
184
190
  name: Scalars['String']['output'];
185
191
  updatedAt: Scalars['DateTime']['output'];
@@ -199,6 +205,7 @@ export type Flow = Element & {
199
205
  createdAt: Scalars['DateTime']['output'];
200
206
  description?: Maybe<Scalars['String']['output']>;
201
207
  id: Scalars['ID']['output'];
208
+ integration?: Maybe<Integration>;
202
209
  key: Scalars['ID']['output'];
203
210
  lastRun?: Maybe<Log>;
204
211
  name: Scalars['String']['output'];
@@ -276,6 +283,7 @@ export type Job = Element & {
276
283
  cron?: Maybe<Scalars['String']['output']>;
277
284
  description?: Maybe<Scalars['String']['output']>;
278
285
  id: Scalars['ID']['output'];
286
+ integration?: Maybe<Integration>;
279
287
  isSubJob?: Maybe<Scalars['Boolean']['output']>;
280
288
  key: Scalars['ID']['output'];
281
289
  lastRun?: Maybe<Log>;
@@ -595,6 +603,7 @@ export type MutationRollbackPromptArgs = {
595
603
  export type MutationSetElementContentArgs = {
596
604
  content?: InputMaybe<Scalars['JSON']['input']>;
597
605
  id: Scalars['ID']['input'];
606
+ provenance?: InputMaybe<Array<Scalars['ID']['input']>>;
598
607
  };
599
608
  export type MutationSetExternalReferenceArgs = {
600
609
  externalId: Scalars['String']['input'];
@@ -866,6 +875,7 @@ export type ResolvedShadowElement = {
866
875
  __typename?: 'ResolvedShadowElement';
867
876
  content?: Maybe<ElementContent>;
868
877
  description?: Maybe<Scalars['String']['output']>;
878
+ integration?: Maybe<Integration>;
869
879
  key: Scalars['ID']['output'];
870
880
  name: Scalars['String']['output'];
871
881
  type: ElementType;
@@ -913,6 +923,7 @@ export type RetryRule = Element & {
913
923
  createdAt: Scalars['DateTime']['output'];
914
924
  description?: Maybe<Scalars['String']['output']>;
915
925
  id: Scalars['ID']['output'];
926
+ integration?: Maybe<Integration>;
916
927
  key: Scalars['ID']['output'];
917
928
  name: Scalars['String']['output'];
918
929
  updatedAt: Scalars['DateTime']['output'];
@@ -962,6 +973,7 @@ export type Schema = Element & {
962
973
  createdAt: Scalars['DateTime']['output'];
963
974
  description?: Maybe<Scalars['String']['output']>;
964
975
  id: Scalars['ID']['output'];
976
+ integration?: Maybe<Integration>;
965
977
  key: Scalars['ID']['output'];
966
978
  name: Scalars['String']['output'];
967
979
  updatedAt: Scalars['DateTime']['output'];
@@ -972,6 +984,7 @@ export type SchemaMutation = Element & {
972
984
  createdAt: Scalars['DateTime']['output'];
973
985
  description?: Maybe<Scalars['String']['output']>;
974
986
  id: Scalars['ID']['output'];
987
+ integration?: Maybe<Integration>;
975
988
  key: Scalars['ID']['output'];
976
989
  name: Scalars['String']['output'];
977
990
  updatedAt: Scalars['DateTime']['output'];
@@ -982,6 +995,7 @@ export type Service = Element & {
982
995
  createdAt: Scalars['DateTime']['output'];
983
996
  description?: Maybe<Scalars['String']['output']>;
984
997
  id: Scalars['ID']['output'];
998
+ integration?: Maybe<Integration>;
985
999
  key: Scalars['ID']['output'];
986
1000
  name: Scalars['String']['output'];
987
1001
  updatedAt: Scalars['DateTime']['output'];
@@ -1055,6 +1069,7 @@ export type Value = Element & {
1055
1069
  description?: Maybe<Scalars['String']['output']>;
1056
1070
  hasValue: Scalars['Boolean']['output'];
1057
1071
  id: Scalars['ID']['output'];
1072
+ integration?: Maybe<Integration>;
1058
1073
  key: Scalars['ID']['output'];
1059
1074
  name: Scalars['String']['output'];
1060
1075
  updatedAt: Scalars['DateTime']['output'];
@@ -1064,6 +1079,7 @@ export type Version = {
1064
1079
  __typename?: 'Version';
1065
1080
  auths: Array<Auth>;
1066
1081
  config?: Maybe<ConfigElement>;
1082
+ configuration: Scalars['JSON']['output'];
1067
1083
  dictionaries: Array<Dictionary>;
1068
1084
  elements: Array<Element>;
1069
1085
  endpointLists: Array<EndpointList>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/generated/schema.ts"],"names":[],"mappings":"AA0DA,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAE3B,4CAAuB,CAAA;IAEvB,kCAAa,CAAA;IAEb,4CAAuB,CAAA;AACzB,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AAGD,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,8BAAe,CAAA;AACjB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAyFD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAiCD,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,4CAA6B,CAAA;IAC7B,4BAAa,CAAA;IACb,0BAAW,CAAA;IACX,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EAbW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B,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAkDD,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IAEvB,8BAAa,CAAA;IAEb,wCAAuB,CAAA;IAEvB,gCAAe,CAAA;AACjB,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAmqBD,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAmeD,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAE3B,4CAAuB,CAAA;IAEvB,kCAAa,CAAA;IAEb,4CAAuB,CAAA;AACzB,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AA0DD,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACvB,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB;AAiFD,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;IAElB,2BAAe,CAAA;IAEf,+BAAmB,CAAA;IAEnB,+BAAmB,CAAA;IAEnB,yBAAa,CAAA;AACf,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB"}
@@ -3,6 +3,8 @@ import { type GraphQLRequestClient } from '../utils/graphqlClient.js';
3
3
  import type { ConfigSchema } from '../utils/config.js';
4
4
  import type { Command } from 'commander';
5
5
  import type { GreatFs } from '../types.js';
6
- export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: GreatFs, config?: Conf<ConfigSchema>) => (templateId: string) => Promise<void>;
6
+ export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: GreatFs, config?: Conf<ConfigSchema>) => (templateIdOrKey: string, options?: {
7
+ account?: string;
8
+ }) => Promise<void>;
7
9
  declare const _default: (program: Command, apiToken?: string) => Command;
8
10
  export default _default;
@@ -1,13 +1,16 @@
1
1
  import chalk from 'chalk';
2
2
  import { getClient } from '../utils/graphqlClient.js';
3
+ import { handleGraphQLError } from '../utils/graphqlError.js';
3
4
  import { fetchIntegrationFromFile } from '../utils/fetchLocal.js';
4
5
  import { resolveTemplateImport } from '../utils/resolveTemplateImport.js';
6
+ import { resolveAccountId } from '../utils/resolveAccount.js';
7
+ import { resolveIntegration } from '../utils/resolveIntegration.js';
5
8
  import { readGreatFile, writeGreatFile, upsertImportRecord, } from '../utils/greatFile.js';
6
9
  import { writeShadowElements, logShadowConflicts, } from '../utils/writeShadowElement.js';
7
- export const action = (log, apiToken, client, fsImpl, config) => async function importTemplate(templateId) {
8
- if (!templateId) {
9
- log(chalk.red('Template id is required'));
10
- log(`Usage: ${chalk.bold('great import <template-id>')}`);
10
+ export const action = (log, apiToken, client, fsImpl, config) => async function importTemplate(templateIdOrKey, options) {
11
+ if (!templateIdOrKey) {
12
+ log(chalk.red('Template id or key is required'));
13
+ log(`Usage: ${chalk.bold('great import <template-id-or-key>')}`);
11
14
  return;
12
15
  }
13
16
  if (!fetchIntegrationFromFile(fsImpl)) {
@@ -16,12 +19,26 @@ export const action = (log, apiToken, client, fsImpl, config) => async function
16
19
  return;
17
20
  }
18
21
  const graphqlClient = getClient(apiToken, client, config);
22
+ const { accountId, error: accountError } = await resolveAccountId(options ?? {}, apiToken ?? '', graphqlClient, config, fsImpl);
23
+ if (accountError) {
24
+ handleGraphQLError(accountError, log);
25
+ return;
26
+ }
27
+ const template = await resolveIntegration(templateIdOrKey, accountId, apiToken, graphqlClient);
28
+ if (template.error) {
29
+ handleGraphQLError(new Error(template.error), log);
30
+ return;
31
+ }
32
+ const templateId = template.id;
19
33
  const resolved = await resolveTemplateImport(graphqlClient, templateId, log);
20
34
  if (!resolved) {
21
35
  return;
22
36
  }
23
37
  const great = readGreatFile(undefined, fsImpl);
24
- const result = writeShadowElements(great, resolved.elements, { fsImpl });
38
+ const result = writeShadowElements(great, resolved.elements, {
39
+ mode: 'import',
40
+ fsImpl,
41
+ });
25
42
  if (result.conflicts.length > 0) {
26
43
  logShadowConflicts('Import', result.conflicts, log);
27
44
  return;
@@ -29,12 +46,16 @@ export const action = (log, apiToken, client, fsImpl, config) => async function
29
46
  upsertImportRecord(great, templateId, resolved.timestamp);
30
47
  writeGreatFile(great, undefined, fsImpl);
31
48
  log(chalk.green(`Imported ${result.written.length} element(s) from template ${templateId}`));
49
+ for (const merged of result.merged) {
50
+ log(chalk.green(`Merged ${merged.folder}/${merged.key} from template ${templateId} (now a local endpoint list)`));
51
+ }
32
52
  if (result.skipped.length > 0) {
33
53
  log(chalk.yellow(`Skipped ${result.skipped.length} config element(s)`));
34
54
  }
35
55
  };
36
56
  export default (program, apiToken) => program
37
57
  .command('import <template>')
38
- .description('import a template, creating a shadow file for each element')
58
+ .description('import a template, creating a shadow file for each element, `<template>` can be a template id or key')
59
+ .option('-a, --account <id>', 'account id or key (uses default from config if not provided)')
39
60
  .action(action(console.log, apiToken));
40
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/import/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAA6B,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,gCAAgC,CAAA;AAKvC,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,GAA8B,EAC9B,QAAiB,EACjB,MAA6B,EAC7B,MAAgB,EAChB,MAA2B,EAC3B,EAAE,CACF,KAAK,UAAU,cAAc,CAAC,UAAkB;IAC9C,IAAI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QAAQ,CAAC,CAAC,CAAA"}
@@ -1,9 +1,11 @@
1
1
  import Conf from 'conf';
2
2
  import { type GraphQLRequestClient } from '../utils/graphqlClient.js';
3
+ import promptForEndpoints from '../utils/promptForEndpoints.js';
4
+ import promptForReplaceLocal from '../utils/promptForReplaceLocal.js';
3
5
  import type { ConfigSchema } from '../utils/config.js';
4
6
  import type { Command } from 'commander';
5
7
  import type { GreatFs } from '../types.js';
6
- export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: GreatFs, config?: Conf<ConfigSchema>) => (elementId: string, options?: {
8
+ export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: GreatFs, config?: Conf<ConfigSchema>, promptForEndpointsFn?: typeof promptForEndpoints, promptForReplaceLocalFn?: typeof promptForReplaceLocal) => (elementId: string, options?: {
7
9
  pinnedAt?: string;
8
10
  }) => Promise<void>;
9
11
  declare const _default: (program: Command, apiToken?: string) => Command;