@incomy/platform-sdk 0.4.0-beta.1973 → 0.5.0-beta.2075

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/README.md ADDED
@@ -0,0 +1,168 @@
1
+ # @incomy/platform-sdk
2
+
3
+ Auto-generated TypeScript client for the Incomy platform APIs (currently **Hub**),
4
+ produced from each service's OpenAPI spec and published to npm. Consumed by the
5
+ `web` frontend as `import { hub } from "@incomy/platform-sdk"`.
6
+
7
+ ## TL;DR
8
+
9
+ - **Daily work:** just merge to `develop` — a beta is published automatically. You don't touch versions.
10
+ - **Release:** `npm version <patch|minor|major>` → commit → **merge to `main`**. No git tags.
11
+ - **Changed the API?** run `npm run snapshot` and commit `oas/hub.json` together with your backend change (otherwise CI fails).
12
+
13
+ ---
14
+
15
+ ## What lives here
16
+
17
+ | Path | Tracked? | What it is |
18
+ |---|---|---|
19
+ | `package.json` | ✅ committed | npm manifest; the `version` field is the **release base** (the single human knob) |
20
+ | `tsconfig.json` | ✅ committed | TypeScript build config |
21
+ | `package-lock.json` | ✅ committed | pinned build deps (`npm ci` in CI) |
22
+ | `scripts/*.mjs` | ✅ committed | generation / snapshot / contract-gate logic |
23
+ | `oas/hub.json` | ✅ committed | **OpenAPI contract snapshot** (reviewable in PRs, drives generation) |
24
+ | `generate.sh` | ✅ committed | local one-shot build (starts the API, then runs the generator) |
25
+ | `services/`, `dist/`, `index.ts`, `meta.json`, `*.tgz`, `node_modules/` | ❌ generated | build output (git-ignored) |
26
+
27
+ ---
28
+
29
+ ## How generation works
30
+
31
+ There is **one source of truth** for generation: [`scripts/build.mjs`](scripts/build.mjs). CI and
32
+ `generate.sh` both call it — there is no duplicated codegen logic.
33
+
34
+ It does, in order:
35
+
36
+ 1. Resolve OpenAPI specs from `OAS_SOURCES` (pipe-delimited `name|url-or-path` lines; GitLab
37
+ package URLs get the `JOB-TOKEN` automatically). With no `OAS_SOURCES`, it reuses the committed
38
+ `oas/*.json` snapshot — so you can regenerate offline.
39
+ 2. Run `openapi-typescript-codegen` per service into `services/<name>` (fetch client, union types).
40
+ 3. Write `index.ts` — one namespace export per service: `export * as hub from "./services/hub"`.
41
+ **This is the public API surface** and it does not change across regenerations.
42
+ 4. Stamp the version (when given), write `meta.json` provenance, compile with `tsc`, `npm pack`.
43
+
44
+ `meta.json` records where the build came from — `sdkVersion`, `apiCommit`, and a sha256 of each
45
+ source spec — so you can always tell which backend commit an SDK build was generated from.
46
+
47
+ ---
48
+
49
+ ## Versioning
50
+
51
+ The **base** `major.minor.patch` is the `version` field in `package.json` (e.g. `0.4.0`). That is
52
+ the only thing a human sets. CI derives the actual published version from the branch
53
+ ([`calculate_version`](.gitlab-ci.yml)):
54
+
55
+ | Context | Published version |
56
+ |---|---|
57
+ | `main` | `BASE` — clean release, e.g. `0.4.0` |
58
+ | `develop` | `BASE-beta.<pipeline-iid>` — e.g. `0.4.0-beta.207` |
59
+ | `feature/*` (build only) | `BASE-alpha.<pipeline-iid>` |
60
+
61
+ `CI_PIPELINE_IID` is strictly increasing per project, so prerelease numbers are always unique and
62
+ monotonic — no duplicate-version publishes.
63
+
64
+ ---
65
+
66
+ ## Releasing (version-file-driven, no tags)
67
+
68
+ A release happens when a **new base version lands on `main`**. There are no manual git tags.
69
+
70
+ | Context | Publishes? | dist-tag | Notes |
71
+ |---|:---:|---|---|
72
+ | `feature/*` | ❌ (build/validate only) | — | proves the SDK still compiles |
73
+ | `develop` | ✅ every push | `@beta` | continuous betas for testing |
74
+ | `main` | ✅ **only if the version is new** | `@latest` | the clean release |
75
+
76
+ The `main` job is **idempotent**: it checks `npm view "<name>@<version>"` and skips if that version
77
+ is already published. So a `main` merge that didn't bump the version is a no-op, and pipeline
78
+ retries never double-publish. `@latest` therefore only ever moves to a clean version from `main`.
79
+
80
+ ### How to cut a release
81
+
82
+ ```bash
83
+ cd sdk
84
+ npm version minor --no-git-tag-version # bump the base in package.json (see "which level" below)
85
+ git commit -am "chore(sdk): release 0.5.0"
86
+ # open an MR and merge to main → CI publishes 0.5.0 to @latest
87
+ ```
88
+
89
+ (Or use the VS Code task **`sdk: bump version (release)`** for the bump step.)
90
+
91
+ ### Which level to bump (semver)
92
+
93
+ | Level | When | Example |
94
+ |---|---|---|
95
+ | **patch** | bug fix, **API contract unchanged** | `0.4.0 → 0.4.1` |
96
+ | **minor** | new, backward-compatible API (new endpoint / optional field) | `0.4.0 → 0.5.0` |
97
+ | **major** | breaking change (removed/renamed/retyped field, removed endpoint) | `0.4.0 → 1.0.0` |
98
+
99
+ The `oas/hub.json` diff tells you the level: `path/schema added` or a new optional field → **minor**;
100
+ `path removed` or an incompatible `schema modified` → **major**; no `oas` change at all → **patch**.
101
+
102
+ > Pre-1.0 note: while on `0.x`, breaking changes conventionally go out as a **minor** bump; reserve
103
+ > `1.0.0` for the first explicitly-stable API.
104
+
105
+ ---
106
+
107
+ ## The OpenAPI contract snapshot + gate
108
+
109
+ `oas/hub.json` is a committed, normalized copy of the Hub OpenAPI spec — the **API contract** the
110
+ SDK is generated from. Committing it means any API change shows up as a reviewable diff in the PR.
111
+
112
+ A CI gate (`check_swagger_snapshot` in
113
+ [`services/hub/.gitlab-ci.yml`](../services/hub/.gitlab-ci.yml)) re-exports the spec from the
114
+ current backend and **fails if it differs from the committed snapshot** — so an API change can't
115
+ slip through without updating the contract. The `servers` block (derived from `INCOMY_ROOT_DOMAIN`)
116
+ is ignored, so deployment-environment differences don't cause false failures.
117
+
118
+ **When you change the API**, refresh and commit the snapshot alongside your backend change:
119
+
120
+ ```bash
121
+ cd sdk
122
+ npm run snapshot # re-export from the local API on :20001 → oas/hub.json
123
+ git add oas/hub.json # commit it together with the C# change
124
+ ```
125
+
126
+ (VS Code task: **`sdk: snapshot OAS contract`**. Start the API first via **`run hub api with db`**.)
127
+
128
+ ---
129
+
130
+ ## Local development
131
+
132
+ | Command (in `sdk/`) | What it does | Needs API running? |
133
+ |---|---|---|
134
+ | `./generate.sh` | full local build: starts hub-api via Docker, then generates from the live spec | starts it for you |
135
+ | `npm run generate` | regenerate from the committed `oas/hub.json` snapshot | no |
136
+ | `npm run snapshot` | refresh `oas/hub.json` from the live API (`:20001`) | yes |
137
+ | `npm run build` | just `tsc` | no |
138
+
139
+ To test changes against `web`, build here and overwrite `web/node_modules/@incomy/platform-sdk`
140
+ with the resulting `dist/`.
141
+
142
+ ---
143
+
144
+ ## Consuming the SDK
145
+
146
+ ```bash
147
+ npm install @incomy/platform-sdk # @latest → newest clean release
148
+ npm install @incomy/platform-sdk@beta # newest beta (pre-release testing)
149
+ ```
150
+
151
+ ```ts
152
+ import { hub } from "@incomy/platform-sdk";
153
+ // hub.<Service>.<operation>(...)
154
+ ```
155
+
156
+ Pin an exact version (recommended for a generated client) and bump deliberately. Avoid caret ranges
157
+ on prereleases (e.g. `^0.4.0-189`) — npm prerelease range semantics make them surprising.
158
+
159
+ ---
160
+
161
+ ## Gotchas
162
+
163
+ - **A `main` merge without a version bump publishes nothing** (idempotent skip). To release, bump first.
164
+ - **Keep `version` a clean `X.Y.Z`** — never hand-add `-beta`/`-alpha`; CI adds those.
165
+ - **npm versions are immutable** — you can't unpublish a mistake; fix forward with a higher version
166
+ (and `npm dist-tag` if you need to move `@latest` back).
167
+ - **`main` also deploys the backend.** A bump-and-merge releases the SDK *and* deploys the API
168
+ together; a no-bump merge just deploys the API.
@@ -77,6 +77,8 @@ export type { TemplatePaginatedList } from './models/TemplatePaginatedList';
77
77
  export type { UpdateProfileRequest } from './models/UpdateProfileRequest';
