@ganaka/sdk 1.1.0 → 1.2.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/dist/index.d.ts CHANGED
@@ -49,6 +49,8 @@ declare const createRun: {
49
49
  start_datetime: z.ZodString;
50
50
  end_datetime: z.ZodString;
51
51
  timezone: z.ZodOptional<z.ZodString>;
52
+ name: z.ZodOptional<z.ZodString>;
53
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
54
  }, z.core.$strip>;
53
55
  response: z.ZodObject<{
54
56
  statusCode: z.ZodNumber;
@@ -58,6 +60,8 @@ declare const createRun: {
58
60
  start_datetime: z.ZodString;
59
61
  end_datetime: z.ZodString;
60
62
  completed: z.ZodBoolean;
63
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
61
65
  }, z.core.$strip>;
62
66
  }, z.core.$strip>;
63
67
  };
@@ -129,7 +133,7 @@ declare const fetchShortlist: ({ developerToken, apiDomain, runId, currentTimest
129
133
 
130
134
  export declare type FetchShortlistResponse = Awaited<ReturnType<ReturnType<typeof fetchShortlist>>>;
131
135
 
132
- export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, deleteRunAfterCompletion, }: {
136
+ export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, deleteRunAfterCompletion, name, tags, }: {
133
137
  fn: (context: RunContext) => Promise<T>;
134
138
  /** Start time in IST string format (YYYY-MM-DDTHH:mm:ss) */
135
139
  startTime: string;
@@ -142,6 +146,14 @@ export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, del
142
146
  * @default false
143
147
  */
144
148
  deleteRunAfterCompletion?: boolean;
149
+ /**
150
+ * Optional name for the run
151
+ */
152
+ name?: string;
153
+ /**
154
+ * Optional array of tags to classify and group the run
155
+ */
156
+ tags?: string[];
145
157
  }): Promise<void>;
146
158
 
147
159
  declare const getAvailableDatetimes: {
@@ -620,10 +632,20 @@ declare const getRuns: {
620
632
  end_datetime: z.ZodString;
621
633
  completed: z.ZodBoolean;
622
634
  orderCount: z.ZodNumber;
635
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
636
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
623
637
  }, z.core.$strip>>>;
624
638
  }, z.core.$strip>;
625
639
  };
626
640
 
641
+ declare const getRunTags: {
642
+ response: z.ZodObject<{
643
+ statusCode: z.ZodNumber;
644
+ message: z.ZodString;
645
+ data: z.ZodArray<z.ZodString>;
646
+ }, z.core.$strip>;
647
+ };
648
+
627
649
  declare const getShortlists: {
628
650
  query: z.ZodObject<{
629
651
  datetime: z.ZodString;
@@ -856,6 +878,8 @@ declare const updateRun: {
856
878
  }, z.core.$strip>;
857
879
  body: z.ZodObject<{
858
880
  completed: z.ZodOptional<z.ZodBoolean>;
881
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
882
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
859
883
  }, z.core.$strip>;
860
884
  response: z.ZodObject<{
861
885
  statusCode: z.ZodNumber;
@@ -865,6 +889,8 @@ declare const updateRun: {
865
889
  start_datetime: z.ZodString;
866
890
  end_datetime: z.ZodString;
867
891
  completed: z.ZodBoolean;
892
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
893
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
868
894
  }, z.core.$strip>;
869
895
  }, z.core.$strip>;
870
896
  };
@@ -912,7 +938,8 @@ declare namespace v1_dashboard_runs_schemas {
912
938
  createRun,
913
939
  updateRun,
914
940
  deleteRun,
915
- createOrder
941
+ createOrder,
942
+ getRunTags
916
943
  }
917
944
  }
918
945
 
package/dist/index.js CHANGED
@@ -4110,7 +4110,7 @@ const t$1 = [
4110
4110
  "TOP_GAINERS",
4111
4111
  "VOLUME_SHOCKERS"
4112
4112
  ];
