great 1.7.0 → 1.8.0

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 (51) hide show
  1. package/README.md +34 -14
  2. package/dist/clone/index.js +3 -11
  3. package/dist/clone/index.js.map +1 -1
  4. package/dist/generated/operations.d.ts +92 -24
  5. package/dist/generated/schema.d.ts +49 -15
  6. package/dist/generated/schema.js +8 -0
  7. package/dist/generated/schema.js.map +1 -1
  8. package/dist/import/index.d.ts +4 -1
  9. package/dist/import/index.js +35 -14
  10. package/dist/import/index.js.map +1 -1
  11. package/dist/include/index.d.ts +5 -2
  12. package/dist/include/index.js +42 -9
  13. package/dist/include/index.js.map +1 -1
  14. package/dist/index.js +3 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/push/index.js +62 -13
  17. package/dist/push/index.js.map +1 -1
  18. package/dist/run/index.d.ts +5 -5
  19. package/dist/run/index.js +3 -10
  20. package/dist/run/index.js.map +1 -1
  21. package/dist/unimport/index.d.ts +10 -0
  22. package/dist/unimport/index.js +70 -0
  23. package/dist/unimport/index.js.map +1 -0
  24. package/dist/utils/applyImports.d.ts +5 -2
  25. package/dist/utils/applyImports.js +8 -4
  26. package/dist/utils/applyImports.js.map +1 -1
  27. package/dist/utils/dispatch.js +7 -0
  28. package/dist/utils/dispatch.js.map +1 -1
  29. package/dist/utils/greatFile.d.ts +1 -0
  30. package/dist/utils/greatFile.js +9 -0
  31. package/dist/utils/greatFile.js.map +1 -1
  32. package/dist/utils/promptForVersionChange.d.ts +4 -0
  33. package/dist/utils/promptForVersionChange.js +36 -0
  34. package/dist/utils/promptForVersionChange.js.map +1 -0
  35. package/dist/utils/resolveElementIncludes.d.ts +10 -0
  36. package/dist/utils/resolveElementIncludes.js +1 -1
  37. package/dist/utils/resolveElementIncludes.js.map +1 -1
  38. package/dist/utils/resolveIntegration.d.ts +4 -0
  39. package/dist/utils/resolveIntegration.js +15 -1
  40. package/dist/utils/resolveIntegration.js.map +1 -1
  41. package/dist/utils/resolveTemplateImport.d.ts +10 -0
  42. package/dist/utils/{resolveImports.js → resolveTemplateImport.js} +36 -18
  43. package/dist/utils/resolveTemplateImport.js.map +1 -0
  44. package/dist/utils/resolveTemplateUnimport.d.ts +5 -0
  45. package/dist/utils/resolveTemplateUnimport.js +47 -0
  46. package/dist/utils/resolveTemplateUnimport.js.map +1 -0
  47. package/dist/utils/writeShadowElement.d.ts +4 -2
  48. package/dist/utils/writeShadowElement.js.map +1 -1
  49. package/package.json +5 -5
  50. package/dist/utils/resolveImports.d.ts +0 -9
  51. package/dist/utils/resolveImports.js.map +0 -1
package/README.md CHANGED
@@ -91,7 +91,8 @@ commands never silently fall back to the current folder in that case.
91
91
  an `integration.json` file; supports `-a` when creating a new integration, to
92
92
  create it in the right account. Will check for conflicts and abort. Use
93
93
  `-y, --yes` to answer yes to all prompts (sets values and detaches edited
94
- shadows).
94
+ shadows). Template imports are registered in Integreat as well, and imports
95
+ removed locally with `great unimport` are unregistered.
95
96
  - `great import <template>`: Import a template, creating a local **shadow file**
96
97
  for each of its elements. `<template>` can be a template id or key; supports
97
98
  `-a`. A shadow file is an ordinary element file carrying a `$shadow: true`
@@ -104,20 +105,39 @@ commands never silently fall back to the current folder in that case.
104
105
  too). Elements shared by several templates point at what the templates have in
105
106
  common. When templates share a service with different endpoint lists, the
106
107
  lists are merged into a local endpoint list that remembers every template it
