@hautechai/sdk 1.3.0 → 1.4.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 (71) hide show
  1. package/dist/index.d.mts +7968 -0
  2. package/dist/index.d.ts +7968 -3
  3. package/dist/index.js +9030 -3
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +8991 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +8 -2
  8. package/.env.example +0 -4
  9. package/.github/workflows/release.yaml +0 -103
  10. package/.prettierignore +0 -1
  11. package/CHANGELOG.md +0 -6
  12. package/dist/autogenerated/api.d.ts +0 -12069
  13. package/dist/autogenerated/api.js +0 -11598
  14. package/dist/autogenerated/base.d.ts +0 -66
  15. package/dist/autogenerated/base.js +0 -59
  16. package/dist/autogenerated/common.d.ts +0 -65
  17. package/dist/autogenerated/common.js +0 -133
  18. package/dist/autogenerated/configuration.d.ts +0 -91
  19. package/dist/autogenerated/configuration.js +0 -39
  20. package/dist/autogenerated/index.d.ts +0 -13
  21. package/dist/autogenerated/index.js +0 -15
  22. package/dist/autogenerated/permissions.d.ts +0 -100
  23. package/dist/autogenerated/permissions.js +0 -1
  24. package/dist/sdk/access/index.d.ts +0 -20
  25. package/dist/sdk/access/index.js +0 -23
  26. package/dist/sdk/accounts/index.d.ts +0 -16
  27. package/dist/sdk/accounts/index.js +0 -25
  28. package/dist/sdk/api.d.ts +0 -20
  29. package/dist/sdk/api.js +0 -33
  30. package/dist/sdk/balances/index.d.ts +0 -12
  31. package/dist/sdk/balances/index.js +0 -19
  32. package/dist/sdk/collections/index.d.ts +0 -33
  33. package/dist/sdk/collections/index.js +0 -34
  34. package/dist/sdk/errors/index.d.ts +0 -3
  35. package/dist/sdk/errors/index.js +0 -6
  36. package/dist/sdk/groups/index.d.ts +0 -24
  37. package/dist/sdk/groups/index.js +0 -31
  38. package/dist/sdk/images/index.d.ts +0 -17
  39. package/dist/sdk/images/index.js +0 -35
  40. package/dist/sdk/index.d.ts +0 -1637
  41. package/dist/sdk/index.js +0 -69
  42. package/dist/sdk/listeners/index.d.ts +0 -28
  43. package/dist/sdk/listeners/index.js +0 -104
  44. package/dist/sdk/operations/index.d.ts +0 -211
  45. package/dist/sdk/operations/index.js +0 -139
  46. package/dist/sdk/pipelines/index.d.ts +0 -1229
  47. package/dist/sdk/pipelines/index.js +0 -214
  48. package/dist/sdk/pipelines/pipelines.d.ts +0 -0
  49. package/dist/sdk/pipelines/pipelines.js +0 -1
  50. package/dist/sdk/poses/index.d.ts +0 -20
  51. package/dist/sdk/poses/index.js +0 -24
  52. package/dist/sdk/stacks/index.d.ts +0 -29
  53. package/dist/sdk/stacks/index.js +0 -32
  54. package/dist/sdk/storage/index.d.ts +0 -18
  55. package/dist/sdk/storage/index.js +0 -27
  56. package/dist/sdk/transformers.d.ts +0 -7
  57. package/dist/sdk/transformers.js +0 -6
  58. package/dist/sdk/utils/index.d.ts +0 -10
  59. package/dist/sdk/utils/index.js +0 -6
  60. package/dist/sdk/videos/index.d.ts +0 -11
  61. package/dist/sdk/videos/index.js +0 -15
  62. package/dist/token/index.d.ts +0 -15
  63. package/dist/token/index.js +0 -65
  64. package/dist/types.d.ts +0 -15
  65. package/dist/types.js +0 -5
  66. package/openapitools.json +0 -7
  67. package/release.config.cjs +0 -39
  68. package/scripts/generate-permissions.js +0 -54
  69. package/scripts/generate.sh +0 -19
  70. package/scripts/up-versions.sh +0 -6
  71. package/tsconfig.json +0 -14
