@devrev/ts-adaas 1.13.1-beta.1 → 1.13.1-beta.3

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 (96) hide show
  1. package/dist/common/constants.d.ts +0 -1
  2. package/dist/common/constants.d.ts.map +1 -1
  3. package/dist/common/constants.js +1 -7
  4. package/dist/common/helpers.d.ts +5 -0
  5. package/dist/common/helpers.d.ts.map +1 -1
  6. package/dist/common/helpers.js +27 -0
  7. package/dist/workers/spawn.d.ts.map +1 -1
  8. package/dist/workers/spawn.js +3 -42
  9. package/package.json +3 -2
  10. package/dist/tests/backwards-compatibility/backwards-compatibility.test.d.ts +0 -3
  11. package/dist/tests/backwards-compatibility/backwards-compatibility.test.d.ts.map +0 -1
  12. package/dist/tests/backwards-compatibility/backwards-compatibility.test.js +0 -441
  13. package/dist/tests/backwards-compatibility/helpers.d.ts +0 -21
  14. package/dist/tests/backwards-compatibility/helpers.d.ts.map +0 -1
  15. package/dist/tests/backwards-compatibility/helpers.js +0 -151
  16. package/dist/tests/backwards-compatibility/jest.setup.d.ts +0 -2
  17. package/dist/tests/backwards-compatibility/jest.setup.d.ts.map +0 -1
  18. package/dist/tests/backwards-compatibility/jest.setup.js +0 -5
  19. package/dist/tests/dummy-connector/data-extraction.d.ts +0 -2
  20. package/dist/tests/dummy-connector/data-extraction.d.ts.map +0 -1
  21. package/dist/tests/dummy-connector/data-extraction.js +0 -43
  22. package/dist/tests/dummy-connector/data-extraction.test.d.ts +0 -2
  23. package/dist/tests/dummy-connector/data-extraction.test.d.ts.map +0 -1
  24. package/dist/tests/dummy-connector/data-extraction.test.js +0 -24
  25. package/dist/tests/dummy-connector/external-sync-units-extraction.d.ts +0 -2
  26. package/dist/tests/dummy-connector/external-sync-units-extraction.d.ts.map +0 -1
  27. package/dist/tests/dummy-connector/external-sync-units-extraction.js +0 -26
  28. package/dist/tests/dummy-connector/external-sync-units-extraction.test.d.ts +0 -2
  29. package/dist/tests/dummy-connector/external-sync-units-extraction.test.d.ts.map +0 -1
  30. package/dist/tests/dummy-connector/external-sync-units-extraction.test.js +0 -21
  31. package/dist/tests/dummy-connector/extraction.d.ts +0 -4
  32. package/dist/tests/dummy-connector/extraction.d.ts.map +0 -1
  33. package/dist/tests/dummy-connector/extraction.js +0 -19
  34. package/dist/tests/dummy-connector/metadata-extraction.d.ts +0 -2
  35. package/dist/tests/dummy-connector/metadata-extraction.d.ts.map +0 -1
  36. package/dist/tests/dummy-connector/metadata-extraction.js +0 -23
  37. package/dist/tests/dummy-connector/metadata-extraction.test.d.ts +0 -2
  38. package/dist/tests/dummy-connector/metadata-extraction.test.d.ts.map +0 -1
  39. package/dist/tests/dummy-connector/metadata-extraction.test.js +0 -54
  40. package/dist/tests/jest.setup.d.ts +0 -3
  41. package/dist/tests/jest.setup.d.ts.map +0 -1
  42. package/dist/tests/jest.setup.js +0 -14
  43. package/dist/tests/mock-server/mock-server.d.ts +0 -79
  44. package/dist/tests/mock-server/mock-server.d.ts.map +0 -1
  45. package/dist/tests/mock-server/mock-server.interfaces.d.ts +0 -53
  46. package/dist/tests/mock-server/mock-server.interfaces.d.ts.map +0 -1
  47. package/dist/tests/mock-server/mock-server.interfaces.js +0 -4
  48. package/dist/tests/mock-server/mock-server.js +0 -237
  49. package/dist/tests/spawn-worker/delete-event-type.test.d.ts +0 -2
  50. package/dist/tests/spawn-worker/delete-event-type.test.d.ts.map +0 -1
  51. package/dist/tests/spawn-worker/delete-event-type.test.js +0 -31
  52. package/dist/tests/spawn-worker/extraction.d.ts +0 -4
  53. package/dist/tests/spawn-worker/extraction.d.ts.map +0 -1
  54. package/dist/tests/spawn-worker/extraction.js +0 -19
  55. package/dist/tests/spawn-worker/some-cleanup-worker.d.ts +0 -2
  56. package/dist/tests/spawn-worker/some-cleanup-worker.d.ts.map +0 -1
  57. package/dist/tests/spawn-worker/some-cleanup-worker.js +0 -16
  58. package/dist/tests/spawn-worker/unknown-event-type.d.ts +0 -2
  59. package/dist/tests/spawn-worker/unknown-event-type.d.ts.map +0 -1
  60. package/dist/tests/spawn-worker/unknown-event-type.js +0 -19
  61. package/dist/tests/spawn-worker/unknown-event-type.test.d.ts +0 -2
  62. package/dist/tests/spawn-worker/unknown-event-type.test.d.ts.map +0 -1
  63. package/dist/tests/spawn-worker/unknown-event-type.test.js +0 -21
  64. package/dist/tests/test-helpers.d.ts +0 -10
  65. package/dist/tests/test-helpers.d.ts.map +0 -1
  66. package/dist/tests/test-helpers.interfaces.d.ts +0 -14
  67. package/dist/tests/test-helpers.interfaces.d.ts.map +0 -1
  68. package/dist/tests/test-helpers.interfaces.js +0 -2
  69. package/dist/tests/test-helpers.js +0 -101
  70. package/dist/tests/timeout-handling/extraction.d.ts +0 -4
  71. package/dist/tests/timeout-handling/extraction.d.ts.map +0 -1
  72. package/dist/tests/timeout-handling/extraction.js +0 -21
  73. package/dist/tests/timeout-handling/no-timeout.d.ts +0 -2
  74. package/dist/tests/timeout-handling/no-timeout.d.ts.map +0 -1
  75. package/dist/tests/timeout-handling/no-timeout.js +0 -14
  76. package/dist/tests/timeout-handling/no-timeout.test.d.ts +0 -2
  77. package/dist/tests/timeout-handling/no-timeout.test.d.ts.map +0 -1
  78. package/dist/tests/timeout-handling/no-timeout.test.js +0 -24
  79. package/dist/tests/timeout-handling/timeout-blocked.d.ts +0 -2
  80. package/dist/tests/timeout-handling/timeout-blocked.d.ts.map +0 -1
  81. package/dist/tests/timeout-handling/timeout-blocked.js +0 -23
  82. package/dist/tests/timeout-handling/timeout-blocked.test.d.ts +0 -2
  83. package/dist/tests/timeout-handling/timeout-blocked.test.d.ts.map +0 -1
  84. package/dist/tests/timeout-handling/timeout-blocked.test.js +0 -25
  85. package/dist/tests/timeout-handling/timeout-graceful.d.ts +0 -2
  86. package/dist/tests/timeout-handling/timeout-graceful.d.ts.map +0 -1
  87. package/dist/tests/timeout-handling/timeout-graceful.js +0 -17
  88. package/dist/tests/timeout-handling/timeout-graceful.test.d.ts +0 -2
  89. package/dist/tests/timeout-handling/timeout-graceful.test.d.ts.map +0 -1
  90. package/dist/tests/timeout-handling/timeout-graceful.test.js +0 -25
  91. package/dist/tests/timeout-handling/timeout-unblocked.d.ts +0 -2
  92. package/dist/tests/timeout-handling/timeout-unblocked.d.ts.map +0 -1
  93. package/dist/tests/timeout-handling/timeout-unblocked.js +0 -26
  94. package/dist/tests/timeout-handling/timeout-unblocked.test.d.ts +0 -2
  95. package/dist/tests/timeout-handling/timeout-unblocked.test.d.ts.map +0 -1
  96. package/dist/tests/timeout-handling/timeout-unblocked.test.js +0 -25