107
- came from. Editing a shadow's content locally and pushing detaches it from its
108
- source (push asks first). Conflicts — such as a local element in the way of a
109
- template element, or templates disagreeing on an element — are reported by
110
- Integreat, and nothing is written. Must be run from a folder with an
111
- `integration.json` file (no push required first).
112
- - `great include <element>`: Include a single element from another integration
113
- as a shadow file. Use `-p, --pinned-at <timestamp>` to pin the shadow to the
114
- source as it stood at that ISO timestamp; omit it to follow the source's
115
- latest content. Including a service with an endpoint list, you're asked which
116
- endpoints to include with it as shadow elements. Leaving any out makes the
117
- endpoint list a local element with only the selected endpoints, detached from
118
- its source. Including an element that already exists replaces it with a
119
- shadow. You're asked first when local content would be overwritten. Must be
108
+ came from. Conflicts — such as a local element in the way of a template
109
+ element, or templates disagreeing on an element — are reported by Integreat,
110
+ and nothing is written. When the only conflict is that already imported
111
+ templates pin a shared element at another version, the elements are listed and
112
+ you are asked whether to move them to the version of the template being
113
+ imported; answering yes leaves the other templates out of sync (which is
114
+ reported) until they are re-imported. Use `-y, --yes` to answer yes to this
115
+ without being asked. Must be run from a folder with an `integration.json` file
116
+ (no push required first).
117
+ - `great unimport <template>`: Remove an imported template. `<template>` can be
118
+ a template id or key; supports `-a`. Integreat resolves the remaining
119
+ templates against the local elements, and the result is applied to the local
120
+ files: elements only this template supplied are removed, shadows other
121
+ templates also supply are kept with the template dropped from their
122
+ provenance, and elements Integreat keeps as local elements lose their link to
123
+ the templates. The template import is removed from `.great.json`. Nothing is
124
+ changed in Integreat right away: the next `great push` deletes the removed
125
+ elements and removes the template import there. Conflicts are reported and
126
+ nothing is written. It is an error when the template is not imported. Must be
120
127
  run from a folder with an `integration.json` file.
128
+ - `great include <element>`: Include a single element from another integration
129
+ as a shadow file. `<element>` is an element id, or `"<folder>/<key>"` (e.g.
130
+ `schemas/entry`). With a key, `-i, --integration` is required and takes the id
131
+ or key of the integration to include from. Use `-a, --account` to resolve an
132
+ integration key (defaults to the folder's account, then the account in
133
+ config). Use `-p, --pinned-at <timestamp>` to pin the shadow to the source as
134
+ it stood at that ISO timestamp; omit it to follow the source's latest content.
135
+ Including a service with an endpoint list, you're asked which endpoints to
136
+ include with it as shadow elements. Leaving any out makes the endpoint list a
137
+ local element with only the selected endpoints, detached from its source.
138
+ Including an element that already exists replaces it with a shadow. You're
139
+ asked first when local content would be overwritten. Must be run from a folder
140
+ with an `integration.json` file.
121
141
  - `great rename <target> <new-key>`: Rename an element or the account key,
122
142
  keeping the link to the remote element intact. `<target>` is
123
143
  `"<folder>/<key>"` for an element (e.g. `schemas/entry`), or the literal
@@ -1,10 +1,8 @@
1
1
  import chalk from 'chalk';
2
2
  import saveIntegration from '../utils/saveIntegration.js';
3
3
  import { getClient } from '../utils/graphqlClient.js';
4
- import { handleGraphQLError } from '../utils/graphqlError.js';
5
4
  import { fetchIntegrationDefinition } from '../utils/fetchIntegrationDefinition.js';
