@superblocksteam/shared 0.9556.12 → 0.9558.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 (170) hide show
  1. package/README.md +1 -0
  2. package/dist/bindings/utils.test.js +4 -3
  3. package/dist/bindings/utils.test.js.map +1 -1
  4. package/dist/constants.test.js +22 -21
  5. package/dist/constants.test.js.map +1 -1
  6. package/dist/dbfs/hashing.d.ts +1 -1
  7. package/dist/dbfs/hashing.d.ts.map +1 -1
  8. package/dist/dbfs/hashing.js.map +1 -1
  9. package/dist/jwt/verifier.test.js +22 -21
  10. package/dist/jwt/verifier.test.js.map +1 -1
  11. package/dist/pageMigrations/migrations/v4to5.test.js +31 -30
  12. package/dist/pageMigrations/migrations/v4to5.test.js.map +1 -1
  13. package/dist/pageMigrations/migrations/v5to6.test.js +33 -32
  14. package/dist/pageMigrations/migrations/v5to6.test.js.map +1 -1
  15. package/dist/pageMigrations/migrations/v6to7/adjustModalCanvases.test.js +18 -17
  16. package/dist/pageMigrations/migrations/v6to7/adjustModalCanvases.test.js.map +1 -1
  17. package/dist/pageMigrations/migrations/v6to7/migrateToDimensions.test.js +28 -27
  18. package/dist/pageMigrations/migrations/v6to7/migrateToDimensions.test.js.map +1 -1
  19. package/dist/pageMigrations/migrations/v6to7/migrateToSections.test.js +22 -21
  20. package/dist/pageMigrations/migrations/v6to7/migrateToSections.test.js.map +1 -1
  21. package/dist/pageMigrations/migrations/v6to7/v6to7.test.js +19 -18
  22. package/dist/pageMigrations/migrations/v6to7/v6to7.test.js.map +1 -1
  23. package/dist/pageMigrations/migrations/v7to8.test.js +22 -21
  24. package/dist/pageMigrations/migrations/v7to8.test.js.map +1 -1
  25. package/dist/plugins/templates/s3.d.ts.map +1 -1
  26. package/dist/plugins/templates/s3.js +24 -0
  27. package/dist/plugins/templates/s3.js.map +1 -1
  28. package/dist/refactoring/refactor.test.js +35 -34
  29. package/dist/refactoring/refactor.test.js.map +1 -1
  30. package/dist/signing/JSON/index.test.js +17 -16
  31. package/dist/signing/JSON/index.test.js.map +1 -1
  32. package/dist/signing/hashing.d.ts.map +1 -1
  33. package/dist/signing/hashing.js.map +1 -1
  34. package/dist/signing/hashing.test.js +18 -17
  35. package/dist/signing/hashing.test.js.map +1 -1
  36. package/dist/signing/index.test.js +22 -21
  37. package/dist/signing/index.test.js.map +1 -1
  38. package/dist/tracing/errorSanitizer.test.js +80 -79
  39. package/dist/tracing/errorSanitizer.test.js.map +1 -1
  40. package/dist/types/api/action.d.ts +5 -1
  41. package/dist/types/api/action.d.ts.map +1 -1
  42. package/dist/types/api/action.js.map +1 -1
  43. package/dist/types/common/file.test.js +10 -9
  44. package/dist/types/common/file.test.js.map +1 -1
  45. package/dist/types/datasource/index.test.js +80 -79
  46. package/dist/types/datasource/index.test.js.map +1 -1
  47. package/dist/types/organization/agent.test.js +37 -36
  48. package/dist/types/organization/agent.test.js.map +1 -1
  49. package/dist/types/page/Dimension.test.js +82 -81
  50. package/dist/types/page/Dimension.test.js.map +1 -1
  51. package/dist/utils/apiv2.test.js +37 -37
  52. package/dist/utils/apiv2.test.js.map +1 -1
  53. package/dist/utils/configuration.test.js +10 -9
  54. package/dist/utils/configuration.test.js.map +1 -1
  55. package/dist/utils/env.test.js +13 -12
  56. package/dist/utils/env.test.js.map +1 -1
  57. package/dist/utils/environment.test.js +16 -15
  58. package/dist/utils/environment.test.js.map +1 -1
  59. package/dist/utils/page.test.js +8 -7
  60. package/dist/utils/page.test.js.map +1 -1
  61. package/dist/utils/string.test.js +24 -23
  62. package/dist/utils/string.test.js.map +1 -1
  63. package/dist/utils/tracedEventEmitter.test.js +8 -7
  64. package/dist/utils/tracedEventEmitter.test.js.map +1 -1
  65. package/dist/utils/truncate.test.js +9 -8
  66. package/dist/utils/truncate.test.js.map +1 -1
  67. package/dist/utils/url.test.js +52 -51
  68. package/dist/utils/url.test.js.map +1 -1
  69. package/dist-esm/bindings/utils.test.js +1 -0
  70. package/dist-esm/bindings/utils.test.js.map +1 -1
  71. package/dist-esm/constants.test.js +1 -0
  72. package/dist-esm/constants.test.js.map +1 -1
  73. package/dist-esm/dbfs/hashing.d.ts +1 -1
  74. package/dist-esm/dbfs/hashing.d.ts.map +1 -1
  75. package/dist-esm/dbfs/hashing.js.map +1 -1
  76. package/dist-esm/jwt/verifier.test.js +2 -1
  77. package/dist-esm/jwt/verifier.test.js.map +1 -1
  78. package/dist-esm/pageMigrations/migrations/v4to5.test.js +1 -0
  79. package/dist-esm/pageMigrations/migrations/v4to5.test.js.map +1 -1
  80. package/dist-esm/pageMigrations/migrations/v5to6.test.js +1 -0
  81. package/dist-esm/pageMigrations/migrations/v5to6.test.js.map +1 -1
  82. package/dist-esm/pageMigrations/migrations/v6to7/adjustModalCanvases.test.js +1 -0
  83. package/dist-esm/pageMigrations/migrations/v6to7/adjustModalCanvases.test.js.map +1 -1
  84. package/dist-esm/pageMigrations/migrations/v6to7/migrateToDimensions.test.js +1 -0
  85. package/dist-esm/pageMigrations/migrations/v6to7/migrateToDimensions.test.js.map +1 -1
  86. package/dist-esm/pageMigrations/migrations/v6to7/migrateToSections.test.js +1 -0
  87. package/dist-esm/pageMigrations/migrations/v6to7/migrateToSections.test.js.map +1 -1
  88. package/dist-esm/pageMigrations/migrations/v6to7/v6to7.test.js +1 -0
  89. package/dist-esm/pageMigrations/migrations/v6to7/v6to7.test.js.map +1 -1
  90. package/dist-esm/pageMigrations/migrations/v7to8.test.js +1 -0
  91. package/dist-esm/pageMigrations/migrations/v7to8.test.js.map +1 -1
  92. package/dist-esm/plugins/templates/s3.d.ts.map +1 -1
  93. package/dist-esm/plugins/templates/s3.js +24 -0
  94. package/dist-esm/plugins/templates/s3.js.map +1 -1
  95. package/dist-esm/refactoring/refactor.test.js +1 -0
  96. package/dist-esm/refactoring/refactor.test.js.map +1 -1
  97. package/dist-esm/signing/JSON/index.test.js +1 -0
  98. package/dist-esm/signing/JSON/index.test.js.map +1 -1
  99. package/dist-esm/signing/hashing.d.ts.map +1 -1
  100. package/dist-esm/signing/hashing.js.map +1 -1
  101. package/dist-esm/signing/hashing.test.js +1 -0
  102. package/dist-esm/signing/hashing.test.js.map +1 -1
  103. package/dist-esm/signing/index.test.js +1 -0
  104. package/dist-esm/signing/index.test.js.map +1 -1
  105. package/dist-esm/tracing/errorSanitizer.test.js +1 -0
  106. package/dist-esm/tracing/errorSanitizer.test.js.map +1 -1
  107. package/dist-esm/types/api/action.d.ts +5 -1
  108. package/dist-esm/types/api/action.d.ts.map +1 -1
  109. package/dist-esm/types/api/action.js.map +1 -1
  110. package/dist-esm/types/common/file.test.js +1 -0
  111. package/dist-esm/types/common/file.test.js.map +1 -1
  112. package/dist-esm/types/datasource/index.test.js +1 -0
  113. package/dist-esm/types/datasource/index.test.js.map +1 -1
  114. package/dist-esm/types/organization/agent.test.js +2 -1
  115. package/dist-esm/types/organization/agent.test.js.map +1 -1
  116. package/dist-esm/types/page/Dimension.test.js +1 -0
  117. package/dist-esm/types/page/Dimension.test.js.map +1 -1
  118. package/dist-esm/utils/apiv2.test.js +3 -3
  119. package/dist-esm/utils/apiv2.test.js.map +1 -1
  120. package/dist-esm/utils/configuration.test.js +1 -0
  121. package/dist-esm/utils/configuration.test.js.map +1 -1
  122. package/dist-esm/utils/env.test.js +1 -0
  123. package/dist-esm/utils/env.test.js.map +1 -1
  124. package/dist-esm/utils/environment.test.js +1 -0
  125. package/dist-esm/utils/environment.test.js.map +1 -1
  126. package/dist-esm/utils/page.test.js +1 -0
  127. package/dist-esm/utils/page.test.js.map +1 -1
  128. package/dist-esm/utils/string.test.js +1 -0
  129. package/dist-esm/utils/string.test.js.map +1 -1
  130. package/dist-esm/utils/tracedEventEmitter.test.js +2 -1
  131. package/dist-esm/utils/tracedEventEmitter.test.js.map +1 -1
  132. package/dist-esm/utils/truncate.test.js +1 -0
  133. package/dist-esm/utils/truncate.test.js.map +1 -1
  134. package/dist-esm/utils/url.test.js +1 -0
  135. package/dist-esm/utils/url.test.js.map +1 -1
  136. package/package.json +11 -19
  137. package/src/bindings/utils.test.ts +1 -0
  138. package/src/constants.test.ts +1 -0
  139. package/src/dbfs/hashing.ts +1 -1
  140. package/src/jwt/verifier.test.ts +3 -2
  141. package/src/pageMigrations/migrations/v4to5.test.ts +1 -0
  142. package/src/pageMigrations/migrations/v5to6.test.ts +1 -0
  143. package/src/pageMigrations/migrations/v6to7/__snapshots__/v6to7.test.ts.snap +7 -7
  144. package/src/pageMigrations/migrations/v6to7/adjustModalCanvases.test.ts +1 -0
  145. package/src/pageMigrations/migrations/v6to7/migrateToDimensions.test.ts +1 -0
  146. package/src/pageMigrations/migrations/v6to7/migrateToSections.test.ts +1 -0
  147. package/src/pageMigrations/migrations/v6to7/v6to7.test.ts +1 -0
  148. package/src/pageMigrations/migrations/v7to8.test.ts +1 -0
  149. package/src/plugins/templates/s3.ts +24 -0
  150. package/src/refactoring/refactor.test.ts +1 -0
  151. package/src/signing/JSON/index.test.ts +1 -0
  152. package/src/signing/hashing.test.ts +1 -0
  153. package/src/signing/hashing.ts +1 -1
  154. package/src/signing/index.test.ts +1 -0
  155. package/src/tracing/errorSanitizer.test.ts +1 -0
  156. package/src/types/api/action.ts +5 -1
  157. package/src/types/common/file.test.ts +1 -0
  158. package/src/types/datasource/index.test.ts +1 -0
  159. package/src/types/organization/agent.test.ts +2 -1
  160. package/src/types/page/Dimension.test.ts +1 -0
  161. package/src/utils/__snapshots__/page.test.ts.snap +5 -5
  162. package/src/utils/apiv2.test.ts +3 -3
  163. package/src/utils/configuration.test.ts +1 -0
  164. package/src/utils/env.test.ts +1 -0
  165. package/src/utils/environment.test.ts +1 -0
  166. package/src/utils/page.test.ts +1 -0
  167. package/src/utils/string.test.ts +1 -0
  168. package/src/utils/tracedEventEmitter.test.ts +3 -2
  169. package/src/utils/truncate.test.ts +1 -0
  170. package/src/utils/url.test.ts +1 -0
