kibela-api-client 0.1.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 (84) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +274 -0
  3. package/bin/kibela.js +2 -0
  4. package/dist/cli/_error-handler.d.ts +9 -0
  5. package/dist/cli/_error-handler.d.ts.map +1 -0
  6. package/dist/cli/_error-handler.js +77 -0
  7. package/dist/cli/_error-handler.js.map +1 -0
  8. package/dist/cli/_validators.d.ts +44 -0
  9. package/dist/cli/_validators.d.ts.map +1 -0
  10. package/dist/cli/_validators.js +70 -0
  11. package/dist/cli/_validators.js.map +1 -0
  12. package/dist/cli/commands/config.d.ts +3 -0
  13. package/dist/cli/commands/config.d.ts.map +1 -0
  14. package/dist/cli/commands/config.js +81 -0
  15. package/dist/cli/commands/config.js.map +1 -0
  16. package/dist/cli/commands/groups.d.ts +3 -0
  17. package/dist/cli/commands/groups.d.ts.map +1 -0
  18. package/dist/cli/commands/groups.js +57 -0
  19. package/dist/cli/commands/groups.js.map +1 -0
  20. package/dist/cli/commands/notes.d.ts +3 -0
  21. package/dist/cli/commands/notes.d.ts.map +1 -0
  22. package/dist/cli/commands/notes.js +223 -0
  23. package/dist/cli/commands/notes.js.map +1 -0
  24. package/dist/cli/commands/stats.d.ts +3 -0
  25. package/dist/cli/commands/stats.d.ts.map +1 -0
  26. package/dist/cli/commands/stats.js +71 -0
  27. package/dist/cli/commands/stats.js.map +1 -0
  28. package/dist/cli/commands/test.d.ts +3 -0
  29. package/dist/cli/commands/test.d.ts.map +1 -0
  30. package/dist/cli/commands/test.js +19 -0
  31. package/dist/cli/commands/test.js.map +1 -0
  32. package/dist/cli/commands/users.d.ts +3 -0
  33. package/dist/cli/commands/users.d.ts.map +1 -0
  34. package/dist/cli/commands/users.js +77 -0
  35. package/dist/cli/commands/users.js.map +1 -0
  36. package/dist/cli/config.d.ts +19 -0
  37. package/dist/cli/config.d.ts.map +1 -0
  38. package/dist/cli/config.js +93 -0
  39. package/dist/cli/config.js.map +1 -0
  40. package/dist/cli/index.d.ts +3 -0
  41. package/dist/cli/index.d.ts.map +1 -0
  42. package/dist/cli/index.js +19 -0
  43. package/dist/cli/index.js.map +1 -0
  44. package/dist/cli/utils.d.ts +11 -0
  45. package/dist/cli/utils.d.ts.map +1 -0
  46. package/dist/cli/utils.js +62 -0
  47. package/dist/cli/utils.js.map +1 -0
  48. package/dist/client/index.d.ts +9 -0
  49. package/dist/client/index.d.ts.map +1 -0
  50. package/dist/client/index.js +33 -0
  51. package/dist/client/index.js.map +1 -0
  52. package/dist/index.d.ts +15 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +39 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/queries/groups.d.ts +3 -0
  57. package/dist/queries/groups.d.ts.map +1 -0
  58. package/dist/queries/groups.js +36 -0
  59. package/dist/queries/groups.js.map +1 -0
  60. package/dist/queries/notes.d.ts +7 -0
  61. package/dist/queries/notes.d.ts.map +1 -0
  62. package/dist/queries/notes.js +188 -0
  63. package/dist/queries/notes.js.map +1 -0
  64. package/dist/queries/users.d.ts +3 -0
  65. package/dist/queries/users.d.ts.map +1 -0
  66. package/dist/queries/users.js +42 -0
  67. package/dist/queries/users.js.map +1 -0
  68. package/dist/resources/groups.d.ts +13 -0
  69. package/dist/resources/groups.d.ts.map +1 -0
  70. package/dist/resources/groups.js +38 -0
  71. package/dist/resources/groups.js.map +1 -0
  72. package/dist/resources/notes.d.ts +23 -0
  73. package/dist/resources/notes.d.ts.map +1 -0
  74. package/dist/resources/notes.js +55 -0
  75. package/dist/resources/notes.js.map +1 -0
  76. package/dist/resources/users.d.ts +13 -0
  77. package/dist/resources/users.d.ts.map +1 -0
  78. package/dist/resources/users.js +38 -0
  79. package/dist/resources/users.js.map +1 -0
  80. package/dist/types/index.d.ts +70 -0
  81. package/dist/types/index.d.ts.map +1 -0
  82. package/dist/types/index.js +3 -0
  83. package/dist/types/index.js.map +1 -0
  84. package/package.json +61 -0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const config_1 = require("./commands/config");