6
- import { resolveAccountId } from '../utils/resolveAccount.js';
7
- import { resolveIntegration } from '../utils/resolveIntegration.js';
5
+ import { resolveIntegrationInAccount } from '../utils/resolveIntegration.js';
8
6
  export const action = (log, apiToken, client, fsImpl, config) => async function cloneIntegration(integrationIdOrKey, options) {
9
7
  if (!integrationIdOrKey) {
10
8
  log(chalk.red('Integration id or key is required'));
@@ -12,14 +10,8 @@ export const action = (log, apiToken, client, fsImpl, config) => async function
12
10
  return;
13
11
  }
14
12
  const graphqlClient = getClient(apiToken, client, config);
15
- const { accountId, error: accountError } = await resolveAccountId(options ?? {}, apiToken ?? '', graphqlClient, config);
16
- if (accountError) {
17
- handleGraphQLError(accountError, log);
18
- return;
19
- }
20
- const resolved = await resolveIntegration(integrationIdOrKey, accountId, apiToken, graphqlClient);
21
- if (resolved.error) {
22
- handleGraphQLError(new Error(resolved.error), log);
13
+ const resolved = await resolveIntegrationInAccount(integrationIdOrKey, options?.account, apiToken, graphqlClient, config, undefined, log);
14
+ if (!resolved) {
23
15
  return;
24
16
  }
25
17
  const integration = await fetchIntegrationDefinition(graphqlClient, resolved.id, log);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clone/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,eAAe,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,SAAS,EAA6B,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAA;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,kBAAkB,E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,EACN,SAAS,EACT,GAAG,CACJ,CAAA;IACD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAM;IACR,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,0BAA0B,CAClD,aAAa,EACb,QAAQ,CAAC,EAAE,EACX,GAAG,CACJ,CAAA;IACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAM;IACR,CAAC;IAGD,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,IAAI,WAAW,CAAC,EAAE,CAAA;IAC9C,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAChE,CAAC,CAAA;AAEH,eAAe,CAAC,OAAgB,EAAE,QAAiB,EAAE,EAAE,CACrD,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,sCAAsC,CAAC;KACnD,MAAM,CACL,oBAAoB,EACpB,8DAA8D,CAC/D;KACA,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA"}
@@ -238,6 +238,22 @@ export type RegisterTemplateImportMutation = {
238
238
  }>;
239
239
  };
240
240
  };
241
+ export type UnregisterTemplateImportMutationVariables = Exact<{
242
+ integrationId: string | number;
243
+ templateId: string | number;
244
+ }>;
245
+ export type UnregisterTemplateImportMutation = {
246
+ unregisterTemplateImport: {
247
+ id: string;
248
+ templateImports: Array<{
249
+ id: string;
250
+ timestamp: string;
251
+ template: {
252
+ id: string;
253
+ } | null;
254
+ }>;
255
+ };
256
+ };
241
257
  export type UpdateElementMutationVariables = Exact<{
242
258
  id: string | number;
243
259
  name?: string | null | undefined;
@@ -386,6 +402,13 @@ export type DispatchMutation = {
386
402
  error: string | null;
387
403
  warning: string | null;
388
404
  itemCount: number | null;
405
+ params: Record<string, unknown> | null;
406
+ reason: string | null;
407
+ origin: string | null;
408
+ paging: {
409
+ next: Record<string, unknown> | null;
410
+ prev: Record<string, unknown> | null;
411
+ } | null;
389
412
  };
390
413
  };
391
414
  export type IntegrationDefinitionQueryVariables = Exact<{
@@ -541,20 +564,55 @@ export type ElementIdByKeyQuery = {
541
564
  id: string;
542
565
  };
543
566
  };