78
78
  export type { User } from './models/User';
79
79
  export type { UserIdentity } from './models/UserIdentity';
80
+ export type { UserSettings } from './models/UserSettings';
81
+ export type { UserSettingsEdit } from './models/UserSettingsEdit';
80
82
  export type { WalletBalance } from './models/WalletBalance';
81
83
  export type { WalletBalancePaginatedList } from './models/WalletBalancePaginatedList';
82
84
  export { AccrualsService } from './services/AccrualsService';
@@ -91,3 +93,4 @@ export { OperationsService } from './services/OperationsService';
91
93
  export { ProjectsService } from './services/ProjectsService';
92
94
  export { ProjectWalletsService } from './services/ProjectWalletsService';
93
95
  export { TemplatesService } from './services/TemplatesService';
96
+ export { UserSettingsService } from './services/UserSettingsService';
@@ -17,3 +17,4 @@ export { OperationsService } from './services/OperationsService';
17
17
  export { ProjectsService } from './services/ProjectsService';
18
18
  export { ProjectWalletsService } from './services/ProjectWalletsService';
19
19
  export { TemplatesService } from './services/TemplatesService';
20
+ export { UserSettingsService } from './services/UserSettingsService';
@@ -2,6 +2,7 @@ import type { BucketBreakdown } from './BucketBreakdown';
2
2
  import type { Money } from './Money';