@@ -8,7 +8,6 @@ export declare const STATELESS_EVENT_TYPES: EventType[];
8
8
  export declare const STATEFUL_EXTRACTION_EVENT_TYPES: EventType[];
9
9
  export declare const STATEFUL_LOADING_EVENT_TYPES: EventType[];
10
10
  export declare const STATEFUL_EVENT_TYPES: EventType[];
11
- export declare const DELETE_EVENT_TYPES: EventType[];
12
11
  export declare const ARTIFACT_BATCH_SIZE = 2000;
13
12
  export declare const MAX_DEVREV_ARTIFACT_SIZE: number;
14
13
  export declare const MAX_DEVREV_FILENAME_LENGTH = 256;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,eAAO,MAAM,8BAA8B,aAS1C,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAKvC,CAAC;AAEF,eAAO,MAAM,mBAAmB,aAG/B,CAAC;AAEF,eAAO,MAAM,gCAAgC,aAI5C,CAAC;AAEF,eAAO,MAAM,6BAA6B,aAGzC,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAGjC,CAAC;AAEF,eAAO,MAAM,+BAA+B,aAGzC,CAAC;AAEJ,eAAO,MAAM,4BAA4B,aAExC,CAAC;AAEF,eAAO,MAAM,oBAAoB,aAGhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAK9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,wBAAwB,QAAyB,CAAC;AAC/D,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD,eAAO,MAAM,0BAA0B;;;;CAItC,CAAC;AAEF,eAAO,MAAM,eAAe,KAAsB,CAAC;AAEnD,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AACrD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,mBAAmB,QAAY,CAAC;AAE7C,eAAO,MAAM,sBAAsB,QAAgB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,eAAO,MAAM,8BAA8B,aAS1C,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAKvC,CAAC;AAEF,eAAO,MAAM,mBAAmB,aAG/B,CAAC;AAEF,eAAO,MAAM,gCAAgC,aAI5C,CAAC;AAEF,eAAO,MAAM,6BAA6B,aAGzC,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAGjC,CAAC;AAEF,eAAO,MAAM,+BAA+B,aAGzC,CAAC;AAEJ,eAAO,MAAM,4BAA4B,aAExC,CAAC;AAEF,eAAO,MAAM,oBAAoB,aAGhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,wBAAwB,QAAyB,CAAC;AAC/D,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD,eAAO,MAAM,0BAA0B;;;;CAItC,CAAC;AAEF,eAAO,MAAM,eAAe,KAAsB,CAAC;AAEnD,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AACrD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,mBAAmB,QAAY,CAAC;AAE7C,eAAO,MAAM,sBAAsB,QAAgB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_SLEEP_DELAY_MS = exports.MEMORY_LOG_INTERVAL = exports.HARD_TIMEOUT_MULTIPLIER = exports.DEFAULT_LAMBDA_TIMEOUT = exports.LIBRARY_VERSION = exports.AIRDROP_DEFAULT_ITEM_TYPES = exports.MAX_DEVREV_FILENAME_EXTENSION_LENGTH = exports.MAX_DEVREV_FILENAME_LENGTH = exports.MAX_DEVREV_ARTIFACT_SIZE = exports.ARTIFACT_BATCH_SIZE = exports.DELETE_EVENT_TYPES = exports.STATEFUL_EVENT_TYPES = exports.STATEFUL_LOADING_EVENT_TYPES = exports.STATEFUL_EXTRACTION_EVENT_TYPES = exports.STATELESS_EVENT_TYPES = exports.STATELESS_LOADING_EVENT_TYPES = exports.STATELESS_EXTRACTION_EVENT_TYPES = exports.ALLOWED_EVENT_TYPES = exports.ALLOWED_LOADING_EVENT_TYPES = exports.ALLOWED_EXTRACTION_EVENT_TYPES = void 0;