4113
- const g = object({
4113
+ const _ = object({
4114
4114
  average_price: number$1().nullable(),
4115
4115
  bid_quantity: number$1().nullable(),
4116
4116
  bid_price: number$1().nullable(),
@@ -4158,7 +4158,7 @@ const g = object({
4158
4158
  week_52_low: number$1().nullable()
4159
4159
  }), a = object({
4160
4160
  status: _enum(["SUCCESS", "FAILURE"]),
4161
- payload: g
4161
+ payload: _
4162
4162
  }), y = object({
4163
4163
  nseSymbol: string(),
4164
4164
  name: string(),
@@ -4322,7 +4322,7 @@ const p = object({
4322
4322
  response: t.extend({
4323
4323
  data: string()
4324
4324
  })
4325
- }, P = {
4325
+ }, x = {
4326
4326
  query: object({
4327
4327
  symbol: string(),
4328
4328
  date: i
@@ -4344,7 +4344,7 @@ const p = object({
4344
4344
  )
4345
4345
  })
4346
4346
  })
4347
- }, q = {
4347
+ }, P = {
4348
4348
  query: object({
4349
4349
  datetime: n.optional(),
4350
4350
  timezone: o.optional()
@@ -4352,31 +4352,31 @@ const p = object({
4352
4352
  response: t.extend({
4353
4353
  data: a.nullable()
4354
4354
  })
4355
- }, ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4355
+ }, ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4356
4356
  __proto__: null,
4357
4357
  getGrowwHistoricalCandles: f,
4358
- getGrowwNiftyQuote: q,
4358
+ getGrowwNiftyQuote: P,
4359
4359
  getGrowwQuote: v,
4360
- getGrowwQuoteTimeline: P,
4360
+ getGrowwQuoteTimeline: x,
4361
4361
  getGrowwToken: T,
4362
4362
  growwHistoricalCandlesSchema: p
4363
- }, Symbol.toStringTag, { value: "Module" })), _ = object({
4363
+ }, Symbol.toStringTag, { value: "Module" })), g = object({
4364
4364
  name: string(),
4365
4365
  price: number$1(),
4366
4366
  nseSymbol: string()
4367
- }), x = {
4367
+ }), q = {
4368
4368
  query: object({
4369
4369
  type: _enum(["top-gainers", "volume-shockers"]),
4370
4370
  datetime: n.optional(),
4371
4371
  timezone: o.optional()
4372
4372
  }),
4373
4373
  response: t.extend({
4374
- data: array(_).nullable()
4374
+ data: array(g).nullable()
4375
4375
  })
4376
- }, ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4376
+ }, je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4377
4377
  __proto__: null,
4378
- getLists: x,
4379
- listSchema: _
4378
+ getLists: q,
4379
+ listSchema: g
4380
4380
  }, Symbol.toStringTag, { value: "Module" })), O = {
4381
4381
  query: object({}),
4382
4382
  response: t.extend({
@@ -4442,7 +4442,7 @@ const p = object({
4442
4442
  }, M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4443
4443
  __proto__: null,
4444
4444
  getDailyPersistentCompanies: C
4445
- }, Symbol.toStringTag, { value: "Module" })), A = {
4445
+ }, Symbol.toStringTag, { value: "Module" })), R = {
4446
4446
  query: object({
4447
4447
  date: i,
4448
4448
  type: _enum(t$1)
@@ -4454,9 +4454,9 @@ const p = object({
4454
4454
  uniqueCount: number$1()
4455
4455
  })
4456
4456
  })
4457
- }, R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4457
+ }, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4458
4458
  __proto__: null,