544
- export type ResolveImportsQueryVariables = Exact<{
545
- imports: Array<Types.ImportInput> | Types.ImportInput;
546
- elements?: Array<Types.TargetElementInput> | Types.TargetElementInput | null | undefined;
567
+ export type IntegrationQueryVariables = Exact<{
568
+ id: string | number;
547
569
  }>;
548
- export type ResolveImportsQuery = {
549
- resolveImports: {
570
+ export type IntegrationQuery = {
571
+ integration: {
572
+ id: string;
573
+ name: string;
574
+ type: Types.IntegrationType;
575
+ } | null;
576
+ };
577
+ export type IntegrationByKeyQueryVariables = Exact<{
578
+ account: Types.AccountSelector;
579
+ key: string | number;
580
+ }>;
581
+ export type IntegrationByKeyQuery = {
582
+ integrationByKey: {
583
+ id: string;
584
+ name: string;
585
+ type: Types.IntegrationType;
586
+ } | null;
587
+ };
588
+ export type ResolveTemplateImportQueryVariables = Exact<{
589
+ templateId: string | number;
590
+ existingTemplates?: Array<Types.TemplateImportInput> | Types.TemplateImportInput | null | undefined;
591
+ existingElements?: Array<Types.TargetElementInput> | Types.TargetElementInput | null | undefined;
592
+ allowVersionChange?: boolean | null | undefined;
593
+ }>;
594
+ export type ResolveTemplateImportQuery = {
595
+ resolveTemplateImport: {
550
596
  imports: Array<{
551
597
  templateId: string;
552
598
  timestamp: string;
599
+ outOfSync: boolean;
600
+ outOfSyncElements: Array<{
601
+ type: Types.ElementType;
602
+ key: string;
603
+ }>;
553
604
  }>;
554
605
  conflicts: Array<{
555
606
  type: Types.ElementType;
556
607
  key: string;
608
+ code: Types.ImportConflictCode;
557
609
  reason: string;
610
+ templates: Array<{
611
+ templateId: string;
612
+ timestamp: string;
613
+ contentTimestamp: string;
614
+ importing: boolean;
615
+ }>;
558
616
  }>;
559
617
  elements: Array<{
560
618
  key: string;
@@ -570,26 +628,36 @@ export type ResolveImportsQuery = {
570
628
  }>;
571
629
  };
572
630
  };
573
- export type IntegrationQueryVariables = Exact<{
574
- id: string | number;
575
- }>;
576
- export type IntegrationQuery = {
577
- integration: {
578
- id: string;
579
- name: string;
580
- type: Types.IntegrationType;
581
- } | null;
582
- };
583
- export type IntegrationByKeyQueryVariables = Exact<{
584
- account: Types.AccountSelector;
585
- key: string | number;
631
+ export type ResolveTemplateUnimportQueryVariables = Exact<{
632
+ templateId: string | number;
633
+ existingTemplates?: Array<Types.TemplateImportInput> | Types.TemplateImportInput | null | undefined;
634
+ existingElements?: Array<Types.TargetElementInput> | Types.TargetElementInput | null | undefined;
586
635
  }>;
587
- export type IntegrationByKeyQuery = {
588
- integrationByKey: {
589
- id: string;
590
- name: string;
591
- type: Types.IntegrationType;
592
- } | null;
636
+ export type ResolveTemplateUnimportQuery = {
637
+ resolveTemplateUnimport: {
638
+ imports: Array<{
639
+ templateId: string;
640
+ timestamp: string;
641
+ }>;
642
+ conflicts: Array<{
643
+ type: Types.ElementType;
644
+ key: string;
645
+ code: Types.ImportConflictCode;
646
+ reason: string;
647
+ }>;
648
+ elements: Array<{
649
+ key: string;
650
+ name: string;
651
+ description: string | null;
652
+ type: Types.ElementType;
653
+ content: {
654
+ sourceId: string | null;
655
+ sourceTimestamp: string | null;
656
+ provenance: Array<string>;
657
+ data: Record<string, unknown> | null;
658
+ } | null;
659
+ }>;
660
+ };
593
661
  };
594
662
  export type ResponseQueryVariables = Exact<{
595
663
  actionId: string | number;
@@ -159,6 +159,11 @@ export type ElementContent = {
159
159
  sourceTimestamp?: Maybe<Scalars['DateTime']['output']>;
160
160
  timestamp?: Maybe<Scalars['Date']['output']>;
161
161
  };
162
+ export type ElementIdentifier = {
163
+ __typename?: 'ElementIdentifier';
164
+ key: Scalars['ID']['output'];
165
+ type: ElementType;
166
+ };
162
167
  export declare enum ElementType {
163
168
  Auth = "auth",
164
169
  Config = "config",
@@ -219,14 +224,25 @@ export type Flow = Element & {
219
224
  };
220
225
  export type ImportConflict = {
221
226
  __typename?: 'ImportConflict';
227
+ code: ImportConflictCode;
222
228
  key: Scalars['ID']['output'];
223
229
  reason: Scalars['String']['output'];
230
+ templates: Array<ImportConflictTemplate>;
224
231
  type: ElementType;
225
232
  };
226
- export type ImportInput = {
227
- templateId: Scalars['ID']['input'];
228
- timestamp?: InputMaybe<Scalars['DateTime']['input']>;
229
- versionId?: InputMaybe<Scalars['ID']['input']>;
233
+ export declare enum ImportConflictCode {
234
+ DifferentOrder = "differentOrder",
235
+ DifferentSource = "differentSource",
236
+ DifferentValue = "differentValue",
237
+ DifferentVersion = "differentVersion",
238
+ LocalElement = "localElement"
239
+ }
240
+ export type ImportConflictTemplate = {
241
+ __typename?: 'ImportConflictTemplate';
242
+ contentTimestamp: Scalars['DateTime']['output'];
243
+ importing: Scalars['Boolean']['output'];
244
+ templateId: Scalars['ID']['output'];
245
+ timestamp: Scalars['DateTime']['output'];
230
246
  };
231
247
  export type Integration = {
232
248
  __typename?: 'Integration';
@@ -482,6 +498,8 @@ export type Mutation = {
482
498
  stopAgent: Scalars['Boolean']['output'];
483
499
  stopIntegration: Integration;
484
500
  unacknowledgeNotifications: Array<Notification>;
501
+ unimportTemplate: Integration;
502
+ unregisterTemplateImport: Integration;
485
503
  updateAccountKey: Account;
486
504
  updateAccountName: Account;
487
505
  updateAccountUserRole: Account;
@@ -593,6 +611,7 @@ export type MutationDispatchArgs = {
593
611
  waitForResponse?: InputMaybe<Scalars['Boolean']['input']>;
594
612
  };
595
613
  export type MutationImportTemplateArgs = {
614
+ allowVersionChange?: InputMaybe<Scalars['Boolean']['input']>;
596
615
  integrationId: Scalars['ID']['input'];
597
616
  templateId: Scalars['ID']['input'];
598
617
  versionId?: InputMaybe<Scalars['ID']['input']>;
@@ -661,6 +680,14 @@ export type MutationStopIntegrationArgs = {
661
680
  export type MutationUnacknowledgeNotificationsArgs = {
662
681
  ids: Array<Scalars['ID']['input']>;
663
682
  };
683
+ export type MutationUnimportTemplateArgs = {
684
+ integrationId: Scalars['ID']['input'];
685
+ templateId: Scalars['ID']['input'];
686
+ };
687
+ export type MutationUnregisterTemplateImportArgs = {
688
+ integrationId: Scalars['ID']['input'];
689
+ templateId: Scalars['ID']['input'];
690
+ };
664
691
  export type MutationUpdateAccountKeyArgs = {
665
692
  id: Scalars['ID']['input'];
666
693
  key: Scalars['ID']['input'];
@@ -797,8 +824,8 @@ export type Query = {
797
824
  logEntry: LogEntry;
798
825
  notifications: NotificationConnection;
799
826
  resolveElementInclude: ResolvedShadowElement;
800
- resolveImports: ResolvedImports;
801
- resolveTemplateImport: ResolvedTemplateImport;
827
+ resolveTemplateImport: ResolvedImports;
828
+ resolveTemplateUnimport: ResolvedImports;
802
829
  response?: Maybe<Response>;
803
830
  ruleset?: Maybe<Ruleset>;
804
831
  rulesets: RulesetConnection;
@@ -877,14 +904,18 @@ export type QueryResolveElementIncludeArgs = {
877
904
  elementId: Scalars['ID']['input'];
878
905
  sourceTimestamp?: InputMaybe<Scalars['DateTime']['input']>;
879
906
  };
880
- export type QueryResolveImportsArgs = {
881
- elements?: InputMaybe<Array<TargetElementInput>>;
882
- imports: Array<ImportInput>;
883
- };
884
907
  export type QueryResolveTemplateImportArgs = {
908
+ allowVersionChange?: InputMaybe<Scalars['Boolean']['input']>;
909
+ existingElements?: InputMaybe<Array<TargetElementInput>>;
910
+ existingTemplates?: InputMaybe<Array<TemplateImportInput>>;
885
911
  templateId: Scalars['ID']['input'];
886
912
  versionId?: InputMaybe<Scalars['ID']['input']>;
887
913
  };
914
+ export type QueryResolveTemplateUnimportArgs = {
915
+ existingElements?: InputMaybe<Array<TargetElementInput>>;
916
+ existingTemplates?: InputMaybe<Array<TemplateImportInput>>;
917
+ templateId: Scalars['ID']['input'];
918
+ };
888
919
  export type QueryResponseArgs = {
889
920
  actionId: Scalars['ID']['input'];
890
921
  };
@@ -910,6 +941,8 @@ export type QueryUserArgs = {
910
941
  };
911
942
  export type ResolvedImport = {
912
943
  __typename?: 'ResolvedImport';
944
+ outOfSync: Scalars['Boolean']['output'];
945
+ outOfSyncElements: Array<ElementIdentifier>;
913
946
  templateId: Scalars['ID']['output'];
914
947
  timestamp: Scalars['DateTime']['output'];
915
948
  };
@@ -928,11 +961,6 @@ export type ResolvedShadowElement = {
928
961
  name: Scalars['String']['output'];
929
962
  type: ElementType;
930
963
  };
931
- export type ResolvedTemplateImport = {
932
- __typename?: 'ResolvedTemplateImport';
933
- elements: Array<ResolvedShadowElement>;
934
- timestamp: Scalars['DateTime']['output'];
935
- };
936
964
  export type Response = {
937
965
  __typename?: 'Response';
938
966
  data?: Maybe<Scalars['JSON']['output']>;
@@ -1076,9 +1104,15 @@ export type TemplateImport = {
1076
1104
  __typename?: 'TemplateImport';
1077
1105
  createdAt: Scalars['DateTime']['output'];
1078
1106
  id: Scalars['ID']['output'];
1107
+ outOfSync: Scalars['Boolean']['output'];
1108
+ outOfSyncElements: Array<ElementIdentifier>;
1079
1109
  template?: Maybe<Integration>;
1080
1110
  timestamp: Scalars['DateTime']['output'];
1081
1111
  };
1112
+ export type TemplateImportInput = {
1113
+ templateId: Scalars['ID']['input'];
1114
+ timestamp: Scalars['DateTime']['input'];
1115
+ };
1082
1116
  export type Thread = {
1083
1117
  __typename?: 'Thread';
1084
1118
  createdAt: Scalars['DateTime']['output'];
@@ -30,6 +30,14 @@ export var ElementType;
30
30
  ElementType["Service"] = "service";
31
31
  ElementType["Value"] = "value";
32
32
  })(ElementType || (ElementType = {}));
33
+ export var ImportConflictCode;
34
+ (function (ImportConflictCode) {
35
+ ImportConflictCode["DifferentOrder"] = "differentOrder";
36
+ ImportConflictCode["DifferentSource"] = "differentSource";
37
+ ImportConflictCode["DifferentValue"] = "differentValue";
38
+ ImportConflictCode["DifferentVersion"] = "differentVersion";
39
+ ImportConflictCode["LocalElement"] = "localElement";
40
+ })(ImportConflictCode || (ImportConflictCode = {}));
33
41
  export var IntegrationOrderField;
34
42
  (function (IntegrationOrderField) {
35
43
  IntegrationOrderField["Account"] = "account";
@@ -1 +1 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00BD,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAmjBD,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAE3B,4CAAuB,CAAA;IAEvB,kCAAa,CAAA;IAEb,4CAAuB,CAAA;AACzB,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AA2DD,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACvB,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB;AAmHD,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"}
@@ -1,10 +1,13 @@
1
1
  import Conf from 'conf';
2
2
  import { type GraphQLRequestClient } from '../utils/graphqlClient.js';
3
+ import type { VersionConflict } from '../utils/promptForVersionChange.js';
3
4
  import type { ConfigSchema } from '../utils/config.js';
4
5
  import type { Command } from 'commander';
5
6
  import type { GreatFs } from '../types.js';
6
- export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: GreatFs, config?: Conf<ConfigSchema>) => (templateIdOrKey: string, options?: {
7
+ type PromptForVersionChange = (conflicts: readonly VersionConflict[], log: (message: string) => void) => Promise<boolean>;
8
+ export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: GreatFs, config?: Conf<ConfigSchema>, promptForVersionChangeFn?: PromptForVersionChange) => (templateIdOrKey: string, options?: {
7
9
  account?: string;
10
+ yes?: boolean;
8
11
  }) => Promise<void>;
9
12
  declare const _default: (program: Command, apiToken?: string) => Command;
10
13
  export default _default;
@@ -1,13 +1,14 @@
1
1
  import chalk from 'chalk';
2
2
  import { getClient } from '../utils/graphqlClient.js';
3
- import { handleGraphQLError } from '../utils/graphqlError.js';
4
3
  import { fetchIntegrationFromFile } from '../utils/fetchLocal.js';
5
- import resolveImports, { buildImportInputs, buildTargetElements, } from '../utils/resolveImports.js';
4
+ import resolveTemplateImport, { buildExistingTemplates, buildTargetElements, } from '../utils/resolveTemplateImport.js';
6
5
  import applyImports from '../utils/applyImports.js';
7
- import { resolveAccountId } from '../utils/resolveAccount.js';
8
- import { resolveIntegration } from '../utils/resolveIntegration.js';
6
+ import promptForVersionChange, { acceptVersionChange, } from '../utils/promptForVersionChange.js';
7
+ import { resolveIntegrationInAccount } from '../utils/resolveIntegration.js';
9
8
  import { readGreatFile, writeGreatFile } from '../utils/greatFile.js';
9
+ import { elementTypeToFolder } from '../utils/elementFiles.js';
10
10
  import { logShadowConflicts } from '../utils/writeShadowElement.js';
11
+ import { ImportConflictCode } from '../generated/schema.js';
11
12
  const formatSummary = (result, templateId) => `Imported template ${templateId}: ${result.imported.length} new, ${result.updated.length} updated, ${result.removedFromTemplate.length} removed, ${result.unchanged.length} unchanged element(s)`;
12
13
  const hasUnchangedValues = (result) => result.unchanged.some(({ folder }) => folder === 'values');
13
14
  function logImportResult(result, templateId, log) {
@@ -28,7 +29,28 @@ function logImportResult(result, templateId, log) {
28
29
  log(chalk.yellow("Note: There may have also been changes to values, but we can't tell."));
29
30
  }
30
31
  }
31
- export const action = (log, apiToken, client, fsImpl, config) => async function importTemplate(templateIdOrKey, options) {
32
+ const isVersionConflict = (conflict) => conflict.code === ImportConflictCode.DifferentVersion;
33
+ const hasOnlyVersionConflicts = (resolved) => resolved.conflicts.length > 0 && resolved.conflicts.every(isVersionConflict);
34
+ async function resolveWithConsent(graphqlClient, templateId, existingTemplates, elements, log, prompt) {
35
+ const resolved = await resolveTemplateImport(graphqlClient, templateId, existingTemplates, elements, false, log);
36
+ if (!resolved || !hasOnlyVersionConflicts(resolved)) {
37
+ return resolved;
38
+ }
39
+ if (!(await prompt(resolved.conflicts, log))) {
40
+ log(chalk.red('Import aborted'));
41
+ return undefined;
42
+ }
43
+ return resolveTemplateImport(graphqlClient, templateId, existingTemplates, elements, true, log);
44
+ }
45
+ const formatOutOfSyncElements = (elements) => elements
46
+ .map((element) => `${elementTypeToFolder[element.type] ?? element.type}/${element.key}`)
47
+ .join(', ');
48
+ function logOutOfSync(imports, log) {
49
+ for (const record of imports.filter((record) => record.outOfSync)) {
50
+ log(chalk.yellow(`Template ${record.templateId} is now out of sync on ${formatOutOfSyncElements(record.outOfSyncElements)}. Re-import it with great import ${record.templateId} to update it`));
51
+ }
52
+ }
53
+ export const action = (log, apiToken, client, fsImpl, config, promptForVersionChangeFn = promptForVersionChange) => async function importTemplate(templateIdOrKey, options) {
32
54
  if (!templateIdOrKey) {
33
55
  log(chalk.red('Template id or key is required'));
34
56
  log(`Usage: ${chalk.bold('great import <template-id-or-key>')}`);
@@ -40,20 +62,17 @@ export const action = (log, apiToken, client, fsImpl, config) => async function
40
62
  return;
41
63
  }
42
64
  const graphqlClient = getClient(apiToken, client, config);
43
- const { accountId, error: accountError } = await resolveAccountId(options ?? {}, apiToken ?? '', graphqlClient, config, fsImpl);
44
- if (accountError) {
45
- handleGraphQLError(accountError, log);
46
- return;
47
- }
48
- const template = await resolveIntegration(templateIdOrKey, accountId, apiToken, graphqlClient);
49
- if (template.error) {
50
- handleGraphQLError(new Error(template.error), log);
65
+ const template = await resolveIntegrationInAccount(templateIdOrKey, options?.account, apiToken, graphqlClient, config, fsImpl, log);
66
+ if (!template) {
51
67
  return;
52
68
  }
53
69
  const templateId = template.id;
70
+ const versionChangePrompt = options?.yes
71
+ ? acceptVersionChange
72
+ : promptForVersionChangeFn;
54
73
  const great = readGreatFile(undefined, fsImpl);
55
74
  const elements = buildTargetElements(great, undefined, fsImpl);
56
- const resolved = await resolveImports(graphqlClient, buildImportInputs(great, templateId), elements, log);
75
+ const resolved = await resolveWithConsent(graphqlClient, templateId, buildExistingTemplates(great, templateId), elements, log, versionChangePrompt);
57
76
  if (!resolved) {
58
77
  return;
59
78
  }
@@ -66,10 +85,12 @@ export const action = (log, apiToken, client, fsImpl, config) => async function
66
85
  }
67
86
  writeGreatFile(great, undefined, fsImpl);
68
87
  logImportResult(result, templateId, log);
88
+ logOutOfSync(resolved.imports, log);
69
89
  };
70
90
  export default (program, apiToken) => program
71
91
  .command('import <template>')
72
92
  .description('import a template, creating a shadow file for each element, `<template>` can be a template id or key')
73
93
  .option('-a, --account <id>', 'account id or key (uses default from config if not provided)')
94
+ .option('-y, --yes', 'answer yes to all prompts (for use in scripts)')
74
95
  .action(action(console.log, apiToken));
75
96
  //# 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,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,cAAc,EAAE,EACrB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,4BAA4B,CAAA;AACnC,OAAO,YAAY,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAMnE,MAAM,aAAa,GAAG,CAAC,MAA0B,EAAE,UAAkB,EAAE,EAAE,CACvE,qBAAqB,UAAU,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,aAAa,MAAM,CAAC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,EACH,mBAAmB,CACpB,CAAA;IACD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAM;IACR,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE;QACjE,MAAM;KACP,CAAC,CAAA;IACF,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QACnD,OAAM;IACR,CAAC;IACD,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;IAExC,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,CAAC,CAAA;IACxC,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC,CAAA;AAEH,eAAe,CAAC,OAAgB,EAAE,QAAiB,EAAE,EAAE,CACrD,OAAO;KACJ,OAAO,CAAC,mBAAmB,CAAC;KAC5B,WAAW,CACV,sGAAsG,CACvG;KACA,MAAM,CACL,oBAAoB,EACpB,8DAA8D,CAC/D;KACA,MAAM,CAAC,WAAW,EAAE,gDAAgD,CAAC;KACrE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA"}
@@ -5,8 +5,11 @@ import promptForReplaceLocal from '../utils/promptForReplaceLocal.js';
5
5
  import type { ConfigSchema } from '../utils/config.js';
6
6
  import type { Command } from 'commander';
7
7
  import type { GreatFs } from '../types.js';
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?: {
8
+ interface IncludeOptions {
9
9
  pinnedAt?: string;
10
- }) => Promise<void>;
10
+ account?: string;
11
+ integration?: string;
12
+ }
13
+ export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: GreatFs, config?: Conf<ConfigSchema>, promptForEndpointsFn?: typeof promptForEndpoints, promptForReplaceLocalFn?: typeof promptForReplaceLocal) => (elementIdOrTarget: string, options?: IncludeOptions) => Promise<void>;
11
14
  declare const _default: (program: Command, apiToken?: string) => Command;
12
15
  export default _default;