3
+ exports.DEFAULT_SLEEP_DELAY_MS = exports.MEMORY_LOG_INTERVAL = exports.HARD_TIMEOUT_MULTIPLIER = exports.DEFAULT_LAMBDA_TIMEOUT = exports.LIBRARY_VERSION = exports.AIRDROP_DEFAULT_ITEM_TYPES = exports.MAX_DEVREV_FILENAME_EXTENSION_LENGTH = exports.MAX_DEVREV_FILENAME_LENGTH = exports.MAX_DEVREV_ARTIFACT_SIZE = exports.ARTIFACT_BATCH_SIZE = exports.STATEFUL_EVENT_TYPES = exports.STATEFUL_LOADING_EVENT_TYPES = exports.STATEFUL_EXTRACTION_EVENT_TYPES = exports.STATELESS_EVENT_TYPES = exports.STATELESS_LOADING_EVENT_TYPES = exports.STATELESS_EXTRACTION_EVENT_TYPES = exports.ALLOWED_EVENT_TYPES = exports.ALLOWED_LOADING_EVENT_TYPES = exports.ALLOWED_EXTRACTION_EVENT_TYPES = void 0;
4
4
  const extraction_1 = require("../types/extraction");
5
5
  const helpers_1 = require("./helpers");
6
6
  exports.ALLOWED_EXTRACTION_EVENT_TYPES = [
@@ -42,12 +42,6 @@ exports.STATEFUL_EVENT_TYPES = [
42
42
  ...exports.STATEFUL_EXTRACTION_EVENT_TYPES,
43
43
  ...exports.STATEFUL_LOADING_EVENT_TYPES,
44
44
  ];
45
- exports.DELETE_EVENT_TYPES = [
46
- extraction_1.EventType.StartDeletingExtractorState,
47
- extraction_1.EventType.StartDeletingExtractorAttachmentsState,
48
- extraction_1.EventType.StartDeletingLoaderState,
49
- extraction_1.EventType.StartDeletingLoaderAttachmentState,
50
- ];
51
45
  exports.ARTIFACT_BATCH_SIZE = 2000;
52
46
  exports.MAX_DEVREV_ARTIFACT_SIZE = 2 * 1024 * 1024 * 1024; // 2GB
53
47
  exports.MAX_DEVREV_FILENAME_LENGTH = 256;
@@ -3,6 +3,11 @@ import { FileToLoad, LoaderEventType, LoaderReport, StatsFileObject } from '../t
3
3
  export declare function getTimeoutErrorEventType(eventType: EventType): {
4
4
  eventType: ExtractorEventType | LoaderEventType;
5
5
  };
6
+ export declare function getNoScriptEventType(eventType: EventType): {
7
+ eventType: ExtractorEventType;
8
+ } | {
9
+ eventType: LoaderEventType;
10
+ };
6
11
  export declare function getSyncDirection({ event }: {
7
12
  event: AirdropEvent;
8
13
  }): string;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/common/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,UAAU,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAM1B,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,GAAG;IAC9D,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;CACjD,CAmFA;AAED,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,UAElE;AAED,wBAAgB,cAAc,CAAC,EAC7B,kBAAkB,EAClB,SAAS,GACV,EAAE;IACD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,GAAG,UAAU,EAAE,CA8Bf;AAED,wBAAgB,uBAAuB,CAAC,EACtC,aAAa,EACb,MAAM,GACP,EAAE;IACD,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,MAAM,EAAE,YAAY,CAAC;CACtB,GAAG,YAAY,EAAE,CA4BjB;AAGD,wBAAgB,iBAAiB,QAiBhC;AAED,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,oBAGrC;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAmBzD;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,cAAc,IAAI,UAAU,CAmD3C"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/common/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,UAAU,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAM1B,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,GAAG;IAC9D,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;CACjD,CAmFA;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS;;;;EA2BxD;AAED,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,UAElE;AAED,wBAAgB,cAAc,CAAC,EAC7B,kBAAkB,EAClB,SAAS,GACV,EAAE;IACD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,GAAG,UAAU,EAAE,CA8Bf;AAED,wBAAgB,uBAAuB,CAAC,EACtC,aAAa,EACb,MAAM,GACP,EAAE;IACD,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,MAAM,EAAE,YAAY,CAAC;CACtB,GAAG,YAAY,EAAE,CA4BjB;AAGD,wBAAgB,iBAAiB,QAiBhC;AAED,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,oBAGrC;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAmBzD;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,cAAc,IAAI,UAAU,CAmD3C"}
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.getTimeoutErrorEventType = getTimeoutErrorEventType;
37
+ exports.getNoScriptEventType = getNoScriptEventType;
37
38
  exports.getSyncDirection = getSyncDirection;
38
39
  exports.getFilesToLoad = getFilesToLoad;
39
40
  exports.addReportToLoaderReport = addReportToLoaderReport;
@@ -119,6 +120,32 @@ function getTimeoutErrorEventType(eventType) {
119
120
  };
120
121
  }
121
122
  }