4459
- getDailyUniqueCompanies: A
4459
+ getDailyUniqueCompanies: R
4460
4460
  }, Symbol.toStringTag, { value: "Module" })), k = object({
4461
4461
  id: uuid(),
4462
4462
  username: string()
@@ -4500,7 +4500,9 @@ const p = object({
4500
4500
  start_datetime: string(),
4501
4501
  end_datetime: string(),
4502
4502
  completed: boolean(),
4503
- orderCount: number$1()
4503
+ orderCount: number$1(),
4504
+ name: string().nullable().optional(),
4505
+ tags: array(string()).optional()
4504
4506
  }), U = record(
4505
4507
  string(),
4506
4508
  // date string (YYYY-MM-DD)
@@ -4541,24 +4543,32 @@ const p = object({
4541
4543
  }, $ = object({
4542
4544
  start_datetime: n,
4543
4545
  end_datetime: n,
4544
- timezone: o.optional()
4546
+ timezone: o.optional(),
4547
+ name: string().optional(),
4548
+ tags: array(string().min(1).max(50)).optional()
4545
4549
  }), F = object({
4546
4550
  id: uuid(),
4547
4551
  start_datetime: n,
4548
4552
  end_datetime: n,
4549
- completed: boolean()
4553
+ completed: boolean(),
4554
+ name: string().nullable().optional(),
4555
+ tags: array(string()).optional()
4550
4556
  }), B = {
4551
4557
  body: $,
4552
4558
  response: t.extend({
4553
4559
  data: F
4554
4560
  })
4555
4561
  }, K = object({
4556
- completed: boolean().optional()
4562
+ completed: boolean().optional(),
4563
+ name: string().nullable().optional(),
4564
+ tags: array(string().min(1).max(50)).optional()
4557
4565
  }), Z = object({
4558
4566
  id: uuid(),
4559
4567
  start_datetime: string(),
4560
4568
  end_datetime: string(),
4561
- completed: boolean()
4569
+ completed: boolean(),
4570
+ name: string().nullable().optional(),
4571
+ tags: array(string()).optional()
4562
4572
  }), V = {
4563
4573
  params: object({
4564
4574
  runId: uuid()
@@ -4599,15 +4609,20 @@ const p = object({
4599
4609
  response: t.extend({
4600
4610
  data: X
4601
4611
  })
4602
- }, te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4612
+ }, te = {
4613
+ response: t.extend({
4614
+ data: array(string())
4615
+ })
4616
+ }, ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4603
4617
  __proto__: null,
4604
4618
  createOrder: ee,
4605
4619
  createRun: B,
4606
4620
  deleteRun: J,
4607
4621
  getRunOrders: H,
4622
+ getRunTags: te,
4608
4623
  getRuns: Q,
4609
4624
  updateRun: V
4610
- }, Symbol.toStringTag, { value: "Module" })), ne = {
4625
+ }, Symbol.toStringTag, { value: "Module" })), oe = {
4611
4626
  query: object({
4612
4627
  datetime: n,
4613
4628
  timezone: o.optional(),
@@ -4624,19 +4639,19 @@ const p = object({
4624
4639
  }).nullable()
4625
4640
  })
4626
4641
  })
4627
- }, oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4642
+ }, ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4628
4643
  __proto__: null,
4629
- getShortlists: ne
4630
- }, Symbol.toStringTag, { value: "Module" })), je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4644
+ getShortlists: oe
4645
+ }, Symbol.toStringTag, { value: "Module" })), he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4631
4646
  __proto__: null,
4632
4647
  v1_dashboard_auth_schemas: I,
4633
4648
  v1_dashboard_available_datetimes_schemas: w,
4634
4649
  v1_dashboard_candles_schemas: D,
4635
4650
  v1_dashboard_daily_persistent_companies_schemas: M,
4636
- v1_dashboard_daily_unique_companies_schemas: R,
4651
+ v1_dashboard_daily_unique_companies_schemas: A,
4637
4652
  v1_dashboard_quote_timeline_schemas: N,
4638
- v1_dashboard_runs_schemas: te,
4639
- v1_dashboard_shortlists_schemas: oe
4653
+ v1_dashboard_runs_schemas: ne,
4654
+ v1_dashboard_shortlists_schemas: ae
4640
4655
  }, Symbol.toStringTag, { value: "Module" }));
