@keboola/api-fixtures 26.0.0 → 28.0.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.
- package/AGENTS.md +13 -7
- package/CHANGELOG.md +46 -0
- package/dist/index.cjs +162 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -8
- package/dist/index.d.ts +90 -8
- package/dist/index.js +159 -17
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { App, AppRun, Deployment } from "@keboola/api-client/apps/types";
|
|
2
2
|
import { AdminVendor, App as App$1, AppChange, ServiceAccount, User, Vendor, VendorListItem } from "@keboola/api-client/developerPortal/types";
|
|
3
|
-
import {
|
|
3
|
+
import { ServiceId } from "@keboola/api-client/constants";
|
|
4
|
+
import { DevBranch, StackInfo, StorageToken, Table, TableDetail } from "@keboola/api-client/storage/types";
|
|
4
5
|
//#region src/clients/apps/apps.d.ts
|
|
5
6
|
declare const appFixtures: {
|
|
6
7
|
neverDeployed: {
|
|
@@ -649,19 +650,65 @@ declare const developerPortalFixtures: {
|
|
|
649
650
|
};
|
|
650
651
|
};
|
|
651
652
|
//#endregion
|
|
653
|
+
//#region src/clients/storage/bootstrap.d.ts
|
|
654
|
+
/** The stack an MSW-backed test points its client at, unless a caller passes its own. */
|
|
655
|
+
declare const DEFAULT_BASE_URL = "https://connection.test";
|
|
656
|
+
type StackInfoOptions = {
|
|
657
|
+
/** Stack the fixture describes; its host is what the announced service URLs are built on. */
|
|
658
|
+
baseUrl?: string;
|
|
659
|
+
/** Services the stack announces. Narrow it to test what a client does without one. */
|
|
660
|
+
services?: ServiceId[];
|
|
661
|
+
};
|
|
662
|
+
type StorageTokenOptions = {
|
|
663
|
+
/** Stack the token was issued by — its `uri`. */
|
|
664
|
+
baseUrl?: string;
|
|
665
|
+
/** Project features `hasFeature()` should report — the token's `owner.features`. */
|
|
666
|
+
features?: string[];
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* The stack index `GET /v2/storage` returns.
|
|
670
|
+
*
|
|
671
|
+
* - Announces every `ServiceId` by default, each on its own host, so no service client is a dummy
|
|
672
|
+
* that throws `ServiceUnavailableError` — a test for a queue / data-science / vault hook only
|
|
673
|
+
* adds its handler.
|
|
674
|
+
* - Defaulting to `Object.values(ServiceId)` is what keeps that exhaustive: a service added to the
|
|
675
|
+
* client arrives here without an edit.
|
|
676
|
+
*/
|
|
677
|
+
declare const getStackInfo: ({ baseUrl, services }?: StackInfoOptions) => StackInfo;
|
|
678
|
+
/**
|
|
679
|
+
* The verified master token `GET /v2/storage/tokens/verify` returns.
|
|
680
|
+
*
|
|
681
|
+
* - Complete on purpose: `api.context.project.sapiToken` is this object verbatim and hooks read deep
|
|
682
|
+
* into it (`owner.id`, `admin.role`, `adminOwner.email`), so a partial body surfaces as
|
|
683
|
+
* `undefined`s far from the test that caused them.
|
|
684
|
+
* - Every permission flag is granted; a test needing a restricted token overrides the handler.
|
|
685
|
+
*/
|
|
686
|
+
declare const verifyStorageToken: ({ baseUrl, features }?: StorageTokenOptions) => StorageToken;
|
|
687
|
+
/**
|
|
688
|
+
* The branch list `GET /v2/storage/dev-branches` returns — the default branch alone.
|
|
689
|
+
*
|
|
690
|
+
* - `context.defaultBranch` is read off it, so the entry must stay `isDefault: true`.
|
|
691
|
+
* - The default branch has no creator, which `DevBranch` models as an empty `creatorToken`.
|
|
692
|
+
*/
|
|
693
|
+
declare const getDevBranches: () => DevBranch[];
|
|
694
|
+
//#endregion
|
|
652
695
|
//#region src/clients/storage/tables.d.ts
|
|
653
696
|
/**
|
|
654
|
-
* Returns a single
|
|
697
|
+
* Returns a single non-typed, non-alias `TableDetail` (fresh, no imports yet).
|
|
655
698
|
*
|
|
656
|
-
* The explicit return type
|
|
657
|
-
*
|
|
699
|
+
* The explicit return type surfaces any divergence from the hand-written `TableDetail` in
|
|
700
|
+
* `@keboola/api-client` as a TypeScript error. That type is not derived from the OpenAPI
|
|
701
|
+
* document, so this annotation and the `satisfies` above are the only mechanical check there is.
|
|
658
702
|
*/
|
|
659
703
|
declare const getTable: () => TableDetail;
|
|
660
704
|
/**
|
|
661
705
|
* Returns three TableDetail objects representing different lifecycle states:
|
|
662
|
-
* 1. Fresh — just created,
|
|
663
|
-
* 2. Recently updated —
|
|
664
|
-
* 3. Large —
|
|
706
|
+
* 1. Fresh — just created, nothing loaded (`lastImportDate: null`, `rowsCount: 0`).
|
|
707
|
+
* 2. Recently updated — 24 500 rows, imported June 2024.
|
|
708
|
+
* 3. Large — 125 500 rows, imported March 2024.
|
|
709
|
+
*
|
|
710
|
+
* The three row counts add up to the shared bucket's own `rowsCount`, and the bucket's
|
|
711
|
+
* `lastChangeDate` is the newest of theirs, as Storage reports it.
|
|
665
712
|
*/
|
|
666
713
|
declare const listTables: () => TableDetail[];
|
|
667
714
|
/**
|
|
@@ -702,9 +749,14 @@ declare const tableFixtures: {
|
|
|
702
749
|
path: string;
|
|
703
750
|
tables: string;
|
|
704
751
|
updated: string;
|
|
752
|
+
isLinkedBucket: boolean;
|
|
753
|
+
bucketSharingAllowed: boolean;
|
|
705
754
|
};
|
|
706
755
|
isTyped: false;
|
|
707
756
|
isAlias: false;
|
|
757
|
+
lastImportDate: null;
|
|
758
|
+
lastChangeDate: null;
|
|
759
|
+
rowsCount: number;
|
|
708
760
|
};
|
|
709
761
|
recentlyUpdated: {
|
|
710
762
|
id: string;
|
|
@@ -754,9 +806,14 @@ declare const tableFixtures: {
|
|
|
754
806
|
path: string;
|
|
755
807
|
tables: string;
|
|
756
808
|
updated: string;
|
|
809
|
+
isLinkedBucket: boolean;
|
|
810
|
+
bucketSharingAllowed: boolean;
|
|
757
811
|
};
|
|
758
812
|
isTyped: false;
|
|
759
813
|
isAlias: false;
|
|
814
|
+
lastImportDate: string;
|
|
815
|
+
lastChangeDate: string;
|
|
816
|
+
rowsCount: number;
|
|
760
817
|
};
|
|
761
818
|
large: {
|
|
762
819
|
id: string;
|
|
@@ -792,15 +849,25 @@ declare const tableFixtures: {
|
|
|
792
849
|
path: string;
|
|
793
850
|
tables: string;
|
|
794
851
|
updated: string;
|
|
852
|
+
isLinkedBucket: boolean;
|
|
853
|
+
bucketSharingAllowed: boolean;
|
|
795
854
|
};
|
|
796
855
|
isTyped: false;
|
|
797
856
|
isAlias: false;
|
|
857
|
+
lastImportDate: string;
|
|
858
|
+
lastChangeDate: string;
|
|
859
|
+
rowsCount: number;
|
|
798
860
|
};
|
|
799
861
|
};
|
|
800
862
|
//#endregion
|
|
801
863
|
//#region src/fixtures.d.ts
|
|
802
864
|
declare const fixtures: {
|
|
803
865
|
storage: {
|
|
866
|
+
bootstrap: {
|
|
867
|
+
getStackInfo: typeof getStackInfo;
|
|
868
|
+
verifyStorageToken: typeof verifyStorageToken;
|
|
869
|
+
getDevBranches: typeof getDevBranches;
|
|
870
|
+
};
|
|
804
871
|
tables: {
|
|
805
872
|
getTable: typeof getTable;
|
|
806
873
|
listTables: typeof listTables;
|
|
@@ -839,9 +906,14 @@ declare const fixtures: {
|
|
|
839
906
|
path: string;
|
|
840
907
|
tables: string;
|
|
841
908
|
updated: string;
|
|
909
|
+
isLinkedBucket: boolean;
|
|
910
|
+
bucketSharingAllowed: boolean;
|
|
842
911
|
};
|
|
843
912
|
isTyped: false;
|
|
844
913
|
isAlias: false;
|
|
914
|
+
lastImportDate: null;
|
|
915
|
+
lastChangeDate: null;
|
|
916
|
+
rowsCount: number;
|
|
845
917
|
};
|
|
846
918
|
recentlyUpdated: {
|
|
847
919
|
id: string;
|
|
@@ -891,9 +963,14 @@ declare const fixtures: {
|
|
|
891
963
|
path: string;
|
|
892
964
|
tables: string;
|
|
893
965
|
updated: string;
|
|
966
|
+
isLinkedBucket: boolean;
|
|
967
|
+
bucketSharingAllowed: boolean;
|
|
894
968
|
};
|
|
895
969
|
isTyped: false;
|
|
896
970
|
isAlias: false;
|
|
971
|
+
lastImportDate: string;
|
|
972
|
+
lastChangeDate: string;
|
|
973
|
+
rowsCount: number;
|
|
897
974
|
};
|
|
898
975
|
large: {
|
|
899
976
|
id: string;
|
|
@@ -929,9 +1006,14 @@ declare const fixtures: {
|
|
|
929
1006
|
path: string;
|
|
930
1007
|
tables: string;
|
|
931
1008
|
updated: string;
|
|
1009
|
+
isLinkedBucket: boolean;
|
|
1010
|
+
bucketSharingAllowed: boolean;
|
|
932
1011
|
};
|
|
933
1012
|
isTyped: false;
|
|
934
1013
|
isAlias: false;
|
|
1014
|
+
lastImportDate: string;
|
|
1015
|
+
lastChangeDate: string;
|
|
1016
|
+
rowsCount: number;
|
|
935
1017
|
};
|
|
936
1018
|
};
|
|
937
1019
|
};
|
|
@@ -1564,5 +1646,5 @@ declare const fixtures: {
|
|
|
1564
1646
|
};
|
|
1565
1647
|
};
|
|
1566
1648
|
//#endregion
|
|
1567
|
-
export { type Table, type TableDetail, appFixtures, deploymentFixtures, developerPortalFixtures, fixtures, getApp, getAppRun, getDeployment, getTable, getVendor, listAllApps, listAllVendors, listAppChanges, listAppRuns, listApps, listDeployments, listPublishedApps, listServiceAccounts, listTables, listUsers, listVendorApps, listVendors, runFixtures, tableFixtures };
|
|
1649
|
+
export { DEFAULT_BASE_URL, type Table, type TableDetail, appFixtures, deploymentFixtures, developerPortalFixtures, fixtures, getApp, getAppRun, getDeployment, getDevBranches, getStackInfo, getTable, getVendor, listAllApps, listAllVendors, listAppChanges, listAppRuns, listApps, listDeployments, listPublishedApps, listServiceAccounts, listTables, listUsers, listVendorApps, listVendors, runFixtures, tableFixtures, verifyStorageToken };
|
|
1568
1650
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ServiceId } from "@keboola/api-client/constants";
|
|
1
2
|
import { App, AppRun, Deployment } from "@keboola/api-client/apps/types";
|
|
2
3
|
import { AdminVendor, App as App$1, AppChange, ServiceAccount, User, Vendor, VendorListItem } from "@keboola/api-client/developerPortal/types";
|
|
3
|
-
import { Table, TableDetail } from "@keboola/api-client/storage/types";
|
|
4
|
+
import { DevBranch, StackInfo, StorageToken, Table, TableDetail } from "@keboola/api-client/storage/types";
|
|
4
5
|
//#region src/clients/apps/apps.d.ts
|
|
5
6
|
declare const appFixtures: {
|
|
6
7
|
neverDeployed: {
|
|
@@ -649,19 +650,65 @@ declare const developerPortalFixtures: {
|
|
|
649
650
|
};
|
|
650
651
|
};
|
|
651
652
|
//#endregion
|
|
653
|
+
//#region src/clients/storage/bootstrap.d.ts
|
|
654
|
+
/** The stack an MSW-backed test points its client at, unless a caller passes its own. */
|
|
655
|
+
declare const DEFAULT_BASE_URL = "https://connection.test";
|
|
656
|
+
type StackInfoOptions = {
|
|
657
|
+
/** Stack the fixture describes; its host is what the announced service URLs are built on. */
|
|
658
|
+
baseUrl?: string;
|
|
659
|
+
/** Services the stack announces. Narrow it to test what a client does without one. */
|
|
660
|
+
services?: ServiceId[];
|
|
661
|
+
};
|
|
662
|
+
type StorageTokenOptions = {
|
|
663
|
+
/** Stack the token was issued by — its `uri`. */
|
|
664
|
+
baseUrl?: string;
|
|
665
|
+
/** Project features `hasFeature()` should report — the token's `owner.features`. */
|
|
666
|
+
features?: string[];
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* The stack index `GET /v2/storage` returns.
|
|
670
|
+
*
|
|
671
|
+
* - Announces every `ServiceId` by default, each on its own host, so no service client is a dummy
|
|
672
|
+
* that throws `ServiceUnavailableError` — a test for a queue / data-science / vault hook only
|
|
673
|
+
* adds its handler.
|
|
674
|
+
* - Defaulting to `Object.values(ServiceId)` is what keeps that exhaustive: a service added to the
|
|
675
|
+
* client arrives here without an edit.
|
|
676
|
+
*/
|
|
677
|
+
declare const getStackInfo: ({ baseUrl, services }?: StackInfoOptions) => StackInfo;
|
|
678
|
+
/**
|
|
679
|
+
* The verified master token `GET /v2/storage/tokens/verify` returns.
|
|
680
|
+
*
|
|
681
|
+
* - Complete on purpose: `api.context.project.sapiToken` is this object verbatim and hooks read deep
|
|
682
|
+
* into it (`owner.id`, `admin.role`, `adminOwner.email`), so a partial body surfaces as
|
|
683
|
+
* `undefined`s far from the test that caused them.
|
|
684
|
+
* - Every permission flag is granted; a test needing a restricted token overrides the handler.
|
|
685
|
+
*/
|
|
686
|
+
declare const verifyStorageToken: ({ baseUrl, features }?: StorageTokenOptions) => StorageToken;
|
|
687
|
+
/**
|
|
688
|
+
* The branch list `GET /v2/storage/dev-branches` returns — the default branch alone.
|
|
689
|
+
*
|
|
690
|
+
* - `context.defaultBranch` is read off it, so the entry must stay `isDefault: true`.
|
|
691
|
+
* - The default branch has no creator, which `DevBranch` models as an empty `creatorToken`.
|
|
692
|
+
*/
|
|
693
|
+
declare const getDevBranches: () => DevBranch[];
|
|
694
|
+
//#endregion
|
|
652
695
|
//#region src/clients/storage/tables.d.ts
|
|
653
696
|
/**
|
|
654
|
-
* Returns a single
|
|
697
|
+
* Returns a single non-typed, non-alias `TableDetail` (fresh, no imports yet).
|
|
655
698
|
*
|
|
656
|
-
* The explicit return type
|
|
657
|
-
*
|
|
699
|
+
* The explicit return type surfaces any divergence from the hand-written `TableDetail` in
|
|
700
|
+
* `@keboola/api-client` as a TypeScript error. That type is not derived from the OpenAPI
|
|
701
|
+
* document, so this annotation and the `satisfies` above are the only mechanical check there is.
|
|
658
702
|
*/
|
|
659
703
|
declare const getTable: () => TableDetail;
|
|
660
704
|
/**
|
|
661
705
|
* Returns three TableDetail objects representing different lifecycle states:
|
|
662
|
-
* 1. Fresh — just created,
|
|
663
|
-
* 2. Recently updated —
|
|
664
|
-
* 3. Large —
|
|
706
|
+
* 1. Fresh — just created, nothing loaded (`lastImportDate: null`, `rowsCount: 0`).
|
|
707
|
+
* 2. Recently updated — 24 500 rows, imported June 2024.
|
|
708
|
+
* 3. Large — 125 500 rows, imported March 2024.
|
|
709
|
+
*
|
|
710
|
+
* The three row counts add up to the shared bucket's own `rowsCount`, and the bucket's
|
|
711
|
+
* `lastChangeDate` is the newest of theirs, as Storage reports it.
|
|
665
712
|
*/
|
|
666
713
|
declare const listTables: () => TableDetail[];
|
|
667
714
|
/**
|
|
@@ -702,9 +749,14 @@ declare const tableFixtures: {
|
|
|
702
749
|
path: string;
|
|
703
750
|
tables: string;
|
|
704
751
|
updated: string;
|
|
752
|
+
isLinkedBucket: boolean;
|
|
753
|
+
bucketSharingAllowed: boolean;
|
|
705
754
|
};
|
|
706
755
|
isTyped: false;
|
|
707
756
|
isAlias: false;
|
|
757
|
+
lastImportDate: null;
|
|
758
|
+
lastChangeDate: null;
|
|
759
|
+
rowsCount: number;
|
|
708
760
|
};
|
|
709
761
|
recentlyUpdated: {
|
|
710
762
|
id: string;
|
|
@@ -754,9 +806,14 @@ declare const tableFixtures: {
|
|
|
754
806
|
path: string;
|
|
755
807
|
tables: string;
|
|
756
808
|
updated: string;
|
|
809
|
+
isLinkedBucket: boolean;
|
|
810
|
+
bucketSharingAllowed: boolean;
|
|
757
811
|
};
|
|
758
812
|
isTyped: false;
|
|
759
813
|
isAlias: false;
|
|
814
|
+
lastImportDate: string;
|
|
815
|
+
lastChangeDate: string;
|
|
816
|
+
rowsCount: number;
|
|
760
817
|
};
|
|
761
818
|
large: {
|
|
762
819
|
id: string;
|
|
@@ -792,15 +849,25 @@ declare const tableFixtures: {
|
|
|
792
849
|
path: string;
|
|
793
850
|
tables: string;
|
|
794
851
|
updated: string;
|
|
852
|
+
isLinkedBucket: boolean;
|
|
853
|
+
bucketSharingAllowed: boolean;
|
|
795
854
|
};
|
|
796
855
|
isTyped: false;
|
|
797
856
|
isAlias: false;
|
|
857
|
+
lastImportDate: string;
|
|
858
|
+
lastChangeDate: string;
|
|
859
|
+
rowsCount: number;
|
|
798
860
|
};
|
|
799
861
|
};
|
|
800
862
|
//#endregion
|
|
801
863
|
//#region src/fixtures.d.ts
|
|
802
864
|
declare const fixtures: {
|
|
803
865
|
storage: {
|
|
866
|
+
bootstrap: {
|
|
867
|
+
getStackInfo: typeof getStackInfo;
|
|
868
|
+
verifyStorageToken: typeof verifyStorageToken;
|
|
869
|
+
getDevBranches: typeof getDevBranches;
|
|
870
|
+
};
|
|
804
871
|
tables: {
|
|
805
872
|
getTable: typeof getTable;
|
|
806
873
|
listTables: typeof listTables;
|
|
@@ -839,9 +906,14 @@ declare const fixtures: {
|
|
|
839
906
|
path: string;
|
|
840
907
|
tables: string;
|
|
841
908
|
updated: string;
|
|
909
|
+
isLinkedBucket: boolean;
|
|
910
|
+
bucketSharingAllowed: boolean;
|
|
842
911
|
};
|
|
843
912
|
isTyped: false;
|
|
844
913
|
isAlias: false;
|
|
914
|
+
lastImportDate: null;
|
|
915
|
+
lastChangeDate: null;
|
|
916
|
+
rowsCount: number;
|
|
845
917
|
};
|
|
846
918
|
recentlyUpdated: {
|
|
847
919
|
id: string;
|
|
@@ -891,9 +963,14 @@ declare const fixtures: {
|
|
|
891
963
|
path: string;
|
|
892
964
|
tables: string;
|
|
893
965
|
updated: string;
|
|
966
|
+
isLinkedBucket: boolean;
|
|
967
|
+
bucketSharingAllowed: boolean;
|
|
894
968
|
};
|
|
895
969
|
isTyped: false;
|
|
896
970
|
isAlias: false;
|
|
971
|
+
lastImportDate: string;
|
|
972
|
+
lastChangeDate: string;
|
|
973
|
+
rowsCount: number;
|
|
897
974
|
};
|
|
898
975
|
large: {
|
|
899
976
|
id: string;
|
|
@@ -929,9 +1006,14 @@ declare const fixtures: {
|
|
|
929
1006
|
path: string;
|
|
930
1007
|
tables: string;
|
|
931
1008
|
updated: string;
|
|
1009
|
+
isLinkedBucket: boolean;
|
|
1010
|
+
bucketSharingAllowed: boolean;
|
|
932
1011
|
};
|
|
933
1012
|
isTyped: false;
|
|
934
1013
|
isAlias: false;
|
|
1014
|
+
lastImportDate: string;
|
|
1015
|
+
lastChangeDate: string;
|
|
1016
|
+
rowsCount: number;
|
|
935
1017
|
};
|
|
936
1018
|
};
|
|
937
1019
|
};
|
|
@@ -1564,5 +1646,5 @@ declare const fixtures: {
|
|
|
1564
1646
|
};
|
|
1565
1647
|
};
|
|
1566
1648
|
//#endregion
|
|
1567
|
-
export { type Table, type TableDetail, appFixtures, deploymentFixtures, developerPortalFixtures, fixtures, getApp, getAppRun, getDeployment, getTable, getVendor, listAllApps, listAllVendors, listAppChanges, listAppRuns, listApps, listDeployments, listPublishedApps, listServiceAccounts, listTables, listUsers, listVendorApps, listVendors, runFixtures, tableFixtures };
|
|
1649
|
+
export { DEFAULT_BASE_URL, type Table, type TableDetail, appFixtures, deploymentFixtures, developerPortalFixtures, fixtures, getApp, getAppRun, getDeployment, getDevBranches, getStackInfo, getTable, getVendor, listAllApps, listAllVendors, listAppChanges, listAppRuns, listApps, listDeployments, listPublishedApps, listServiceAccounts, listTables, listUsers, listVendorApps, listVendors, runFixtures, tableFixtures, verifyStorageToken };
|
|
1568
1650
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ServiceId } from "@keboola/api-client/constants";
|
|
1
2
|
//#region src/clients/apps/deployments.ts
|
|
2
3
|
/**
|
|
3
4
|
* Deployment ids are the deterministic Kubernetes CR name — `app-{appId}-dpl-{hash}` —
|
|
@@ -652,6 +653,125 @@ const developerPortalFixtures = {
|
|
|
652
653
|
changes: { single: appChange }
|
|
653
654
|
};
|
|
654
655
|
//#endregion
|
|
656
|
+
//#region src/clients/storage/bootstrap.ts
|
|
657
|
+
/** The stack an MSW-backed test points its client at, unless a caller passes its own. */
|
|
658
|
+
const DEFAULT_BASE_URL = "https://connection.test";
|
|
659
|
+
/**
|
|
660
|
+
* The stack index `GET /v2/storage` returns.
|
|
661
|
+
*
|
|
662
|
+
* - Announces every `ServiceId` by default, each on its own host, so no service client is a dummy
|
|
663
|
+
* that throws `ServiceUnavailableError` — a test for a queue / data-science / vault hook only
|
|
664
|
+
* adds its handler.
|
|
665
|
+
* - Defaulting to `Object.values(ServiceId)` is what keeps that exhaustive: a service added to the
|
|
666
|
+
* client arrives here without an edit.
|
|
667
|
+
*/
|
|
668
|
+
const getStackInfo = ({ baseUrl = DEFAULT_BASE_URL, services = Object.values(ServiceId) } = {}) => {
|
|
669
|
+
const { host } = new URL(baseUrl);
|
|
670
|
+
return {
|
|
671
|
+
api: host,
|
|
672
|
+
documentation: "https://developers.keboola.com",
|
|
673
|
+
host,
|
|
674
|
+
revision: "test-revision",
|
|
675
|
+
stack: "test-stack",
|
|
676
|
+
version: "test-version",
|
|
677
|
+
urlTemplates: { orchestrationJob: "" },
|
|
678
|
+
services: services.map((id) => ({
|
|
679
|
+
id,
|
|
680
|
+
url: `https://${id}.${host}`
|
|
681
|
+
})),
|
|
682
|
+
components: [],
|
|
683
|
+
features: []
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
/**
|
|
687
|
+
* The verified master token `GET /v2/storage/tokens/verify` returns.
|
|
688
|
+
*
|
|
689
|
+
* - Complete on purpose: `api.context.project.sapiToken` is this object verbatim and hooks read deep
|
|
690
|
+
* into it (`owner.id`, `admin.role`, `adminOwner.email`), so a partial body surfaces as
|
|
691
|
+
* `undefined`s far from the test that caused them.
|
|
692
|
+
* - Every permission flag is granted; a test needing a restricted token overrides the handler.
|
|
693
|
+
*/
|
|
694
|
+
const verifyStorageToken = ({ baseUrl = DEFAULT_BASE_URL, features = [] } = {}) => ({
|
|
695
|
+
id: "token-1",
|
|
696
|
+
created: "2024-01-01T00:00:00Z",
|
|
697
|
+
refreshed: "2024-01-01T00:00:00Z",
|
|
698
|
+
description: "Test token",
|
|
699
|
+
uri: baseUrl,
|
|
700
|
+
isMasterToken: true,
|
|
701
|
+
canManageBuckets: true,
|
|
702
|
+
canManageTokens: true,
|
|
703
|
+
canReadAllFileUploads: true,
|
|
704
|
+
canPurgeTrash: true,
|
|
705
|
+
canManageProtectedDefaultBranch: true,
|
|
706
|
+
canCreateJobs: true,
|
|
707
|
+
canReadAllProjectEvents: true,
|
|
708
|
+
canManageDevBranches: true,
|
|
709
|
+
creatorToken: {
|
|
710
|
+
id: 42,
|
|
711
|
+
description: "Test token"
|
|
712
|
+
},
|
|
713
|
+
expires: null,
|
|
714
|
+
isExpired: false,
|
|
715
|
+
isDisabled: false,
|
|
716
|
+
isBYODB: false,
|
|
717
|
+
dailyCapacity: 1e3,
|
|
718
|
+
bucketPermissions: {},
|
|
719
|
+
owner: {
|
|
720
|
+
id: 42,
|
|
721
|
+
name: "Test Project",
|
|
722
|
+
type: "project",
|
|
723
|
+
region: "us-east-1",
|
|
724
|
+
created: "2024-01-01T00:00:00Z",
|
|
725
|
+
expires: null,
|
|
726
|
+
features,
|
|
727
|
+
dataSizeBytes: 0,
|
|
728
|
+
rowsCount: 0,
|
|
729
|
+
hasMysql: false,
|
|
730
|
+
hasSynapse: false,
|
|
731
|
+
hasRedshift: false,
|
|
732
|
+
hasSnowflake: true,
|
|
733
|
+
hasExasol: false,
|
|
734
|
+
hasTeradata: false,
|
|
735
|
+
hasBigquery: false,
|
|
736
|
+
defaultBackend: "snowflake",
|
|
737
|
+
hasTryModeOn: "false",
|
|
738
|
+
limits: {},
|
|
739
|
+
metrics: {},
|
|
740
|
+
isDisabled: false,
|
|
741
|
+
billedMonthlyPrice: null,
|
|
742
|
+
dataRetentionTimeInDays: 30,
|
|
743
|
+
assignedBackends: ["snowflake"],
|
|
744
|
+
fileStorageProvider: "s3"
|
|
745
|
+
},
|
|
746
|
+
organization: { id: "org-1" },
|
|
747
|
+
admin: {
|
|
748
|
+
id: 100,
|
|
749
|
+
name: "Admin User",
|
|
750
|
+
features: [],
|
|
751
|
+
isOrganizationMember: true,
|
|
752
|
+
role: "admin"
|
|
753
|
+
},
|
|
754
|
+
adminOwner: {
|
|
755
|
+
id: 200,
|
|
756
|
+
name: "Owner User",
|
|
757
|
+
email: "owner@example.com"
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
/**
|
|
761
|
+
* The branch list `GET /v2/storage/dev-branches` returns — the default branch alone.
|
|
762
|
+
*
|
|
763
|
+
* - `context.defaultBranch` is read off it, so the entry must stay `isDefault: true`.
|
|
764
|
+
* - The default branch has no creator, which `DevBranch` models as an empty `creatorToken`.
|
|
765
|
+
*/
|
|
766
|
+
const getDevBranches = () => [{
|
|
767
|
+
id: 1,
|
|
768
|
+
name: "Main",
|
|
769
|
+
description: "",
|
|
770
|
+
isDefault: true,
|
|
771
|
+
created: "2024-01-01T00:00:00Z",
|
|
772
|
+
creatorToken: []
|
|
773
|
+
}];
|
|
774
|
+
//#endregion
|
|
655
775
|
//#region src/clients/storage/tables.ts
|
|
656
776
|
const bucket = {
|
|
657
777
|
id: "in.c-main",
|
|
@@ -660,7 +780,7 @@ const bucket = {
|
|
|
660
780
|
stage: "in",
|
|
661
781
|
description: "Main input bucket",
|
|
662
782
|
created: "2024-01-15T10:00:00+0100",
|
|
663
|
-
lastChangeDate: "2024-
|
|
783
|
+
lastChangeDate: "2024-06-01T09:00:00+0200",
|
|
664
784
|
isMaintenance: false,
|
|
665
785
|
isReadOnly: false,
|
|
666
786
|
isSnowflakeSharedDatabase: false,
|
|
@@ -677,7 +797,9 @@ const bucket = {
|
|
|
677
797
|
sharing: null,
|
|
678
798
|
path: "in.c-main",
|
|
679
799
|
tables: "https://connection.keboola.com/v2/storage/buckets/in.c-main/tables",
|
|
680
|
-
updated: "2024-
|
|
800
|
+
updated: "2024-06-01T09:00:00+0200",
|
|
801
|
+
isLinkedBucket: false,
|
|
802
|
+
bucketSharingAllowed: true
|
|
681
803
|
};
|
|
682
804
|
const freshTable = {
|
|
683
805
|
id: "in.c-main.users",
|
|
@@ -695,7 +817,10 @@ const freshTable = {
|
|
|
695
817
|
attributes: [],
|
|
696
818
|
bucket,
|
|
697
819
|
isTyped: false,
|
|
698
|
-
isAlias: false
|
|
820
|
+
isAlias: false,
|
|
821
|
+
lastImportDate: null,
|
|
822
|
+
lastChangeDate: null,
|
|
823
|
+
rowsCount: 0
|
|
699
824
|
};
|
|
700
825
|
const recentlyUpdatedTable = {
|
|
701
826
|
id: "in.c-main.orders",
|
|
@@ -727,7 +852,10 @@ const recentlyUpdatedTable = {
|
|
|
727
852
|
attributes: [],
|
|
728
853
|
bucket,
|
|
729
854
|
isTyped: false,
|
|
730
|
-
isAlias: false
|
|
855
|
+
isAlias: false,
|
|
856
|
+
lastImportDate: "2024-06-01T09:00:00+0200",
|
|
857
|
+
lastChangeDate: "2024-06-01T09:00:00+0200",
|
|
858
|
+
rowsCount: 24500
|
|
731
859
|
};
|
|
732
860
|
const largeTable = {
|
|
733
861
|
id: "in.c-main.events",
|
|
@@ -746,20 +874,27 @@ const largeTable = {
|
|
|
746
874
|
attributes: [],
|
|
747
875
|
bucket,
|
|
748
876
|
isTyped: false,
|
|
749
|
-
isAlias: false
|
|
877
|
+
isAlias: false,
|
|
878
|
+
lastImportDate: "2024-03-10T08:30:00+0100",
|
|
879
|
+
lastChangeDate: "2024-03-10T08:30:00+0100",
|
|
880
|
+
rowsCount: 125500
|
|
750
881
|
};
|
|
751
882
|
/**
|
|
752
|
-
* Returns a single
|
|
883
|
+
* Returns a single non-typed, non-alias `TableDetail` (fresh, no imports yet).
|
|
753
884
|
*
|
|
754
|
-
* The explicit return type
|
|
755
|
-
*
|
|
885
|
+
* The explicit return type surfaces any divergence from the hand-written `TableDetail` in
|
|
886
|
+
* `@keboola/api-client` as a TypeScript error. That type is not derived from the OpenAPI
|
|
887
|
+
* document, so this annotation and the `satisfies` above are the only mechanical check there is.
|
|
756
888
|
*/
|
|
757
889
|
const getTable = () => freshTable;
|
|
758
890
|
/**
|
|
759
891
|
* Returns three TableDetail objects representing different lifecycle states:
|
|
760
|
-
* 1. Fresh — just created,
|
|
761
|
-
* 2. Recently updated —
|
|
762
|
-
* 3. Large —
|
|
892
|
+
* 1. Fresh — just created, nothing loaded (`lastImportDate: null`, `rowsCount: 0`).
|
|
893
|
+
* 2. Recently updated — 24 500 rows, imported June 2024.
|
|
894
|
+
* 3. Large — 125 500 rows, imported March 2024.
|
|
895
|
+
*
|
|
896
|
+
* The three row counts add up to the shared bucket's own `rowsCount`, and the bucket's
|
|
897
|
+
* `lastChangeDate` is the newest of theirs, as Storage reports it.
|
|
763
898
|
*/
|
|
764
899
|
const listTables = () => [
|
|
765
900
|
freshTable,
|
|
@@ -777,11 +912,18 @@ const tableFixtures = {
|
|
|
777
912
|
//#endregion
|
|
778
913
|
//#region src/fixtures.ts
|
|
779
914
|
const fixtures = {
|
|
780
|
-
storage: {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
915
|
+
storage: {
|
|
916
|
+
bootstrap: {
|
|
917
|
+
getStackInfo,
|
|
918
|
+
verifyStorageToken,
|
|
919
|
+
getDevBranches
|
|
920
|
+
},
|
|
921
|
+
tables: {
|
|
922
|
+
getTable,
|
|
923
|
+
listTables,
|
|
924
|
+
fixtures: tableFixtures
|
|
925
|
+
}
|
|
926
|
+
},
|
|
785
927
|
apps: {
|
|
786
928
|
apps: {
|
|
787
929
|
getApp,
|
|
@@ -813,6 +955,6 @@ const fixtures = {
|
|
|
813
955
|
}
|
|
814
956
|
};
|
|
815
957
|
//#endregion
|
|
816
|
-
export { appFixtures, deploymentFixtures, developerPortalFixtures, fixtures, getApp, getAppRun, getDeployment, getTable, getVendor, listAllApps, listAllVendors, listAppChanges, listAppRuns, listApps, listDeployments, listPublishedApps, listServiceAccounts, listTables, listUsers, listVendorApps, listVendors, runFixtures, tableFixtures };
|
|
958
|
+
export { DEFAULT_BASE_URL, appFixtures, deploymentFixtures, developerPortalFixtures, fixtures, getApp, getAppRun, getDeployment, getDevBranches, getStackInfo, getTable, getVendor, listAllApps, listAllVendors, listAppChanges, listAppRuns, listApps, listDeployments, listPublishedApps, listServiceAccounts, listTables, listUsers, listVendorApps, listVendors, runFixtures, tableFixtures, verifyStorageToken };
|
|
817
959
|
|
|
818
960
|
//# sourceMappingURL=index.js.map
|