123
+ function getNoScriptEventType(eventType) {
124
+ switch (eventType) {
125
+ case extraction_1.EventType.StartDeletingExtractorState:
126
+ return {
127
+ eventType: extraction_1.ExtractorEventType.ExtractorStateDeletionDone,
128
+ };
129
+ case extraction_1.EventType.StartDeletingExtractorAttachmentsState:
130
+ return {
131
+ eventType: extraction_1.ExtractorEventType.ExtractorAttachmentsStateDeletionDone,
132
+ };
133
+ case extraction_1.EventType.StartDeletingLoaderState:
134
+ return {
135
+ eventType: loading_1.LoaderEventType.LoaderStateDeletionDone,
136
+ };
137
+ case extraction_1.EventType.StartDeletingLoaderAttachmentState:
138
+ return {
139
+ eventType: loading_1.LoaderEventType.LoaderAttachmentStateDeletionDone,
140
+ };
141
+ default:
142
+ console.error('Event type not recognized in getNoScriptEventType function: ' +
143
+ eventType);
144
+ return {
145
+ eventType: loading_1.LoaderEventType.UnknownEventType,
146
+ };
147
+ }
148
+ }
122
149
  function getSyncDirection({ event }) {
123
150
  return event.payload.event_context.mode;
124
151
  }
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/workers/spawn.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,kBAAkB,CAAC;AAqC1B;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA+HvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;gBACX,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;IAgGjB,OAAO,CAAC,aAAa;YAYP,kBAAkB;CAiCjC"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/workers/spawn.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,kBAAkB,CAAC;AAmC1B;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;gBACX,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;IAgGjB,OAAO,CAAC,aAAa;YAYP,kBAAkB;CAiCjC"}
@@ -15,7 +15,6 @@ const extraction_1 = require("../types/extraction");
15
15
  const workers_1 = require("../types/workers");
16
16
  const constants_1 = require("../common/constants");
17
17
  const create_worker_1 = require("./create-worker");
18
- const types_1 = require("../types");
19
18
  function getWorkerPath({ event, workerBasePath, }) {
20
19
  let path = null;
21
20
  switch (event.payload.event_type) {
@@ -111,53 +110,15 @@ async function spawn({ event, initialState, workerPath, initialDomainMapping, op
111
110
  return Promise.reject(error);
112
111
  }
113
112
  }
114
- // If the script is not found and the event type is a delete event type, emit a done event.
115
- else if (constants_1.DELETE_EVENT_TYPES.includes(event.payload.event_type)) {
116
- switch (event.payload.event_type) {
117
- case extraction_1.EventType.StartDeletingExtractorAttachmentsState:
118
- await (0, control_protocol_1.emit)({
119
- event,
120
- eventType: extraction_1.ExtractorEventType.ExtractorAttachmentsStateDeletionDone,
121
- });
122
- break;
123
- case extraction_1.EventType.StartDeletingLoaderAttachmentState:
124
- await (0, control_protocol_1.emit)({
125
- event,
126
- eventType: types_1.LoaderEventType.LoaderAttachmentStateDeletionDone,
127
- });
128
- break;
129
- case extraction_1.EventType.StartDeletingExtractorState:
130
- await (0, control_protocol_1.emit)({
131
- event,
132
- eventType: extraction_1.ExtractorEventType.ExtractorStateDeletionDone,
133
- });
134
- break;
135
- case extraction_1.EventType.StartDeletingLoaderState:
136
- await (0, control_protocol_1.emit)({
137
- event,
138
- eventType: types_1.LoaderEventType.LoaderStateDeletionDone,
139
- });
140
- break;
141
- }
142
- // eslint-disable-next-line no-global-assign
143
- console = originalConsole;
144
- return Promise.resolve();
145
- }
146
- // If the script is not found and the event type is not a delete event type, emit an unknown event.
147
113
  else {
148
- console.error(`Script was not found for event type: ${event.payload.event_type}.`);
114
+ const { eventType } = (0, helpers_2.getNoScriptEventType)(event.payload.event_type);
149
115
  await (0, control_protocol_1.emit)({
150
116
  event,
151
- eventType: extraction_1.ExtractorEventType.UnknownEventType,
152
- data: {
153
- error: {
154
- message: `Unrecognized event type in spawn ${event.payload.event_type}.`,
155
- },
156
- },
117
+ eventType,
157
118
  });
158
119
  // eslint-disable-next-line no-global-assign
159
120
  console = originalConsole;
160
- return Promise.reject();
121
+ return Promise.resolve();
161
122
  }
162
123
  }
163
124
  class Spawn {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/ts-adaas",
3
- "version": "1.13.1-beta.1",
3
+ "version": "1.13.1-beta.3",
4
4
  "description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -54,6 +54,7 @@
54
54
  "yargs": "^17.7.2"
55
55
  },
56
56
  "files": [
57
- "dist"
57
+ "dist/**/*",
58
+ "!dist/tests/**/*"
58
59
  ]
59
60
  }