@@ -1,214 +0,0 @@
1
- import { Pipeline } from '@hautechai/pipelines';
2
- import { CallApi, PipelinesApi, } from '../../autogenerated';
3
- import { useAutogeneratedAPI } from '../api';
4
- import { transformToListResponse } from '../transformers';
5
- const pipelines = (options) => {
6
- const api = useAutogeneratedAPI({ API: PipelinesApi, options });
7
- const callAPI = useAutogeneratedAPI({ API: CallApi, options });
8
- const callMethod = (method) =>
9
- // Type intersection is used as a type check assistance to prevent accidental passing of raw TaskOutput.
10
- (params) => callAPI.call({
11
- run: (methods) => method(methods)(params),
12
- });
13
- const createPipeline = () => new Pipeline({
14
- access: {
15
- attach: callMethod((methods) => methods.callControllerCallAccessAttachV1),
16
- grant: callMethod((methods) => methods.callControllerCallAccessGrantV1),
17
- },
18
- accounts: {
19
- create: callMethod((methods) => methods.callControllerCallAccountsCreateV1),
20
- get: callMethod((methods) => methods.callControllerCallAccountsGetV1),
21
- list: callMethod((methods) => methods.callControllerCallAccountsListV1),
22
- },
23
- balances: {
24
- add: callMethod((methods) => methods.callControllerCallAccountsBalanceAddV1),
25
- get: callMethod((methods) => methods.callControllerCallAccountsBalanceGetV1),
26
- getSelf: callMethod((methods) => methods.callControllerCallAccountsBalanceSelfV1),
27
- },
28
- collections: {
29
- create: callMethod((methods) => methods.callControllerCallCollectionsCreateV1),
30
- items: {
31
- add: callMethod((methods) => methods.callControllerCallCollectionsItemsAddV1),
32
- list: callMethod((methods) => methods.callControllerCallCollectionsItemsListV1),
33
- remove: callMethod((methods) => methods.callControllerCallCollectionsItemsRemoveV1),
34
- },
35
- get: callMethod((methods) => methods.callControllerCallCollectionsGetV1),
36
- list: callMethod((methods) => methods.callControllerCallCollectionsListV1),
37
- updateMetadata: callMethod((methods) => methods.callControllerCallCollectionsMetadataUpdateV1),
38
- },
39
- groups: {
40
- accounts: {
41
- add: callMethod((methods) => methods.callControllerCallGroupsAccountsAddV1),
42
- remove: callMethod((methods) => methods.callControllerCallGroupsAccountsRemoveV1),
43
- },
44
- create: callMethod((methods) => methods.callControllerCallGroupsCreateV1),
45
- delete: callMethod((methods) => methods.callControllerCallGroupsDeleteV1),
46
- get: callMethod((methods) => methods.callControllerCallGroupsGetV1),
47
- },
48
- images: {
49
- get: callMethod((methods) => methods.callControllerCallImagesGetV1),
50
- getUrls: callMethod((methods) => methods.callControllerCallImagesGetManyV1),
51
- },
52
- videos: {
53
- get: callMethod((methods) => methods.callControllerCallVideosGetV1),
54
- getUrls: callMethod((methods) => methods.callControllerCallVideosGetManyV1),
55
- },
56
- operations: {
57
- get: callMethod((methods) => methods.callControllerCallOperationsGetV1),
58
- list: callMethod((methods) => methods.callControllerCallOperationsListV1),
59
- updateMetadata: callMethod((methods) => methods.callControllerCallOperationsMetadataUpdateV1),
60
- run: {
61
- animate: {
62
- kling_1_6_pro: {
63
- v1: callMethod((methods) => methods.callControllerCallOperationsRunAnimateKling16ProV1V1),
64
- },
65
- kling_2_1: {
66
- v1: callMethod((methods) => methods.callControllerCallOperationsRunAnimateKling21V1V1),
67
- },
68
- creatomate: {
69
- v1: callMethod((methods) => methods.callControllerCallOperationsRunAnimateCreatomateV1V1),
70
- },
71
- },
72
- edit: {
73
- flux_kontext_dev: {
74
- v1: callMethod((methods) => methods.callControllerCallOperationsRunEditFluxKontextDevV1V1),
75
- },
76
- },
77
- haute: {
78
- linda: {
79
- v1: callMethod((methods) => methods.callControllerCallOperationsRunHauteLindaV1V1),
80
- },
81
- naomi: {
82
- v1: callMethod((methods) => methods.callControllerCallOperationsRunHauteNaomiV1V1),
83
- },
84
- },
85
- inpaint: {
86
- kate: {
87
- v1: callMethod((methods) => methods.callControllerCallOperationsRunInpaintKateV1V1),
88
- },
89
- },
90
- gpt: {
91
- v1: callMethod((methods) => methods.callControllerCallOperationsRunGptV1V1),
92
- v2: callMethod((methods) => methods.callControllerCallOperationsRunGptV2V1),
93
- },
94
- math: {
95
- v1: callMethod((methods) => methods.callControllerCallOperationsRunMathV1V1),
96
- },
97
- translate: {
98
- v1: callMethod((methods) => methods.callControllerCallOperationsRunTranslateV1V1),
99
- },
100
- imagine: {
101
- kate: {
102
- v1: callMethod((methods) => methods.callControllerCallOperationsRunImagineKateV1V1),
103
- },
104
- },
105
- upscale: {
106
- v1: callMethod((methods) => methods.callControllerCallOperationsRunUpscaleV1V1),
107
- },
108
- objectDetection: {
109
- v1: callMethod((methods) => methods.callControllerCallOperationsRunObjectDetectionV1V1),
110
- },
111
- segmentAnything: {
112
- embeddings: {
113
- v1: callMethod((methods) => methods.callControllerCallOperationsRunSegmentAnythingEmbeddingsV1V1),
114
- },
115
- mask: {
116
- v1: callMethod((methods) => methods.callControllerCallOperationsRunSegmentAnythingMaskV1V1),
117
- },
118
- },
119
- poseEstimation: {
120
- v1: callMethod((methods) => methods.callControllerCallOperationsRunPoseEstimationV1V1),
121
- },
122
- cut: {
123
- v1: callMethod((methods) => methods.callControllerCallOperationsRunCutV1V1),
124
- },
125
- crop: {
126
- v1: callMethod((methods) => methods.callControllerCallOperationsRunCropV1V1),
127
- },
128
- noise: {
129
- v1: callMethod((methods) => methods.callControllerCallOperationsRunNoiseV1V1),
130
- },
131
- contrast: {
132
- v1: callMethod((methods) => methods.callControllerCallOperationsRunContrastV1V1),
133
- },
134
- composite: {
135
- v1: callMethod((methods) => methods.callControllerCallOperationsRunCompositeV1V1),
136
- },
137
- vton: {
138
- gisele: {
139
- v1: callMethod((methods) => methods.callControllerCallOperationsRunVtonGiseleV1V1),
140
- },
141
- },
142
- negateImage: {
143
- v1: callMethod((methods) => methods.callControllerCallOperationsRunNegateImageV1V1),
144
- },
145
- resize: {
146
- v1: callMethod((methods) => methods.callControllerCallOperationsRunResizeV1V1),
147
- },
148
- strings: {
149
- template: {
150
- v1: callMethod((methods) => methods.callControllerCallOperationsRunStringsTemplateV1V1),
151
- },
152
- },
153
- onecompiler: {
154
- v1: callMethod((methods) => methods.callControllerCallOperationsRunOnecompilerV1V1),
155
- },
156
- },
157
- wait: callMethod((methods) => methods.callControllerCallOperationsWaitV1),
158
- },
159
- poses: {
160
- get: callMethod((methods) => methods.callControllerCallPosesGetV1),
161
- list: callMethod((methods) => methods.callControllerCallPosesListV1),
162
- },
163
- stacks: {
164
- create: callMethod((methods) => methods.callControllerCallStacksCreateV1),
165
- get: callMethod((methods) => methods.callControllerCallStacksGetV1),
166
- list: callMethod((methods) => methods.callControllerCallStacksListV1),
167
- updateMetadata: callMethod((methods) => methods.callControllerCallStacksMetadataUpdateV1),
168
- items: {
169
- add: callMethod((methods) => methods.callControllerCallStacksItemsAddV1),
170
- remove: callMethod((methods) => methods.callControllerCallStacksItemsRemoveV1),
171
- },
172
- },
173
- storage: {
174
- create: callMethod((methods) => methods.callControllerCallStorageCreateV1),
175
- delete: callMethod((methods) => methods.callControllerCallStorageDeleteV1),
176
- getMany: callMethod((methods) => methods.callControllerCallStorageGetManyV1),
177
- update: callMethod((methods) => methods.callControllerCallStorageUpdateV1),
178
- },
179
- });
180
- return {
181
- constructTemplate: (consructPipeline) => consructPipeline(createPipeline()),
182
- create: async (props) => api.call({
183
- run: (methods) => methods.pipelinesControllerCreatePipelineV1({
184
- metadata: props.metadata,
185
- tasks: (props.template?.tasks ?? props.tasks),
186
- state: props.state,
187
- }),
188
- }),
189
- get: async (props) => api.callWithReturningUndefinedOn404({
190
- run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
191
- }),
192
- list: (props = {}) => api.call({
193
- run: (methods) => methods.pipelinesControllerListPipelinesV1(props.orderBy, props.limit, props.cursor),
194
- transform: transformToListResponse,
195
- }),
196
- wait: async (props) => new Promise((resolve, reject) => {
197
- const initialDelay = 5000;
198
- const delay = 2000;
199
- let timeoutId;
200
- const poll = async () => {
201
- const pipeline = (await api.call({
202
- run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
203
- }));
204
- if (pipeline.status === 'completed')
205
- return resolve(pipeline);
206
- if (pipeline.status === 'failed')
207
- return resolve(pipeline);
208
- timeoutId = setTimeout(poll, delay);
209
- };
210
- timeoutId = setTimeout(poll, initialDelay);
211
- }),
212
- };
213
- };
214
- export default pipelines;
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,20 +0,0 @@
1
- import { ListPosesParamsDto, PoseEntity } from '../../autogenerated';
2
- import { ListResponse, SDKOptions } from '../../types';
3
- import { PoseMetadata } from '../index';
4
- import { AddMetadata } from '../utils';
5
- type PoseEntityWithMetadata = AddMetadata<PoseEntity, PoseMetadata>;
6
- declare const poses: (options: SDKOptions) => {
7
- putPreview: (props: {
8
- id: string;
9
- previewImageId: string;
10
- }) => Promise<void>;
11
- get: (props: {
12
- id: string;
13
- }) => Promise<PoseEntityWithMetadata | undefined>;
14
- list: (props: ListPosesParamsDto) => Promise<ListResponse<PoseEntityWithMetadata>>;
15
- updateMetadata: (props: {
16
- id: string;
17
- metadata?: PoseMetadata;
18
- }) => Promise<void>;
19
- };
20
- export default poses;
@@ -1,24 +0,0 @@
1
- import { PosesApi } from '../../autogenerated';
2
- import { useAutogeneratedAPI } from '../api';
3
- import { transformToListResponse } from '../transformers';
4
- const poses = (options) => {
5
- const api = useAutogeneratedAPI({ API: PosesApi, options });
6
- return {
7
- putPreview: async (props) => api.call({
8
- run: (methods) => methods.posesControllerSetPosePreviewV1(props.id, {
9
- previewImageId: props.previewImageId,
10
- }),
11
- }),
12
- get: async (props) => api.callWithReturningUndefinedOn404({
13
- run: (methods) => methods.posesControllerGetPoseV1(props.id),
14
- }),
15
- list: async (props) => api.call({
16
- run: (methods) => methods.posesControllerListPosesV1(props.orderBy, props.limit, props.cursor),
17
- transform: transformToListResponse,
18
- }),
19
- updateMetadata: async (props) => api.call({
20
- run: (methods) => methods.posesControllerUpdateMetadataV1(props.id, { overwrite: props.metadata ?? {} }),
21
- }),
22
- };
23
- };
24
- export default poses;
@@ -1,29 +0,0 @@
1
- import { SDKOptions, ListProps, ListResponse } from '../../types';
2
- import { StackEntity } from '../../autogenerated';
3
- import { StackMetadata } from '../index';
4
- import { AddMetadata } from '../utils';
5
- type StackEntityWithMetadata = AddMetadata<StackEntity, StackMetadata>;
6
- declare const stacks: (options: SDKOptions) => {
7
- create: (props?: {
8
- metadata?: StackMetadata;
9
- }) => Promise<StackEntity>;
10
- get: (props: {
11
- id: string;
12
- }) => Promise<StackEntityWithMetadata | undefined>;
13
- list: (props?: ListProps) => Promise<ListResponse<StackEntityWithMetadata>>;
14
- items: {
15
- add: (props: {
16
- itemIds: string[];
17
- stackId: string;
18
- }) => Promise<void>;
19
- remove: (props: {
20
- itemIds: string[];
21
- stackId: string;
22
- }) => Promise<void>;
23
- };
24
- updateMetadata: (props: {
25
- id: string;
26
- metadata?: StackMetadata;
27
- }) => Promise<void>;
28
- };
29
- export default stacks;
@@ -1,32 +0,0 @@
1
- import { StacksApi } from '../../autogenerated';
2
- import { useAutogeneratedAPI } from '../api';
3
- import { transformToListResponse } from '../transformers';
4
- const stacks = (options) => {
5
- const api = useAutogeneratedAPI({ API: StacksApi, options });
6
- return {
7
- create: async (props = {}) => api.call({
8
- run: (methods) => methods.stacksControllerCreateStackV1({
9
- metadata: props.metadata,
10
- }),
11
- }),
12
- get: async (props) => api.callWithReturningUndefinedOn404({
13
- run: (methods) => methods.stacksControllerGetStackV1(props.id),
14
- }),
15
- list: async (props = {}) => api.call({
16
- run: (methods) => methods.stacksControllerListStacksV1(props.orderBy, props.limit, props.cursor),
17
- transform: transformToListResponse,
18
- }),
19
- items: {
20
- add: async (props) => api.call({
21
- run: (methods) => methods.stacksControllerAddItemsV1(props.stackId, { itemIds: props.itemIds }),
22
- }),
23
- remove: async (props) => api.call({
24
- run: (methods) => methods.stacksControllerRemoveItemsV1(props.stackId, { itemIds: props.itemIds }),
25
- }),
26
- },
27
- updateMetadata: async (props) => api.call({
28
- run: (methods) => methods.stacksControllerUpdateMetadataV1(props.id, { overwrite: props.metadata ?? {} }),
29
- }),
30
- };
31
- };
32
- export default stacks;
@@ -1,18 +0,0 @@
1
- import { SDKOptions } from '../../types';
2
- declare const storage: (options: SDKOptions) => {
3
- create: (props: {
4
- key: string;
5
- value: any;
6
- }) => Promise<any>;
7
- delete: (props: {
8
- key: string;
9
- }) => Promise<void>;
10
- getMany: (props: {
11
- keys: string[];
12
- }) => Promise<Record<string, any>>;
13
- update: (props: {
14
- key: string;
15
- value: any;
16
- }) => Promise<any>;
17
- };
18
- export default storage;
@@ -1,27 +0,0 @@
1
- import { StorageApi } from '../../autogenerated';
2
- import { useAutogeneratedAPI } from '../api';
3
- const storage = (options) => {
4
- const api = useAutogeneratedAPI({ API: StorageApi, options });
5
- return {
6
- create: async (props) => api.call({
7
- run: (methods) => methods.storageControllerCreateRecordV1({
8
- key: props.key,
9
- value: props.value,
10
- }),
11
- }),
12
- delete: async (props) => api.call({
13
- run: (methods) => methods.storageControllerDeleteRecordV1({ key: props.key }),
14
- }),
15
- getMany: async (props) => api.call({
16
- run: (methods) => methods.storageControllerGetRecordsV1({ keys: props.keys }),
17
- transform: (response) => response.reduce((acc, item) => {
18
- acc[item.key] = item.value;
19
- return acc;
20
- }, {}),
21
- }),
22
- update: async (props) => api.call({
23
- run: (methods) => methods.storageControllerUpdateRecordV1({ key: props.key, value: props.value }),
24
- }),
25
- };
26
- };
27
- export default storage;
@@ -1,7 +0,0 @@
1
- import { ListResponse } from '../types';
2
- export declare const transformToListResponse: <T>(response: {
3
- data: T[];
4
- pageInfo: {
5
- nextCursor?: string;
6
- };
7
- }) => ListResponse<T>;
@@ -1,6 +0,0 @@
1
- import { ListResponse } from '../types';
2
- export const transformToListResponse = (response) => {
3
- const array = new ListResponse(...response.data);
4
- array.nextCursor = response.pageInfo.nextCursor;
5
- return array;
6
- };
@@ -1,10 +0,0 @@
1
- import { SDKOptions } from '../../types';
2
- declare const utils: (options: SDKOptions) => {
3
- seed: () => number;
4
- };
5
- export type AddMetadata<T extends {
6
- metadata: unknown;
7
- }, M> = Omit<T, 'metadata'> & {
8
- metadata: M;
9
- };
10
- export default utils;
@@ -1,6 +0,0 @@
1
- const utils = (options) => {
2
- return {
3
- seed: () => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER),
4
- };
5
- };
6
- export default utils;
@@ -1,11 +0,0 @@
1
- import { VideoEntity } from '../../autogenerated';
2
- import { SDKOptions } from '../../types';
3
- declare const videos: (options: SDKOptions) => {
4
- get: (props: {
5
- id: string;
6
- }) => Promise<VideoEntity | undefined>;
7
- getUrls: (props: {
8
- ids: string[];
9
- }) => Promise<Record<string, string>>;
10
- };
11
- export default videos;
@@ -1,15 +0,0 @@
1
- import { VideosApi } from '../../autogenerated';
2
- import { useAutogeneratedAPI } from '../api';
3
- const videos = (options) => {
4
- const api = useAutogeneratedAPI({ API: VideosApi, options });
5
- return {
6
- get: async (props) => api.callWithReturningUndefinedOn404({
7
- run: (methods) => methods.videosControllerGetVideoV1(props.id),
8
- }),
9
- getUrls: async (props) => api.call({
10
- run: (methods) => methods.videosControllerGetUrlsV1({ ids: props.ids }),
11
- transform: (data) => data.reduce((acc, { id, url }) => ({ ...acc, [id]: url }), {}),
12
- }),
13
- };
14
- };
15
- export default videos;
@@ -1,15 +0,0 @@
1
- import { MethodsPermissions } from '../autogenerated/permissions';
2
- export declare const createTokenSigner: (options: {
3
- appId: string;
4
- appKeyId: string;
5
- appKeySecret: string;
6
- }) => {
7
- createAccountToken: (props: {
8
- accountId: string;
9
- expiresInSeconds: number;
10
- permissions?: Partial<MethodsPermissions>;
11
- }) => Promise<string>;
12
- createRootToken: (props: {
13
- expiresInSeconds: number;
14
- }) => Promise<string>;
15
- };
@@ -1,65 +0,0 @@
1
- import * as jose from 'jose';
2
- const createPrivateKey = (key) => {
3
- const header = `-----BEGIN PRIVATE KEY-----\n`;
4
- const footer = `\n-----END PRIVATE KEY-----`;
5
- // @ts-ignore
6
- const keyBody = key.match(/.{1,64}/g).join('\n');
7
- return header + keyBody + footer;
8
- };
9
- const createToken = async (props) => {
10
- const alg = 'RS256';
11
- const pkcs8 = createPrivateKey(props.appKeySecret);
12
- const privateKey = await jose.importPKCS8(pkcs8, alg);
13
- return await new jose.SignJWT(props.payload)
14
- .setIssuedAt()
15
- .setExpirationTime(`${props.expiresInSeconds}s`)
16
- .setProtectedHeader({ alg, kid: props.appKeyId })
17
- .sign(privateKey);
18
- };
19
- const serializePermissions = (permissions) => {
20
- const result = [];
21
- const traverse = (obj, path = []) => {
22
- for (const [key, value] of Object.entries(obj)) {
23
- if (typeof value === 'boolean' && value === true) {
24
- result.push(path.concat(key).join(':'));
25
- }
26
- else if (typeof value === 'object') {
27
- traverse(value, path.concat(key));
28
- }
29
- }
30
- };
31
- traverse(permissions);
32
- return result;
33
- };
34
- export const createTokenSigner = (options) => {
35
- if (!options.appId || options.appId.length === 0) {
36
- throw new Error('appId is required');
37
- }
38
- if (!options.appKeyId || options.appKeyId.length === 0) {
39
- throw new Error('appKeyId is required');
40
- }
41
- if (!options.appKeySecret || options.appKeySecret.length === 0) {
42
- throw new Error('appKeySecret is required');
43
- }
44
- return {
45
- createAccountToken: async (props) => createToken({
46
- appKeyId: options.appKeyId,
47
- appKeySecret: options.appKeySecret,
48
- expiresInSeconds: props.expiresInSeconds,
49
- payload: {
50
- iss: options.appId,
51
- permissions: serializePermissions(props.permissions ?? {}),
52
- sub: props.accountId,
53
- },
54
- }),
55
- createRootToken: async (props) => createToken({
56
- appKeyId: options.appKeyId,
57
- appKeySecret: options.appKeySecret,
58
- expiresInSeconds: props.expiresInSeconds ?? 3600,
59
- payload: {
60
- iss: options.appId,
61
- permissions: ['*'],
62
- },
63
- }),
64
- };
65
- };
package/dist/types.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export interface SDKOptions {
2
- authToken: () => string | Promise<string>;
3
- endpoint?: string;
4
- useWebsocket?: boolean;
5
- allowPollingFallback?: boolean;
6
- }
7
- export type ListProps = {
8
- cursor?: string;
9
- limit?: number;
10
- orderBy?: 'createdAt_ASC' | 'createdAt_DESC' | 'updatedAt_ASC' | 'updatedAt_DESC';
11
- };
12
- export declare class ListResponse<T> extends Array<T> {
13
- nextCursor?: string;
14
- }
15
- export { AccountEntity, CollectionEntity, GroupEntity, ImageEntity, OperationEntity, PipelineDto, PipelinePreviewDto, ResourceEntity, StackEntity, StorageEntity, } from './autogenerated/api';
package/dist/types.js DELETED
@@ -1,5 +0,0 @@
1
- export class ListResponse extends Array {
2
- }
3
- // ------------------------------------------------------------
4
- // AUTOGENERATED TYPES END
5
- // ------------------------------------------------------------
package/openapitools.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
3
- "spaces": 2,
4
- "generator-cli": {
5
- "version": "7.10.0"
6
- }
7
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * @type {import('semantic-release').GlobalConfig}
3
- */
4
- module.exports = {
5
- branches: ['main'],
6
- plugins: [
7
- [
8
- '@semantic-release/commit-analyzer',
9
- {
10
- preset: 'angular',
11
- releaseRules: [
12
- {
13
- type: 'docs',
14
- release: 'patch',
15
- },
16
- {
17
- type: 'feat',
18
- release: 'minor',
19
- },
20
- {
21
- type: 'chore',
22
- release: 'patch',
23
- },
24
- {
25
- message: '**',
26
- release: 'patch',
27
- },
28
- ],
29
- parserOpts: {
30
- noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
31
- },
32
- },
33
- ],
34
- "@semantic-release/release-notes-generator",
35
- "@semantic-release/changelog",
36
- "@semantic-release/npm",
37
- "@semantic-release/github"
38
- ],
39
- };
@@ -1,54 +0,0 @@
1
- #!/bin/node
2
-
3
- const url = process.argv[2];
4
- const outputFilePath = process.argv[3];
5
-
6
- const loadPermissions = async () => {
7
- const response = await fetch(url);
8
- const data = await response.json();
9
-
10
- const output = {};
11
-
12
- // Process each permission string into nested structure
13
- data.forEach((permission) => {
14
- const parts = permission.split(':');
15
- let current = output;
16
-
17
- // Build nested objects for each part
18
- for (let i = 0; i < parts.length - 1; i++) {
19
- const part = parts[i];
20
- if (!current[part]) {
21
- current[part] = {};
22
- }
23
- current = current[part];
24
- }
25
-
26
- // Set the final property to boolean type
27
- const lastPart = parts[parts.length - 1];
28
- current[lastPart] = 'boolean';
29
- });
30
-
31
- // Convert to TypeScript interface string
32
- const generateTypeString = (obj, indent = '') => {
33
- const entries = Object.entries(obj);
34
- if (entries.length === 0) return '{}';
35
-
36
- return `{\n${entries
37
- .map(([key, value]) => {
38
- const valueStr = typeof value === 'string' ? value : generateTypeString(value, indent + ' ');
39
- return `${indent} ${key}: ${valueStr};`;
40
- })
41
- .join('\n')}\n${indent}}`;
42
- };
43
-
44
- const typeString = generateTypeString(output);
45
-
46
- const fs = require('fs');
47
-
48
- const fileContent = `// This file is auto-generated. Do not edit manually.
49
- export type MethodsPermissions = ${typeString};`;
50
-
51
- fs.writeFileSync(outputFilePath, fileContent);
52
- };
53
-
54
- loadPermissions();