4641
4656
  ({
4642
4657
  response: t.extend({
@@ -7925,7 +7940,7 @@ const fetchCandles = ({
7925
7940
  );
7926
7941
  }
7927
7942
  try {
7928
- const validatedParams = ge.getGrowwHistoricalCandles.query.parse(params);
7943
+ const validatedParams = ye.getGrowwHistoricalCandles.query.parse(params);
7929
7944
  const headers = {
7930
7945
  Authorization: `Bearer ${developerToken}`
7931
7946
  };
@@ -7969,7 +7984,7 @@ const fetchQuote = ({
7969
7984
  );
7970
7985
  }
7971
7986
  try {
7972
- const validatedParams = ge.getGrowwQuote.query.parse(params);
7987
+ const validatedParams = ye.getGrowwQuote.query.parse(params);
7973
7988
  const headers = {
7974
7989
  Authorization: `Bearer ${developerToken}`
7975
7990
  };
@@ -8009,7 +8024,7 @@ const fetchQuoteTimeline = ({
8009
8024
  throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
8010
8025
  }
8011
8026
  try {
8012
- const validatedParams = ge.getGrowwQuoteTimeline.query.parse({
8027
+ const validatedParams = ye.getGrowwQuoteTimeline.query.parse({
8013
8028
  symbol,
8014
8029
  date: date2
8015
8030
  });
@@ -8056,7 +8071,7 @@ const fetchShortlist = ({
8056
8071
  );
8057
8072
  }
8058
8073
  try {
8059
- const validatedParams = ye.getLists.query.parse(queryParams);
8074
+ const validatedParams = je.getLists.query.parse(queryParams);
8060
8075
  const headers = {
8061
8076
  Authorization: `Bearer ${developerToken}`
8062
8077
  };
@@ -8098,7 +8113,7 @@ const fetchNiftyQuote = ({
8098
8113
  throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
8099
8114
  }
8100
8115
  try {
8101
- const validatedParams = ge.getGrowwNiftyQuote.query.parse(params);
8116
+ const validatedParams = ye.getGrowwNiftyQuote.query.parse(params);
8102
8117
  const headers = {
8103
8118
  Authorization: `Bearer ${developerToken}`
8104
8119
  };
@@ -8205,7 +8220,7 @@ const placeOrder = ({ runId, apiClient }) => async (data) => {
8205
8220
  try {
8206
8221
  await retryWithBackoff(
8207
8222
  async () => {
8208
- const validatedData = je.v1_dashboard_runs_schemas.createOrder.body.parse(data);
8223
+ const validatedData = he.v1_dashboard_runs_schemas.createOrder.body.parse(data);
8209
8224
  await apiClient.post(`/v1/dashboard/runs/${runId}/orders`, validatedData);
8210
8225
  logger.debug(`Order persisted for ${data.nseSymbol} in runId: ${runId}`);
8211
8226
  },
@@ -8464,7 +8479,9 @@ async function ganaka({
8464
8479
  startTime,
8465
8480
  endTime,
8466
8481
  intervalMinutes = 1,
8467
- deleteRunAfterCompletion = false
8482
+ deleteRunAfterCompletion = false,
8483
+ name,
8484
+ tags
8468
8485
  }) {
8469
8486
  const developerToken = process.env.DEVELOPER_KEY;
8470
8487
  const apiDomain = process.env.API_DOMAIN || "https://api.ganaka.live";
@@ -8483,7 +8500,9 @@ async function ganaka({
8483
8500
  const createRunBody = {
8484
8501
  start_datetime: startTime,
8485
8502
  end_datetime: endTime,
8486
- timezone: "Asia/Kolkata"
8503
+ timezone: "Asia/Kolkata",
8504
+ ...name !== void 0 && { name },
8505
+ ...tags !== void 0 && { tags }
8487
8506
  };
8488
8507
  try {
8489
8508
  const createRunResponse = await apiClient.post("/v1/dashboard/runs", createRunBody);
@@ -8574,6 +8593,6 @@ async function ganaka({
8574
8593
  }
8575
8594
  }
8576
8595
  exports.ganaka = ganaka;
8577
- exports.growwQuotePayloadSchema = g;
8596
+ exports.growwQuotePayloadSchema = _;
8578
8597
  exports.growwQuoteSchema = a;
8579
8598
  //# sourceMappingURL=index.js.map