@@ -1,3 +0,0 @@
1
- import { ApiConstructor, ApiFunction, ApiMethodSignature } from '@microsoft/api-extractor-model';
2
- export declare function checkFunctionCompatibility(newFunction: ApiFunction | ApiConstructor | ApiMethodSignature, currentFunction: ApiFunction | ApiConstructor | ApiMethodSignature): void;
3
- //# sourceMappingURL=backwards-compatibility.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backwards-compatibility.test.d.ts","sourceRoot":"","sources":["../../../src/tests/backwards-compatibility/backwards-compatibility.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGd,WAAW,EAGX,kBAAkB,EAKnB,MAAM,gCAAgC,CAAC;AAgBxC,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,WAAW,GAAG,cAAc,GAAG,kBAAkB,EAC9D,eAAe,EAAE,WAAW,GAAG,cAAc,GAAG,kBAAkB,QAuHnE"}
@@ -1,441 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkFunctionCompatibility = checkFunctionCompatibility;
4
- const api_extractor_model_1 = require("@microsoft/api-extractor-model");
5
- const helpers_1 = require("./helpers");
6
- function checkFunctionCompatibility(newFunction, currentFunction) {
7
- var _a;
8
- const lengthOfPreviousParameters = currentFunction.parameters.length;
9
- it(`Function ${newFunction.displayName} should have at least as many parameters as the current function`, () => {
10
- expect(newFunction.parameters.length).toBeGreaterThanOrEqual(currentFunction.parameters.length);
11
- });
12
- it(`Function ${newFunction.displayName} should have parameters in the same order as the current function`, () => {
13
- const newFunctionParamNames = newFunction.parameters
14
- .slice(0, lengthOfPreviousParameters)
15
- .map((p) => p.name);
16
- const currentFunctionParamNames = currentFunction.parameters.map((p) => p.name);
17
- // Check each parameter position for destructured parameter compatibility
18
- for (let i = 0; i <
19
- Math.min(newFunctionParamNames.length, currentFunctionParamNames.length); i++) {
20
- const newParam = newFunctionParamNames[i];
21
- const currentParam = currentFunctionParamNames[i];
22
- // If both are destructured parameters (contain '{')
23
- if (newParam.includes('{') && currentParam.includes('{')) {
24
- // Extract field names from destructured parameters
25
- const extractFields = (param) => param
26
- .replace(/[{}\s]/g, '')
27
- .split(',')
28
- .filter((f) => f.length > 0);
29
- const newFields = extractFields(newParam);
30
- const currentFields = extractFields(currentParam);
31
- // Check that all current fields are present in new fields
32
- const missingFields = currentFields.filter((field) => !newFields.includes(field));
33
- expect(missingFields).toEqual([]);
34
- }
35
- else {
36
- // For non-destructured parameters, they must match exactly
37
- expect(newParam).toEqual(currentParam);
38
- }
39
- }
40
- });
41
- it(`Function ${newFunction.displayName} should have compatible parameter types with the current function`, () => {
42
- const newFunctionParamTypes = newFunction.parameters
43
- .slice(0, lengthOfPreviousParameters)
44
- .map((p) => p.parameterTypeExcerpt.text);
45
- const currentFunctionParameterTypes = currentFunction.parameters.map((p) => p.parameterTypeExcerpt.text);
46
- expect(newFunctionParamTypes).toEqual(currentFunctionParameterTypes);
47
- });
48
- // Check return type compatibility
49
- // This check fails if it's a constructor, as those don't have a return type
50
- if (currentFunction instanceof api_extractor_model_1.ApiFunction &&
51
- newFunction instanceof api_extractor_model_1.ApiFunction) {
52
- if (!((_a = currentFunction.returnTypeExcerpt) === null || _a === void 0 ? void 0 : _a.isEmpty)) {
53
- if (newFunction.returnTypeExcerpt.text !=
54
- currentFunction.returnTypeExcerpt.text) {
55
- // This will pass, if the new implementation is an object and the current one is not specified or a hard-coded type.
56
- if (!(currentFunction.returnTypeExcerpt.text.split(' ').length != 1 &&
57
- newFunction.returnTypeExcerpt.text.split(' ').length == 1)) {
58
- it(`Function ${newFunction.displayName} should have the same return type as the current function`, () => {
59
- expect(newFunction.returnTypeExcerpt.text).toEqual(currentFunction.returnTypeExcerpt.text);
60
- });
61
- }
62
- }
63
- }
64
- }
65
- it(`Function ${newFunction.displayName} should have all new parameters as optional`, () => {
66
- const newParameters = newFunction.parameters.slice(lengthOfPreviousParameters);
67
- expect(newParameters.every((p) => p.isOptional)).toBe(true);
68
- });
69
- it(`Function ${newFunction.displayName} should not have any optional parameters that became required`, () => {
70
- const minLength = Math.min(newFunction.parameters.length, currentFunction.parameters.length);
71
- for (let i = 0; i < minLength; i++) {
72
- const newParam = newFunction.parameters[i];
73
- const currentParam = currentFunction.parameters[i];
74
- // If current parameter was optional, new parameter should also be optional
75
- if (currentParam.isOptional && !newParam.isOptional) {
76
- throw new Error(`Parameter ${newParam.name} became required but was optional`);
77
- }
78
- // Skip interface compatibility check for destructured parameters
79
- if (newParam.name.includes('{') || currentParam.name.includes('{')) {
80
- continue;
81
- }
82
- }
83
- });
84
- }
85
- describe('Backwards Compatibility', () => {
86
- let failure = false;
87
- afterEach(() => {
88
- var _a;
89
- // Check if current test failed
90
- if (expect.getState().currentTestName &&
91
- ((_a = expect.getState().suppressedErrors) === null || _a === void 0 ? void 0 : _a.length) > 0) {
92
- failure = true;
93
- }
94
- });
95
- describe('Exports', () => {
96
- describe('should verify that all exports in current are still in new', () => {
97
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
98
- const newExports = newApiMembers.map((m) => m.displayName);
99
- const currentExports = currentApiMembers.map((m) => m.displayName);
100
- it.each(currentExports)('should contain export: %s', (exportName) => {
101
- expect(newExports).toContain(exportName);
102
- });
103
- });
104
- });
105
- describe('Functions', () => {
106
- describe('should have all current functions exported in new', () => {
107
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
108
- const newFunctions = (0, helpers_1.getFunctions)(newApiMembers);
109
- const currentFunctions = (0, helpers_1.getFunctions)(currentApiMembers);
110
- const newFunctionNames = newFunctions.map((f) => f.name);
111
- for (const currentFunction of currentFunctions) {
112
- it(`should contain function: ${currentFunction.name}`, () => {
113
- expect(newFunctionNames).toContain(currentFunction.name);
114
- });
115
- }
116
- });
117
- describe('should verify function compatibility for each function', () => {
118
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
119
- const newFunctions = (0, helpers_1.getFunctions)(newApiMembers);
120
- const currentFunctions = (0, helpers_1.getFunctions)(currentApiMembers);
121
- for (const newFunction of newFunctions) {
122
- const currentFunction = currentFunctions.find((f) => f.name === newFunction.name);
123
- // Skip if function doesn't exist in current API
124
- if (!currentFunction) {
125
- continue;
126
- }
127
- checkFunctionCompatibility(newFunction, currentFunction);
128
- }
129
- // TODO: Check that optional promotion works only one way (no required parameters becoming optional, but optional parameters can become required)
130
- // TODO: Check that function overloads weren't removed
131
- // TODO: Verify that function parameter destructuring patterns maintain compatibility
132
- // TODO: Check that function parameter default values don't change in breaking ways
133
- });
134
- });
135
- describe('Classes', () => {
136
- describe('should verify class property counts and compatibility', () => {
137
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
138
- const newClasses = (0, helpers_1.getClasses)(newApiMembers);
139
- const currentClasses = (0, helpers_1.getClasses)(currentApiMembers);
140
- for (const newClass of newClasses) {
141
- const currentClass = currentClasses.find((c) => c.name === newClass.name);
142
- // Skip if class doesn't exist in current API
143
- if (!currentClass) {
144
- continue;
145
- }
146
- const newClassProperties = (0, helpers_1.getProperties)(newClass.members);
147
- const currentClassProperties = (0, helpers_1.getProperties)(currentClass.members);
148
- describe(`Class ${newClass.name} should have at least all public properties from the current class`, () => {
149
- const newPropertyNames = newClassProperties.map((p) => p.name);
150
- for (const currentProperty of currentClassProperties) {
151
- it(`should contain property: ${currentProperty.name}`, () => {
152
- expect(newPropertyNames).toContain(currentProperty.name);
153
- });
154
- }
155
- });
156
- describe(`Class ${newClass.name} should not have any optional properties that became required`, () => {
157
- for (const currentProperty of currentClassProperties) {
158
- it(`should not have optional property that became required: ${currentProperty.name}`, () => {
159
- const newProperty = newClassProperties.find((p) => p.name === currentProperty.name);
160
- if (newProperty && currentProperty.isOptional) {
161
- // If the current property was optional, the new property should also be optional
162
- expect(newProperty.isOptional).toBe(true);
163
- }
164
- });
165
- }
166
- });
167
- // Check property compatibility
168
- const oldProperties = currentClassProperties;
169
- const newProperties = newClassProperties;
170
- for (const newProperty of newProperties) {
171
- const currentProperty = oldProperties.find((p) => p.name === newProperty.name);
172
- // If the property is new, there's no need to check for compatibility
173
- if (!currentProperty) {
174
- continue;
175
- }
176
- it(`Class ${newClass.name} property ${newProperty.name} should have the same type as the current property`, () => {
177
- expect(newProperty.propertyTypeExcerpt.text).toEqual(currentProperty.propertyTypeExcerpt.text);
178
- });
179
- it(`Class ${newClass.name} property ${newProperty.name} should have the same optionality as the current property`, () => {
180
- expect(newProperty.isOptional).toEqual(currentProperty.isOptional);
181
- });
182
- }
183
- // Check constructor signature compatibility (same rules as functions)
184
- const currentMethod = (0, helpers_1.getConstructor)(currentClass.members);
185
- const newMethod = (0, helpers_1.getConstructor)(newClass.members);
186
- checkFunctionCompatibility(newMethod, currentMethod);
187
- // Check method count
188
- const newClassMethods = (0, helpers_1.getFunctions)(newClass.members);
189
- const currentClassMethods = (0, helpers_1.getFunctions)(currentClass.members);
190
- describe(`Class ${newClass.name} should export all public methods from the current class`, () => {
191
- const newMethodNames = newClassMethods.map((m) => m.name);
192
- for (const currentMethod of currentClassMethods) {
193
- it(`should contain method: ${currentMethod.name}`, () => {
194
- expect(newMethodNames).toContain(currentMethod.name);
195
- });
196
- }
197
- });
198
- // Check method compatibility (same rules as functions)
199
- // Make sure to allow optional parameters to be added to the end
200
- for (const newMethod of newClassMethods) {
201
- const currentMethod = currentClassMethods.find((m) => m.name === newMethod.name);
202
- // If the method is new, there's no need to check for compatibility
203
- if (!currentMethod) {
204
- continue;
205
- }
206
- checkFunctionCompatibility(newMethod, currentMethod);
207
- }
208
- // TODO: Verify class inheritance hierarchy hasn't changed in breaking ways
209
- // TODO: Check that class mixins maintain their composition behavior
210
- // TODO: Verify that abstract class methods remain abstract or are properly implemented
211
- }
212
- });
213
- });
214
- describe('Interfaces', () => {
215
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
216
- const newInterfaces = (0, helpers_1.getInterfaces)(newApiMembers);
217
- const currentInterfaces = (0, helpers_1.getInterfaces)(currentApiMembers);
218
- describe('should verify interface property counts and compatibility', () => {
219
- for (const newInterface of newInterfaces) {
220
- const currentInterface = currentInterfaces.find((i) => i.name === newInterface.name);
221
- if (!currentInterface) {
222
- continue;
223
- }
224
- const newInterfaceProperties = (0, helpers_1.getPropertySignatures)(newInterface.members);
225
- const currentInterfaceProperties = (0, helpers_1.getPropertySignatures)(currentInterface.members);
226
- it(`Interface ${newInterface.name} should have at least as many properties as the current interface`, () => {
227
- expect(newInterfaceProperties.length).toBeGreaterThanOrEqual(currentInterfaceProperties.length);
228
- });
229
- it(`Interface ${newInterface.name} should not have any optional properties that became required`, () => {
230
- const requiredProperties = newInterfaceProperties.filter((p) => !p.isOptional);
231
- expect(requiredProperties.length).toBeLessThanOrEqual(currentInterfaceProperties.filter((p) => !p.isOptional).length);
232
- });
233
- // Check property compatibility
234
- const oldProperties = currentInterfaceProperties;
235
- const newProperties = newInterfaceProperties;
236
- for (const newProperty of newProperties) {
237
- const currentProperty = oldProperties.find((p) => p.name === newProperty.name);
238
- // If the property is new, there's no need to check for compatibility
239
- if (!currentProperty) {
240
- continue;
241
- }
242
- it(`Interface ${newInterface.name} property ${newProperty.name} should have the same type as the current property`, () => {
243
- expect(newProperty.propertyTypeExcerpt.text).toEqual(currentProperty.propertyTypeExcerpt.text);
244
- });
245
- it(`Interface ${newInterface.name} property ${newProperty.name} should have not been made required if it was optional`, () => {
246
- // If the new property is required, it must have been required before.
247
- // Otherwise we break backwards-compatibility.
248
- expect(
249
- // If it was required before, it can be either now.
250
- !currentProperty.isOptional ||
251
- // If it was optional before, it can only be optional now.
252
- newProperty.isOptional).toEqual(true);
253
- });
254
- }
255
- // Check method count
256
- const newInterfaceMethods = (0, helpers_1.getMethodSignatures)(newInterface.members);
257
- const currentInterfaceMethods = (0, helpers_1.getMethodSignatures)(currentInterface.members);
258
- it(`Interface ${newInterface.name} should have at least as many public methods as the current interface`, () => {
259
- expect(newInterfaceMethods.length).toBeGreaterThanOrEqual(currentInterfaceMethods.length);
260
- });
261
- // Check method compatibility (same rules as functions)
262
- // Make sure to allow optional parameters to be added to the end
263
- for (const newMethod of newInterfaceMethods) {
264
- const currentMethod = currentInterfaceMethods.find((m) => m.name === newMethod.name);
265
- // If the method is new, there's no need to check for compatibility
266
- if (!currentMethod) {
267
- continue;
268
- }
269
- checkFunctionCompatibility(newMethod, currentMethod);
270
- }
271
- }
272
- });
273
- // TODO: Verify interface inheritance hierarchy hasn't changed
274
- // TODO: Check that interface merging behavior is preserved
275
- // TODO: Verify that interface index signatures maintain their key/value types
276
- });
277
- describe('Enums', () => {
278
- let newEnums;
279
- let currentEnums;
280
- describe('should verify enum value counts and existence', () => {
281
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
282
- newEnums = (0, helpers_1.getEnums)(newApiMembers);
283
- currentEnums = (0, helpers_1.getEnums)(currentApiMembers);
284
- // Verify no enum values were removed
285
- for (const newEnum of newEnums) {
286
- const currentEnum = currentEnums.find((e) => e.name === newEnum.name);
287
- // If it's a new enum, there's no need to check for compatibility
288
- if (!currentEnum) {
289
- continue;
290
- }
291
- const currentEnumValues = currentEnum.members;
292
- const newEnumValues = newEnum.members;
293
- it(`Enum ${newEnum.name} should have at least as many enum values as the current enum`, () => {
294
- expect(newEnumValues.length).toBeGreaterThanOrEqual(currentEnumValues.length);
295
- });
296
- for (const currentEnumValue of currentEnumValues) {
297
- const newEnumValue = newEnumValues.find((v) => v.name === currentEnumValue.name);
298
- // If it's a new enum value, there's no need to check for compatibility
299
- if (!newEnumValue) {
300
- continue;
301
- }
302
- it(`Enum ${newEnum.name} should contain enum value: ${currentEnumValue.name}`, () => {
303
- expect(newEnumValue).toBeDefined();
304
- });
305
- }
306
- }
307
- });
308
- // Verify numeric enum values haven't changed (if numeric enum)
309
- describe('should verify numeric enum values have not changed', () => {
310
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
311
- newEnums = (0, helpers_1.getEnums)(newApiMembers);
312
- currentEnums = (0, helpers_1.getEnums)(currentApiMembers);
313
- for (const newEnum of newEnums) {
314
- const currentEnum = currentEnums.find((e) => e.name === newEnum.name);
315
- // If it's a new enum, there's no need to check for compatibility
316
- if (!currentEnum) {
317
- continue;
318
- }
319
- // Helper function to determine if an enum is numeric based on its members' initializer values
320
- const isNumericEnum = (enumMembers) => {
321
- return enumMembers.every((member) => {
322
- var _a, _b, _c;
323
- // Check if the member has an initializer and if it's a numeric value
324
- const initializerText = (_c = (_b = (_a = member.excerptTokens) === null || _a === void 0 ? void 0 : _a.find((token) => token.kind === 'Content' && /^\d+$/.test(token.text.trim()))) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.trim();
325
- return (initializerText !== undefined && /^\d+$/.test(initializerText));
326
- });
327
- };
328
- const newEnumNumeric = isNumericEnum([...newEnum.members]);
329
- const currentEnumNumeric = isNumericEnum([...currentEnum.members]);
330
- it(`Enum ${newEnum.name} should have the same numeric type as the current enum`, () => {
331
- expect(newEnumNumeric).toBe(currentEnumNumeric);
332
- });
333
- const currentEnumValues = currentEnum.members;
334
- const newEnumValues = newEnum.members;
335
- it(`Enum ${newEnum.name} should have at least as many enum values as the current enum`, () => {
336
- expect(newEnumValues.length).toBeGreaterThanOrEqual(currentEnumValues.length);
337
- });
338
- for (const currentEnumValue of currentEnumValues) {
339
- const newEnumValue = newEnumValues.find((v) => v.name === currentEnumValue.name);
340
- // If it's not defined, an existing value is missing from the new enum
341
- it(`Enum ${newEnum.name} should contain enum value: ${currentEnumValue.name}`, () => {
342
- expect(newEnumValue).toBeDefined();
343
- });
344
- it(`Enum ${newEnum.name} should have the same value for enum member: ${currentEnumValue.name}`, () => {
345
- var _a, _b;
346
- // Both can be undefined, but they should always equal each other
347
- const newValue = (_a = newEnumValue.initializerExcerpt) === null || _a === void 0 ? void 0 : _a.text;
348
- const currentValue = (_b = currentEnumValue.initializerExcerpt) === null || _b === void 0 ? void 0 : _b.text;
349
- expect(newValue).toEqual(currentValue);
350
- });
351
- }
352
- }
353
- });
354
- // TODO: Check that new enum values were only added at the end (best practice)
355
- // TODO: Verify that const enums maintain their compile-time behavior
356
- // TODO: Check that enum member values don't change in breaking ways
357
- describe('should verify enum value types have been added to the end', () => {
358
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
359
- newEnums = (0, helpers_1.getEnums)(newApiMembers);
360
- currentEnums = (0, helpers_1.getEnums)(currentApiMembers);
361
- for (const newEnum of newEnums) {
362
- const currentEnum = currentEnums.find((e) => e.name === newEnum.name);
363
- // If it's a new enum, there's no need to check for compatibility
364
- if (!currentEnum) {
365
- continue;
366
- }
367
- const currentEnumValues = currentEnum.members.map((a) => a.name);
368
- const newEnumValues = newEnum.members
369
- .slice(0, currentEnumValues.length)
370
- .map((a) => a.name);
371
- // This might appear to not be working sometimes, but remember that the order of enum values is determined by the enum member key name
372
- it(`Enum ${newEnum.name} should have added new options to the end of the array`, () => {
373
- expect(newEnumValues).toStrictEqual(currentEnumValues);
374
- });
375
- }
376
- });
377
- });
378
- describe('Types', () => {
379
- const { newApiMembers, currentApiMembers } = (0, helpers_1.loadApiData)();
380
- const newTypes = (0, helpers_1.getTypes)(newApiMembers);
381
- const currentTypes = (0, helpers_1.getTypes)(currentApiMembers);
382
- // Verify type aliases weren't removed
383
- describe("should verify type aliases weren't removed", () => {
384
- for (const newType of newTypes) {
385
- const currentType = currentTypes.find((t) => t.name === newType.name);
386
- if (!currentType) {
387
- continue;
388
- }
389
- it(`Type ${newType.name} should not have been removed`, () => {
390
- expect(currentType).toBeDefined();
391
- });
392
- }
393
- });
394
- // Verify that the type alias is the same as the current type alias
395
- describe('should verify type aliases are the same as the current type aliases', () => {
396
- for (const newType of newTypes) {
397
- const currentType = currentTypes.find((t) => t.name === newType.name);
398
- if (!currentType) {
399
- continue;
400
- }
401
- it(`Type ${newType.name} should have the same type as the current type`, () => {
402
- // Replace all whitespace with an empty string to ignore whitespace differences
403
- expect(newType.typeExcerpt.text.replace(/\s/g, '')).toEqual(currentType.typeExcerpt.text.replace(/\s/g, ''));
404
- });
405
- }
406
- });
407
- // TODO: Verify union types didn't become more restrictive (no types removed from union)
408
- // TODO: Verify intersection types didn't become more permissive (no required types removed)
409
- // TODO: Check generic type parameter compatibility
410
- });
411
- describe('Method Signatures', () => {
412
- // TODO: Verify generic constraints haven't become more restrictive
413
- // TODO: Check that default parameter values are still compatible
414
- // TODO: Verify rest parameters (...args) compatibility
415
- // TODO: Check function signature overloads
416
- });
417
- describe('Generics', () => {
418
- // TODO: Verify generic type parameters weren't removed
419
- // TODO: Check that generic constraints didn't become more restrictive
420
- // TODO: Verify generic parameter names haven't changed (affects explicit type arguments)
421
- // TODO: Check variance compatibility (covariant/contravariant)
422
- });
423
- describe('Property Types', () => {
424
- // TODO: Check readonly properties didn't become mutable (or vice versa in breaking way)
425
- // TODO: Verify array types compatibility (T[] vs Array<T>)
426
- // TODO: Check Promise/async compatibility
427
- // TODO: Verify callback function signature compatibility
428
- });
429
- describe('Accessibility', () => {
430
- // TODO: Verify public members didn't become private/protected
431
- // TODO: Check that protected members didn't become private
432
- // TODO: Ensure no breaking changes in static vs instance members
433
- });
434
- afterAll(() => {
435
- // If there are any failures, don't update the current API baseline files
436
- if (failure) {
437
- return;
438
- }
439
- (0, helpers_1.updateCurrentApiJson)();
440
- });
441
- });