6
+ const notes_1 = require("./commands/notes");
7
+ const groups_1 = require("./commands/groups");
8
+ const users_1 = require("./commands/users");
9
+ const program = new commander_1.Command();
10
+ program
11
+ .name('kibela')
12
+ .description('Kibela API CLI')
13
+ .version('0.1.0');
14
+ program.addCommand(config_1.configCommand);
15
+ program.addCommand(notes_1.notesCommand);
16
+ program.addCommand(groups_1.groupsCommand);
17
+ program.addCommand(users_1.usersCommand);
18
+ program.parse(process.argv);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,8CAAkD;AAClD,4CAAgD;AAChD,8CAAkD;AAClD,4CAAgD;AAEhD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,gBAAgB,CAAC;KAC7B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,oBAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,oBAAY,CAAC,CAAC;AAEjC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import ora from 'ora';
2
+ import { Kibela } from '../index';
3
+ export declare function success(message: string): void;
4
+ export declare function error(message: string): void;
5
+ export declare function info(message: string): void;
6
+ export declare function warn(message: string): void;
7
+ export declare function createSpinner(text: string): ora.Ora;
8
+ export declare function getClient(): Kibela;
9
+ export declare function formatDate(dateString: string): string;
10
+ export declare function displayToken(token: string): string;
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKlC,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,WAKzC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAwBlC;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.success = success;
7
+ exports.error = error;
8
+ exports.info = info;
9
+ exports.warn = warn;
10
+ exports.createSpinner = createSpinner;
11
+ exports.getClient = getClient;
12
+ exports.formatDate = formatDate;
13
+ exports.displayToken = displayToken;
14
+ const chalk_1 = __importDefault(require("chalk"));
15
+ const ora_1 = __importDefault(require("ora"));
16
+ const index_1 = require("../index");
17
+ const config_1 = require("./config");
18
+ const _validators_1 = require("./_validators");
19
+ const _error_handler_1 = require("./_error-handler");
20
+ function success(message) {
21
+ console.log(chalk_1.default.green('✔'), message);
22
+ }
23
+ function error(message) {
24
+ console.error(chalk_1.default.red('✖'), message);
25
+ }
26
+ function info(message) {
27
+ console.log(chalk_1.default.blue('ℹ'), message);
28
+ }
29
+ function warn(message) {
30
+ console.log(chalk_1.default.yellow('⚠'), message);
31
+ }
32
+ function createSpinner(text) {
33
+ return (0, ora_1.default)({
34
+ text,
35
+ spinner: 'dots'
36
+ });
37
+ }
38
+ function getClient() {
39
+ const team = config_1.ConfigManager.get('team');
40
+ const token = config_1.ConfigManager.get('token');
41
+ console.log('DEBUG: team from config:', team);
42
+ console.log('DEBUG: token exists:', !!token);
43
+ console.log('DEBUG: token length:', token?.length);
44
+ const validation = (0, _validators_1.validateConfig)(team, token);
45
+ if (!validation.isValid) {
46
+ throw new _error_handler_1.KibelaError(`Configuration error: ${validation.error}\nRun "kibela config" to set up your credentials.`, 'CONFIG_ERROR');
47
+ }
48
+ try {
49
+ return new index_1.Kibela({ team: team, token: token });
50
+ }
51
+ catch (err) {
52
+ throw new _error_handler_1.KibelaError(`Failed to create Kibela client: ${err}`, 'CLIENT_ERROR');
53
+ }
54
+ }
55
+ function formatDate(dateString) {
56
+ const date = new Date(dateString);
57
+ return date.toLocaleString();
58
+ }
59
+ function displayToken(token) {
60
+ return (0, _validators_1.sanitizeToken)(token);
61
+ }
62
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":";;;;;AAOA,0BAEC;AAED,sBAEC;AAED,oBAEC;AAED,oBAEC;AAED,sCAKC;AAED,8BAwBC;AAED,gCAGC;AAED,oCAEC;AA/DD,kDAA0B;AAC1B,8CAAsB;AACtB,oCAAkC;AAClC,qCAAyC;AACzC,+CAA8D;AAC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F,cAAc,CACf,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,cAAM,CAAC,EAAE,IAAI,EAAE,IAAK,EAAE,KAAK,EAAE,KAAM,EAAE,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,4BAAW,CACnB,mCAAmC,GAAG,EAAE,EACxC,cAAc,CACf,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,UAAU,CAAC,UAAkB;IAC3C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;AAC/B,CAAC;AAED,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,IAAA,2BAAa,EAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { KibelaConfig } from '../types';
2
+ export declare class KibelaClient {
3
+ private client;
4
+ private team;
5
+ constructor(config: KibelaConfig);
6
+ request<T>(query: string, variables?: any): Promise<T>;
7
+ getTeam(): string;
8
+ }
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,IAAI,CAAS;gBAET,MAAM,EAAE,YAAY;IAY1B,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAW5D,OAAO,IAAI,MAAM;CAGlB"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KibelaClient = void 0;
4
+ const graphql_request_1 = require("graphql-request");
5
+ class KibelaClient {
6
+ constructor(config) {
7
+ this.team = config.team;
8
+ this.client = new graphql_request_1.GraphQLClient(`https://${config.team}.kibe.la/api/v1`, {
9
+ headers: {
10
+ 'Authorization': `Bearer ${config.token}`,
11
+ 'Content-Type': 'application/json',
12
+ 'Accept': 'application/json',
13
+ 'User-Agent': '@kibela/api'
14
+ },
15
+ });
16
+ }
17
+ async request(query, variables) {
18
+ try {
19
+ return await this.client.request(query, variables);
20
+ }
21
+ catch (error) {
22
+ if (error instanceof Error) {
23
+ throw new Error(`Kibela API Error: ${error.message}`);
24
+ }
25
+ throw error;
26
+ }
27
+ }
28
+ getTeam() {
29
+ return this.team;
30
+ }
31
+ }
32
+ exports.KibelaClient = KibelaClient;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAGhD,MAAa,YAAY;IAIvB,YAAY,MAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,+BAAa,CAAC,WAAW,MAAM,CAAC,IAAI,iBAAiB,EAAE;YACvE,OAAO,EAAE;gBACP,eAAe,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE;gBACzC,cAAc,EAAE,kBAAkB;gBAClC,QAAQ,EAAE,kBAAkB;gBAC5B,YAAY,EAAE,aAAa;aAC5B;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAI,KAAa,EAAE,SAAe;QAC7C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAI,KAAK,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACxD,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AA9BD,oCA8BC"}
@@ -0,0 +1,15 @@
1
+ import { Notes } from './resources/notes';
2
+ import { Groups } from './resources/groups';
3
+ import { Users } from './resources/users';
4
+ import { KibelaConfig } from './types';
5
+ export declare class Kibela {
6
+ private client;
7
+ notes: Notes;
8
+ groups: Groups;
9
+ users: Users;
10
+ constructor(config: KibelaConfig);
11
+ getTeam(): string;
12
+ }
13
+ export declare function createClient(config: KibelaConfig): Kibela;
14
+ export * from './types';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAe;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;gBAER,MAAM,EAAE,YAAY;IAOhC,OAAO,IAAI,MAAM;CAGlB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAEzD;AAED,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Kibela = void 0;
18
+ exports.createClient = createClient;
19
+ const client_1 = require("./client");
20
+ const notes_1 = require("./resources/notes");
21
+ const groups_1 = require("./resources/groups");
22
+ const users_1 = require("./resources/users");
23
+ class Kibela {
24
+ constructor(config) {
25
+ this.client = new client_1.KibelaClient(config);
26
+ this.notes = new notes_1.Notes(this.client);
27
+ this.groups = new groups_1.Groups(this.client);
28
+ this.users = new users_1.Users(this.client);
29
+ }
30
+ getTeam() {
31
+ return this.client.getTeam();
32
+ }
33
+ }
34
+ exports.Kibela = Kibela;
35
+ function createClient(config) {
36
+ return new Kibela(config);
37
+ }
38
+ __exportStar(require("./types"), exports);
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAwBA,oCAEC;AA1BD,qCAAwC;AACxC,6CAA0C;AAC1C,+CAA4C;AAC5C,6CAA0C;AAG1C,MAAa,MAAM;IAMjB,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAY,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;CACF;AAhBD,wBAgBC;AAED,SAAgB,YAAY,CAAC,MAAoB;IAC/C,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,0CAAwB"}
@@ -0,0 +1,3 @@
1
+ export declare const LIST_GROUPS = "\n query ListGroups($first: Int, $after: String) {\n groups(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n name\n description\n isPrivate\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n";
2
+ export declare const GET_GROUP = "\n query GetGroup($id: ID!) {\n group(id: $id) {\n id\n name\n description\n isPrivate\n }\n }\n";
3
+ //# sourceMappingURL=groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/queries/groups.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,kYAqBvB,CAAC;AAEF,eAAO,MAAM,SAAS,iIASrB,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET_GROUP = exports.LIST_GROUPS = void 0;
4
+ exports.LIST_GROUPS = `
5
+ query ListGroups($first: Int, $after: String) {
6
+ groups(first: $first, after: $after) {
7
+ edges {
8
+ cursor
9
+ node {
10
+ id
11
+ name
12
+ description
13
+ isPrivate
14
+ }
15
+ }
16
+ pageInfo {
17
+ endCursor
18
+ hasNextPage
19
+ hasPreviousPage
20
+ startCursor
21
+ }
22
+ totalCount
23
+ }
24
+ }
25
+ `;
26
+ exports.GET_GROUP = `
27
+ query GetGroup($id: ID!) {
28
+ group(id: $id) {
29
+ id
30
+ name
31
+ description
32
+ isPrivate
33
+ }
34
+ }
35
+ `;
36
+ //# sourceMappingURL=groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../src/queries/groups.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;CAqB1B,CAAC;AAEW,QAAA,SAAS,GAAG;;;;;;;;;CASxB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const CREATE_NOTE = "\n mutation CreateNote($input: CreateNoteInput!) {\n createNote(input: $input) {\n note {\n id\n title\n content\n contentHtml\n contentUpdatedAt\n publishedAt\n url\n coediting\n author {\n id\n account\n realName\n avatarImage {\n url\n }\n url\n }\n groups {\n id\n name\n }\n commentsCount\n }\n }\n }\n";
2
+ export declare const UPDATE_NOTE = "\n mutation UpdateNote($input: UpdateNoteInput!) {\n updateNote(input: $input) {\n note {\n id\n title\n content\n contentHtml\n contentUpdatedAt\n publishedAt\n url\n coediting\n author {\n id\n account\n realName\n avatarImage {\n url\n }\n url\n }\n groups {\n id\n name\n }\n commentsCount\n }\n }\n }\n";
3
+ export declare const DELETE_NOTE = "\n mutation DeleteNote($input: DeleteNoteInput!) {\n deleteNote(input: $input) {\n note {\n id\n }\n }\n }\n";
4
+ export declare const GET_NOTE = "\n query GetNote($id: ID!) {\n note(id: $id) {\n id\n title\n content\n contentHtml\n contentUpdatedAt\n publishedAt\n url\n coediting\n author {\n id\n account\n realName\n avatarImage {\n url\n }\n url\n }\n groups {\n id\n name\n }\n commentsCount\n comments(first: 50) {\n edges {\n node {\n id\n content\n contentHtml\n publishedAt\n author {\n id\n account\n realName\n avatarImage {\n url\n }\n url\n }\n }\n }\n }\n }\n }\n";
5
+ export declare const LIST_NOTES = "\n query ListNotes($first: Int, $after: String, $orderBy: NoteOrder) {\n notes(first: $first, after: $after, orderBy: $orderBy) {\n edges {\n cursor\n node {\n id\n title\n content\n contentHtml\n contentUpdatedAt\n publishedAt\n url\n coediting\n author {\n id\n account\n realName\n avatarImage {\n url\n }\n url\n }\n groups {\n id\n name\n }\n commentsCount\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n";
6
+ export declare const SEARCH_NOTES = "\n query SearchNotes($query: String!, $first: Int, $after: String) {\n search(query: $query, first: $first, after: $after) {\n edges {\n cursor\n node {\n __typename\n ... on Note {\n id\n title\n contentUpdatedAt\n url\n author {\n id\n account\n realName\n }\n }\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n totalCount\n }\n }\n";
7
+ //# sourceMappingURL=notes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../src/queries/notes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wfA6BvB,CAAC;AAEF,eAAO,MAAM,WAAW,wfA6BvB,CAAC;AAEF,eAAO,MAAM,WAAW,0IAQvB,CAAC;AAEF,eAAO,MAAM,QAAQ,uwBA8CpB,CAAC;AAEF,eAAO,MAAM,UAAU,owBAuCtB,CAAC;AAEF,eAAO,MAAM,YAAY,+hBA2BxB,CAAC"}
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SEARCH_NOTES = exports.LIST_NOTES = exports.GET_NOTE = exports.DELETE_NOTE = exports.UPDATE_NOTE = exports.CREATE_NOTE = void 0;
4
+ exports.CREATE_NOTE = `
5
+ mutation CreateNote($input: CreateNoteInput!) {
6
+ createNote(input: $input) {
7
+ note {
8
+ id
9
+ title
10
+ content
11
+ contentHtml
12
+ contentUpdatedAt
13
+ publishedAt
14
+ url
15
+ coediting
16
+ author {
17
+ id
18
+ account
19
+ realName
20
+ avatarImage {
21
+ url
22
+ }
23
+ url
24
+ }
25
+ groups {
26
+ id
27
+ name
28
+ }
29
+ commentsCount
30
+ }
31
+ }
32
+ }
33
+ `;
34
+ exports.UPDATE_NOTE = `
35
+ mutation UpdateNote($input: UpdateNoteInput!) {
36
+ updateNote(input: $input) {
37
+ note {
38
+ id
39
+ title
40
+ content
41
+ contentHtml
42
+ contentUpdatedAt
43
+ publishedAt
44
+ url
45
+ coediting
46
+ author {
47
+ id
48
+ account
49
+ realName
50
+ avatarImage {
51
+ url
52
+ }
53
+ url
54
+ }
55
+ groups {
56
+ id
57
+ name
58
+ }
59
+ commentsCount
60
+ }
61
+ }
62
+ }
63
+ `;
64
+ exports.DELETE_NOTE = `
65
+ mutation DeleteNote($input: DeleteNoteInput!) {
66
+ deleteNote(input: $input) {
67
+ note {
68
+ id
69
+ }
70
+ }
71
+ }
72
+ `;
73
+ exports.GET_NOTE = `
74
+ query GetNote($id: ID!) {
75
+ note(id: $id) {
76
+ id
77
+ title
78
+ content
79
+ contentHtml
80
+ contentUpdatedAt
81
+ publishedAt
82
+ url
83
+ coediting
84
+ author {
85
+ id
86
+ account
87
+ realName
88
+ avatarImage {
89
+ url
90
+ }
91
+ url
92
+ }
93
+ groups {
94
+ id
95
+ name
96
+ }
97
+ commentsCount
98
+ comments(first: 50) {
99
+ edges {
100
+ node {
101
+ id
102
+ content
103
+ contentHtml
104
+ publishedAt
105
+ author {
106
+ id
107
+ account
108
+ realName
109
+ avatarImage {
110
+ url
111
+ }
112
+ url
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ `;
120
+ exports.LIST_NOTES = `
121
+ query ListNotes($first: Int, $after: String, $orderBy: NoteOrder) {
122
+ notes(first: $first, after: $after, orderBy: $orderBy) {
123
+ edges {
124
+ cursor
125
+ node {
126
+ id
127
+ title
128
+ content
129
+ contentHtml
130
+ contentUpdatedAt
131
+ publishedAt
132
+ url
133
+ coediting
134
+ author {
135
+ id
136
+ account
137
+ realName
138
+ avatarImage {
139
+ url
140
+ }
141
+ url
142
+ }
143
+ groups {
144
+ id
145
+ name
146
+ }
147
+ commentsCount
148
+ }
149
+ }
150
+ pageInfo {
151
+ endCursor
152
+ hasNextPage
153
+ hasPreviousPage
154
+ startCursor
155
+ }
156
+ totalCount
157
+ }
158
+ }
159
+ `;
160
+ exports.SEARCH_NOTES = `
161
+ query SearchNotes($query: String!, $first: Int, $after: String) {
162
+ search(query: $query, first: $first, after: $after) {
163
+ edges {
164
+ cursor
165
+ node {
166
+ __typename
167
+ ... on Note {
168
+ id
169
+ title
170
+ contentUpdatedAt
171
+ url
172
+ author {
173
+ id
174
+ account
175
+ realName
176
+ }
177
+ }
178
+ }
179
+ }
180
+ pageInfo {
181
+ endCursor
182
+ hasNextPage
183
+ }
184
+ totalCount
185
+ }
186
+ }
187
+ `;
188
+ //# sourceMappingURL=notes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notes.js","sourceRoot":"","sources":["../../src/queries/notes.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B1B,CAAC;AAEW,QAAA,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B1B,CAAC;AAEW,QAAA,WAAW,GAAG;;;;;;;;CAQ1B,CAAC;AAEW,QAAA,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CvB,CAAC;AAEW,QAAA,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCzB,CAAC;AAEW,QAAA,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const LIST_USERS = "\n query ListUsers($first: Int, $after: String) {\n users(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n account\n realName\n avatarImage {\n url\n }\n url\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n totalCount\n }\n }\n";
2
+ export declare const GET_CURRENT_USER = "\n query GetCurrentUser {\n currentUser {\n id\n account\n realName\n avatarImage {\n url\n }\n url\n }\n }\n";
3
+ //# sourceMappingURL=users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/queries/users.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,ibAwBtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+JAY5B,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET_CURRENT_USER = exports.LIST_USERS = void 0;
4
+ exports.LIST_USERS = `
5
+ query ListUsers($first: Int, $after: String) {
6
+ users(first: $first, after: $after) {
7
+ edges {
8
+ cursor
9
+ node {
10
+ id
11
+ account
12
+ realName
13
+ avatarImage {
14
+ url
15
+ }
16
+ url
17
+ }
18
+ }
19
+ pageInfo {
20
+ endCursor
21
+ hasNextPage
22
+ hasPreviousPage
23
+ startCursor
24
+ }
25
+ totalCount
26
+ }
27
+ }
28
+ `;
29
+ exports.GET_CURRENT_USER = `
30
+ query GetCurrentUser {
31
+ currentUser {
32
+ id
33
+ account
34
+ realName
35
+ avatarImage {
36
+ url
37
+ }
38
+ url
39
+ }
40
+ }
41
+ `;
42
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/queries/users.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBzB,CAAC;AAEW,QAAA,gBAAgB,GAAG;;;;;;;;;;;;CAY/B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { KibelaClient } from '../client';
2
+ import { Group, Connection } from '../types';
3
+ export declare class Groups {
4
+ private client;
5
+ constructor(client: KibelaClient);
6
+ list(options?: {
7
+ first?: number;
8
+ after?: string;
9
+ }): Promise<Connection<Group>>;
10
+ get(id: string): Promise<Group | null>;
11
+ getAll(): Promise<Group[]>;
12
+ }
13
+ //# sourceMappingURL=groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/resources/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7C,qBAAa,MAAM;IACL,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAElC,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAiBxB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAQtC,MAAM,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;CAcjC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Groups = void 0;
4
+ const groups_1 = require("../queries/groups");
5
+ class Groups {
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ async list(options) {
10
+ const { groups } = await this.client.request(groups_1.LIST_GROUPS, {
11
+ first: options?.first ?? 50,
12
+ after: options?.after
13
+ });
14
+ // Ensure nodes array exists
15
+ if (!groups.nodes && groups.edges) {
16
+ groups.nodes = groups.edges.map(edge => edge.node);
17
+ }
18
+ return groups;
19
+ }
20
+ async get(id) {
21
+ const { group } = await this.client.request(groups_1.GET_GROUP, { id });
22
+ return group;
23
+ }
24
+ async getAll() {
25
+ const allGroups = [];
26
+ let hasNextPage = true;
27
+ let after;
28
+ while (hasNextPage) {
29
+ const result = await this.list({ first: 100, after });
30
+ allGroups.push(...result.nodes);
31
+ hasNextPage = result.pageInfo.hasNextPage;
32
+ after = result.pageInfo.endCursor;
33
+ }
34
+ return allGroups;
35
+ }
36
+ }
37
+ exports.Groups = Groups;
38
+ //# sourceMappingURL=groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../src/resources/groups.ts"],"names":[],"mappings":";;;AACA,8CAA2D;AAG3D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CACF;AA7CD,wBA6CC"}
@@ -0,0 +1,23 @@
1
+ import { KibelaClient } from '../client';
2
+ import { Note, CreateNoteInput, UpdateNoteInput, Connection } from '../types';
3
+ export declare class Notes {
4
+ private client;
5
+ constructor(client: KibelaClient);
6
+ create(input: CreateNoteInput): Promise<Note>;
7
+ update(id: string, input: UpdateNoteInput): Promise<Note>;
8
+ delete(id: string): Promise<string>;
9
+ get(id: string): Promise<Note | null>;
10
+ list(options?: {
11
+ first?: number;
12
+ after?: string;
13
+ orderBy?: {
14
+ field: 'CONTENT_UPDATED_AT' | 'PUBLISHED_AT';
15
+ direction: 'ASC' | 'DESC';
16
+ };
17
+ }): Promise<Connection<Note>>;
18
+ search(query: string, options?: {
19
+ first?: number;
20
+ after?: string;
21
+ }): Promise<Connection<Note>>;
22
+ }
23
+ //# sourceMappingURL=notes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../src/resources/notes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AASzC,OAAO,EACL,IAAI,EACJ,eAAe,EACf,eAAe,EACf,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,qBAAa,KAAK;IACJ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAElC,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7C,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IASzD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAQrC,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE;YACR,KAAK,EAAE,oBAAoB,GAAG,cAAc,CAAC;YAC7C,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;SAC3B,CAAC;KACH,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAkBvB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QACpC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;CAiB9B"}