@@ -1,4 +1,5 @@
1
1
  import { tokenize } from 'esprima';
2
+ import { describe, it, expect } from 'vitest';
2
3
  import { EvaluationPair, extractJsEvaluationPairsWithTokenizer, LanguagePluginID } from '../types/index.js';
3
4
  import { refactorNameInCode, refactorNameInString, refactorNameInValue, refactorNameInStep } from './refactor.js';
4
5
 
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { stableJSONStringify_fast } from './fast.js';
2
3
  import { stableJSONStringify_portable } from './portable.js';
3
4
  import { stableJSONStringify, testStringOut, testStringSrc } from '.';
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from 'vitest';
1
2
  import { sha256Base64 } from './hashing.js';
2
3
 
3
4
  describe('hashing', () => {
@@ -1,5 +1,5 @@
1
- import { Base64 } from 'js-base64';
2
1
  import { BufferSource } from 'node:stream/web';
2
+ import { Base64 } from 'js-base64';
3
3
 
4
4
  // This module is used by the FE and the BE, so it must be compatible with both.
5
5
  // For both sides, we are using the Web Crypto API. This API is supported by all modern browsers, and
@@ -1,4 +1,5 @@
1
1
  import { UtilsV1 as UtilsV1Pb } from '@superblocksteam/types';
2
+ import { describe, it, expect } from 'vitest';
2
3
  import { AnyPageDSL, ApplicationConfiguration, ApplicationSettings } from '../types/index.js';
3
4
  import {
4
5
  ApplicationSignatureTreeV1,
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from 'vitest';
1
2
  import { sanitizeError } from './errorSanitizer.js';
2
3
 
3
4
  describe('Error Sanitization', () => {
@@ -300,7 +300,11 @@ export type S3ActionConfiguration = {
300
300
  path?: string;
301
301
  body?: string;
302
302
  fileObjects?: unknown;
303
- custom?: CustomProperties;
303
+ custom?: {
304
+ /** Enum name for presigned URL method */
305
+ presignedMethod?: 'PRESIGNED_METHOD_UNSPECIFIED' | 'PRESIGNED_METHOD_GET' | 'PRESIGNED_METHOD_PUT';
306
+ presignedExpiration?: Property;
307
+ };
304
308
  responseType?: ActionResponseType;
305
309
  listFilesConfig?: {
306
310
  // Limits the response to keys that begin with the specified prefix.
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { isReadableFileConstructor } from './file.js';
2
3
 
3
4
  describe('is readable file constructor', () => {
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { IntegrationAuthType } from './auth.js';
2
3
  import {
3
4
  DatasourceConfiguration,
@@ -1,6 +1,7 @@
1
+ import { describe, it, expect } from 'vitest';
1
2
  import { compareSemVer } from './agent.js';
2
3
 
3
- describe.only('compareSemver', () => {
4
+ describe('compareSemver', () => {
4
5
  it('should throw error is one of the versions is a number', () => {
5
6
  // @ts-ignore
6
7
  expect(() => compareSemVer('1.2.3', 1)).toThrowError('Invalid semver 1.');
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from 'vitest';
1
2
  import { Dimension } from './Dimension.js';
2
3
 
3
4
  describe('Dimension math functions', () => {
@@ -1,6 +1,6 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`page.ts getDefaultLayout snapshot 5: 5 1`] = `
3
+ exports[`page.ts > getDefaultLayout snapshot 5 > 5 1`] = `
4
4
  {
5
5
  "backgroundColor": "none",
6
6
  "bottomRow": 99,
@@ -20,7 +20,7 @@ exports[`page.ts getDefaultLayout snapshot 5: 5 1`] = `
20
20
  }
21
21
  `;
22
22
 
23
- exports[`page.ts getDefaultLayout snapshot 6: 6 1`] = `
23
+ exports[`page.ts > getDefaultLayout snapshot 6 > 6 1`] = `
24
24
  {
25
25
  "backgroundColor": "none",
26
26
  "bottomRow": 99,
@@ -40,7 +40,7 @@ exports[`page.ts getDefaultLayout snapshot 6: 6 1`] = `
40
40
  }
41
41
  `;
42
42
 
43
- exports[`page.ts getDefaultLayout snapshot 7: 7 1`] = `
43
+ exports[`page.ts > getDefaultLayout snapshot 7 > 7 1`] = `
44
44
  {
45
45
  "apis": {
46
46
  "apiMap": {},
@@ -167,7 +167,7 @@ exports[`page.ts getDefaultLayout snapshot 7: 7 1`] = `
167
167
  }
168
168
  `;
169
169
 
170
- exports[`page.ts getDefaultLayout snapshot 8: 8 1`] = `
170
+ exports[`page.ts > getDefaultLayout snapshot 8 > 8 1`] = `
171
171
  {
172
172
  "apis": {
173
173
  "apiMap": {},
@@ -1,6 +1,7 @@
1
1
  import { JsonValue } from '@bufbuild/protobuf';
2
2
  import { Api } from '@superblocksteam/types';
3
3
  import { cloneDeep } from 'lodash';
4
+ import { describe, it, expect } from 'vitest';
4
5
  import { sanitizeV2RequestBody } from './apiv2.js';
5
6
 
6
7
  describe('sanitizeV2RequestBody', () => {
@@ -82,7 +83,7 @@ describe('sanitizeV2RequestBody', () => {
82
83
  expect(sanitizeV2RequestBody(apiBody)).toEqual(sanitizedApiBody);
83
84
  });
84
85
 
85
- it('is able to sanitize null values in DSL', () => {
86
+ it('is able to sanitize null values in DSL', async () => {
86
87
  // api that has some null values.
87
88
  // protobuf does not support null values, so we need to convert them to ValuePb.fromJson(null)
88
89
  const apiBody = {
@@ -151,8 +152,7 @@ describe('sanitizeV2RequestBody', () => {
151
152
  return Api.fromJson(apiBody, { ignoreUnknownFields: true });
152
153
  }
153
154
  // the initial conversion should fail because of the null values
154
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
155
- expect(toApiPbIgnoreUnknownFields()).rejects.toThrow(
155
+ await expect(toApiPbIgnoreUnknownFields()).rejects.toThrow(
156
156
  'cannot decode field api.v1.Trigger.Workflow.Parameters.body from JSON: map value null'
157
157
  );
158
158
  const sanitizedApiBody = sanitizeV2RequestBody(apiBody) as JsonValue;
@@ -1,4 +1,5 @@
1
1
  import { cloneDeep } from 'lodash';
2
+ import { describe, test, expect } from 'vitest';
2
3
  import { PostgresPlugin, RestApiIntegrationPlugin } from '../plugins/index.js';
3
4
  import { PostgresDatasourceConfiguration, Property, RestApiDatasourceConfiguration } from '../types/index.js';
4
5
  import { MASKED_SECRET, maskSecrets, unmaskSecrets } from './configuration.js';
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { InvalidConfigurationError } from '../errors/index.js';
2
3
  import { EnvStore } from './env.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { BadRequestError } from '../errors/index.js';
2
3
  import { DatasourceEnvironments, ENVIRONMENT_ALL, ENVIRONMENT_PRODUCTION, ENVIRONMENT_STAGING } from '../types/index.js';
3
4
  import { checkEnvironment, getDefaultDatasourceEnvironment, getDefaultEnvironment } from './environment.js';
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { defaultPageLayouts } from './page.js';
2
3
 
3
4
  describe('page.ts', () => {
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { camelCaseToDisplay, getNextEntityName, validateEmail } from './string.js';
2
3
 
3
4
  describe('camel case to display', () => {
@@ -1,4 +1,5 @@
1
1
  import { trace, Tracer } from '@opentelemetry/api';
2
+ import { vi, describe, it, expect, beforeEach, type MockInstance } from 'vitest';
2
3
  import { TracedEventEmitter } from './tracedEventEmitter.js';
3
4
 
4
5
  type EventMap = {
@@ -10,7 +11,7 @@ class TestEmitter extends TracedEventEmitter<EventMap> {}
10
11
  describe('TracedEventEmitter', () => {
11
12
  let counter: number;
12
13
  let listenerFn: (path: string, content: string, bool: boolean) => void;
13
- let startActiveSpanSpy: jest.SpyInstance;
14
+ let startActiveSpanSpy: MockInstance;
14
15
  let tracer: Tracer;
15
16
  let calledWith: [path: string, content: string, bool: boolean][];
16
17
 
@@ -19,7 +20,7 @@ describe('TracedEventEmitter', () => {
19
20
  calledWith = [];
20
21
  // using the real tracer to ensure that things work in reality
21
22
  tracer = trace.getTracer('superblocks-test', 'v0');
22
- startActiveSpanSpy = jest.spyOn(tracer, 'startActiveSpan');
23
+ startActiveSpanSpy = vi.spyOn(tracer, 'startActiveSpan');
23
24
 
24
25
  listenerFn = function (a, b, c) {
25
26
  calledWith.push([a, b, c]);
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { truncatedJsonStringify } from './truncate.js';
2
3
 
3
4
  describe('truncate json', () => {
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from 'vitest';
1
2
  import { Property, RestApiBodyDataType } from '../types/index.js';
2
3
  import {
3
4
  appendParam,