@carthooks/arcubase-cli 0.1.17 → 0.1.18

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.
@@ -0,0 +1,7 @@
1
+ import type { ArcubaseCliUserReference } from '../interface/user_identity.js';
2
+ export type ApiTenantUserReference = {
3
+ tenantUserId: string;
4
+ };
5
+ export declare function toCliArcubaseUserId(input: ApiTenantUserReference): ArcubaseCliUserReference;
6
+ export declare function toApiTenantUserId(input: ArcubaseCliUserReference): ApiTenantUserReference;
7
+ //# sourceMappingURL=user_identity_adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user_identity_adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/user_identity_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAE7E,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,GAAG,wBAAwB,CAI3F;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,wBAAwB,GAAG,sBAAsB,CAIzF"}
@@ -0,0 +1,10 @@
1
+ export function toCliArcubaseUserId(input) {
2
+ return {
3
+ arcubaseUserId: input.tenantUserId,
4
+ };
5
+ }
6
+ export function toApiTenantUserId(input) {
7
+ return {
8
+ tenantUserId: input.arcubaseUserId,
9
+ };
10
+ }
@@ -0,0 +1,3 @@
1
+ export * from './user_identity.js';
2
+ export * from './organization.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './user_identity.js';
2
+ export * from './organization.js';
@@ -0,0 +1,14 @@
1
+ import type { ArcubaseUserId } from './user_identity.js';
2
+ export type ArcubaseCliDepartmentMember = {
3
+ arcubaseUserId: ArcubaseUserId;
4
+ name?: string;
5
+ departments?: string[];
6
+ roles?: string[];
7
+ };
8
+ export type ArcubaseCliRoleMember = {
9
+ arcubaseUserId: ArcubaseUserId;
10
+ name?: string;
11
+ departments?: string[];
12
+ roles?: string[];
13
+ };
14
+ //# sourceMappingURL=organization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../src/interface/organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,MAAM,MAAM,2BAA2B,GAAG;IACxC,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ export type ArcubaseUserId = string;
2
+ export type ArcubaseCliUserIdentity = {
3
+ arcubaseUserId: ArcubaseUserId;
4
+ name?: string;
5
+ email?: string;
6
+ };
7
+ export type ArcubaseCliUserReference = {
8
+ arcubaseUserId: ArcubaseUserId;
9
+ };
10
+ //# sourceMappingURL=user_identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user_identity.d.ts","sourceRoot":"","sources":["../../src/interface/user_identity.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAA;AAEnC,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,EAAE,cAAc,CAAA;CAC/B,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carthooks/arcubase-cli",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Arcubase runtime CLI for admin and user command execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,2 @@
1
+ export * from './user_identity.js'
2
+ export * from './organization.js'
@@ -0,0 +1,15 @@
1
+ import type { ArcubaseUserId } from './user_identity.js'
2
+
3
+ export type ArcubaseCliDepartmentMember = {
4
+ arcubaseUserId: ArcubaseUserId
5
+ name?: string
6
+ departments?: string[]
7
+ roles?: string[]
8
+ }
9
+
10
+ export type ArcubaseCliRoleMember = {
11
+ arcubaseUserId: ArcubaseUserId
12
+ name?: string
13
+ departments?: string[]
14
+ roles?: string[]
15
+ }
@@ -0,0 +1,11 @@
1
+ export type ArcubaseUserId = string
2
+
3
+ export type ArcubaseCliUserIdentity = {
4
+ arcubaseUserId: ArcubaseUserId
5
+ name?: string
6
+ email?: string
7
+ }
8
+
9
+ export type ArcubaseCliUserReference = {
10
+ arcubaseUserId: ArcubaseUserId
11
+ }
@@ -0,0 +1,17 @@
1
+ import type { ArcubaseCliUserReference } from '../interface/user_identity.js'
2
+
3
+ export type ApiTenantUserReference = {
4
+ tenantUserId: string
5
+ }
6
+
7
+ export function toCliArcubaseUserId(input: ApiTenantUserReference): ArcubaseCliUserReference {
8
+ return {
9
+ arcubaseUserId: input.tenantUserId,
10
+ }
11
+ }
12
+
13
+ export function toApiTenantUserId(input: ArcubaseCliUserReference): ApiTenantUserReference {
14
+ return {
15
+ tenantUserId: input.arcubaseUserId,
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ export * from './user_identity.js'
2
+ export * from './organization.js'
@@ -0,0 +1,15 @@
1
+ import type { ArcubaseUserId } from './user_identity.js'
2
+
3
+ export type ArcubaseCliDepartmentMember = {
4
+ arcubaseUserId: ArcubaseUserId
5
+ name?: string
6
+ departments?: string[]
7
+ roles?: string[]
8
+ }
9
+
10
+ export type ArcubaseCliRoleMember = {
11
+ arcubaseUserId: ArcubaseUserId
12
+ name?: string
13
+ departments?: string[]
14
+ roles?: string[]
15
+ }
@@ -0,0 +1,11 @@
1
+ export type ArcubaseUserId = string
2
+
3
+ export type ArcubaseCliUserIdentity = {
4
+ arcubaseUserId: ArcubaseUserId
5
+ name?: string
6
+ email?: string
7
+ }
8
+
9
+ export type ArcubaseCliUserReference = {
10
+ arcubaseUserId: ArcubaseUserId
11
+ }
@@ -135,6 +135,16 @@ test('admin assign-users help uses arcubaseUserId terminology', async () => {
135
135
  assert.match(help.text, /arcubaseUserId/)
136
136
  })
137
137
 
138
+ test('CLI help does not expose tenantUserId', async () => {
139
+ for (const scope of ['admin', 'user'] as const satisfies readonly CommandScope[]) {
140
+ for (const command of listCommands(scope)) {
141
+ const out = await executeCLI(scope, [...command.commandPath, '--help'], env as any, async () => new Response('{}'))
142
+ assert.equal(out.kind, 'help')
143
+ assert.doesNotMatch(out.text, /tenantUserId/)
144
+ }
145
+ }
146
+ })
147
+
138
148
  function forbiddenArcubaseUserTerms(): RegExp {
139
149
  return new RegExp(['tenant' + 'UserId', 'TenantUser' + String.raw`\.ID`, 'tenant user' + ' id'].join('|'), 'i')
140
150
  }
@@ -0,0 +1,43 @@
1
+ import assert from 'node:assert/strict'
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import test from 'node:test'
5
+ import { fileURLToPath } from 'node:url'
6
+ import { toApiTenantUserId, toCliArcubaseUserId } from '../adapters/user_identity_adapter.js'
7
+
8
+ const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
9
+
10
+ function walk(dir: string): string[] {
11
+ if (!fs.existsSync(dir)) return []
12
+ const out: string[] = []
13
+ for (const name of fs.readdirSync(dir)) {
14
+ const abs = path.join(dir, name)
15
+ const stat = fs.statSync(abs)
16
+ if (stat.isDirectory()) {
17
+ out.push(...walk(abs))
18
+ } else if (stat.isFile() && /\.(ts|md|js|mjs)$/.test(name)) {
19
+ out.push(abs)
20
+ }
21
+ }
22
+ return out
23
+ }
24
+
25
+ test('CLI interface types do not expose tenantUserId', () => {
26
+ const files = walk(path.join(packageRoot, 'src/interface'))
27
+ assert.ok(files.length > 0)
28
+ for (const file of files) {
29
+ assert.equal(fs.readFileSync(file, 'utf8').includes('tenantUserId'), false, file)
30
+ }
31
+ })
32
+
33
+ test('CLI adapter maps tenantUserId to arcubaseUserId', () => {
34
+ assert.deepEqual(toCliArcubaseUserId({ tenantUserId: '2188890296' }), {
35
+ arcubaseUserId: '2188890296',
36
+ })
37
+ })
38
+
39
+ test('CLI adapter maps arcubaseUserId to tenantUserId', () => {
40
+ assert.deepEqual(toApiTenantUserId({ arcubaseUserId: '2188890296' }), {
41
+ tenantUserId: '2188890296',
42
+ })
43
+ })