3
3
  export type Accrual = {
4
4
  bucketBreakdown?: Array<BucketBreakdown> | null;
5
+ companyId?: string | null;
5
6
  /**
6
7
  * If set, record will be deleted when unlined from a multievent or when linked multievent is deleted.
7
8
  */
@@ -2,6 +2,10 @@ import type { BucketBreakdown } from './BucketBreakdown';
2
2
  import type { Money } from './Money';
3
3
  export type AccrualEdit = {
4
4
  bucketBreakdown?: Array<BucketBreakdown> | null;
5
+ /**
6
+ * Set to "" in order to clear.
7
+ */
8
+ companyId?: string | null;
5
9
  /**
6
10
  * If set, record will be deleted when unlined from a multievent or when linked multievent is deleted.
7
11
  */
@@ -2,6 +2,7 @@ import type { BucketBreakdown } from './BucketBreakdown';
2
2
  import type { Money } from './Money';
3
3
  export type AccrualInsert = {
4
4
  bucketBreakdown?: Array<BucketBreakdown> | null;
5
+ companyId?: string | null;
5
6
  /**
6
7
  * If set, record will be deleted when unlined from a multievent or when linked multievent is deleted.
7
8
  */
@@ -4,6 +4,7 @@ import type { Money } from './Money';
4
4
  export type LogAccrual = {
5
5
  balance?: BalanceReport;
6
6
  bucketBreakdown?: Array<BucketBreakdown> | null;
7
+ companyId?: string | null;
7
8
  /**
8
9
  * If set, record will be deleted when unlined from a multievent or when linked multievent is deleted.
9
10
  */
@@ -13,7 +13,9 @@ export type LogOperation = {
13
13
  money: Money;
14
14
  multiEventId?: string | null;
15
15
  name: string;
16
+ originCompanyId?: string | null;
16
17
  originWalletId?: string | null;
18
+ targetCompanyId?: string | null;
17
19
  targetWalletId?: string | null;
18
20
  time: string;
19
21
  type: 'in' | 'out' | 'transfer';
@@ -11,7 +11,9 @@ export type Operation = {
11
11
  money: Money;
12
12
  multiEventId?: string | null;
13
13
  name: string;
14
+ originCompanyId?: string | null;
14
15
  originWalletId?: string | null;
16
+ targetCompanyId?: string | null;
15
17
  targetWalletId?: string | null;
16
18
  time: string;
17
19
  type: 'in' | 'out' | 'transfer';
@@ -13,10 +13,18 @@ export type OperationEdit = {
13
13
  */
14
14
  multiEventId?: string | null;
15
15
  name?: string | null;
16
+ /**
17
+ * Set to "" in order to clear.
18
+ */
19
+ originCompanyId?: string | null;
16
20
  /**
17
21
  * Set to "" in order to clear.
18
22
  */
19
23
  originWalletId?: string | null;
24
+ /**
25
+ * Set to "" in order to clear.
26
+ */
27
+ targetCompanyId?: string | null;
20
28
  /**
21
29
  * Set to "" in order to clear.
22
30
  */
@@ -10,7 +10,9 @@ export type OperationInsert = {
10
10
  money: Money;
11
11
  multiEventId?: string | null;
12
12
  name: string;
13
+ originCompanyId?: string | null;
13
14
  originWalletId?: string | null;
15
+ targetCompanyId?: string | null;
14
16
  targetWalletId?: string | null;
15
17
  /**
16
18
  * MultiEvent time will be used if left empty
@@ -1,8 +1,4 @@
1
1
  export type UpdateProfileRequest = {
2
2
  firstName?: string | null;
3
- /**
4
- * Preferred UI language as a lowercase ISO 639-1 code. Only the supported locales are accepted.
5
- */
6
- language?: string | null;
7
3
  lastName?: string | null;
8
4
  };
@@ -5,11 +5,6 @@ export type User = {
5
5
  firstName?: string | null;
6
6
  id?: string;
7
7
  identities?: Array<UserIdentity> | null;
8
- /**
9
- * Preferred UI language as a lowercase ISO 639-1 code (e.g. "en", "pl").
10
- * Null means the user has not chosen one; the client falls back to the browser language.
11
- */
12
- language?: string | null;
13
8
  lastName?: string | null;
14
9
  readonly name?: string | null;
15
10
  };
@@ -1,10 +1,14 @@
1
1
  export type UserIdentity = {
2
- auth0Id: string | null;
3
2
  avatar?: string | null;
4
3
  email?: string | null;
5
4
  firstName?: string | null;
5
+ /**
6
+ * Surrogate identifier of this identity link. Stable across logins and used to address the
7
+ * identity (e.g. when unlinking). The raw external subject is intentionally not exposed.
8
+ */
9
+ id?: string;
6
10
  isCurrent?: boolean;
7
11
  lastName?: string | null;
8
- readonly provider?: string | null;
12
+ provider: string | null;
9
13
  readonly providerDisplayName?: string | null;
10
14
  };
@@ -0,0 +1,4 @@
1
+ export type UserSettings = {
2
+ language?: string | null;
3
+ timezone?: string | null;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type UserSettingsEdit = {
2
+ language?: string | null;
3
+ timezone?: string | null;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -3,11 +3,11 @@ import type { User } from '../models/User';
3
3
  import type { CancelablePromise } from '../core/CancelablePromise';
4
4
  export declare class AuthService {
5
5
  /**
6
- * @param auth0IdToUnlink
6
+ * @param identityId
7
7
  * @returns any OK
8
8
  * @throws ApiError
9
9
  */
10
- static postAuthIdentitiesUnlink(auth0IdToUnlink: string): CancelablePromise<any>;
10
+ static postAuthIdentitiesUnlink(identityId: string): CancelablePromise<any>;
11
11
  /**
12
12
  * @param returnUrl
13
13
  * @returns any OK
@@ -2,16 +2,16 @@ import { OpenAPI } from '../core/OpenAPI';
2
2
  import { request as __request } from '../core/request';
3
3
  export class AuthService {
4
4
  /**
5
- * @param auth0IdToUnlink
5
+ * @param identityId
6
6
  * @returns any OK
7
7
  * @throws ApiError
8
8
  */
9
- static postAuthIdentitiesUnlink(auth0IdToUnlink) {
9
+ static postAuthIdentitiesUnlink(identityId) {
10
10
  return __request(OpenAPI, {
11
11
  method: 'POST',
12
- url: '/auth/identities/{auth0IdToUnlink}/unlink',
12
+ url: '/auth/identities/{identityId}/unlink',
13
13
  path: {
14
- 'auth0IdToUnlink': auth0IdToUnlink,
14
+ 'identityId': identityId,
15
15
  },
16
16
  });
17
17
  }
@@ -0,0 +1,16 @@
1
+ import type { UserSettings } from '../models/UserSettings';
2
+ import type { UserSettingsEdit } from '../models/UserSettingsEdit';
3
+ import type { CancelablePromise } from '../core/CancelablePromise';
4
+ export declare class UserSettingsService {
5
+ /**
6
+ * @returns UserSettings OK
7
+ * @throws ApiError
8
+ */
9
+ static getUsersMeSettings(): CancelablePromise<UserSettings>;
10
+ /**
11
+ * @param requestBody
12
+ * @returns UserSettings OK
13
+ * @throws ApiError
14
+ */
15
+ static patchUsersMeSettings(requestBody?: UserSettingsEdit): CancelablePromise<UserSettings>;
16
+ }
@@ -0,0 +1,27 @@
1
+ import { OpenAPI } from '../core/OpenAPI';
2
+ import { request as __request } from '../core/request';
3
+ export class UserSettingsService {
4
+ /**
5
+ * @returns UserSettings OK
6
+ * @throws ApiError
7
+ */
8
+ static getUsersMeSettings() {
9
+ return __request(OpenAPI, {
10
+ method: 'GET',
11
+ url: '/users/me/settings',
12
+ });
13
+ }
14
+ /**
15
+ * @param requestBody
16
+ * @returns UserSettings OK
17
+ * @throws ApiError
18
+ */
19
+ static patchUsersMeSettings(requestBody) {
20
+ return __request(OpenAPI, {
21
+ method: 'PATCH',
22
+ url: '/users/me/settings',
23
+ body: requestBody,
24
+ mediaType: 'application/json',
25
+ });
26
+ }
27
+ }
package/meta.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "sdkVersion": "0.4.0-beta.1973",
3
- "generatedAt": "2026-06-25T17:05:16.389Z",
4
- "apiCommit": "cfa90784",
5
- "pipelineUrl": "https://gitlab.com/incomy/platform/-/pipelines/2629786412",
2
+ "sdkVersion": "0.5.0-beta.2075",
3
+ "generatedAt": "2026-06-28T14:57:47.783Z",
4
+ "apiCommit": "ff9810a6",
5
+ "pipelineUrl": "https://gitlab.com/incomy/platform/-/pipelines/2635127130",
6
6
  "sources": {
7
7
  "hub": {
8
- "sha256": "db56e9ea7e70f27b4681ff0437208f90663024ce412985e3edf06463f46eea70"
8
+ "sha256": "f34d7a263e1fadb8f8b8caad8fed7d6edf3d69e27767e4e737f8b9bee71055b5"
9
9
  }
10
10
  }
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incomy/platform-sdk",
3
- "version": "0.4.0-beta.1973",
3
+ "version": "0.5.0-beta.2075",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [